[jbosscache-commits] JBoss Cache SVN: r4633 - in core/trunk/src: main/java/org/jboss/cache/interceptors and 2 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Oct 17 11:56:21 EDT 2007


Author: manik.surtani at jboss.com
Date: 2007-10-17 11:56:21 -0400 (Wed, 17 Oct 2007)
New Revision: 4633

Added:
   core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
Modified:
   core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNode.java
   core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
Log:
JBCACHE-1121 : Avoid copying child maps into transaction workspace to improve scalability

Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2007-10-17 15:25:57 UTC (rev 4632)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2007-10-17 15:56:21 UTC (rev 4633)
@@ -417,8 +417,7 @@
 
    public Set<Object> getChildrenNamesDirect()
    {
-      return children == null ? Collections.<Object>emptySet() : new HashSet<Object>(children.keySet());
-      //return childrenNames();
+      return children == null ? Collections.emptySet() : new HashSet<Object>(children.keySet());
    }
 
    public Set<K> getKeys()
@@ -499,7 +498,7 @@
 
    public boolean removeChild(Object childName)
    {
-      return removeChild(new Fqn(getFqn(), childName));
+      return cache.removeNode(new Fqn(getFqn(), childName));
    }
 
    public boolean removeChildDirect(Object childName)

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2007-10-17 15:25:57 UTC (rev 4632)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2007-10-17 15:56:21 UTC (rev 4633)
@@ -10,6 +10,7 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Node;
 import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.marshall.MethodCall;
@@ -151,7 +152,7 @@
             // try and get the child of current node
 
             if (debug) log.debug("Attempting to get child " + childName);
-            NodeSPI currentNode = workspaceNode.getChild(childName);
+            NodeSPI currentNode = workspaceNode.getNode().getChildDirect(childName);
 
 
             if (currentNode == null)

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2007-10-17 15:25:57 UTC (rev 4632)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2007-10-17 15:56:21 UTC (rev 4633)
@@ -150,6 +150,9 @@
             case MethodDeclarations.getKeysMethodLocal_id:
                result = getKeysAndNotify(args, getTransactionWorkspace(getGlobalTransaction(ctx)), ctx);
                break;
+            case MethodDeclarations.getDataMapMethodLocal_id:
+               result = getDataAndNotify(args, getTransactionWorkspace(getGlobalTransaction(ctx)), ctx);
+               break;
             case MethodDeclarations.getChildrenNamesMethodLocal_id:
                result = getChildNamesAndNotify(args, getTransactionWorkspace(getGlobalTransaction(ctx)), ctx);
                break;
@@ -416,6 +419,11 @@
          if (trace) log.trace("Unable to find node " + fqn + " in workspace.");
          return null;
       }
+      else if (workspaceNode.isDeleted())
+      {
+         if (trace) log.trace("Attempted to retrieve node " + fqn + " but it has been deleted!");
+         return null;
+      }
       else
       {
          notifier.notifyNodeVisited(fqn, true, ctx);
@@ -446,6 +454,27 @@
       }
    }
 
+   private Object getDataAndNotify(Object[] args, TransactionWorkspace workspace, InvocationContext ctx)
+   {
+      Fqn fqn = (Fqn) args[0];
+
+      WorkspaceNode workspaceNode = fetchWorkspaceNode(fqn, workspace, false);
+
+      if (workspaceNode == null)
+      {
+         if (trace) log.trace("unable to find node " + fqn + " in workspace.");
+         return null;
+      }
+      else
+      {
+         notifier.notifyNodeVisited(fqn, true, ctx);
+         Object data = workspaceNode.getData();
+         workspace.addNode(workspaceNode);
+         notifier.notifyNodeVisited(fqn, false, ctx);
+         return data;
+      }
+   }
+
    private Object getChildNamesAndNotify(Object[] args, TransactionWorkspace workspace, InvocationContext ctx)
    {
       Fqn fqn = (Fqn) args[0];

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java	2007-10-17 15:25:57 UTC (rev 4632)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java	2007-10-17 15:56:21 UTC (rev 4633)
@@ -191,7 +191,8 @@
                if (trace) log.trace("Applying children deltas to parent node " + underlyingNode.getFqn());
                for (Fqn child : deltas.get(0))
                {
-                  underlyingNode.addChildDirect(workspaceNode.getChild(child.getLastElement()));
+//                  underlyingNode.addChildDirect(workspaceNode.getChild(child.getLastElement()));
+                  underlyingNode.addChildDirect(workspace.getNode(child).getNode());
                }
 
                for (Fqn child : deltas.get(1))

Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNode.java	2007-10-17 15:25:57 UTC (rev 4632)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNode.java	2007-10-17 15:56:21 UTC (rev 4633)
@@ -170,4 +170,10 @@
     * @return true if children have been added to or removed from this node.  Not the same as 'dirty'.
     */
    boolean isChildrenModified();
+
+   /**
+    *
+    * @return true if the child map has been loaded from the underlying data structure into the workspace.
+    */
+   boolean isChildrenLoaded();
 }

Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java	2007-10-17 15:25:57 UTC (rev 4632)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java	2007-10-17 15:56:21 UTC (rev 4633)
@@ -60,12 +60,6 @@
       this.node = node;
       this.workspace = workspace;
       optimisticDataMap = new HashMap<K, V>(node.getDataDirect());
-      Map<Object, Node<K, V>> childrenMap = node.getChildrenMapDirect();
-      // we NEED this null check otherwise the ConcurrentHashMap constructor could throw an NPE
-      // could this not be a HashMap?  After all, each WNI is only used within a single Workspace, which is only
-      // attached to a single transaction entry.
-      this.optimisticChildNodeMap = childrenMap == null ? new HashMap() : new HashMap(childrenMap);
-//      optimisticChildNodeMap = new HashMap(childrenMap);
       this.version = node.getVersion();
       if (version == null)
       {
@@ -78,6 +72,11 @@
       return childrenModified;
    }
 
+   public boolean isChildrenLoaded()
+   {
+      return optimisticChildNodeMap != null;
+   }
+
    /**
     * Returns true if this node is modified.
     */
@@ -140,9 +139,20 @@
    //not able to delete from this
    public Set<Object> getChildrenNames()
    {
+      if (optimisticChildNodeMap == null)
+      {
+         initialiseChildMap();
+      }
       return new HashSet<Object>(optimisticChildNodeMap.keySet());
    }
 
+   @SuppressWarnings("unchecked")
+   private void initialiseChildMap()
+   {
+      Map<Object, Node<K, V>> childrenMap = node.getChildrenMapDirect();
+      this.optimisticChildNodeMap = childrenMap == null ? new HashMap() : new HashMap(childrenMap);
+   }
+
    private void realPut(Map<K, V> data, boolean eraseData)
    {
       realPut(data, eraseData, true);
@@ -172,17 +182,17 @@
       }
 
       //see if we already have it
-      NodeSPI<K, V> child = optimisticChildNodeMap.get(child_name);
+//      NodeSPI<K, V> child = optimisticChildNodeMap.get(child_name);
 
       // if not we need to create it
-      if (child == null)
-      {
+//      if (child == null)
+//      {
          NodeFactory<K, V> factory = cache.getConfiguration().getRuntimeConfig().getNodeFactory();
-         child = (NodeSPI<K, V>) factory.createNodeOfType(parent, child_name, parent, null);
-         optimisticChildNodeMap.put(child_name, child);
+         NodeSPI<K, V> child = (NodeSPI<K, V>) factory.createNodeOfType(parent, child_name, parent, null);
+//         optimisticChildNodeMap.put(child_name, child);
          childrenAdded.add(child.getFqn());
          childrenRemoved.remove(child.getFqn());
-      }
+//      }
       childrenModified = true;
       return child;
    }
@@ -200,7 +210,8 @@
    public NodeSPI<K, V> getChild(Object childName)
    {
       //see if in the the transaction map
-      return optimisticChildNodeMap.get(childName);
+//      return optimisticChildNodeMap.get(childName);
+      throw new UnsupportedOperationException("This call should be intercepted by the optimisticNodeInterceptor and the child node should be retrieved from the workspace.");
    }
 
    public NodeSPI<K, V> getNode()
@@ -302,7 +313,7 @@
 
    public void addChild(WorkspaceNode<K,V> child)
    {
-      optimisticChildNodeMap.put(child.getFqn().getLastElement(), child.getNode());
+//      optimisticChildNodeMap.put(child.getFqn().getLastElement(), child.getNode());
       childrenAdded.add(child.getFqn());
       childrenRemoved.remove(child.getFqn());
       if (log.isTraceEnabled()) log.trace("Adding child " + child.getFqn());
@@ -387,18 +398,19 @@
 
    public boolean removeChild(Object childName)
    {
-      NodeSPI n = optimisticChildNodeMap.remove(childName);
-      if (n != null)
-      {
-         childrenRemoved.add(n.getFqn());
-         childrenAdded.remove(n.getFqn());
+      //NodeSPI n = node.getChildDirect(childName);
+      Fqn childFqn = new Fqn(getFqn(), childName);
+      /*if (n != null)
+      {*/
+         childrenRemoved.add(childFqn);
+         childrenAdded.remove(childFqn);
          childrenModified = true;
-         return true;
-      }
+         return node.getChildDirect(childName) != null;
+      /*}
       else
       {
          return false;
-      }
+      }*/
    }
 
    protected CacheSPI<K, V> getCache()

Added: core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java	                        (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ChildMapLazyLoadingTest.java	2007-10-17 15:56:21 UTC (rev 4633)
@@ -0,0 +1,214 @@
+package org.jboss.cache.optimistic;
+
+import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.transaction.OptimisticTransactionEntry;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import javax.transaction.Transaction;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Tests that children maps in workspace nodes are only loaded lazily, when a move() or getChildrenNames()
+ *
+ * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
+ * @since 2.1.0
+ */
+ at Test(groups = {"functional"})
+public class ChildMapLazyLoadingTest
+{
+   private CacheSPI<Object, Object> cache;
+   private Fqn parent = Fqn.fromString("/parent");
+   private Fqn child = Fqn.fromString("/parent/child");
+
+   @BeforeMethod
+   public void setUp()
+   {
+      cache = (CacheSPI<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
+      cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
+      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
+      cache.start();
+      cache.put(parent, "k", "v");
+      cache.put(child, "k", "v");
+   }
+
+   @AfterMethod
+   public void tearDown()
+   {
+      if (cache != null)
+      {
+         try
+         {
+            cache.getTransactionManager().rollback();
+         }
+         catch (Exception e)
+         {
+
+         }
+      cache.stop();
+      }
+   }
+
+   public void testLazyLoadingOnCacheGet() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      assert cache.get(parent, "k").equals("v") : "Should retrieve value";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnCachePut() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      cache.put(parent, "k2", "v2");
+      assert cache.get(parent, "k2").equals("v2") : "Should retrieve value";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnCachePutData() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      Map<Object, Object> data = new HashMap<Object, Object>();
+      data.put("k2", "v2");
+      cache.put(parent, data);
+      assert cache.get(parent, "k2").equals("v2") : "Should retrieve value";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnCacheRemove() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      cache.remove(parent, "k");
+      assert cache.get(parent, "k") == null : "Data should be removed";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnCacheRemoveNode() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      cache.removeNode(parent);
+      assert !cache.getRoot().hasChild(parent) : "Node should be removed";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnCacheMove() throws Exception
+   {
+      Fqn newparentToMoveTo = Fqn.fromString("/newparent");
+      Fqn newparent = Fqn.fromString("/newparent/parent");
+      Fqn newchild = Fqn.fromString("/newparent/parent/child");
+      cache.getTransactionManager().begin();
+      cache.move(parent, newparentToMoveTo);
+      assert !cache.getRoot().hasChild(parent) : "Node should be removed";
+      assert !cache.getRoot().hasChild(child) : "Node should be removed";
+      assert cache.getRoot().hasChild(newparent) : "Node should have moved";
+      assert cache.getRoot().hasChild(newchild) : "Node should have moved";
+      assert cache.get(newparent, "k").equals("v") : "Data should have moved too";
+
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert n.isChildrenLoaded() : "Should have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnNodeGet() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      Node node = cache.getRoot().getChild(parent);
+      assert node.getData().size() == 1 : "Node should have data";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnNodeRemove() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      Node node = cache.getRoot().getChild(parent);
+      node.clearData();
+      assert node.getData().size() == 0 : "Node should have removed data";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnNodePut() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      Node node = cache.getRoot().getChild(parent);
+      node.put("k2", "v2");
+      assert node.getData().size() == 2 : "Node should have added data";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnNodeGetChildrenNames() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      Node node = cache.getRoot().getChild(parent);
+      assert node.getChildrenNames().size() == 1 : "Node should have 1 child";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert n.isChildrenLoaded() : "Should have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnNodeGetChildren() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      Node node = cache.getRoot().getChild(parent);
+      assert node.getChildren().size() == 1 : "Node should have 1 child";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert n.isChildrenLoaded() : "Should have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnNodeAddChild() throws Exception
+   {
+      Fqn newChild = Fqn.fromString("/newchild");
+      cache.getTransactionManager().begin();
+      Node node = cache.getRoot().getChild(parent);
+      node.addChild(newChild);
+      assert node.hasChild(newChild) : "Node should have added child";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   public void testLazyLoadingOnNodeRemoveChild() throws Exception
+   {
+      cache.getTransactionManager().begin();
+      Node node = cache.getRoot().getChild(parent);
+      node.removeChild(child.getLastElement());
+      assert !node.hasChild(child.getLastElement()) : "Node should have removed child";
+      WorkspaceNode n = getWorkspaceNode(parent);
+      assert !n.isChildrenLoaded() : "Should not have loaded children";
+      cache.getTransactionManager().commit();
+   }
+
+   private WorkspaceNode getWorkspaceNode(Fqn fqn) throws Exception
+   {
+      CacheImpl ci = (CacheImpl) cache;
+      Transaction tx = ci.getTransactionManager().getTransaction();
+      GlobalTransaction gtx = ci.getTransactionTable().get(tx);
+      OptimisticTransactionEntry te = (OptimisticTransactionEntry) ci.getTransactionTable().get(gtx);
+      TransactionWorkspace tw = te.getTransactionWorkSpace();
+      return tw.getNode(fqn);
+   }
+}

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java	2007-10-17 15:25:57 UTC (rev 4632)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java	2007-10-17 15:56:21 UTC (rev 4633)
@@ -5,18 +5,7 @@
  *
  */
 package org.jboss.cache.optimistic;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNotSame;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
@@ -27,12 +16,22 @@
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
+import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * @author xenephon
  */
+ at Test (groups = {"functional"})
 @SuppressWarnings("unchecked")
 public class NodeInterceptorRemoveNodeTest extends AbstractOptimisticTestCase
 {
@@ -135,8 +134,8 @@
       assertEquals(true, workspace.getNode(Fqn.fromString("/one/two")).isDeleted());
       assertNotNull(workspace.getNode(Fqn.fromString("/one")));
       assertEquals(false, workspace.getNode(Fqn.fromString("/one")).isDeleted());
-      assertEquals(1, workspace.getNode(Fqn.fromString("/one")).getMergedChildren().get(1).size());
-      assertEquals(null, workspace.getNode(Fqn.fromString("/one")).getChild(Fqn.fromString("/two")));
+      List<Set<Fqn>> mergedChildren = workspace.getNode(Fqn.fromString("/one")).getMergedChildren();
+      assertEquals(1, mergedChildren.get(1).size());
       System.out.println(entry.getModifications());
       assertEquals(2, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
@@ -177,8 +176,6 @@
       assertNotNull(workspace.getNode(Fqn.fromString("/one")));
       assertEquals(true, workspace.getNode(Fqn.fromString("/one")).isDeleted());
       assertEquals(1, workspace.getNode(Fqn.fromString("/one")).getMergedChildren().get(0).size());
-      assertNotNull(workspace.getNode(Fqn.fromString("/one")).getChild(Fqn.fromString("two")));
-      assertEquals(null, workspace.getNode(Fqn.fromString("/")).getChild(Fqn.fromString("/one")));
       assertEquals(2, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assertEquals(null, dummy.getCalled());
@@ -217,10 +214,6 @@
       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(Fqn.fromString("two")));
-      assertEquals(null, workspace.getNode(Fqn.fromString("/")).getChild(Fqn.fromString("one")));
-
       //now put /one/two back in
       cache.remove("/one");
 
@@ -230,13 +223,8 @@
       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(Fqn.fromString("two")));
-      assertEquals(null, workspace.getNode(Fqn.fromString("/")).getChild(Fqn.fromString("one")));
-
       assertEquals(null, dummy.getCalled());
 
-
       mgr.commit();
 
       //assert what should be the results of our call
@@ -282,10 +270,6 @@
       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(Fqn.fromString("two")));
-      assertEquals(null, workspace.getNode(Fqn.fromString("/")).getChild(Fqn.fromString("one")));
-
       //now put /one/two back in
       cache.put("/one/two", temp);
 
@@ -297,9 +281,6 @@
       assertNotSame(two, twoAfter);
       assertEquals(false, twoAfter.isDeleted());
 
-      assertEquals(twoAfter.getNode(), workspace.getNode(Fqn.fromString("/one")).getChild(Fqn.fromString("two")));
-      assertEquals(oneAfter.getNode(), workspace.getNode(Fqn.fromString("/")).getChild(Fqn.fromString("one")));
-
       assertEquals(null, dummy.getCalled());
 
 
@@ -348,10 +329,6 @@
       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(Fqn.fromString("two")));
-      assertEquals(null, workspace.getNode(Fqn.fromString("/")).getChild(Fqn.fromString("one")));
-
       //now put /one back in
       SamplePojo pojo2 = new SamplePojo(21, "test");
       cache.put(new Fqn("one"), "key1", pojo2);
@@ -364,12 +341,8 @@
       assertEquals(two, twoAfter);
       assertEquals(true, twoAfter.isDeleted());
 
-      assertNull(workspace.getNode(Fqn.fromString("/one")).getChild(Fqn.fromString("two")));
-      assertEquals(oneAfter.getNode(), workspace.getNode(Fqn.fromString("/")).getChild(Fqn.fromString("one")));
-
       assertEquals(null, dummy.getCalled());
 
-
       mgr.commit();
 
       assertEquals(pojo2, workspace.getNode(Fqn.fromString("/one")).get("key1"));
@@ -416,13 +389,8 @@
       assertNotNull(workspace.getNode(Fqn.fromString("/one")));
       assertEquals(false, workspace.getNode(Fqn.fromString("/one")).isDeleted());
 
-      //will still have alink from one to two
-      assertEquals(null, workspace.getNode(Fqn.fromString("/one")).getChild(Fqn.fromString("two")));
-
-
       assertEquals(null, dummy.getCalled());
 
-
       mgr.commit();
 
       assertEquals(1, workspace.getNode(Fqn.fromString("/one")).getMergedChildren().get(1).size());




More information about the jbosscache-commits mailing list