Author: manik.surtani(a)jboss.com
Date: 2008-10-13 14:32:30 -0400 (Mon, 13 Oct 2008)
New Revision: 6921
Modified:
core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
Log:
replaced test helper brittleness
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-10-13
18:31:25 UTC (rev 6920)
+++
core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java 2008-10-13
18:32:30 UTC (rev 6921)
@@ -11,7 +11,6 @@
import org.jboss.cache.io.ByteBuffer;
import org.jboss.cache.marshall.AbstractMarshaller;
import org.jboss.cache.marshall.CommandAwareRpcDispatcher;
-import org.jboss.cache.marshall.InactiveRegionAwareRpcDispatcher;
import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.marshall.RegionalizedMethodCall;
import org.jboss.cache.util.TestingUtil;
@@ -61,18 +60,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.Marshaller2 realMarshaller = (RpcDispatcher.Marshaller2)
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.Marshaller2
Show replies by date