[jbosscache-commits] JBoss Cache SVN: r6511 - in core/trunk/src/test/java/org/jboss/cache: commands/write and 1 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Aug 5 07:20:47 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-08-05 07:20:47 -0400 (Tue, 05 Aug 2008)
New Revision: 6511

Modified:
   core/trunk/src/test/java/org/jboss/cache/commands/legacy/write/VersionedInvalidateCommandTest.java
   core/trunk/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java
   core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
Log:
Fixed broken tests

Modified: core/trunk/src/test/java/org/jboss/cache/commands/legacy/write/VersionedInvalidateCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/legacy/write/VersionedInvalidateCommandTest.java	2008-08-05 10:56:29 UTC (rev 6510)
+++ core/trunk/src/test/java/org/jboss/cache/commands/legacy/write/VersionedInvalidateCommandTest.java	2008-08-05 11:20:47 UTC (rev 6511)
@@ -58,8 +58,8 @@
       nodes.adfNode.setVersion(dataVersion);
       nodes.adfNode.setDataLoaded(true);
       expect(spiMock.getNode(testFqn)).andReturn(nodes.adfNode);
-      notifier.notifyNodeEvicted(testFqn, true, ctx);
-      notifier.notifyNodeEvicted(testFqn, false, ctx);
+      notifier.notifyNodeInvalidated(testFqn, true, ctx);
+      notifier.notifyNodeInvalidated(testFqn, false, ctx);
 
       control.replay();
       assert null == command.perform(ctx);
@@ -102,8 +102,8 @@
       nodes.adfNode.setVersion(dataVersion);
       expect(spiMock.getNode(testFqn)).andReturn(null);
       expect(container.peek(testFqn, true, true)).andReturn(nodes.adfNode);
-      notifier.notifyNodeEvicted(testFqn, true, ctx);
-      notifier.notifyNodeEvicted(testFqn, false, ctx);
+      notifier.notifyNodeInvalidated(testFqn, true, ctx);
+      notifier.notifyNodeInvalidated(testFqn, false, ctx);
 
       control.replay();
       assert null == command.perform(ctx);

Modified: core/trunk/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java	2008-08-05 10:56:29 UTC (rev 6510)
+++ core/trunk/src/test/java/org/jboss/cache/commands/write/InvalidateCommandTest.java	2008-08-05 11:20:47 UTC (rev 6511)
@@ -1,15 +1,15 @@
 package org.jboss.cache.commands.write;
 
-import static org.easymock.EasyMock.*;
-import org.testng.annotations.Test;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.mock.MockNodesFixture;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
+import org.easymock.IMocksControl;
+import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DataContainer;
-import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.commands.read.AbstractDataCommandTest;
-import org.easymock.IMocksControl;
-import static org.easymock.EasyMock.createStrictControl;
+import org.jboss.cache.mock.MockNodesFixture;
+import org.jboss.cache.notifications.Notifier;
+import org.testng.annotations.Test;
 
 import javax.transaction.TransactionManager;
 
@@ -53,9 +53,9 @@
    public void testExistingNode()
    {
       expect(spiMock.getNode(testFqn)).andReturn(nodes.adfNode);
-      notifier.notifyNodeEvicted(testFqn, true, ctx);
+      notifier.notifyNodeInvalidated(testFqn, true, ctx);
       expect(container.evict(testFqn)).andReturn(Boolean.TRUE);
-      notifier.notifyNodeEvicted(testFqn, false, ctx);
+      notifier.notifyNodeInvalidated(testFqn, false, ctx);
       control.replay();
       assert null == command.perform(ctx);
       assert !nodes.adfNode.isValid() : "node should had been invalidated";
@@ -67,11 +67,11 @@
    public void testRootNodeInvalidation()
    {
       command.setFqn(Fqn.ROOT);
-      nodes.adfgNode.put("key","value");
+      nodes.adfgNode.put("key", "value");
       expect(spiMock.getNode(Fqn.ROOT)).andReturn(nodes.root);
-      notifier.notifyNodeEvicted(Fqn.ROOT, true, ctx);
+      notifier.notifyNodeInvalidated(Fqn.ROOT, true, ctx);
       expect(container.evict(Fqn.ROOT)).andReturn(Boolean.TRUE);
-      notifier.notifyNodeEvicted(Fqn.ROOT, false, ctx);
+      notifier.notifyNodeInvalidated(Fqn.ROOT, false, ctx);
       control.replay();
       assert null == command.perform(ctx);
       assert nodes.root.isValid() : "root should NOT had been invalidated";

Modified: core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java	2008-08-05 10:56:29 UTC (rev 6510)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java	2008-08-05 11:20:47 UTC (rev 6511)
@@ -16,6 +16,7 @@
 import org.jboss.cache.marshall.RegionalizedMethodCall;
 import org.jboss.cache.util.TestingUtil;
 import org.jgroups.blocks.RpcDispatcher;
+import org.jgroups.util.Buffer;
 
 import java.io.InputStream;
 import java.io.ObjectInputStream;
@@ -68,17 +69,17 @@
       }
       else
       {
-         RpcDispatcher.Marshaller realMarshaller = (RpcDispatcher.Marshaller) TestingUtil.extractField(RpcDispatcher.class, realDispatcher, "req_marshaller");
+         RpcDispatcher.Marshaller2 realMarshaller = (RpcDispatcher.Marshaller2) TestingUtil.extractField(RpcDispatcher.class, realDispatcher, "req_marshaller");
          MarshallerDelegate delegate = new MarshallerDelegate(realMarshaller);
          TestingUtil.replaceField(delegate, "req_marshaller", realDispatcher, RpcDispatcher.class);
       }
    }
 
-   private class MarshallerDelegate implements RpcDispatcher.Marshaller
+   private class MarshallerDelegate implements RpcDispatcher.Marshaller2
    {
-      RpcDispatcher.Marshaller marshaller;
+      RpcDispatcher.Marshaller2 marshaller;
 
-      private MarshallerDelegate(RpcDispatcher.Marshaller marshaller)
+      private MarshallerDelegate(RpcDispatcher.Marshaller2 marshaller)
       {
          this.marshaller = marshaller;
       }
@@ -98,6 +99,22 @@
          }
          return result;
       }
+
+      public Buffer objectToBuffer(Object o) throws Exception
+      {
+         return marshaller.objectToBuffer(o);
+      }
+
+      public Object objectFromByteBuffer(byte[] bytes, int i, int i1) throws Exception
+      {
+         Object result = marshaller.objectFromByteBuffer(bytes, i, i1);
+         if (result instanceof ReplicateCommand && expectedCommands != null)
+         {
+            ReplicateCommand replicateCommand = (ReplicateCommand) result;
+            return new ReplicateCommandDelegate(replicateCommand);
+         }
+         return result;
+      }
    }
 
    /**




More information about the jbosscache-commits mailing list