[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/buddyreplication ...
Manik Surtani
manik at jboss.org
Tue May 22 10:11:47 EDT 2007
User: msurtani
Date: 07/05/22 10:11:47
Modified: tests/functional/org/jboss/cache/buddyreplication
BuddyReplicationConfigTest.java
Log:
broken sequence of events in creating interceptor stack
Revision Changes Path
1.15 +17 -6 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyReplicationConfigTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- BuddyReplicationConfigTest.java 12 Mar 2007 18:13:48 -0000 1.14
+++ BuddyReplicationConfigTest.java 22 May 2007 14:11:47 -0000 1.15
@@ -8,6 +8,7 @@
import junit.framework.TestCase;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.Configuration;
@@ -24,9 +25,17 @@
*/
public class BuddyReplicationConfigTest extends TestCase
{
+ private CacheSPI<?, ?> cache;
+
+ protected void tearDown()
+ {
+ cache.stop();
+ cache = null;
+ }
+
public void testNullConfig() throws Exception
{
- CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
cache.getConfiguration().setBuddyReplicationConfig(null);
assertNull(cache.getBuddyManager());
}
@@ -36,7 +45,7 @@
String xmlConfig = "<config><buddyReplicationEnabled>false</buddyReplicationEnabled></config>";
Element element = XmlHelper.stringToElement(xmlConfig);
BuddyReplicationConfig config = XmlConfigurationParser.parseBuddyReplicationConfig(element);
- CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
cache.getConfiguration().setBuddyReplicationConfig(config);
assertNull(cache.getBuddyManager());
}
@@ -46,10 +55,11 @@
String xmlConfig = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled></config>";
Element element = XmlHelper.stringToElement(xmlConfig);
BuddyReplicationConfig config = XmlConfigurationParser.parseBuddyReplicationConfig(element);
- CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
+ cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache.getConfiguration().setBuddyReplicationConfig(config);
cache.create();
+ cache.start();
assertNotNull(cache.getBuddyManager());
BuddyManager mgr = cache.getBuddyManager();
assertTrue(mgr.isEnabled());
@@ -62,9 +72,10 @@
public void testXmlConfig() throws Exception
{
- CacheImpl<?, ?> cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
- cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/buddyreplication-service.xml"));
+ cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(false);
+ ((CacheImpl) cache).setConfiguration(new XmlConfigurationParser().parseFile("META-INF/buddyreplication-service.xml"));
cache.create();
+ cache.start();
BuddyManager bm = cache.getBuddyManager();
assertNotNull(bm);
assertTrue(bm.isEnabled());
@@ -78,7 +89,7 @@
// test Data Gravitator
boolean hasDG = false;
- for (Interceptor interceptor : cache.getInterceptors())
+ for (Interceptor interceptor : cache.getInterceptorChain())
{
hasDG = hasDG || (interceptor instanceof DataGravitatorInterceptor);
}
More information about the jboss-cvs-commits
mailing list