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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Apr 28 04:09:48 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-04-28 04:09:48 -0400 (Mon, 28 Apr 2008)
New Revision: 5709

Modified:
   core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
Log:
Fixed OL tests not to rely on transaction entry details after a tx has completed as these are now properly wiped.

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java	2008-04-28 07:58:39 UTC (rev 5708)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java	2008-04-28 08:09:48 UTC (rev 5709)
@@ -211,13 +211,13 @@
       TransactionTable table = c.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
+      ReversibleCommand command = entry.getModifications().get(0);
       mgr.commit();
 
       GlobalTransaction remoteGtx = new GlobalTransaction();
 
       remoteGtx.setAddress(new DummyAddress());
       //hack the method call to make it have the remote globalTransaction
-      ReversibleCommand command = entry.getModifications().get(0);
 
       command.setGlobalTransaction(remoteGtx);
 
@@ -234,11 +234,10 @@
       assertNotNull(table.get(remoteGtx));
       assertNotNull(table.getLocalTransaction(remoteGtx));
       //assert that this is populated
-      assertEquals(1, table.get(remoteGtx).getModifications().size());
+//      assertEquals(1, table.get(remoteGtx).getModifications().size());
 
       //assert that the remote prepare has populated the local workspace
       assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
-      assertEquals(1, entry.getModifications().size());
       List<?> calls = dummy.getAllCalled();
       assertEquals(OptimisticPrepareCommand.class, calls.get(2));
 

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java	2008-04-28 07:58:39 UTC (rev 5708)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/NodeInterceptorRemoveNodeTest.java	2008-04-28 08:09:48 UTC (rev 5709)
@@ -88,7 +88,6 @@
       assertEquals(0, workspace.getNodes().size());
 
       assertTrue(entry.getLocks().isEmpty());
-      assertEquals(1, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assertEquals(0, listener.getNodesAdded());
    }
@@ -131,7 +130,6 @@
       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"));
    }
 
@@ -169,7 +167,6 @@
       assertNotNull(workspace.getNode(Fqn.fromString("/one")));
       assertEquals(true, workspace.getNode(Fqn.fromString("/one")).isDeleted());
       assertEquals(0, workspace.getNode(Fqn.fromString("/one")).getMergedChildren().get(0).size());
-      assertEquals(2, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assert 2 == dummy.getAllCalled().size();
       assert dummy.getAllCalled().contains(CommitCommand.class);
@@ -226,8 +223,6 @@
       //assert what should be the results of our call
       assertEquals(3, workspace.getNodes().size());
 
-
-      assertEquals(3, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assert 2 == dummy.getAllCalled().size();
       assert dummy.getAllCalled().contains(CommitCommand.class);
@@ -288,7 +283,6 @@
       assertEquals(3, workspace.getNodes().size());
 
 
-      assertEquals(3, entry.getModifications().size());
       assert 2 == dummy.getAllCalled().size();
       assert dummy.getAllCalled().contains(CommitCommand.class);
       assert dummy.getAllCalled().contains(OptimisticPrepareCommand.class);
@@ -349,7 +343,6 @@
       assertEquals(3, workspace.getNodes().size());
 
 
-      assertEquals(3, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assert 2 == dummy.getAllCalled().size();
       assert dummy.getAllCalled().contains(CommitCommand.class);
@@ -399,8 +392,6 @@
       //assert what should be the results of our call
       assertEquals(3, workspace.getNodes().size());
 
-
-      assertEquals(2, entry.getModifications().size());
       assertTrue(!cache.exists("/one/two"));
       assert 2 == dummy.getAllCalled().size();
       assert dummy.getAllCalled().contains(CommitCommand.class);

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java	2008-04-28 07:58:39 UTC (rev 5708)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java	2008-04-28 08:09:48 UTC (rev 5709)
@@ -289,6 +289,7 @@
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
+      ReversibleCommand command = entry.getModifications().get(0);
       mgr.commit();
 
       //test local calls
@@ -305,7 +306,7 @@
 
       remoteGtx.setAddress(new DummyAddress());
       //hack the method call to make it have the remote globalTransaction
-      ReversibleCommand command = entry.getModifications().get(0);
+
       command.setGlobalTransaction(remoteGtx);
       //call our remote method
       OptimisticPrepareCommand prepareCommand = new OptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
@@ -615,6 +616,7 @@
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
+      ReversibleCommand command = entry.getModifications().get(0);
       mgr.commit();
 
       //test local calls
@@ -633,7 +635,7 @@
       remoteGtx.setAddress(new DummyAddress());
 
 //	    hack the method call to make it have the remote globalTransaction
-      ReversibleCommand command = entry.getModifications().get(0);
+
       command.setGlobalTransaction(remoteGtx);
       //call our remote method
       OptimisticPrepareCommand prepareCommand = new OptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map) null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
@@ -655,7 +657,7 @@
       assertNotNull(table.get(remoteGtx));
       assertNotNull(table.getLocalTransaction(remoteGtx));
       //this is not populated until replication interceptor is used
-      assertEquals(1, table.get(remoteGtx).getModifications().size());
+//      assertEquals(1, table.get(remoteGtx).getModifications().size());
 
       calls = dummy.getAllCalledIds();
       assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));
@@ -706,6 +708,7 @@
       TransactionTable table = cache.getTransactionTable();
       OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
       assertNotNull(mgr.getTransaction());
+      ReversibleCommand command = entry.getModifications().get(0);
       mgr.commit();
 
       //test local calls
@@ -717,7 +720,6 @@
 
       remoteGtx.setAddress(new DummyAddress());
 
-      ReversibleCommand command = entry.getModifications().get(0);
       command.setGlobalTransaction(remoteGtx);
       //call our remote method
       OptimisticPrepareCommand prepareCommand = new OptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Map) null, (Address) remoteGtx.getAddress(), Boolean.FALSE);
@@ -737,7 +739,7 @@
       assertNotNull(table.get(remoteGtx));
       assertNotNull(table.getLocalTransaction(remoteGtx));
       //this is not populated until replication interceptor is used
-      assertEquals(1, table.get(remoteGtx).getModifications().size());
+//      assertEquals(1, table.get(remoteGtx).getModifications().size());
 
       calls = dummy.getAllCalledIds();
       assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(2));




More information about the jbosscache-commits mailing list