public void checkUpdateSameObject(ExtObjectContainer oc) throws Exception { Query query = oc.query(); query.descend("_s").constrain(testString + COUNT / 2); ObjectSet result = query.execute(); Assert.areEqual(1, result.size()); SimpleObject o = (SimpleObject) result.next(); int i = o.getI(); Assert.isTrue(COUNT <= i && i < COUNT + threadCount()); }
public void concUpdateSameObject(ExtObjectContainer oc, int seq) throws Exception { Query query = oc.query(); query.descend("_s").constrain(testString + COUNT / 2); ObjectSet result = query.execute(); Assert.areEqual(1, result.size()); SimpleObject o = (SimpleObject) result.next(); o.setI(COUNT + seq); oc.store(o); }
public void concUpdateDifferentObject(ExtObjectContainer oc, int seq) throws Exception { Query query = oc.query(); query .descend("_s") .constrain(testString + seq) .and(query.descend("_i").constrain(new Integer(seq))); ObjectSet result = query.execute(); Assert.areEqual(1, result.size()); SimpleObject o = (SimpleObject) result.next(); o.setI(seq + COUNT); oc.store(o); }
public void concUpdate(ExtObjectContainer oc, int seq) throws Exception { Query q = oc.query(); q.constrain(IndexedByIdentityTestCase.class); ObjectSet os = q.execute(); Assert.areEqual(COUNT, os.size()); while (os.hasNext()) { IndexedByIdentityTestCase idi = (IndexedByIdentityTestCase) os.next(); idi.atom.name = "updated" + seq; oc.store(idi); Thread.sleep(100); } }
public void checkUpdateDifferentObject(ExtObjectContainer oc) throws Exception { ObjectSet result = oc.query(SimpleObject.class); Assert.areEqual(COUNT, result.size()); while (result.hasNext()) { SimpleObject o = (SimpleObject) result.next(); int i = o.getI(); if (i >= COUNT) { i -= COUNT; } Assert.areEqual(testString + i, o.getS()); } }
public void checkUpdate(ExtObjectContainer oc) { Query q = oc.query(); q.constrain(IndexedByIdentityTestCase.class); ObjectSet os = q.execute(); Assert.areEqual(COUNT, os.size()); String expected = null; while (os.hasNext()) { IndexedByIdentityTestCase idi = (IndexedByIdentityTestCase) os.next(); if (expected == null) { expected = idi.atom.name; Assert.isTrue(expected.startsWith("updated")); Assert.isTrue(expected.length() > "updated".length()); } Assert.areEqual(expected, idi.atom.name); } }
public void concRead(ExtObjectContainer oc) { for (int i = 0; i < COUNT; i++) { Query q = oc.query(); q.constrain(Atom.class); q.descend("name").constrain("ibi" + i); ObjectSet objectSet = q.execute(); Assert.areEqual(1, objectSet.size()); Atom child = (Atom) objectSet.next(); q = oc.query(); q.constrain(IndexedByIdentityTestCase.class); q.descend("atom").constrain(child).identity(); objectSet = q.execute(); Assert.areEqual(1, objectSet.size()); IndexedByIdentityTestCase ibi = (IndexedByIdentityTestCase) objectSet.next(); Assert.areSame(child, ibi.atom); } }
public void concDelete(ExtObjectContainer oc) throws Exception { int size = countOccurences(oc, SimpleObject.class); if (size == 0) { // already deleted return; } Assert.areEqual(ELEMENT_COUNT, size); ObjectSet os = oc.query(ArrayItem.class); if (os.size() == 0) { // already deteled return; } Assert.areEqual(1, os.size()); ArrayItem item = (ArrayItem) os.next(); // waits for other threads Thread.sleep(500); oc.delete(item); oc.commit(); assertOccurrences(oc, SimpleObject.class, 0); }