[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/jmx ...
Brian Stansberry
brian.stansberry at jboss.com
Fri Jul 13 16:23:12 EDT 2007
User: bstansberry
Date: 07/07/13 16:23:12
Modified: tests/functional/org/jboss/cache/jmx
CacheJmxWrapperTestBase.java
InterceptorRegistrationTest.java
CacheJmxWrapperTest.java
Log:
[JBCACHE-1131] Genericize CacheJmxWrapper
Revision Changes Path
1.4 +14 -12 JBossCache/tests/functional/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheJmxWrapperTestBase.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- CacheJmxWrapperTestBase.java 23 May 2007 10:28:53 -0000 1.3
+++ CacheJmxWrapperTestBase.java 13 Jul 2007 20:23:11 -0000 1.4
@@ -2,6 +2,7 @@
import junit.framework.TestCase;
import org.jboss.cache.Cache;
+import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.Configuration;
@@ -21,8 +22,8 @@
{
public static final String CLUSTER_NAME = "CacheMBeanTest";
- protected Cache cache;
- protected CacheJmxWrapperMBean jmxWrapper;
+ protected Cache<String, String> cache;
+ protected CacheJmxWrapperMBean<String, String> jmxWrapper;
protected MBeanServer mBeanServer;
protected ObjectName mBeanName;
protected String mBeanNameStr;
@@ -51,30 +52,30 @@
}
}
- protected CacheJmxWrapperMBean registerWrapper() throws Exception
+ protected CacheJmxWrapperMBean<String, String> registerWrapper() throws Exception
{
if (cache == null)
cache = createCache(createConfiguration());
return registerWrapper(cache);
}
- protected CacheJmxWrapperMBean registerWrapper(Cache toWrap) throws Exception
+ protected CacheJmxWrapperMBean<String, String> registerWrapper(Cache toWrap) throws Exception
{
- CacheJmxWrapper wrapper = new CacheJmxWrapper(toWrap);
+ CacheJmxWrapper<String, String> wrapper = new CacheJmxWrapper<String, String>(toWrap);
return registerWrapper(wrapper);
}
- protected CacheJmxWrapperMBean registerWrapper(Configuration config) throws Exception
+ protected CacheJmxWrapperMBean<String, String> registerWrapper(Configuration config) throws Exception
{
- CacheJmxWrapper wrapper = new CacheJmxWrapper();
+ CacheJmxWrapper<String, String> wrapper = new CacheJmxWrapper<String, String>();
wrapper.setConfiguration(config);
return registerWrapper(wrapper);
}
- protected CacheJmxWrapperMBean registerWrapper(CacheJmxWrapperMBean wrapper) throws Exception
+ protected CacheJmxWrapperMBean<String, String> registerWrapper(CacheJmxWrapperMBean<String, String> wrapper) throws Exception
{
JmxUtil.registerCacheMBean(mBeanServer, wrapper, mBeanNameStr);
- jmxWrapper = (CacheJmxWrapperMBean) MBeanServerInvocationHandler.newProxyInstance(mBeanServer, mBeanName, CacheJmxWrapperMBean.class, false);
+ jmxWrapper = (CacheJmxWrapperMBean<String, String>) MBeanServerInvocationHandler.newProxyInstance(mBeanServer, mBeanName, CacheJmxWrapperMBean.class, false);
return jmxWrapper;
}
@@ -83,16 +84,17 @@
mBeanServer.unregisterMBean(mBeanName);
}
- protected CacheJmxWrapper createWrapper(Configuration config)
+ protected CacheJmxWrapper<String, String> createWrapper(Configuration config)
{
- CacheJmxWrapper wrapper = new CacheJmxWrapper();
+ CacheJmxWrapper<String, String> wrapper = new CacheJmxWrapper<String, String>();
wrapper.setConfiguration(config);
return wrapper;
}
protected Cache createCache(Configuration config)
{
- cache = DefaultCacheFactory.getInstance().createCache(config, false);
+ CacheFactory<String, String> factory = DefaultCacheFactory.getInstance();
+ cache = factory.createCache(config, false);
return cache;
}
1.3 +13 -15 JBossCache/tests/functional/org/jboss/cache/jmx/InterceptorRegistrationTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InterceptorRegistrationTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/jmx/InterceptorRegistrationTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- InterceptorRegistrationTest.java 22 May 2007 22:53:09 -0000 1.2
+++ InterceptorRegistrationTest.java 13 Jul 2007 20:23:11 -0000 1.3
@@ -28,7 +28,7 @@
* Tests the interceptor registration function of CacheJmxWrapper.
*
* @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class InterceptorRegistrationTest extends CacheJmxWrapperTestBase
{
@@ -48,7 +48,7 @@
createCache(createConfiguration());
cache.start();
- CacheJmxWrapperMBean wrapper = registerWrapper(cache);
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(cache);
assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
interceptorRegistrationTest(true);
@@ -82,7 +82,7 @@
createCache(createConfiguration());
cache.start();
- CacheJmxWrapperMBean wrapper = new CacheJmxWrapper(cache);
+ CacheJmxWrapperMBean<String, String> wrapper = new CacheJmxWrapper(cache);
wrapper.start();
wrapper = registerWrapper(wrapper);
assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
@@ -112,7 +112,7 @@
*/
public void testInterceptorMBeans3() throws Exception
{
- CacheJmxWrapperMBean wrapper = registerWrapper(createConfiguration());
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(createConfiguration());
assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
// have to start the cache to have any interceptors
@@ -144,7 +144,7 @@
*/
public void testInterceptorMBeans4() throws Exception
{
- CacheJmxWrapper wrapper = createWrapper(createConfiguration());
+ CacheJmxWrapper<String, String> wrapper = createWrapper(createConfiguration());
// have to start the cache to have any interceptors
wrapper.create();
@@ -179,7 +179,7 @@
*/
public void testInterceptorMBeans5() throws Exception
{
- CacheJmxWrapperMBean wrapper = registerWrapper();
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
// wrapper.setManageCacheLifecycle(true);
assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
@@ -212,7 +212,7 @@
*/
public void testInterceptorMBeans6() throws Exception
{
- CacheJmxWrapperMBean wrapper = registerWrapper();
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
// have to start the cache to have any interceptors
@@ -243,7 +243,7 @@
*/
public void testInterceptorMBeans7() throws Exception
{
- CacheJmxWrapperMBean wrapper = new CacheJmxWrapper(createCache(createConfiguration()));
+ CacheJmxWrapperMBean<String, String> wrapper = new CacheJmxWrapper(createCache(createConfiguration()));
// have to start the cache to have any interceptors
wrapper.create();
@@ -273,7 +273,7 @@
*/
public void testRegisterInterceptors1() throws Exception
{
- CacheJmxWrapper wrapper = createWrapper(createConfiguration());
+ CacheJmxWrapper<String, String> wrapper = createWrapper(createConfiguration());
wrapper.setRegisterInterceptors(false);
registerWrapper(wrapper);
@@ -304,7 +304,7 @@
*/
public void testRegisterInterceptors2() throws Exception
{
- CacheJmxWrapper wrapper = createWrapper(createConfiguration());
+ CacheJmxWrapper<String, String> wrapper = createWrapper(createConfiguration());
wrapper.setRegisterInterceptors(false);
wrapper.create();
@@ -331,7 +331,7 @@
Configuration cfg = createConfiguration();
cfg.setExposeManagementStatistics(false);
- CacheJmxWrapper wrapper = createWrapper(cfg);
+ CacheJmxWrapper<String, String> wrapper = createWrapper(cfg);
registerWrapper(cfg);
assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
@@ -356,7 +356,7 @@
Configuration cfg = createConfiguration();
cfg.setExposeManagementStatistics(false);
- CacheJmxWrapper wrapper = createWrapper(cfg);
+ CacheJmxWrapper<String, String> wrapper = createWrapper(cfg);
wrapper.create();
wrapper.start();
@@ -378,6 +378,4 @@
}
-
-
}
1.11 +15 -15 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.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- CacheJmxWrapperTest.java 3 Jul 2007 11:57:48 -0000 1.10
+++ CacheJmxWrapperTest.java 13 Jul 2007 20:23:11 -0000 1.11
@@ -41,7 +41,7 @@
boolean registered = false;
try
{
- CacheJmxWrapper wrapper = createWrapper(createConfiguration());
+ CacheJmxWrapper<String, String> wrapper = createWrapper(createConfiguration());
wrapper.setCacheObjectName(str);
// Register under the standard name
@@ -73,7 +73,7 @@
{
ObjectName on = new ObjectName("jboss.cache:test=SetCacheObjectName");
String str = on.getCanonicalName();
- CacheJmxWrapper wrapper = createWrapper(createConfiguration());
+ CacheJmxWrapper<String, String> wrapper = createWrapper(createConfiguration());
wrapper.setCacheObjectName(str);
assertEquals("Setter and getter match", str, wrapper.getCacheObjectName());
@@ -88,7 +88,7 @@
public void testGetConfiguration1() throws Exception
{
- CacheJmxWrapperMBean wrapper = registerWrapper();
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
Configuration cfgFromJmx = wrapper.getConfiguration();
assertNotNull("Got a configuration", cfgFromJmx);
assertSame(cache.getConfiguration(), cfgFromJmx);
@@ -97,7 +97,7 @@
public void testGetConfiguration2() throws Exception
{
Configuration cfg = createConfiguration();
- CacheJmxWrapperMBean wrapper = registerWrapper(cfg);
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(cfg);
Configuration cfgFromJmx = wrapper.getConfiguration();
assertNotNull("Got a configuration", cfgFromJmx);
assertSame(cfg, cfgFromJmx);
@@ -113,7 +113,7 @@
*/
public void testGetConfigurationAsString1() throws Exception
{
- CacheJmxWrapperMBean wrapper = registerWrapper();
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
String cfgFromJmx = wrapper.getConfigurationAsString();
assertEquals(cache.getConfiguration().toString(), cfgFromJmx);
}
@@ -129,7 +129,7 @@
public void testGetConfigurationAsString2() throws Exception
{
Configuration cfg = createConfiguration();
- CacheJmxWrapperMBean wrapper = registerWrapper(cfg);
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(cfg);
wrapper.create();
wrapper.start();
String cfgFromJmx = wrapper.getConfigurationAsString();
@@ -147,7 +147,7 @@
*/
public void testGetConfigurationAsHtml1() throws Exception
{
- CacheJmxWrapperMBean wrapper = registerWrapper();
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
String cfgFromJmx = wrapper.getConfigurationAsHtmlString();
assertEquals(CacheJmxWrapper.formatHtml(cache.getConfiguration().toString()), cfgFromJmx);
checkHtml(cfgFromJmx, false);
@@ -165,7 +165,7 @@
public void testGetConfigurationAsHtml2() throws Exception
{
Configuration cfg = createConfiguration();
- CacheJmxWrapperMBean wrapper = registerWrapper(cfg);
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(cfg);
wrapper.create();
wrapper.start();
String cfgFromJmx = wrapper.getConfigurationAsHtmlString();
@@ -179,7 +179,7 @@
// have to start the cache before we'll have a root
cache.start();
- Cache cacheJmx = (Cache) mBeanServer.getAttribute(mBeanName, "Cache");
+ Cache<String, String> cacheJmx = (Cache<String, String>) mBeanServer.getAttribute(mBeanName, "Cache");
cacheJmx.getRoot().put("key", "value");
assertEquals("value", cache.getRoot().get("key"));
@@ -231,7 +231,7 @@
{
Configuration c = createConfiguration();
c.setCacheMode(CacheMode.REPL_ASYNC);
- CacheJmxWrapperMBean wrapper = registerWrapper(c);
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(c);
wrapper.start();
assertTrue("Got an IpAddress", wrapper.getLocalAddress() instanceof IpAddress);
}
@@ -240,7 +240,7 @@
{
Configuration c = createConfiguration();
c.setCacheMode(CacheMode.REPL_ASYNC);
- CacheJmxWrapperMBean wrapper = registerWrapper(c);
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(c);
wrapper.start();
c = createConfiguration();
@@ -271,7 +271,7 @@
public void testDuplicateInvocation() throws Exception
{
- CacheJmxWrapperMBean cache = registerWrapper();
+ CacheJmxWrapperMBean<String, String> cache = registerWrapper();
cache.create();
cache.start();
cache.create();
@@ -297,7 +297,7 @@
public void testFailedStart() throws Exception
{
- CacheJmxWrapper wrapper = new CacheJmxWrapper(createCache(createConfiguration()));
+ CacheJmxWrapper<String, String> wrapper = new CacheJmxWrapper(createCache(createConfiguration()));
registerWrapper(wrapper);
assertEquals("Correct state", CacheStatus.INSTANTIATED, wrapper.getCacheStatus());
wrapper.create();
@@ -353,7 +353,7 @@
private String getCacheDetailsTest(boolean html) throws Exception
{
- CacheJmxWrapperMBean wrapper = registerWrapper();
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
// have to start the cache before we'll have a root
cache.start();
@@ -377,7 +377,7 @@
Configuration config = createConfiguration();
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
Cache c = createCache(config);
- CacheJmxWrapperMBean wrapper = registerWrapper(c);
+ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(c);
// wrapper.setManageCacheLifecycle(true);
wrapper.create();
More information about the jboss-cvs-commits
mailing list