[jbosscache-commits] JBoss Cache SVN: r5588 - core/trunk/src/test/java/org/jboss/cache/transaction.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Fri Apr 18 07:37:42 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-04-18 07:37:42 -0400 (Fri, 18 Apr 2008)
New Revision: 5588

Modified:
   core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java
Log:
implemented missing bits

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java	2008-04-18 11:09:55 UTC (rev 5587)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/PrepareCommitContentionTest.java	2008-04-18 11:37:42 UTC (rev 5588)
@@ -6,6 +6,9 @@
 import org.jboss.cache.RPCManager;
 import org.jboss.cache.RPCManagerImpl;
 import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.remote.ReplicateCommand;
+import org.jboss.cache.commands.tx.CommitCommand;
+import org.jboss.cache.commands.tx.PrepareCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.ComponentRegistry;
 import org.jboss.cache.misc.TestingUtil;
@@ -193,17 +196,29 @@
 
       private boolean isCommitMethod(CacheCommand call)
       {
-         //todo reimplement
-//         return call.getMethodId() == CommitCommand.METHOD_ID ||
-//               (call.getMethodId() == MethodDeclarations.replicateMethod_id && isCommitMethod((MethodCall) call.getArgs()[0]));
+         if (call instanceof CommitCommand) return true;
+         if (call instanceof ReplicateCommand)
+         {
+            ReplicateCommand rCom = (ReplicateCommand) call;
+            if (rCom.isSingleCommand())
+            {
+               return rCom.getSingleModification() instanceof CommitCommand;
+            }
+         }
          return false;
       }
 
       private boolean isPrepareMethod(CacheCommand call)
       {
-         //todo reimplement
-//         return call.getMethodId() == MethodDeclarations.prepareMethod_id ||
-//               (call.getMethodId() == MethodDeclarations.replicateMethod_id && isPrepareMethod((MethodCall) call.getArgs()[0]));
+         if (call instanceof PrepareCommand) return true;
+         if (call instanceof ReplicateCommand)
+         {
+            ReplicateCommand rCom = (ReplicateCommand) call;
+            if (rCom.isSingleCommand())
+            {
+               return rCom.getSingleModification() instanceof PrepareCommand;
+            }
+         }
          return false;
       }
    }




More information about the jbosscache-commits mailing list