[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/jmx ...
Brian Stansberry
brian.stansberry at jboss.com
Tue May 22 19:00:45 EDT 2007
User: bstansberry
Date: 07/05/22 19:00:45
Modified: tests/functional/org/jboss/cache/jmx
CacheJmxWrapperTest.java
Log:
[JBCACHE-1063] Test of getLocalAddress() and getMembers()
Revision Changes Path
1.4 +37 -0 JBossCache/tests/functional/org/jboss/cache/jmx/CacheJmxWrapperTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheJmxWrapperTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/jmx/CacheJmxWrapperTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- CacheJmxWrapperTest.java 22 May 2007 22:53:09 -0000 1.3
+++ CacheJmxWrapperTest.java 22 May 2007 23:00:45 -0000 1.4
@@ -1,5 +1,7 @@
package org.jboss.cache.jmx;
+import java.util.List;
+
import javax.management.ObjectName;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
@@ -8,7 +10,9 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
/**
@@ -227,6 +231,39 @@
assertTrue("Got an IpAddress", wrapper.getLocalAddress() instanceof IpAddress);
}
+ public void testGetMembers() throws Exception
+ {
+ Configuration c = createConfiguration();
+ c.setCacheMode(CacheMode.REPL_ASYNC);
+ CacheJmxWrapperMBean wrapper = registerWrapper(c);
+ wrapper.start();
+
+ c = createConfiguration();
+ c.setCacheMode(CacheMode.REPL_ASYNC);
+ Cache cache2 = null;
+ try
+ {
+ cache2 = createCache(c);
+ cache2.start();
+ Cache[] caches = new Cache[]{wrapper.getCache(), cache2 };
+ TestingUtil.blockUntilViewsReceived(caches, 5000);
+
+ Address addr = wrapper.getLocalAddress();
+ assertNotNull("Got an Address", addr);
+ List members = wrapper.getMembers();
+ assertNotNull("Got members", addr);
+ assertEquals("Got correct number of members", 2, members.size());
+ assertTrue("I am a member", members.contains(addr));
+ }
+ finally
+ {
+ if (cache2 != null)
+ {
+ cache2.destroy();
+ }
+ }
+ }
+
private String getCacheDetailsTest(boolean html) throws Exception
{
CacheJmxWrapperMBean wrapper = registerWrapper();
More information about the jboss-cvs-commits
mailing list