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 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); }
public void conc1(ExtObjectContainer oc) throws Exception { ObjectSet os = oc.query(Item.class); Thread.sleep(500); deleteObjectSet(oc, os); oc.rollback(); }
public void conc2(ExtObjectContainer oc) throws Exception { ObjectSet os = oc.query(Item.class); Thread.sleep(500); deleteObjectSet(oc, os); assertOccurrences(oc, Atom.class, 0); }