Author: mircea.markus
Date: 2008-04-14 10:11:28 -0400 (Mon, 14 Apr 2008)
New Revision: 5549
Modified:
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
Log:
JBCACHE-1222 - fixed eviction tests
Modified:
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-04-14
13:22:50 UTC (rev 5548)
+++
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-04-14
14:11:28 UTC (rev 5549)
@@ -80,6 +80,7 @@
cache.start();
invoker =
TestingUtil.extractComponentRegistry(cache).getComponent(InterceptorChain.class);
+ commandsFactory = TestingUtil.extractCommandsFactory(cache);
regionManager = cache.getRegionManager();
}
@@ -324,7 +325,7 @@
for (int i = 0; i < 100; i++)
{
- PutKeyValueCommand pkvCommand = commandsFactory.buildPutKeyValueCommand(null,
(Fqn<?>) fqn, data, false, false, false);
+ PutKeyValueCommand pkvCommand = commandsFactory.buildPutKeyValueCommand(null,
(Fqn<?>) fqn, i, "value", false, false);
invoker.invoke(pkvCommand);
assertEquals("value", cache.peek(fqn, false, false).getDirect(i));
@@ -417,7 +418,7 @@
putQuietly(fqn, "a", "b");
putQuietly(fqn, "b", "c");
- RemoveDataCommand removeDataCommand = new RemoveDataCommand(null, fqn, false,
false, false);
+ RemoveDataCommand removeDataCommand = commandsFactory.buildRemoveDataCommand(null,
fqn, false, false, false);
invoker.invoke(removeDataCommand);
assertEquals(0, cache.peek(fqn, false, false).getDataDirect().size());
@@ -500,7 +501,7 @@
assertEquals(fqn, event.getFqn());
assertNull(region.takeLastEventNode());
- RemoveNodeCommand removeNodeCommand = new RemoveNodeCommand(null, fqn, false,
false, false);
+ RemoveNodeCommand removeNodeCommand = commandsFactory.buildRemoveNodeCommand(null,
fqn, false, false, false);
invoker.invoke(removeNodeCommand);
assertNull(cache.getNode(fqn));
event = region.takeLastEventNode();
Modified: core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java 2008-04-14 13:22:50 UTC
(rev 5548)
+++ core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java 2008-04-14 14:11:28 UTC
(rev 5549)
@@ -12,11 +12,13 @@
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.Interceptor;
import org.jboss.cache.interceptors.base.ChainedInterceptor;
import org.jboss.cache.invocation.CacheInvocationDelegate;
import org.jboss.cache.invocation.InterceptorChain;
+import org.jboss.cache.invocation.CacheLifecycleManager;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
@@ -470,8 +472,8 @@
*/
public static ComponentRegistry extractComponentRegistry(Cache cache)
{
- InterceptorChain ic = (InterceptorChain) extractField(cache, "invoker");
- return extractComponentRegistry(ic);
+ CacheLifecycleManager clm = (CacheLifecycleManager) extractField(cache,
"lifecycleManager");
+ return (ComponentRegistry) extractField(clm, "componentRegistry");
}
/**
@@ -545,4 +547,8 @@
}
+ public static CommandsFactory extractCommandsFactory(CacheSPI<Object, Object>
cache)
+ {
+ return (CommandsFactory) extractField(cache, "commandsFactory");
+ }
}