* @param optimistic should the cache be configured for optimistic locking
* @throws Exception
*/
private void nodeResurrectionTest2() throws Exception
{
Node root1 = cache1.getRoot();
Node root2 = cache2.getRoot();
// this fqn is relative, but since it is from the root it may as well be absolute
Fqn fqn = Fqn.fromString("/test/fqn");
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
root1.addChild(fqn);
assertEquals(true, root1.hasChild(fqn));
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
root1.addChild(fqn);
assertEquals(true, root1.hasChild(fqn));
Fqn child = Fqn.fromRelativeElements(fqn, "child");
cache1.putForExternalRead(child, "key", "value");
cache2.putForExternalRead(child, "key", "value");
assertEquals("value", cache1.get(child, "key"));
assertEquals("value", cache2.get(child, "key"));
assertEquals(true, cache1.removeNode(fqn));
assertFalse(root1.hasChild(fqn));
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
root1.addChild(fqn);
assertEquals(true, root1.hasChild(fqn));
Node remoteNode = root2.getChild(fqn);
CacheLoaderInvalidationTest.checkRemoteNodeIsRemoved(remoteNode);
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
root2.addChild(fqn);
assertEquals(true, root2.hasChild(fqn));
}