[jbosscache-commits] JBoss Cache SVN: r5346 - in core/trunk/src: test/java/org/jboss/cache/marshall and 1 other directory.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Tue Feb 12 14:41:54 EST 2008
Author: manik.surtani at jboss.com
Date: 2008-02-12 14:41:54 -0500 (Tue, 12 Feb 2008)
New Revision: 5346
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
Log:
fixed broken tests
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2008-02-12 18:38:52 UTC (rev 5345)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2008-02-12 19:41:54 UTC (rev 5346)
@@ -411,12 +411,7 @@
throw new IllegalArgumentException("cache mode " + configuration.getCacheMode() + " is invalid");
}
- // these 2 components need to be started manually since they can only be started after ALL other components have started.
- // i.e., rpcManager's start() method may do state transfers. State transfers will rely on the interceptor chain being started.
- // the interceptor chain cannot start until the rpcManager is started. And similarly, the buddyManager relies on the
- // rpcManager being started.
- if (rpcManager != null) rpcManager.start();
- if (buddyManager != null) buddyManager.init();
+ startManualComponents();
//now attempt to preload the cache from the loader - Manik
if (cacheLoaderManager != null)
@@ -439,6 +434,16 @@
cacheStatus = CacheStatus.STARTED;
}
+ private void startManualComponents()
+ {
+ // these 2 components need to be started manually since they can only be started after ALL other components have started.
+ // i.e., rpcManager's start() method may do state transfers. State transfers will rely on the interceptor chain being started.
+ // the interceptor chain cannot start until the rpcManager is started. And similarly, the buddyManager relies on the
+ // rpcManager being started.
+ if (rpcManager != null) rpcManager.start();
+ if (buddyManager != null) buddyManager.init();
+ }
+
private void addShutdownHook()
{
ArrayList al = MBeanServerFactory.findMBeanServer(null);
@@ -2329,6 +2334,9 @@
componentRegistry.registerComponent(i, Interceptor.class);
interceptors.add(++position, i);
setInterceptorChain(factory.correctInterceptorChaining(interceptors));
+ componentRegistry.start();
+ // make sure I start the last 2 "manually startable" components
+ startManualComponents();
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-02-12 18:38:52 UTC (rev 5345)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-02-12 19:41:54 UTC (rev 5346)
@@ -200,7 +200,6 @@
{
log.info("Stopping the RpcDispatcher");
disp.stop();
- disp = null;
}
if (members != null)
{
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java 2008-02-12 18:38:52 UTC (rev 5345)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java 2008-02-12 19:41:54 UTC (rev 5346)
@@ -44,12 +44,15 @@
@BeforeMethod
- public void setUp()
+ public void setUp() throws CloneNotSupportedException
{
cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false), false);
- cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false), false);
+ if (cache1.getConfiguration().getBuddyReplicationConfig() != null)
+ cache1.getConfiguration().setBuddyReplicationConfig(null);
cache1.getConfiguration().setUseLazyDeserialization(true);
- cache2.getConfiguration().setUseLazyDeserialization(true);
+
+ cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), false);
+
cache1.start();
cache2.start();
@@ -321,17 +324,21 @@
public Object invoke(InvocationContext ctx) throws Throwable
{
- invocationCount++;
- MethodCall mc = ctx.getMethodCall();
- for (Object arg : mc.getArgs())
+ if (MethodDeclarations.isPutMethod(ctx.getMethodCall().getMethodId()))
{
- if (arg instanceof MarshalledValue) assertOnlyOneRepresentationExists((MarshalledValue) arg);
- }
+ invocationCount++;
+ MethodCall mc = ctx.getMethodCall();
+ for (Object arg : mc.getArgs())
+ {
+ if (arg instanceof MarshalledValue) assertOnlyOneRepresentationExists((MarshalledValue) arg);
+ }
- Object retval = nextInterceptor(ctx);
+ Object retval = nextInterceptor(ctx);
- if (retval instanceof MarshalledValue) assertOnlyOneRepresentationExists((MarshalledValue) retval);
- return retval;
+ if (retval instanceof MarshalledValue) assertOnlyOneRepresentationExists((MarshalledValue) retval);
+ return retval;
+ }
+ else return nextInterceptor(ctx);
}
}
More information about the jbosscache-commits
mailing list