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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Apr 22 04:12:20 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-04-22 04:12:20 -0400 (Tue, 22 Apr 2008)
New Revision: 5614

Modified:
   core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java
Log:
Fixed various issues

Modified: core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java	2008-04-22 00:37:00 UTC (rev 5613)
+++ core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java	2008-04-22 08:12:20 UTC (rev 5614)
@@ -341,14 +341,17 @@
             break;
 
          case RemoveDataCommand.METHOD_ID:
+         case RemoveDataCommand.VERSIONED_METHOD_ID:
             returnValue = new RemoveDataCommand();
             break;
 
          case RemoveKeyCommand.METHOD_ID:
+         case RemoveKeyCommand.VERSIONED_METHOD_ID:
             returnValue = new RemoveKeyCommand();
             break;
 
          case RemoveNodeCommand.METHOD_ID:
+         case RemoveNodeCommand.VERSIONED_METHOD_ID:
             returnValue = new RemoveNodeCommand();
             break;
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java	2008-04-22 00:37:00 UTC (rev 5613)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java	2008-04-22 08:12:20 UTC (rev 5614)
@@ -266,8 +266,8 @@
       assertTrue(cache.exists(Fqn.fromString("/one/two")));
       assertNotNull(cache.getNode("/one"));
       assertEquals(false, cache.getRoot().getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one")).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache.getNode("/one/two")).getLock().isLocked());
+      assertEquals(false, cache.getNode("/one").getLock().isLocked());
+      assertEquals(false, cache.getNode("/one/two").getLock().isLocked());
       assertNotNull(cache.getNode("/one").getChild("two"));
       assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
 
@@ -285,8 +285,8 @@
       assertTrue(cache2.exists(Fqn.fromString("/one/two")));
       assertNotNull(cache2.getRoot().getChild("one"));
       assertEquals(false, cache2.getRoot().getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one")).getLock().isLocked());
-      assertEquals(false, ((NodeSPI<Object, Object>) cache2.getNode("/one/two")).getLock().isLocked());
+      assertEquals(false, cache2.getNode("/one").getLock().isLocked());
+      assertEquals(false, cache2.getNode("/one/two").getLock().isLocked());
       assertNotNull(cache2.getNode("/one").getChild("two"));
       assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java	2008-04-22 00:37:00 UTC (rev 5613)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticVersioningTest.java	2008-04-22 08:12:20 UTC (rev 5614)
@@ -7,7 +7,6 @@
 package org.jboss.cache.optimistic;
 
 import junit.framework.Assert;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheSPI;
@@ -35,7 +34,7 @@
 public class OptimisticVersioningTest extends AbstractOptimisticTestCase
 {
    private static final Log log = LogFactory.getLog(OptimisticVersioningTest.class);
-   
+
    CacheSPI cache1, cache2;
 
    @BeforeMethod(alwaysRun = true)
@@ -72,8 +71,8 @@
       // change stuff in the node again...
       cache1.put(fqn, key, "value2");
 
-      v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
-      v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
+      v1 = cache1.getNode(fqn).getVersion();
+      v2 = cache2.getNode(fqn).getVersion();
 
       assertEquals("value2", cache1.get(fqn, key));
       assertEquals("value2", cache2.get(fqn, key));
@@ -91,8 +90,8 @@
 
       cache1.put(fqn, key, "value");
 
-      DataVersion v1 = ((NodeSPI) cache1.getNode(fqn)).getVersion();
-      DataVersion v2 = ((NodeSPI) cache2.getNode(fqn)).getVersion();
+      DataVersion v1 = cache1.getNode(fqn).getVersion();
+      DataVersion v2 = cache2.getNode(fqn).getVersion();
 
       assertEquals("value", cache1.get(fqn, key));
       assertEquals("value", cache2.get(fqn, key));
@@ -130,35 +129,41 @@
 
       assertEquals("Version info should have propagated", v1, v2);
    }
-   
+
    public void testRemovalWithSpecifiedVersion() throws Exception
    {
       Fqn fqn = Fqn.fromString("/test/node");
-      
+
       Node root = cache1.getRoot();
       cache1.getInvocationContext().getOptionOverrides().setDataVersion(new NonLockingDataVersion());
       root.addChild(fqn);
       cache1.getInvocationContext().getOptionOverrides().setDataVersion(new NonLockingDataVersion());
       cache1.removeNode(fqn);
-      
+
       Assert.assertNull(cache1.getRoot().getChild(fqn));
    }
-   
-   private static class NonLockingDataVersion implements DataVersion {
 
-      /** The serialVersionUID */
+   private static class NonLockingDataVersion implements DataVersion
+   {
+
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 1L;
 
-      public boolean newerThan(DataVersion dataVersion) {
-          
-          if (dataVersion instanceof DefaultDataVersion) {
-              log.info("unexpectedly validating against a DefaultDataVersion", new Exception("Just a stack trace"));
-          }
-          else {
-              log.trace("non locking lock check...");
-          }
-          return false;
+      public boolean newerThan(DataVersion dataVersion)
+      {
+
+         if (dataVersion instanceof DefaultDataVersion)
+         {
+            log.info("unexpectedly validating against a DefaultDataVersion", new Exception("Just a stack trace"));
+         }
+         else
+         {
+            log.trace("non locking lock check...");
+         }
+         return false;
       }
 
-  }
+   }
 }




More information about the jbosscache-commits mailing list