{
Fqn A = Fqn.fromString("/a");
Fqn B = Fqn.fromString("/b");
Fqn A_B = Fqn.fromString("/a/b");
NodeSPI nodeA, nodeB;
cache.put(A, "k", "v");
cache.put(A_B, "k", "v");
nodeA = cache.getRoot().getChildDirect(A);// should work
nodeB = cache.getRoot().getChildDirect(A_B);// should work
assertEquals(A_B, nodeB.getFqn());
nodeB = nodeA.getChildDirect(B);// should work
assertEquals(A_B, nodeB.getFqn());
assertEquals(true, cache.getRoot().removeChildDirect(A_B));// should work
assertEquals(false, cache.getRoot().removeChildDirect(A_B));// should work
cache.put(A_B, "k", "v");
assertEquals(true, nodeA.removeChildDirect(B));// should work
assertEquals(false, nodeA.removeChildDirect(B));// should work
assertEquals(true, cache.getRoot().removeChildDirect(A.getLastElement()));
assertEquals(false, cache.getRoot().removeChildDirect(A.getLastElement()));
try
{
cache.getRoot().addChildDirect(A_B);// should fail
fail("Should have failed");
}
catch (UnsupportedOperationException e)
{
// expected
}
nodeA = cache.getRoot().addChildDirect(A);// should work
nodeA.addChildDirect(B);// should work
}