public void testTransactionConsistentVersion() throws Exception { store(new Item(NEWER)); db().commit(); Item newer = itemByName(NEWER); Item original = itemByName(ORIGINAL); Assert.isGreater(version(original), version(newer)); newer._name += " modified"; original._name += " modified"; store(newer); store(original); db().commit(); Assert.areEqual(version(newer), version(original)); reopen(); newer = itemByName(newer._name); original = itemByName(original._name); Assert.areEqual(version(newer), version(original)); }
protected void store() { Item dd1 = new Item(); dd1.atom = new Atom("justone"); store(dd1); Item dd2 = new Item(); dd2.atom = dd1.atom; store(dd2); }
protected void store() { final Item root = new Item("1", null); Item current = root; for (int i = 2; i < 11; i++) { current.child = new Item("" + i, null); current = current.child; } store(root); }
public void testVersionIncrease() { Item item = (Item) retrieveOnlyInstance(Item.class); ObjectInfo objectInfo = db().getObjectInfo(item); long version1 = objectInfo.getCommitTimestamp(); item._name = "modified"; db().store(item); db().commit(); long version2 = objectInfo.getCommitTimestamp(); Assert.isGreater(version1, version2); db().store(item); db().commit(); objectInfo = db().getObjectInfo(item); long version3 = objectInfo.getCommitTimestamp(); Assert.isGreater(version2, version3); }
private void storeItem(Object listElement) { Item item = new Item(); item.list = new ArrayList(); item.list.add(listElement); store(item); }