public void setUp()
 {
     client = new AerospikeClient(clientPolicy, TestQueryEngine.HOST, TestQueryEngine.PORT);
     client.writePolicyDefault.expiration = 1800;
     client.writePolicyDefault.recordExistsAction = RecordExistsAction.REPLACE;
     queryEngine = new QueryEngine(client);
     int i = 0;
     Key key = new Key(TestQueryEngine.NAMESPACE, TestQueryEngine.SET_NAME, "selector-test:" + 10);
     if (this.client.Exists(null, key))
         return;
     for (int x = 1; x <= TestQueryEngine.RECORD_COUNT; x++)
     {
         key = new Key(TestQueryEngine.NAMESPACE, TestQueryEngine.SET_NAME, "selector-test:" + x);
         Bin name = new Bin("name", "name:" + x);
         Bin age = new Bin("age", ages[i]);
         Bin colour = new Bin("color", colours[i]);
         Bin animal = new Bin("animal", animals[i]);
         this.client.Put(null, key, name, age, colour, animal);
         i++;
         if (i == 5)
             i = 0;
     }
 }
 public virtual void SetUp()
 {
     client = new AerospikeClient(clientPolicy, TestQueryEngine.HOST, TestQueryEngine.PORT);
     queryEngine = new QueryEngine(client);
 }
Example #3
0
        public void setUpp()
        {
            client = new AerospikeClient(clientPolicy, TestQueryEngine.HOST, TestQueryEngine.PORT);
            queryEngine = new QueryEngine(client);

            writePolicy = new WritePolicy(); // Create a WritePolicy
            writePolicy.sendKey = true; // Save the Key on each write
            writePolicy.expiration = 300; // expire the records in 5 minutes

            // Create indexes on map bin, if they do not exist
            createIndex("mapKeyIndex", mapBin, IndexType.STRING, IndexCollectionType.MAPKEYS);
            createIndex("mapValueIndex", mapBin, IndexType.NUMERIC, IndexCollectionType.MAPVALUES);

            // Create many records with values in a map
            Random rand = new Random(300);
            for (int i = 0; i < 100; i++)
            {
                Key newKey = new Key(TestQueryEngine.NAMESPACE, SET, "a-record-with-a-map-" + i);
                Dictionary<Value, Value> aMap = new Dictionary<Value, Value>();
                Dictionary<Value, Value> bMap = new Dictionary<Value, Value>();
                for (int j = 0; j < 100; j++)
                {
                    aMap[Value.Get("dogs" + j)] = Value.Get(rand.Next(100) + 250);
                    aMap[Value.Get("mice" + j)] = Value.Get(rand.Next(100) + 250);
                    bMap[Value.Get("dogs" + j)] = Value.Get(rand.Next(100) + 250);
                    bMap[Value.Get("mice" + j)] = Value.Get(rand.Next(100) + 250);
                }
                client.Put(writePolicy, newKey, new Bin(mapBin, aMap), new Bin(mapBinNoIndex, bMap));
            }
        }
        public void setUpp()
        {
            client = new AerospikeClient(clientPolicy, TestQueryEngine.HOST, TestQueryEngine.PORT);
            queryEngine = new QueryEngine(client);

            writePolicy = new WritePolicy(); // Create a WritePolicy
            writePolicy.sendKey = true; // Save the Key on each write
            writePolicy.expiration = 300; // expire the records in 5 minutes

            // Create index on list bin, if it does not exist
            createIndex("listBinIndex", listBin, IndexType.NUMERIC);

            // Create many records with values in a list
            Random rand = new Random(300);
            for (int i = 0; i < 100; i++)
            {
                Key newKey = new Key(TestQueryEngine.NAMESPACE, SET, "a-record-with-a-list-" + i);
                List<long> aList = new List<long>();
                List<long> bList = new List<long>();
                for (int j = 0; j < 100; j++)
                {
                    long newInt = rand.Next(200) + 250L;
                    aList.Add(newInt);
                    bList.Add(newInt);
                }
                client.Put(writePolicy, newKey, new Bin(listBin, aList), new Bin(listBinNoIndex, bList));
            }
        }