[jbosscache-commits] JBoss Cache SVN: r6920 - core/branches/2.2.X/src/test/java/org/jboss/cache/util/internals.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Oct 13 14:31:25 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-10-13 14:31:25 -0400 (Mon, 13 Oct 2008)
New Revision: 6920

Modified:
   core/branches/2.2.X/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
Log:
Fixed brittle test helper

Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java	2008-10-13 18:01:11 UTC (rev 6919)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java	2008-10-13 18:31:25 UTC (rev 6920)
@@ -1,9 +1,9 @@
 package org.jboss.cache.util.internals;
 
 import org.jboss.cache.Cache;
-import org.jboss.cache.RPCManager;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.RPCManager;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.remote.ReplicateCommand;
 import org.jboss.cache.commands.tx.PrepareCommand;
@@ -11,19 +11,18 @@
 import org.jboss.cache.marshall.CommandAwareRpcDispatcher;
 import org.jboss.cache.marshall.Marshaller;
 import org.jboss.cache.marshall.RegionalizedMethodCall;
-import org.jboss.cache.marshall.InactiveRegionAwareRpcDispatcher;
 import org.jboss.cache.util.TestingUtil;
 import org.jgroups.blocks.RpcDispatcher;
 
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.InputStream;
 
 /**
  * Utility class that notifies when certain commands were asynchronously replicated on secondary cache.
@@ -58,18 +57,11 @@
       ComponentRegistry componentRegistry = TestingUtil.extractComponentRegistry(cache);
       RPCManager rpcManager = componentRegistry.getComponent(RPCManager.class);
       CommandAwareRpcDispatcher realDispatcher = (CommandAwareRpcDispatcher) TestingUtil.extractField(rpcManager, "rpcDispatcher");
-      if (realDispatcher instanceof InactiveRegionAwareRpcDispatcher)
-      {
-         Marshaller realMarshaller = (Marshaller) TestingUtil.extractField(InactiveRegionAwareRpcDispatcher.class, realDispatcher, "requestMarshaller");
-         RegionMarshallerDelegate delegate = new RegionMarshallerDelegate(realMarshaller);
-         TestingUtil.replaceField(delegate, "requestMarshaller", realDispatcher, InactiveRegionAwareRpcDispatcher.class);
-      }
-      else
-      {
-         RpcDispatcher.Marshaller realMarshaller = (RpcDispatcher.Marshaller) TestingUtil.extractField(RpcDispatcher.class, realDispatcher, "req_marshaller");
-         MarshallerDelegate delegate = new MarshallerDelegate(realMarshaller);
-         TestingUtil.replaceField(delegate, "req_marshaller", realDispatcher, RpcDispatcher.class);
-      }
+      RpcDispatcher.Marshaller realMarshaller = realDispatcher.getMarshaller();
+      MarshallerDelegate delegate = new MarshallerDelegate(realMarshaller);
+      realDispatcher.setMarshaller(delegate);
+      realDispatcher.setRequestMarshaller(delegate);
+      realDispatcher.setResponseMarshaller(delegate);
    }
 
    private class MarshallerDelegate implements RpcDispatcher.Marshaller




More information about the jbosscache-commits mailing list