Author: bstansberry(a)jboss.com
Date: 2007-09-17 23:43:06 -0400 (Mon, 17 Sep 2007)
New Revision: 4483
Modified:
core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java
core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
Log:
[JBCACHE-1181] Expose voluminous details via "printXXX" operations, not
attributes
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-09-18 03:26:48
UTC (rev 4482)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2007-09-18 03:43:06
UTC (rev 4483)
@@ -126,24 +126,24 @@
return cfg;
}
- public String getConfigurationAsString()
+ public String printConfigurationAsString()
{
Configuration cfg = getConfiguration();
return cfg == null ? "Configuration is null" : cfg.toString();
}
- public String getConfigurationAsHtmlString()
+ public String printConfigurationAsHtmlString()
{
Configuration cfg = getConfiguration();
return cfg == null ? "Configuration is null" :
formatHtml(cfg.toString());
}
- public String getCacheDetails()
+ public String printCacheDetails()
{
return cache == null ? "Cache is null" : cache.printDetails();
}
- public String getCacheDetailsAsHtml()
+ public String printCacheDetailsAsHtml()
{
return cache == null ? "Cache is null" :
formatHtml(cache.printDetails());
}
@@ -199,12 +199,12 @@
return cache == null ? -1 : cache.getNumberOfAttributes();
}
- public String getLockInfo()
+ public String printLockInfo()
{
return cache == null ? "Cache is null" : cache.printLockInfo();
}
- public String getLockInfoAsHtml()
+ public String printLockInfoAsHtml()
{
return cache == null ? "Cache is null" :
formatHtml(cache.printLockInfo());
}
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java 2007-09-18
03:26:48 UTC (rev 4482)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java 2007-09-18
03:43:06 UTC (rev 4483)
@@ -85,22 +85,22 @@
/**
* @return a string based representation of the configuration
*/
- String getConfigurationAsString();
+ String printConfigurationAsString();
/**
* @return an HTML formatted string based representation of the configuration
*/
- String getConfigurationAsHtmlString();
+ String printConfigurationAsHtmlString();
/**
* @return details of nodes in the cache
*/
- String getCacheDetails();
+ String printCacheDetails();
/**
* @return details of nodes in the cache, formatted as HTML
*/
- String getCacheDetailsAsHtml();
+ String printCacheDetailsAsHtml();
/**
* Returns the local address of this cache in a cluster, or
<code>null</code>
@@ -133,12 +133,12 @@
/**
* @return information on the state of node locks
*/
- String getLockInfo();
+ String printLockInfo();
/**
* @return information on the state of node locks, formatted as HTML
*/
- String getLockInfoAsHtml();
+ String printLockInfoAsHtml();
/**
* Gets whether this object should register the cache's interceptors
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java 2007-09-18
03:26:48 UTC (rev 4482)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java 2007-09-18
03:43:06 UTC (rev 4483)
@@ -118,10 +118,10 @@
*
* @throws Exception
*/
- public void testGetConfigurationAsString1() throws Exception
+ public void testPrintConfigurationAsString1() throws Exception
{
CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
- String cfgFromJmx = wrapper.getConfigurationAsString();
+ String cfgFromJmx = wrapper.printConfigurationAsString();
assertEquals(cache.getConfiguration().toString(), cfgFromJmx);
}
@@ -133,13 +133,13 @@
*
* @throws Exception
*/
- public void testGetConfigurationAsString2() throws Exception
+ public void testPrintConfigurationAsString2() throws Exception
{
Configuration cfg = createConfiguration();
CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(cfg);
wrapper.create();
wrapper.start();
- String cfgFromJmx = wrapper.getConfigurationAsString();
+ String cfgFromJmx = wrapper.printConfigurationAsString();
assertEquals(wrapper.getCache().getConfiguration().toString(), cfgFromJmx);
}
@@ -152,10 +152,10 @@
*
* @throws Exception
*/
- public void testGetConfigurationAsHtml1() throws Exception
+ public void testPrintConfigurationAsHtml1() throws Exception
{
CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
- String cfgFromJmx = wrapper.getConfigurationAsHtmlString();
+ String cfgFromJmx = wrapper.printConfigurationAsHtmlString();
assertEquals(CacheJmxWrapper.formatHtml(cache.getConfiguration().toString()),
cfgFromJmx);
checkHtml(cfgFromJmx, false);
}
@@ -169,13 +169,13 @@
*
* @throws Exception
*/
- public void testGetConfigurationAsHtml2() throws Exception
+ public void testPrintConfigurationAsHtml2() throws Exception
{
Configuration cfg = createConfiguration();
CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(cfg);
wrapper.create();
wrapper.start();
- String cfgFromJmx = wrapper.getConfigurationAsHtmlString();
+ String cfgFromJmx = wrapper.printConfigurationAsHtmlString();
assertEquals(CacheJmxWrapper.formatHtml(wrapper.getCache().getConfiguration().toString()),
cfgFromJmx);
checkHtml(cfgFromJmx, false);
}
@@ -198,9 +198,9 @@
assertEquals("value", cacheJmx.get(fqn, "key"));
}
- public void testGetCacheDetails() throws Exception
+ public void testPrintCacheDetails() throws Exception
{
- getCacheDetailsTest(false);
+ printCacheDetailsTest(false);
}
/**
@@ -211,15 +211,15 @@
*
* @throws Exception
*/
- public void testGetCacheDetailsAsHtml() throws Exception
+ public void testPrintCacheDetailsAsHtml() throws Exception
{
- String html = getCacheDetailsTest(true);
+ String html = printCacheDetailsTest(true);
checkHtml(html, true);
}
- public void testGetLockInfo() throws Exception
+ public void testPrintLockInfo() throws Exception
{
- getLockInfoTest(false);
+ printLockInfoTest(false);
}
/**
@@ -230,9 +230,9 @@
*
* @throws Exception
*/
- public void testGetLockInfoAsHtml() throws Exception
+ public void testPrintLockInfoAsHtml() throws Exception
{
- getLockInfoTest(true);
+ printLockInfoTest(true);
}
public void testGetLocalAddress() throws Exception
@@ -289,10 +289,10 @@
assertTrue(cache.getNumberOfNodes() > 0);
assertEquals(0, cache.getNumberOfAttributes());
- System.out.println("cache locks before restart:\n" +
cache.getLockInfo());
+ System.out.println("cache locks before restart:\n" +
cache.printLockInfo());
cache.destroy();
cache.start();
- System.out.println("cache locks after restart:\n" +
cache.getLockInfo());
+ System.out.println("cache locks after restart:\n" +
cache.printLockInfo());
assertEquals(0, cache.getNumberOfNodes());
assertEquals(0, cache.getNumberOfAttributes());
@@ -359,7 +359,7 @@
assertEquals("Correct state", CacheStatus.DESTROYED,
wrapper.getCacheStatus());
}
- private String getCacheDetailsTest(boolean html) throws Exception
+ private String printCacheDetailsTest(boolean html) throws Exception
{
CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
@@ -370,7 +370,7 @@
assertEquals("barfoo", cache.get(fqn, "foobar"));
- String details = html ? wrapper.getCacheDetailsAsHtml() :
wrapper.getCacheDetails();
+ String details = html ? wrapper.printCacheDetailsAsHtml() :
wrapper.printCacheDetails();
assertTrue("Details include testing",
details.contains("testing"));
assertTrue("Details include jmx", details.contains("jmx"));
@@ -380,7 +380,7 @@
return details;
}
- private String getLockInfoTest(boolean html) throws Exception
+ private String printLockInfoTest(boolean html) throws Exception
{
Configuration config = createConfiguration();
config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
@@ -400,7 +400,7 @@
Fqn fqn = Fqn.fromString("/testing/jmx");
cache.put(fqn, "foobar", "barfoo");
- String locks = html ? wrapper.getLockInfoAsHtml() : wrapper.getLockInfo();
+ String locks = html ? wrapper.printLockInfoAsHtml() : wrapper.printLockInfo();
assertTrue("Details include testing",
locks.contains("testing"));
assertTrue("Details include jmx", locks.contains("jmx"));