public void conc2(ExtObjectContainer oc) { oc.store(new CreateIndexFor("d")); tQueryB(oc); tUpdateB(oc); oc.store(new CreateIndexFor("z")); oc.store(new CreateIndexFor("y")); }
private void tUpdateB(ExtObjectContainer oc) { ObjectSet res = query(oc, "b"); CreateIndexFor ci = (CreateIndexFor) res.next(); ci.i_name = "j"; oc.store(ci); res = query(oc, "b"); Assert.areEqual(0, res.size()); res = query(oc, "j"); Assert.areEqual(1, res.size()); ci.i_name = "b"; oc.store(ci); tQueryB(oc); }
/* * delete - set - commit set - commit delete */ public void testSD() { ExtObjectContainer oc1 = openNewSession(); ExtObjectContainer oc2 = openNewSession(); ExtObjectContainer oc3 = openNewSession(); try { SimpleObject o1 = (SimpleObject) retrieveOnlyInstance(oc1, SimpleObject.class); oc1.delete(o1); SimpleObject o2 = (SimpleObject) retrieveOnlyInstance(oc2, SimpleObject.class); Assert.areEqual("hello", o2.getS()); o2.setS("o2"); oc2.store(o2); oc2.commit(); oc1.commit(); assertOccurrences(oc1, SimpleObject.class, 0); assertOccurrences(oc2, SimpleObject.class, 0); assertOccurrences(oc3, SimpleObject.class, 0); } finally { oc1.close(); oc2.close(); oc3.close(); } }
/* * delete - set - commit delete - commit set */ public void _testDS() { ExtObjectContainer oc1 = openNewSession(); ExtObjectContainer oc2 = openNewSession(); ExtObjectContainer oc3 = openNewSession(); try { SimpleObject o1 = (SimpleObject) retrieveOnlyInstance(oc1, SimpleObject.class); oc1.delete(o1); SimpleObject o2 = (SimpleObject) retrieveOnlyInstance(oc2, SimpleObject.class); Assert.areEqual("hello", o2.getS()); o2.setS("o2"); oc2.store(o2); oc1.commit(); oc2.commit(); o1 = (SimpleObject) retrieveOnlyInstance(oc1, SimpleObject.class); oc1.refresh(o1, Integer.MAX_VALUE); Assert.areEqual("o2", o1.getS()); o2 = (SimpleObject) retrieveOnlyInstance(oc2, SimpleObject.class); oc2.refresh(o2, Integer.MAX_VALUE); Assert.areEqual("o2", o2.getS()); SimpleObject o3 = (SimpleObject) retrieveOnlyInstance(oc3, SimpleObject.class); oc1.refresh(o1, Integer.MAX_VALUE); Assert.areEqual("o2", o3.getS()); } finally { oc1.close(); oc2.close(); oc3.close(); } }
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); } }