nodeInterceptor.setNext(dummy);
cache.setInterceptorChain(interceptor);
// first set up a node with a pojo
DummyTransactionManager mgr = DummyTransactionManager.getInstance();
mgr.begin();
Transaction tx = mgr.getTransaction();
// inject InvocationContext
cache.getInvocationContext().setTransaction(tx);
cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
SamplePojo pojo = new SamplePojo(21, "test");
Map temp = new HashMap();
temp.put("key1", pojo);
cache.put("/one/two", temp);
// get the transaction stuff
TransactionTable table = cache.getTransactionTable();
GlobalTransaction gtx = table.get(tx);
OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
TransactionWorkspace workspace = entry.getTransactionWorkSpace();
TreeNode one = workspace.getNode(Fqn.fromString("/one"));
TreeNode two = workspace.getNode(Fqn.fromString("/one/two"));
cache.remove("/one");
assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
assertEquals(true, workspace.getNode(Fqn.fromString("/one/two")).isDeleted());
assertNotNull(workspace.getNode(Fqn.fromString("/one")));
assertEquals(true, workspace.getNode(Fqn.fromString("/one")).isDeleted());
//will still have alink from one to two
assertNotNull(workspace.getNode(Fqn.fromString("/one")).getChild("two"));
assertEquals(null, workspace.getNode(Fqn.fromString("/")).getChild("one"));
//now put /one back in
SamplePojo pojo2 = new SamplePojo(21, "test");
cache.put("/one", "key1", pojo2);
WorkspaceNode oneAfter = workspace.getNode(Fqn.fromString("/one"));
WorkspaceNode twoAfter = workspace.getNode(Fqn.fromString("/one/two"));
assertNotSame(one, oneAfter);
assertEquals(false, oneAfter.isDeleted());
assertEquals(two, twoAfter);
assertEquals(true, twoAfter.isDeleted());
assertNull(workspace.getNode(Fqn.fromString("/one")).getChild("two"));
assertEquals(oneAfter.getNode(), workspace.getNode(Fqn.fromString("/")).getChild("one"));
assertEquals(null, dummy.getCalled());
mgr.commit();
assertEquals(pojo2, workspace.getNode(Fqn.fromString("/one")).get("key1"));
//assert what should be the results of our call
assertEquals(3, workspace.getNodes().size());