Пример #1
0
        public void QueryExecuteOperate()
        {
            int begin = 3;
            int end   = 9;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilter(Filter.Range(binName1, begin, end));

            Bin bin = new Bin("foo", "bar");

            ExecuteTask task = client.Execute(null, stmt, Operation.Put(bin));

            task.Wait(3000, 3000);

            string expected = bin.value.ToString();

            stmt = new Statement();
            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilter(Filter.Range(binName1, begin, end));

            RecordSet rs = client.Query(null, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    Record record = rs.Record;
                    string value  = record.GetString(bin.name);

                    if (value == null)
                    {
                        Assert.Fail("Bin " + bin.name + " not found");
                    }

                    if (!value.Equals(expected))
                    {
                        Assert.Fail("Data mismatch. Expected " + expected + ". Received " + value);
                    }
                    count++;
                }
                Assert.AreEqual(end - begin + 1, count);
            }
            finally
            {
                rs.Close();
            }
        }
        public void QueryExecute()
        {
            int begin = 3;
            int end   = 9;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilters(Filter.Range(binName1, begin, end));

            ExecuteTask task = client.Execute(null, stmt, "record_example", "processRecord", Value.Get(binName1), Value.Get(binName2), Value.Get(100));

            task.Wait();
            ValidateRecords();
        }
Пример #3
0
        public static void RunTest()
        {
            AerospikeClient client = new AerospikeClient("172.28.128.3", 3000);

            try
            {
                QueryTest.RunTest();
                //Querytestten gelen binler;
                string binName  = "querybinint";
                string binName2 = "querybinint2";



                Policy policy = new Policy();
                policy.SetTimeout(100);


                //Assembly assembly = Assembly.GetExecutingAssembly();
                //RegisterTask rtask = client.Register(policy, "example.lua", "example.lua", Language.LUA);
                //rtask.Wait();


                //rtask.Wait();
                //if (rtask.IsDone())
                //{
                //    Console.WriteLine("done");

                //}

                int begin = 1;
                int end   = 10;

                Statement stmt = new Statement();
                stmt.SetNamespace("test");
                stmt.SetSetName("QueryTest");
                stmt.SetFilter(Filter.Range("querybinint", begin, end));

                ExecuteTask task = client.Execute(null, stmt, "example", "processRecord", Value.Get(binName), Value.Get(binName2), Value.Get(100));
                //task.Wait(3000, 3000);
                task.Wait();
            }
            finally
            {
                client.Close();
            }
        }
Пример #4
0
        private void RunQueryExecute(AerospikeClient client, Arguments args, string indexName, string binName1, string binName2)
        {
            int begin = 3;
            int end   = 9;

            console.Info("For ns={0} set={1} index={2} bin={3} >= {4} <= {5}", args.ns, args.set, indexName, binName1, begin, end);
            console.Info("Even integers: add 100 to existing " + binName1);
            console.Info("Multiple of 5: delete " + binName2 + " bin");
            console.Info("Multiple of 9: delete record");

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilters(Filter.Range(binName1, begin, end));

            ExecuteTask task = client.Execute(args.writePolicy, stmt, "record_example", "processRecord", Value.Get(binName1), Value.Get(binName2), Value.Get(100));

            task.Wait();
        }