private void assertDescendingRange(int startingValue, TAItem item) { TAItem current = item; while (current != null) { Assert.areEqual(startingValue, current.value()); current = current.next(); startingValue--; } }
private void updateAscendingWithRange(TAItem item, int startingValue) { TAItem current = item; while (current != null) { current.value(startingValue); current = current.next(); startingValue++; } }
public static TAItem newTAITem(int depth) { if (depth == 0) { return null; } TAItem header = new TAItem(depth); header._next = Item.newItem(depth - 1); return header; }
public static TAItem newTAItem(int depth) { if (depth == 0) { return null; } TAItem root = new TAItem(); root._value = depth; root._next = newTAItem(depth - 1); return root; }
public void testRefresh() { ExtObjectContainer client1 = openNewSession(); ExtObjectContainer client2 = openNewSession(); TAItem item1 = (TAItem) retrieveInstance(client1); TAItem item2 = (TAItem) retrieveInstance(client2); assertDescendingRange(10, item1); assertDescendingRange(10, item2); item1.value(100); item1.next().value(200); client1.store(item1, 2); client1.commit(); Assert.areEqual(100, item1.value()); Assert.areEqual(200, item1.next().value()); Assert.areEqual(10, item2.value()); Assert.areEqual(9, item2.next().value()); // refresh 0 client2.refresh(item2, 0); Assert.areEqual(10, item2.value()); Assert.areEqual(9, item2.next().value()); // refresh 1 client2.refresh(item2, 1); Assert.areEqual(100, item2.value()); Assert.areEqual(9, item2.next().value()); // refresh 2 client2.refresh(item2, 2); Assert.areEqual(100, item2.value()); Assert.areEqual(200, item2.next().value()); updateAscendingWithRange(item1, 1000); client1.store(item1, 5); client1.commit(); client2.refresh(item2, 5); TAItem next2 = item2; for (int i = 1000; i < 1005; i++) { Assert.areEqual(i, next2.value()); next2 = next2.next(); } client1.close(); client2.close(); }
protected void store() throws Exception { TAItem item = TAItem.newTAItem(ITEM_DEPTH); item._isRoot = true; _class = item.getClass(); store(item); }
protected void store() throws Exception { Item item = TAItem.newItem(ITEM_DEPTH); item._isRoot = true; store(item); }