public void InsertByKey() { int i = 0; for (int x = 1; x <= TestQueryEngine.RECORD_COUNT; x++) { String keyString = "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]); List<Bin> bins = new List<Bin>() { name, age, colour, animal }; Key key = new Key(TestQueryEngine.NAMESPACE, TestQueryEngine.SET_NAME, keyString); this.client.Delete(null, key); KeyQualifier kq = new KeyQualifier(Value.Get(keyString)); Statement stmt = new Statement(); stmt.Namespace = TestQueryEngine.NAMESPACE; stmt.SetName = TestQueryEngine.SET_NAME; queryEngine.Insert(stmt, kq, bins); Record record = this.client.Get(null, key); Assert.NotNull(record); i++; if (i == 5) i = 0; } }
public void deleteByKey() { for (int x = 1; x <= TestQueryEngine.RECORD_COUNT; x++) { String keyString = "selector-test:" + x; Key key = new Key(TestQueryEngine.NAMESPACE, TestQueryEngine.SET_NAME, keyString); KeyQualifier kq = new KeyQualifier(Value.Get(keyString)); Statement stmt = new Statement(); stmt.Namespace = TestQueryEngine.NAMESPACE; stmt.SetName = TestQueryEngine.SET_NAME; IDictionary<string, long> counts = queryEngine.Delete(stmt, kq); Assert.AreEqual(1L, counts["write"]); Record record = this.client.Get(null, key); Assert.Null(record); } }
public void selectOneWitKey() { Statement stmt = new Statement(); stmt.Namespace = TestQueryEngine.NAMESPACE; stmt.SetName = TestQueryEngine.SET_NAME; KeyQualifier kq = new KeyQualifier(Value.Get("selector-test:3")); KeyRecordEnumerator it = queryEngine.Select(stmt, kq); int count = 0; while (it.MoveNext()) { KeyRecord rec = it.Current; count++; // System.out.println(rec); } it.Close(); // System.out.println(count); Assert.Equals(1, count); }
public void Insert(Statement stmt, KeyQualifier keyQualifier, List<Bin> bins, int ttl) { Key key = keyQualifier.MakeKey(stmt.Namespace, stmt.SetName); //Key key = new Key(stmt.getNamespace(), stmt.getSetName(), keyQualifier.getValue1()); this.client.Put(this.insertPolicy, key, bins.ToArray()); }
public void Insert(Statement stmt, KeyQualifier keyQualifier, List<Bin> bins) { Insert(stmt, keyQualifier, bins, 0); }