}
@Test
public void testHierarchyReading()
{
ObjectStore store = ObjectStore.Factory.create();
Node root = new Node();
root.name = "Root";
Node child1 = new Node();
child1.name = "Child1";
child1.parent = root;
Node child2 = new Node();
child2.name = "Child2";
child2.parent = root;
root.children = Lists.newArrayList(child1, child2);
Node grandchild1 = new Node();
grandchild1.name = "Grandkid1";
grandchild1.parent = child2;
Node grandchild2 = new Node();
grandchild2.name = "Grandkid2";
grandchild2.parent = child2;
child2.children = Lists.newArrayList(grandchild1, grandchild2);
Node grandchild3 = new Node();
grandchild3.name = "Grandkid3";
grandchild3.parent = child1;
child1.children = Lists.newArrayList(grandchild3);
ObjectStoreSession sess1 = store.beginSession();
sess1.store(root).now();
Key key = sess1.getKey(child2);
ObjectStoreSession sess2 = store.beginSession();
Node child2a = sess2.load(key).activate("**.children", "**.parent", "!**.parent.children").now();
assertEquals(child2.name, child2a.name);
assertEquals(child2.children.size(), child2a.children.size());
assertEquals(child2.children.get(0).name, child2a.children.get(0).name);