[jbosscache-commits] JBoss Cache SVN: r8377 - in core/trunk/src: test/java/org/jboss/cache/options/cachemodelocal and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Apr 20 08:09:26 EDT 2010


Author: galder.zamarreno at jboss.com
Date: 2010-04-20 08:09:25 -0400 (Tue, 20 Apr 2010)
New Revision: 8377

Modified:
   core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
   core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
Log:
[JBCACHE-1577] (Cannot clear a distributed cache locally) Fixed.

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java	2010-04-12 04:53:50 UTC (rev 8376)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java	2010-04-20 12:09:25 UTC (rev 8377)
@@ -457,13 +457,13 @@
          boolean result = true;
          // we need to preserve options
          InvocationContext ctx = getInvocationContext();
-         Option o = ctx.getOptionOverrides();
+         Option o = ctx.getOptionOverrides().copy();
          Set<Fqn> internalFqns = getInternalFqns();
          for (Object childName : peek(fqn, false, false).getChildrenNames())
          {
             if (!internalFqns.contains(Fqn.fromElements(childName)))
             {
-               ctx.setOptionOverrides(o);
+               ctx.setOptionOverrides(o.copy());
                result = removeNode(Fqn.fromRelativeElements(fqn, childName)) && result;
             }
          }

Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java	2010-04-12 04:53:50 UTC (rev 8376)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java	2010-04-20 12:09:25 UTC (rev 8377)
@@ -372,6 +372,39 @@
       assertNull("should be null", cache2.get(fqn, key));
    }
 
+   public void testRemoveRootNode() throws Exception
+   {
+      replListener2.expect(PutKeyValueCommand.class);
+      cache1.getInvocationContext().setOptionOverrides(null);
+      cache1.put(fqn, key, "value");
+      replListener2.waitForReplicationToOccur();
+      assertEquals("value", cache1.get(fqn, key));
+      if (isInvalidation)
+      {
+         assertNull("Should be null", cache2.get(fqn, key));
+      }
+      else
+      {
+         assertEquals("value", cache2.get(fqn, key));
+      }
+
+      cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+      cache1.removeNode(Fqn.ROOT);
+      Thread.sleep(500);
+
+      // should be removed in cache1
+      assertNull("should be null", cache1.get(fqn, key));
+      // Not in cache2
+      if (isInvalidation)
+      {
+         assertNull("Should be null", cache2.get(fqn, key));
+      }
+      else
+      {
+         assertEquals("value", cache2.get(fqn, key));
+      }      
+   }
+
    public void testRemoveNodeViaNodeAPI() throws Exception
    {
 



More information about the jbosscache-commits mailing list