public async Task Multiple_scheduled_commands_having_the_some_causative_command_etag_have_repeatable_and_unique_etags()
        {
            var senderId = Any.Word();

            await Save(new NonEventSourcedCommandTarget(senderId));

            var targetIds = new[] { Any.Word(), Any.Word(), Any.Word() };

            var results = new ConcurrentBag<RequestReply>();

            Configuration.Current
                         .TraceScheduledCommands(
                             onScheduling: cmd =>
                             {
                                 var requestReply = ((dynamic) cmd).Command as RequestReply;
                                 if (requestReply != null)
                                 {
                                     results.Add(requestReply);
                                 }
                             });

            var initialEtag = "initial".ToETag();

            var firstCommand = new SendRequests(targetIds)
                               {
                                   ETag = initialEtag
                               };

            var scheduledCommand = new ScheduledCommand<NonEventSourcedCommandTarget>(
                firstCommand,
                senderId);

            await Deliver(scheduledCommand);

            var secondCommand = new SendRequests(targetIds)
                                {
                                    ETag = initialEtag
                                };

            scheduledCommand = new ScheduledCommand<NonEventSourcedCommandTarget>(
                secondCommand,
                senderId);

            // redeliver
            await Deliver(scheduledCommand);

            results.Should().HaveCount(6);
            results.Select(r => r.ETag)
                   .Distinct()
                   .Should()
                   .HaveCount(3);
        }
        public string Get(string login_local)
        {
            OracleDataReader d = SendRequests.send("SELECT data_izmenenia as Dat FROM users_list WHERE login_user ='******'");

            d.Read();

            if (d.HasRows)
            {
                return(d["Dat"].ToString());
            }
            else
            {
                return((-1).ToString());
            }
        }
Esempio n. 3
0
        public string Get(string login_local)
        {
            OracleDataReader d = SendRequests.send("SELECT TO_CHAR(MONTHS_BETWEEN((SELECT CURRENT_DATE FROM DUAL),(select data_izmenenia FROM users_list WHERE login_user = '******'))) as dif1 FROM DUAL");

            d.Read();

            if (d.HasRows)
            {
                return(d.GetString(0));
            }
            else
            {
                return((-1).ToString());
            }
        }
Esempio n. 4
0
        public string Get(string login_local)
        {
            OracleDataReader d = SendRequests.send("SELECT tes.Poisk_id_po_loginu('" + login_local + "') as ID FROM dual");

            d.Read();

            if (d.HasRows)
            {
                return(d.GetInt32(0).ToString());
            }
            else
            {
                return((-1).ToString());
            }
        }
Esempio n. 5
0
        public string Get(string id_local)
        {
            OracleDataReader d = SendRequests.send("SELECT tes.Poisk_password_po_id(" + id_local + ") as Password FROM dual");

            d.Read();

            if (d.HasRows)
            {
                return(d.GetString(0));
            }
            else
            {
                return((-1).ToString());
            }
        }
Esempio n. 6
0
        public string Get(string id_pol)
        {
            OracleDataReader d = SendRequests.send("SELECT data_lists.ID_TABLE " +
                                                   "FROM data_lists, users_list, role_user " +
                                                   "WHERE data_lists.UROVEN_KRITICHNOSTI <= role_user.UROVEN_PROZRACHNOSTI AND users_list.role = role_user.id_role AND users_list.id_user = " + id_pol);


            List <int> dataList = new List <int>();

            while (d.Read())
            {
                dataList.Add(d.GetInt32(0));
            }

            return(JsonConvert.SerializeObject(dataList));
        }
Esempio n. 7
0
        public string Get()
        {
            OracleDataReader d = SendRequests.send("SELECT * FROM role_user");


            List <role> dataList = new List <role>();

            while (d.Read())
            {
                role fl = new role();
                fl.id_role = d.GetInt32(0);
                fl.name    = d.GetString(1);
                fl.lvl     = d.GetInt32(2);
                dataList.Add(fl);
            }

            return(JsonConvert.SerializeObject(dataList));
        }
        public string Get()
        {
            OracleDataReader d = SendRequests.send("SELECT * FROM users_list");


            List <users> dataList = new List <users>();

            while (d.Read())
            {
                users fl = new users();
                fl.id_user  = d.GetInt32(0);
                fl.login    = d.GetString(1);
                fl.password = d.GetString(2);
                fl.data     = d.GetDateTime(3).ToString();
                fl.role     = d.GetInt32(4);
                dataList.Add(fl);
            }

            return(JsonConvert.SerializeObject(dataList));
        }
        public string Get()
        {
            OracleDataReader d = SendRequests.send("SELECT * FROM films");


            List <films> dataList = new List <films>();

            while (d.Read())
            {
                films fl = new films();
                fl.id_film   = d.GetInt32(0);
                fl.avtor     = d.GetString(1);
                fl.nazvanie  = d.GetString(2);
                fl.annotacia = d.GetString(3);
                fl.strana    = d.GetString(4);
                fl.god       = d.GetInt32(5);
                fl.zhanr     = d.GetString(6);
                dataList.Add(fl);
            }

            return(JsonConvert.SerializeObject(dataList));
        }
        public async Task Scheduled_commands_triggered_by_a_scheduled_command_are_idempotent()
        {
            var id = Any.Word();
            await store.Put(new CommandTarget(id));

            var command = new SendRequests(new[] { id })
            {
                ETag = "hello".ToETag()
            };

            await scheduler.Schedule(id, command);
            await scheduler.Schedule(id, command);

            var recipient = await store.Get(id);

            recipient
                .CommandsEnacted
                .OfType<SendRequests>()
                .Should()
                .HaveCount(1);
        }
        public async Task Multiple_scheduled_commands_having_the_some_causative_command_etag_have_repeatable_and_unique_etags()
        {
            var id = Any.Word();
            await store.Put(new CommandTarget(id));

            var command = new SendRequests(new[] { Any.Word() })
            {
                ETag = "one".ToETag()
            };

            var scheduled = new ScheduledCommand<CommandTarget>(
                command, 
                id);

            await scheduler.Deliver(scheduled);

            Assert.Fail("Test not written yet.");
        }
Esempio n. 12
0
 public string Get(int id_polz, int id_table)
 {
     return(SendRequests.get_rules_and_othr(id_polz, id_table));
 }