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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Aug 10 08:42:06 EDT 2009


Author: manik.surtani at jboss.com
Date: 2009-08-10 08:42:05 -0400 (Mon, 10 Aug 2009)
New Revision: 8176

Modified:
   core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
Log:
Removed dependency on JGroups specifics

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java	2009-08-10 12:17:35 UTC (rev 8175)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java	2009-08-10 12:42:05 UTC (rev 8176)
@@ -26,17 +26,12 @@
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionSetup;
 import org.jboss.cache.util.TestingUtil;
-import org.jgroups.Address;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Random;
@@ -303,44 +298,4 @@
       }
       return modifications;
    }
-
-   protected class DummyAddress implements Address
-   {
-      private static final long serialVersionUID = -2628268587640985944L;
-
-      public int compareTo(Object o)
-      {
-         return 0;
-      }
-
-      public void readFrom(DataInputStream
-            arg0)
-      {
-      }
-
-      public void writeTo(DataOutputStream
-            arg0)
-      {
-      }
-
-      public void readExternal(ObjectInput
-            arg0)
-      {
-      }
-
-      public void writeExternal(ObjectOutput
-            arg0)
-      {
-      }
-
-      public int size()
-      {
-         return 0;
-      }
-
-      public boolean isMulticastAddress()
-      {
-         return false;
-      }
-   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java	2009-08-10 12:17:35 UTC (rev 8175)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java	2009-08-10 12:42:05 UTC (rev 8176)
@@ -6,7 +6,12 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.easymock.EasyMock;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.VersionedNode;
 import org.jboss.cache.commands.WriteCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
@@ -215,7 +220,9 @@
 
       GlobalTransaction remoteGtx = new GlobalTransaction();
 
-      remoteGtx.setAddress(new DummyAddress());
+      Address mockAddress = EasyMock.createNiceMock(Address.class);
+
+      remoteGtx.setAddress(mockAddress);
       //hack the method call to make it have the remote globalTransaction
 
       command.setGlobalTransaction(remoteGtx);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java	2009-08-10 12:17:35 UTC (rev 8175)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java	2009-08-10 12:42:05 UTC (rev 8176)
@@ -6,6 +6,7 @@
  */
 package org.jboss.cache.optimistic;
 
+import org.easymock.EasyMock;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.commands.WriteCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
@@ -303,7 +304,7 @@
 
       GlobalTransaction remoteGtx = new GlobalTransaction();
 
-      remoteGtx.setAddress(new DummyAddress());
+      remoteGtx.setAddress(EasyMock.createNiceMock(Address.class));
       //hack the method call to make it have the remote globalTransaction
 
       command.setGlobalTransaction(remoteGtx);
@@ -362,7 +363,7 @@
 
       GlobalTransaction remoteGtx = new GlobalTransaction();
 
-      remoteGtx.setAddress(new DummyAddress());
+      remoteGtx.setAddress(EasyMock.createNiceMock(Address.class));
       //hack the method call to make it have the remote globalTransaction
       WriteCommand command = entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
@@ -445,7 +446,7 @@
 
       GlobalTransaction remoteGtx = new GlobalTransaction();
 
-      remoteGtx.setAddress(new DummyAddress());
+      remoteGtx.setAddress(EasyMock.createNiceMock(Address.class));
       //hack the method call to make it have the remote globalTransaction
       WriteCommand command = entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
@@ -533,7 +534,7 @@
 
       GlobalTransaction remoteGtx = new GlobalTransaction();
 
-      remoteGtx.setAddress(new DummyAddress());
+      remoteGtx.setAddress(EasyMock.createNiceMock(Address.class));
       //hack the method call to make it have the remote globalTransaction
       WriteCommand command = entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
@@ -631,7 +632,7 @@
 
       GlobalTransaction remoteGtx = new GlobalTransaction();
 
-      remoteGtx.setAddress(new DummyAddress());
+      remoteGtx.setAddress(EasyMock.createNiceMock(Address.class));
 
 //	    hack the method call to make it have the remote globalTransaction
 
@@ -717,7 +718,7 @@
 
       GlobalTransaction remoteGtx = new GlobalTransaction();
 
-      remoteGtx.setAddress(new DummyAddress());
+      remoteGtx.setAddress(EasyMock.createNiceMock(Address.class));
 
       command.setGlobalTransaction(remoteGtx);
       //call our remote method



More information about the jbosscache-commits mailing list