[jboss-cvs] JBossAS SVN: r72463 - trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Apr 19 21:30:49 EDT 2008
Author: bstansberry at jboss.com
Date: 2008-04-19 21:30:49 -0400 (Sat, 19 Apr 2008)
New Revision: 72463
Modified:
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java
Log:
[JBAS-5380] Fix and expand the tests
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java 2008-04-20 01:14:18 UTC (rev 72462)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/TreeCacheSSOClusterManagerUnitTestCase.java 2008-04-20 01:30:49 UTC (rev 72463)
@@ -33,18 +33,24 @@
import org.apache.catalina.session.StandardManager;
import org.apache.catalina.session.StandardSession;
import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.buddyreplication.NextMemberBuddyLocatorConfig;
import org.jboss.cache.config.BuddyReplicationConfig;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.ConfigurationRegistry;
import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.jmx.CacheJmxWrapper;
import org.jboss.cache.notifications.event.EventImpl;
import org.jboss.cache.notifications.event.Event.Type;
+import org.jboss.cache.pojo.PojoCache;
+import org.jboss.cache.pojo.PojoCacheFactory;
import org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper;
import org.jboss.cache.transaction.BatchModeTransactionManager;
+import org.jboss.ha.cachemanager.CacheManager;
+import org.jboss.ha.cachemanager.DependencyInjectedConfigurationRegistry;
+import org.jboss.ha.framework.server.JChannelFactory;
import org.jboss.test.JBossTestCase;
import org.jboss.test.cluster.testutil.DelegatingMockCacheSPI;
import org.jboss.test.cluster.testutil.MockTransactionManagerLookup;
@@ -63,10 +69,17 @@
*/
public class TreeCacheSSOClusterManagerUnitTestCase extends JBossTestCase
{
+ /**
+ * Default global value for the cacheName property
+ */
+ public static final String CACHE_OBJECT_NAME = "jboss.cache:service=ClusteredSSOCache";
+
private static IpAddress LOCAL_ADDRESS;
private static IpAddress REMOTE_ADDRESS;
private String bindAddress;
+ private MBeanServer mbeanServer;
+ private CacheManager cacheManager;
public TreeCacheSSOClusterManagerUnitTestCase(String name)
{
@@ -94,31 +107,42 @@
System.clearProperty("jgroups.bind.address");
else
System.setProperty("jgroups.bind.address", bindAddress);
+
+ if (cacheManager != null)
+ {
+ cacheManager.stop();
+ cacheManager = null;
+ }
+
+ if (mbeanServer != null)
+ {
+ MBeanServerFactory.releaseMBeanServer(mbeanServer);
+ mbeanServer = null;
+ }
}
- public void testPojoCacheIntegration() throws Exception
+ public void testCacheJmxIntegration() throws Exception
{
- log.debug("+++ testPojoCacheIntegration()");
+ log.debug("+++ testCacheJmxIntegration()");
- MBeanServer mbeanServer =
- MBeanServerFactory.createMBeanServer("pojoCacheTest");
- PojoCacheJmxWrapper wrapper = null;
+ mbeanServer = MBeanServerFactory.createMBeanServer("cacheJmxTest");
+ CacheJmxWrapper wrapper = null;
try
{
// Register a cache
- wrapper = new PojoCacheJmxWrapper();
+ wrapper = new CacheJmxWrapper();
// JBAS-4097 -- don't use a TransactionManagerLookup that will
// bind DummyTransactionManager into JNDI, as that will screw
// up other tests
wrapper.setTransactionManagerLookupClass(MockTransactionManagerLookup.class.getName());
wrapper.setCacheMode("REPL_SYNC");
- mbeanServer.registerMBean(wrapper, new ObjectName(TreeCacheSSOClusterManager.DEFAULT_GLOBAL_CACHE_NAME));
+ mbeanServer.registerMBean(wrapper, new ObjectName(CACHE_OBJECT_NAME));
wrapper.create();
wrapper.start();
// Build up an SSO infrastructure based on LOCAL_ADDRESS
TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- localSSOManager.setCacheName(TreeCacheSSOClusterManager.DEFAULT_GLOBAL_CACHE_NAME);
+ localSSOManager.setCacheName(CACHE_OBJECT_NAME);
MockSSOValve localValve = new MockSSOValve();
localValve.setClusterManager(localSSOManager);
@@ -152,72 +176,50 @@
catch (Exception ignored)
{
}
- finally
- {
- MBeanServerFactory.releaseMBeanServer(mbeanServer);
- }
- }
+ }
}
-
- public void testDisallowBuddyReplication() throws Exception
+
+ public void testPojoCacheJmxIntegration() throws Exception
{
- log.debug("+++ testDisallowBuddyReplication()");
- buddyReplicationConfigTest(true);
- buddyReplicationConfigTest(false);
- }
-
- private void buddyReplicationConfigTest(boolean enabled) throws Exception
- {
- MBeanServer mbeanServer =
- MBeanServerFactory.createMBeanServer("brTest");
- CacheJmxWrapper wrapper = null;
+ log.debug("+++ testPojoCacheJmxIntegration()");
+
+ mbeanServer = MBeanServerFactory.createMBeanServer("pojoCacheTest");
+ PojoCacheJmxWrapper wrapper = null;
try
{
// Register a cache
- wrapper = new CacheJmxWrapper();
+ wrapper = new PojoCacheJmxWrapper();
// JBAS-4097 -- don't use a TransactionManagerLookup that will
// bind DummyTransactionManager into JNDI, as that will screw
// up other tests
wrapper.setTransactionManagerLookupClass(MockTransactionManagerLookup.class.getName());
wrapper.setCacheMode("REPL_SYNC");
- // Configure buddy replication
- BuddyReplicationConfig brc = new BuddyReplicationConfig();
- brc.setEnabled(enabled);
- brc.setBuddyPoolName("clusteredsso");
- BuddyLocatorConfig blc = new NextMemberBuddyLocatorConfig();
- brc.setBuddyLocatorConfig(blc);
- wrapper.getConfiguration().setBuddyReplicationConfig(brc);
-
- mbeanServer.registerMBean(wrapper, new ObjectName(TreeCacheSSOClusterManager.DEFAULT_GLOBAL_CACHE_NAME));
+ mbeanServer.registerMBean(wrapper, new ObjectName(CACHE_OBJECT_NAME));
wrapper.create();
wrapper.start();
// Build up an SSO infrastructure based on LOCAL_ADDRESS
TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- localSSOManager.setCacheName(TreeCacheSSOClusterManager.DEFAULT_GLOBAL_CACHE_NAME);
+ localSSOManager.setCacheName(CACHE_OBJECT_NAME);
MockSSOValve localValve = new MockSSOValve();
localValve.setClusterManager(localSSOManager);
localSSOManager.setSingleSignOnValve(localValve);
+ localSSOManager.start();
- try
- {
- localSSOManager.start();
- if (enabled)
- {
- fail("TreeCacheSSOClusterManager should not start with buddy replication enabled");
- }
- }
- catch (LifecycleException le)
- {
- if (!enabled)
- {
- String msg = "Caught exception starting with BR disabled " + le.getLocalizedMessage();
- log.error(msg, le);
- fail(msg);
- }
- // else we shouldn't start
- }
+ // Create an SSO that will have two sessions from local valve
+ localSSOManager.register("1", "FORM", "Brian", "password");
+
+ Manager localSessMgr1 = new StandardManager();
+ Session sess1 = new MockSession(localSessMgr1, "1");
+ localSSOManager.addSession("1", sess1);
+
+ Manager localSessMgr2 = new StandardManager();
+ Session sess2 = new MockSession(localSessMgr2, "2");
+ localSSOManager.addSession("1", sess2);
+
+ // Confirm that data is cached properly
+ assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
}
finally
{
@@ -232,11 +234,109 @@
catch (Exception ignored)
{
}
- finally
+ }
+ }
+
+ public void testPojoCacheIntegration() throws Exception
+ {
+ log.debug("+++ testPojoCacheIntegration()");
+
+ CacheManager cacheManager = getCacheManager();
+
+ // Register a cache
+ Configuration config = new Configuration();
+ // JBAS-4097 -- don't use a TransactionManagerLookup that will
+ // bind DummyTransactionManager into JNDI, as that will screw
+ // up other tests
+ config.setTransactionManagerLookupClass(MockTransactionManagerLookup.class.getName());
+ config.setCacheMode("REPL_SYNC");
+ PojoCache pc = PojoCacheFactory.createCache(config, false);
+
+ cacheManager.registerPojoCache(pc, ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+
+ // Build up an SSO infrastructure based on LOCAL_ADDRESS
+ TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
+ localSSOManager.setCacheName(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+
+ MockSSOValve localValve = new MockSSOValve();
+ localValve.setClusterManager(localSSOManager);
+ localSSOManager.setSingleSignOnValve(localValve);
+ localSSOManager.start();
+
+ // Create an SSO that will have two sessions from local valve
+ localSSOManager.register("1", "FORM", "Brian", "password");
+
+ Manager localSessMgr1 = new StandardManager();
+ Session sess1 = new MockSession(localSessMgr1, "1");
+ localSSOManager.addSession("1", sess1);
+
+ Manager localSessMgr2 = new StandardManager();
+ Session sess2 = new MockSession(localSessMgr2, "2");
+ localSSOManager.addSession("1", sess2);
+
+ // Confirm that data is cached properly
+ assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
+ }
+
+ public void testDisallowBuddyReplication() throws Exception
+ {
+ log.debug("+++ testDisallowBuddyReplication()");
+ buddyReplicationConfigTest(true);
+
+ // Flush the cache manager
+ cacheManager.stop();
+ cacheManager = null;
+
+ buddyReplicationConfigTest(false);
+ }
+
+ private void buddyReplicationConfigTest(boolean enabled) throws Exception
+ {
+ CacheManager cacheManager = getCacheManager();
+
+ // Register a cache
+ Cache cache = new DefaultCacheFactory().createCache(false);
+ // JBAS-4097 -- don't use a TransactionManagerLookup that will
+ // bind DummyTransactionManager into JNDI, as that will screw
+ // up other tests
+ cache.getConfiguration().setTransactionManagerLookupClass(MockTransactionManagerLookup.class.getName());
+ cache.getConfiguration().setCacheMode("REPL_SYNC");
+ // Configure buddy replication
+ BuddyReplicationConfig brc = new BuddyReplicationConfig();
+ brc.setEnabled(enabled);
+ brc.setBuddyPoolName("clusteredsso");
+ BuddyLocatorConfig blc = new NextMemberBuddyLocatorConfig();
+ brc.setBuddyLocatorConfig(blc);
+ cache.getConfiguration().setBuddyReplicationConfig(brc);
+
+ cacheManager.registerCache(cache, ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+
+ // Build up an SSO infrastructure based on LOCAL_ADDRESS
+ TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(null);
+ localSSOManager.setCacheName(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+
+ MockSSOValve localValve = new MockSSOValve();
+ localValve.setClusterManager(localSSOManager);
+ localSSOManager.setSingleSignOnValve(localValve);
+
+ try
+ {
+ localSSOManager.start();
+ if (enabled)
{
- MBeanServerFactory.releaseMBeanServer(mbeanServer);
+ fail("TreeCacheSSOClusterManager should not start with buddy replication enabled");
}
}
+ catch (LifecycleException le)
+ {
+ if (!enabled)
+ {
+ String msg = "Caught exception starting with BR disabled " + le.getLocalizedMessage();
+ log.error(msg, le);
+ fail(msg);
+ }
+ // else we shouldn't start
+ }
}
public void testDeadMemberCleanupWithPool() throws Exception
@@ -253,134 +353,139 @@
private void deadMemberCleanupTest(boolean usePool) throws Exception
{
- MBeanServer mbeanServer =
- MBeanServerFactory.createMBeanServer("deadMemberTest");
- try
+ mbeanServer = usePool ? MBeanServerFactory.createMBeanServer("deadMemberTest")
+ : null;
+
+ CacheManager cacheManager = getCacheManager();
+ // Register a cache
+ CacheSPI delegate = (CacheSPI) new DefaultCacheFactory().createCache(false);
+ MockTreeCache cache = new MockTreeCache(delegate);
+ // JBAS-4097 -- don't use a TransactionManagerLookup that will
+ // bind DummyTransactionManager into JNDI, as that will screw
+ // up other tests
+ cache.getConfiguration().getRuntimeConfig().setTransactionManager(new BatchModeTransactionManager());
+
+ cacheManager.registerCache(cache, ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+
+ if (usePool)
{
- // Register a cache
- CacheSPI delegate = (CacheSPI) new DefaultCacheFactory().createCache(false);
- MockTreeCache cache = new MockTreeCache(delegate);
- // JBAS-4097 -- don't use a TransactionManagerLookup that will
- // bind DummyTransactionManager into JNDI, as that will screw
- // up other tests
- cache.getConfiguration().getRuntimeConfig().setTransactionManager(new BatchModeTransactionManager());
- CacheJmxWrapper wrapper = new CacheJmxWrapper(cache);
- mbeanServer.registerMBean(wrapper, new ObjectName(TreeCacheSSOClusterManager.DEFAULT_GLOBAL_CACHE_NAME));
- wrapper.create();
- wrapper.start();
-
- if (usePool)
- {
- BasicThreadPool pool = new BasicThreadPool();
- mbeanServer.registerMBean(pool, new ObjectName(TreeCacheSSOClusterManager.DEFAULT_THREAD_POOL_NAME));
- }
-
- // Build up an SSO infrastructure based on LOCAL_ADDRESS
- TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- localSSOManager.setCacheName(TreeCacheSSOClusterManager.DEFAULT_GLOBAL_CACHE_NAME);
-
- MockSSOValve localValve = new MockSSOValve();
- localValve.setClusterManager(localSSOManager);
- localSSOManager.setSingleSignOnValve(localValve);
- localSSOManager.start();
-
- assertEquals("Thread pool usage as expected", usePool, localSSOManager.isUsingThreadPool());
-
- // Build up a second SSO infrastructure based on LOCAL_ADDRESS
- // It uses the same mock cache, but we change the cache address
- // so it thinks it's a different address when it starts
- cache.setOurAddress(REMOTE_ADDRESS);
-
- TreeCacheSSOClusterManager remoteSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
- remoteSSOManager.setCacheName(TreeCacheSSOClusterManager.DEFAULT_GLOBAL_CACHE_NAME);
-
- MockSSOValve remoteValve = new MockSSOValve();
- remoteValve.setClusterManager(remoteSSOManager);
- remoteSSOManager.setSingleSignOnValve(localValve);
- remoteSSOManager.start();
-
-
- // Create an SSO that will have sessions from both valves
- localSSOManager.register("1", "FORM", "Brian", "password");
-
- Manager localSessMgr1 = new StandardManager();
- Session sess1 = new MockSession(localSessMgr1, "1");
- localSSOManager.addSession("1", sess1);
-
- Manager remoteSessMgr1 = new StandardManager();
- Session sess2 = new MockSession(remoteSessMgr1, "2");
- remoteSSOManager.addSession("1", sess2);
-
-
- // Create another SSO with sessions only from remote
- remoteSSOManager.register("2", "FORM", "Brian", "password");
-
- Manager remoteSessMgr2 = new StandardManager();
- Session sess3 = new MockSession(remoteSessMgr2, "3");
- remoteSSOManager.addSession("2", sess3);
-
- Manager remoteSessMgr3 = new StandardManager();
- Session sess4 = new MockSession(remoteSessMgr3, "4");
- remoteSSOManager.addSession("2", sess4);
-
-
- // Create a third SSO that will have sessions from both valves
- localSSOManager.register("3", "FORM", "Brian", "password");
-
- Manager localSessMgr2 = new StandardManager();
- Session sess5 = new MockSession(localSessMgr2, "5");
- localSSOManager.addSession("3", sess5);
-
- Manager remoteSessMgr4 = new StandardManager();
- Session sess6 = new MockSession(remoteSessMgr4, "6");
- remoteSSOManager.addSession("3", sess6);
-
-
- // Create a fourth SSO that will have two sessions from local valve
- localSSOManager.register("4", "FORM", "Brian", "password");
-
- Manager localSessMgr3 = new StandardManager();
- Session sess7 = new MockSession(localSessMgr3, "7");
- localSSOManager.addSession("4", sess7);
-
- Manager localSessMgr4 = new StandardManager();
- Session sess8 = new MockSession(localSessMgr4, "8");
- localSSOManager.addSession("4", sess8);
-
- // Confirm that data is cached properly
- assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
- assertEquals("SSO 1 has correct number of sessions", 2, remoteSSOManager.getSessionCount("1"));
- assertEquals("SSO 2 has correct number of sessions", 2, localSSOManager.getSessionCount("2"));
- assertEquals("SSO 2 has correct number of sessions", 2, remoteSSOManager.getSessionCount("2"));
- assertEquals("SSO 3 has correct number of sessions", 2, localSSOManager.getSessionCount("3"));
- assertEquals("SSO 3 has correct number of sessions", 2, remoteSSOManager.getSessionCount("3"));
- assertEquals("SSO 4 has correct number of sessions", 2, localSSOManager.getSessionCount("4"));
- assertEquals("SSO 4 has correct number of sessions", 2, remoteSSOManager.getSessionCount("4"));
-
- // Put in a new view with REMOTE_ADDRESS dead
- ViewId viewId = new ViewId(LOCAL_ADDRESS, 1);
- Vector v = new Vector();
- v.add(LOCAL_ADDRESS);
- EventImpl event = new EventImpl();
- event.setNewView(new View(viewId, v));
- event.setType(Type.VIEW_CHANGED);
- event.setPre(false);
-
- localSSOManager.viewChange(event);
-
- // Give the cleanup thread time to finish
- Thread.sleep(2000);
-
- // Confirm that cached data is properly cleaned up
- assertEquals("SSO 1 has correct number of sessions", 1, localSSOManager.getSessionCount("1"));
- assertEquals("SSO 2 has correct number of sessions", 0, localSSOManager.getSessionCount("2"));
- assertEquals("SSO 3 has correct number of sessions", 1, localSSOManager.getSessionCount("3"));
- assertEquals("SSO 4 has correct number of sessions", 2, localSSOManager.getSessionCount("4"));
+ BasicThreadPool pool = new BasicThreadPool();
+ mbeanServer.registerMBean(pool, new ObjectName(TreeCacheSSOClusterManager.DEFAULT_THREAD_POOL_NAME));
}
- finally
+
+ // Build up an SSO infrastructure based on LOCAL_ADDRESS
+ TreeCacheSSOClusterManager localSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
+ localSSOManager.setCacheName(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+
+ MockSSOValve localValve = new MockSSOValve();
+ localValve.setClusterManager(localSSOManager);
+ localSSOManager.setSingleSignOnValve(localValve);
+ localSSOManager.start();
+
+ assertEquals("Thread pool usage as expected", usePool, localSSOManager.isUsingThreadPool());
+
+ // Build up a second SSO infrastructure based on LOCAL_ADDRESS
+ // It uses the same mock cache, but we change the cache address
+ // so it thinks it's a different address when it starts
+ cache.setOurAddress(REMOTE_ADDRESS);
+
+ TreeCacheSSOClusterManager remoteSSOManager = new TreeCacheSSOClusterManager(mbeanServer);
+ remoteSSOManager.setCacheName(ClusteredSingleSignOn.DEFAULT_CACHE_NAME);
+
+ MockSSOValve remoteValve = new MockSSOValve();
+ remoteValve.setClusterManager(remoteSSOManager);
+ remoteSSOManager.setSingleSignOnValve(localValve);
+ remoteSSOManager.start();
+
+
+ // Create an SSO that will have sessions from both valves
+ localSSOManager.register("1", "FORM", "Brian", "password");
+
+ Manager localSessMgr1 = new StandardManager();
+ Session sess1 = new MockSession(localSessMgr1, "1");
+ localSSOManager.addSession("1", sess1);
+
+ Manager remoteSessMgr1 = new StandardManager();
+ Session sess2 = new MockSession(remoteSessMgr1, "2");
+ remoteSSOManager.addSession("1", sess2);
+
+
+ // Create another SSO with sessions only from remote
+ remoteSSOManager.register("2", "FORM", "Brian", "password");
+
+ Manager remoteSessMgr2 = new StandardManager();
+ Session sess3 = new MockSession(remoteSessMgr2, "3");
+ remoteSSOManager.addSession("2", sess3);
+
+ Manager remoteSessMgr3 = new StandardManager();
+ Session sess4 = new MockSession(remoteSessMgr3, "4");
+ remoteSSOManager.addSession("2", sess4);
+
+
+ // Create a third SSO that will have sessions from both valves
+ localSSOManager.register("3", "FORM", "Brian", "password");
+
+ Manager localSessMgr2 = new StandardManager();
+ Session sess5 = new MockSession(localSessMgr2, "5");
+ localSSOManager.addSession("3", sess5);
+
+ Manager remoteSessMgr4 = new StandardManager();
+ Session sess6 = new MockSession(remoteSessMgr4, "6");
+ remoteSSOManager.addSession("3", sess6);
+
+
+ // Create a fourth SSO that will have two sessions from local valve
+ localSSOManager.register("4", "FORM", "Brian", "password");
+
+ Manager localSessMgr3 = new StandardManager();
+ Session sess7 = new MockSession(localSessMgr3, "7");
+ localSSOManager.addSession("4", sess7);
+
+ Manager localSessMgr4 = new StandardManager();
+ Session sess8 = new MockSession(localSessMgr4, "8");
+ localSSOManager.addSession("4", sess8);
+
+ // Confirm that data is cached properly
+ assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));
+ assertEquals("SSO 1 has correct number of sessions", 2, remoteSSOManager.getSessionCount("1"));
+ assertEquals("SSO 2 has correct number of sessions", 2, localSSOManager.getSessionCount("2"));
+ assertEquals("SSO 2 has correct number of sessions", 2, remoteSSOManager.getSessionCount("2"));
+ assertEquals("SSO 3 has correct number of sessions", 2, localSSOManager.getSessionCount("3"));
+ assertEquals("SSO 3 has correct number of sessions", 2, remoteSSOManager.getSessionCount("3"));
+ assertEquals("SSO 4 has correct number of sessions", 2, localSSOManager.getSessionCount("4"));
+ assertEquals("SSO 4 has correct number of sessions", 2, remoteSSOManager.getSessionCount("4"));
+
+ // Put in a new view with REMOTE_ADDRESS dead
+ ViewId viewId = new ViewId(LOCAL_ADDRESS, 1);
+ Vector v = new Vector();
+ v.add(LOCAL_ADDRESS);
+ EventImpl event = new EventImpl();
+ event.setNewView(new View(viewId, v));
+ event.setType(Type.VIEW_CHANGED);
+ event.setPre(false);
+
+ localSSOManager.viewChange(event);
+
+ // Give the cleanup thread time to finish
+ Thread.sleep(2000);
+
+ // Confirm that cached data is properly cleaned up
+ assertEquals("SSO 1 has correct number of sessions", 1, localSSOManager.getSessionCount("1"));
+ assertEquals("SSO 2 has correct number of sessions", 0, localSSOManager.getSessionCount("2"));
+ assertEquals("SSO 3 has correct number of sessions", 1, localSSOManager.getSessionCount("3"));
+ assertEquals("SSO 4 has correct number of sessions", 2, localSSOManager.getSessionCount("4"));
+ }
+
+ private CacheManager getCacheManager() throws Exception
+ {
+ if (cacheManager == null)
{
- MBeanServerFactory.releaseMBeanServer(mbeanServer);
- }
+ JChannelFactory channelFactory = new JChannelFactory();
+ ConfigurationRegistry registry = new DependencyInjectedConfigurationRegistry();
+ cacheManager = new CacheManager(registry, channelFactory);
+ cacheManager.start();
+ }
+ return cacheManager;
}
More information about the jboss-cvs-commits
mailing list