Author: manik.surtani(a)jboss.com
Date: 2009-02-04 06:19:35 -0500 (Wed, 04 Feb 2009)
New Revision: 7636
Added:
core/trunk/src/test/java/org/jboss/cache/jmx/JmxManualTest.java
Modified:
core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java
core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTest.java
Log:
More JMX details
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2009-02-03 22:29:46
UTC (rev 7635)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2009-02-04 11:19:35
UTC (rev 7636)
@@ -30,9 +30,11 @@
import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.factories.annotations.Stop;
+import org.jboss.cache.jmx.annotations.MBean;
import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.lock.LockManager;
import org.jboss.cache.marshall.NodeData;
+import org.jboss.cache.util.CachePrinter;
import java.util.ArrayList;
import java.util.Collections;
@@ -48,6 +50,7 @@
* @since 2.2
*/
@NonVolatile
+@MBean(objectName = "DataContainer", description = "Core container for all
cached items")
public class DataContainerImpl implements DataContainer
{
private static final Log log = LogFactory.getLog(DataContainerImpl.class);
@@ -193,7 +196,10 @@
public NodeSPI peek(Fqn fqn, boolean includeDeletedNodes, boolean
includeInvalidNodes)
{
- if (trace) log.trace("peek " + fqn + ", includeDeletedNodes:"
+includeDeletedNodes + ", includeInvalidNodes:" + includeInvalidNodes);
+ if (trace)
+ {
+ log.trace("peek " + fqn + ", includeDeletedNodes:" +
includeDeletedNodes + ", includeInvalidNodes:" + includeInvalidNodes);
+ }
if (fqn == null || fqn.size() == 0) return getRoot();
NodeSPI n = getRoot();
int fqnSize = fqn.size();
@@ -483,7 +489,13 @@
return sb.toString();
}
+ @ManagedOperation(description = "Prints details of the data container, formatted
as an HTML String")
+ public String printDetailsAsHtml()
+ {
+ return CachePrinter.formatHtml(printDetails());
+ }
+
/**
* Returns lock information.
*
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-03 22:29:46 UTC
(rev 7635)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-04 11:19:35 UTC
(rev 7636)
@@ -81,7 +81,7 @@
*
* @author <a href="mailto:manik AT jboss DOT org">Manik Surtani (manik
AT jboss DOT org)</a>
*/
-@MBean(objectName = "RPCManager")
+@MBean(objectName = "RPCManager", description = "Manages RPC connections
to remote caches")
public class RPCManagerImpl implements RPCManager
{
private Channel channel;
@@ -177,7 +177,9 @@
if (getMembers().size() > 1) messageListener.waitForState();
if (log.isDebugEnabled())
+ {
log.debug("connected, state was retrieved successfully (in
" + (System.currentTimeMillis() - start) + " milliseconds)");
+ }
}
catch (StateTransferException ste)
{
@@ -271,7 +273,9 @@
ReflectionUtil.setValue(configuration, "accessible", true);
configuration.setUsingMultiplexer(true);
if (log.isDebugEnabled())
+ {
log.debug("Created Multiplexer Channel for cache cluster " +
configuration.getClusterName() + " using stack " +
configuration.getMultiplexerStack());
+ }
}
else
{
@@ -447,9 +451,13 @@
int modeToUse = mode;
int preferredMode;
if ((preferredMode =
spi.getInvocationContext().getOptionOverrides().getGroupRequestMode()) > -1)
+ {
modeToUse = preferredMode;
+ }
if (trace)
+ {
log.trace("callRemoteMethods(): valid members are " + recipients +
" methods: " + command + " Using OOB? " + useOutOfBandMessage + "
modeToUse: " + modeToUse);
+ }
if (channel.flushSupported() &&
!flushBlockGate.await(configuration.getStateRetrievalTimeout(), TimeUnit.MILLISECONDS))
{
throw new TimeoutException("State retrieval timed out waiting for flush
unblock. (timeout = " + configuration.getStateRetrievalTimeout() + " millis)
");
@@ -458,7 +466,9 @@
RspList rsps = rpcDispatcher.invokeRemoteCommands(recipients, command,
modeToUse, timeout, isUsingBuddyReplication, useOutOfBandMessage, responseFilter);
if (mode == GroupRequest.GET_NONE) return Collections.emptyList();// async case
if (trace)
+ {
log.trace("(" + getLocalAddress() + "): responses for method
" + command.getClass().getSimpleName() + ":\n" + rsps);
+ }
// short-circuit no-return-value calls.
if (rsps == null) return Collections.emptyList();
List<Object> retval = new ArrayList<Object>(rsps.size());
@@ -529,7 +539,9 @@
// Yes -- cache is configured LOCAL but app doesn't know it -- Brian
//throw new IllegalArgumentException("Cannot fetch partial state, targets
are " + sources + " and stateId is " + stateId);
if (log.isWarnEnabled())
+ {
log.warn("Cannot fetch partial state, targets are " + sources +
" and stateId is " + stateId);
+ }
return;
}
@@ -547,14 +559,18 @@
}
if (log.isDebugEnabled())
+ {
log.debug("Node " + getLocalAddress() + " fetching partial state
" + stateId + " from members " + targets);
+ }
boolean successfulTransfer = false;
for (Address target : targets)
{
try
{
if (log.isDebugEnabled())
+ {
log.debug("Node " + getLocalAddress() + " fetching partial
state " + stateId + " from member " + target);
+ }
messageListener.setStateSet(false);
successfulTransfer = channel.getState(target, stateId,
configuration.getStateRetrievalTimeout());
if (successfulTransfer)
@@ -570,14 +586,18 @@
}
}
if (log.isDebugEnabled())
+ {
log.debug("Node " + getLocalAddress() + " fetching partial
state " + stateId + " from member " + target + (successfulTransfer ? "
successful" : " failed"));
+ }
if (successfulTransfer) break;
}
catch (IllegalStateException ise)
{
// thrown by the JGroups channel if state retrieval fails.
if (log.isInfoEnabled())
+ {
log.info("Channel problems fetching state. Continuing on to next
provider. ", ise);
+ }
}
}
@@ -592,10 +612,10 @@
// ------------ START: Informational methods ------------
- @ManagedAttribute (description = "Local address")
+ @ManagedAttribute(description = "Local address")
public String getLocalAddressString()
{
- Address address = getLocalAddress();
+ Address address = getLocalAddress();
return address == null ? "null" : address.toString();
}
@@ -604,7 +624,7 @@
return channel != null ? channel.getLocalAddress() : null;
}
- @ManagedAttribute (description = "Cluster view")
+ @ManagedAttribute(description = "Cluster view")
public String getMembersString()
{
List l = getMembers();
@@ -615,9 +635,13 @@
{
if (isInLocalMode) return null;
if (members == null)
+ {
return Collections.emptyList();
+ }
else
+ {
return members;
+ }
}
public boolean isCoordinator()
@@ -715,7 +739,7 @@
catch (Throwable e)
{
//do not rethrow! jgroups might behave funny, resulting even in deadlock
- log.error("Error found while processing view accepted!!!", e);
+ log.error("Error found while processing view accepted!!!", e);
}
}
@@ -812,6 +836,12 @@
return statisticsEnabled;
}
+ @ManagedAttribute(description = "whether or not the RPCManager is used in this
cache instance")
+ public boolean isEnabled()
+ {
+ return !isInLocalMode;
+ }
+
@ManagedAttribute
public void setStatisticsEnabled(boolean statisticsEnabled)
{
@@ -837,7 +867,9 @@
{
//if we use a shared transport do not log any warn message
if (configuration.getMultiplexerStack() != null)
+ {
return;
+ }
//bundling is not good for sync caches
Configuration.CacheMode cacheMode = configuration.getCacheMode();
if (!cacheMode.equals(Configuration.CacheMode.LOCAL) &&
configuration.getCacheMode().isSynchronous())
Modified: core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java 2009-02-03 22:29:46
UTC (rev 7635)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManagerImpl.java 2009-02-04 11:19:35
UTC (rev 7636)
@@ -24,7 +24,9 @@
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.jboss.cache.Region.Type.*;
+import static org.jboss.cache.Region.Type.ANY;
+import static org.jboss.cache.Region.Type.EVICTION;
+import static org.jboss.cache.Region.Type.MARSHALLING;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.config.Configuration;
@@ -36,6 +38,7 @@
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.factories.annotations.Stop;
+import org.jboss.cache.jmx.annotations.MBean;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.lock.LockManager;
@@ -55,6 +58,7 @@
* @since 3.0.0
*/
@ThreadSafe
+@MBean(objectName = "RegionManager", description = "Manages eviction and
marshalling regions")
public class RegionManagerImpl implements RegionManager
{
/**
@@ -141,7 +145,9 @@
setDefaultInactive(configuration.isInactiveOnStartup());
if (isUsingEvictions())
+ {
evictionTimerTask.init(evictionConfig.getWakeupInterval(),
configuration.getRuntimeConfig().getEvictionTimerThreadFactory(), regionsRegistry);
+ }
}
@Stop
@@ -420,7 +426,9 @@
// Don't bother trying to fetch state if we are in LOCAL mode
if (members != null && !members.isEmpty())
+ {
rpcManager.fetchPartialState(members, subtreeRoot.getFqn());
+ }
}
else if (!buddyFqnTransformer.isBackupFqn(fqn))
{
@@ -431,7 +439,9 @@
{
List<Address> sources = new ArrayList<Address>(1);
if (!cache.getMembers().contains(buddy))
+ {
continue;
+ }
sources.add(buddy);
Fqn buddyRoot = buddyFqnTransformer.getBackupFqn(buddy, fqn);
subtreeRoot = cache.peek(buddyRoot, false, false);
@@ -642,7 +652,9 @@
{
if ((type == EVICTION && r.getEvictionRegionConfig() != null) ||
(type == MARSHALLING && r.isActive() &&
r.getClassLoader() != null))
+ {
regions.add(r);
+ }
}
}
else
@@ -673,7 +685,9 @@
// needDefault = ercs.size() == 0;
if (evictionConfig.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig() !=
null &&
!ercs.contains(evictionConfig.getDefaultEvictionRegionConfig())) // then the
default is a real region too; not just a template for others
+ {
ercs.add(0, evictionConfig.getDefaultEvictionRegionConfig());
+ }
// create regions for the regions defined in the evictionConfig.
// scan to be sure the _default_ region isn't added twice
@@ -746,7 +760,7 @@
evictionTimerTask.stop();
}
- @ManagedAttribute(name="numRegions", description = "A count of all
regions")
+ @ManagedAttribute(name = "numRegions", description = "A count of all
regions")
public int getNumRegions()
{
return regionsRegistry.size();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2009-02-03
22:29:46 UTC (rev 7635)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2009-02-04
11:19:35 UTC (rev 7636)
@@ -152,7 +152,9 @@
{
double total = hits + misses;
if (total == 0)
+ {
return 0;
+ }
return (hits / total);
}
@@ -160,7 +162,9 @@
public double getReadWriteRatio()
{
if (stores == 0)
+ {
return 0;
+ }
return (((double) (hits + misses) / (double) stores));
}
@@ -169,7 +173,9 @@
{
long total = hits + misses;
if (total == 0)
+ {
return 0;
+ }
return (hitTimes + missTimes) / total;
}
@@ -177,17 +183,19 @@
public long getAverageWriteTime()
{
if (stores == 0)
+ {
return 0;
+ }
return (storeTimes) / stores;
}
- @ManagedAttribute(description = "number of cache eviction operations")
+ @ManagedAttribute(description = "number of cache attributes")
public int getNumberOfAttributes()
{
return dataContainer.getNumberOfAttributes();
}
- @ManagedAttribute
+ @ManagedAttribute(description = "number of nodes in the cache")
public int getNumberOfNodes()
{
return dataContainer.getNumberOfNodes();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java 2009-02-03
22:29:46 UTC (rev 7635)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java 2009-02-04
11:19:35 UTC (rev 7636)
@@ -30,6 +30,8 @@
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.invocation.InvocationContextContainer;
+import org.jboss.cache.jmx.annotations.MBean;
+import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.util.CachePrinter;
import java.util.ArrayList;
@@ -45,6 +47,7 @@
* todo - if you add the same interceptor instance twice, things get really
dirty.
* -- this should be treated as an missuse and an exception should be thrown
*/
+@MBean(description = "InterceptorChain")
public class InterceptorChain
{
/**
@@ -151,6 +154,25 @@
}
+ @ManagedOperation(description = "Retrieves a list of the interceptors in the
chain")
+ public String getInterceptorDetails()
+ {
+ StringBuilder sb = new StringBuilder("Interceptor chain: \n");
+ int count = 0;
+ for (CommandInterceptor i : asList())
+ {
+ count++;
+ sb.append(" ").append(count).append(".
").append(i).append("\n");
+ }
+ return sb.toString();
+ }
+
+ @ManagedOperation(description = "Retrieves a list of the interceptors in the
chain, formatted as HTML")
+ public String getInterceptorDetailsAsHtml()
+ {
+ return CachePrinter.formatHtml(getInterceptorDetails());
+ }
+
/**
* Returns an unmofiable list with all the interceptors in sequence.
* If first in chain is null an empty list is returned.
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2009-02-03 22:29:46
UTC (rev 7635)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2009-02-04 11:19:35
UTC (rev 7636)
@@ -48,16 +48,7 @@
import org.jgroups.jmx.JChannelFactoryMBean;
import org.w3c.dom.Element;
-import javax.management.AttributeChangeNotification;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
+import javax.management.*;
import javax.transaction.TransactionManager;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@@ -146,7 +137,7 @@
public String printConfigurationAsHtmlString()
{
Configuration cfg = getConfiguration();
- return cfg == null ? "Configuration is null" :
formatHtml(cfg.toString());
+ return cfg == null ? "Configuration is null" :
CachePrinter.formatHtml(cfg.toString());
}
public String printCacheDetails()
@@ -156,7 +147,7 @@
public String printCacheDetailsAsHtml()
{
- return cache == null ? "Cache is null" :
formatHtml(CachePrinter.printCacheDetails(cache));
+ return cache == null ? "Cache is null" :
CachePrinter.formatHtml(CachePrinter.printCacheDetails(cache));
}
public CacheStatus getCacheStatus()
@@ -217,7 +208,7 @@
public String printLockInfoAsHtml()
{
- return cache == null ? "Cache is null" :
formatHtml(CachePrinter.printCacheLockingInfo(cache));
+ return cache == null ? "Cache is null" :
CachePrinter.formatHtml(CachePrinter.printCacheLockingInfo(cache));
}
public boolean getRegisterJmxResource()
@@ -599,9 +590,13 @@
if (!cacheStatus.createAllowed())
{
if (cacheStatus.needToDestroyFailedCache())
+ {
destroy();
+ }
else
+ {
return;
+ }
}
try
@@ -633,12 +628,18 @@
if (!cacheStatus.startAllowed())
{
if (cacheStatus.needToDestroyFailedCache())
+ {
destroy(); // this will take us back to DESTROYED
+ }
if (cacheStatus.needCreateBeforeStart())
+ {
create();
+ }
else
+ {
return;
+ }
}
try
@@ -718,7 +719,9 @@
}
}
else
+ {
return;
+ }
}
try
@@ -730,7 +733,9 @@
unregisterJmxResources();
if (cache != null)
+ {
cache.destroy();
+ }
}
finally
{
@@ -901,22 +906,6 @@
return server;
}
- /**
- * Formats a given String for display as an HTML snippet.
- *
- * @param s string to format
- * @return formatted string
- */
- public static String formatHtml(String s)
- {
- s = s.replaceAll("\r\n", "<br/>");
- s = s.replaceAll("\r", "<br/>");
- s = s.replaceAll("\n", "<br/>");
- s = s.replaceAll("\t",
" ");
- s = s.replaceAll(" ", " ");
- return s;
- }
-
public String getNotificationServiceName()
{
return notificationServiceName;
@@ -1049,14 +1038,18 @@
{
listenerCount.incrementAndGet();
if (cache != null)
+ {
cache.addCacheListener(cacheNotificationListener);
+ }
}
else
{
if (listenerCount.decrementAndGet() <= 0)
{
if (cache != null)
+ {
cache.removeCacheListener(cacheNotificationListener);
+ }
listenerCount.set(0);
}
@@ -1082,13 +1075,21 @@
sendStateChangeNotification(oldState, getState(), getClass().getSimpleName() +
" failed", t);
if (t instanceof CacheException)
+ {
throw (CacheException) t;
+ }
else if (t instanceof RuntimeException)
+ {
throw (RuntimeException) t;
+ }
else if (t instanceof Error)
+ {
throw (Error) t;
+ }
else
+ {
throw new CacheException(t);
+ }
}
/**
@@ -1097,7 +1098,9 @@
private void sendStateChangeNotification(int oldState, int newState, String msg,
Throwable t)
{
if (isDisableStateChangeNotifications())
+ {
return;
+ }
long now = System.currentTimeMillis();
Modified: core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2009-02-03 22:29:46
UTC (rev 7635)
+++ core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2009-02-04 11:19:35
UTC (rev 7636)
@@ -93,4 +93,20 @@
}
return sb.toString();
}
+
+ /**
+ * Formats a given String for display as an HTML snippet.
+ *
+ * @param s string to format
+ * @return formatted string
+ */
+ public static String formatHtml(String s)
+ {
+ s = s.replaceAll("\r\n", "<br/>");
+ s = s.replaceAll("\r", "<br/>");
+ s = s.replaceAll("\n", "<br/>");
+ s = s.replaceAll("\t",
" ");
+ s = s.replaceAll(" ", " ");
+ return s;
+ }
}
Added: core/trunk/src/test/java/org/jboss/cache/jmx/JmxManualTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/JmxManualTest.java
(rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/JmxManualTest.java 2009-02-04 11:19:35
UTC (rev 7636)
@@ -0,0 +1,76 @@
+package org.jboss.cache.jmx;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.eviction.FIFOAlgorithmConfig;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+// do NOT enable this test in SVN as it will cause Hudson (or any other continuous
integration test harness) to get
+
+// stuck.
+@Test(groups = "maual", enabled = false)
+public class JmxManualTest
+{
+ public void testLocal() throws IOException
+ {
+ Configuration c = new Configuration();
+ Cache cache = new DefaultCacheFactory().createCache(c);
+ cache.put("/a/b/c", "a", "b");
+ cache.put("/a/b/c", "c", "d");
+ cache.put("/a/b/d", "a", "b");
+ cache.put("/a/b/e", "c", "d");
+
+ System.in.read();
+ }
+
+ public void testLocalNoJMX() throws IOException
+ {
+ Configuration c = new Configuration();
+ c.setExposeManagementStatistics(false);
+ Cache cache = new DefaultCacheFactory().createCache(c);
+ cache.put("/a/b/c", "a", "b");
+ cache.put("/a/b/c", "c", "d");
+ cache.put("/a/b/d", "a", "b");
+ cache.put("/a/b/e", "c", "d");
+
+ System.in.read();
+ }
+
+ public void testLocalWithEviction() throws IOException
+ {
+ Configuration c = new Configuration();
+ EvictionConfig ec = new EvictionConfig();
+ ec.setWakeupInterval(250, TimeUnit.MILLISECONDS);
+ EvictionRegionConfig erc = new EvictionRegionConfig();
+ erc.setEvictionAlgorithmConfig(new FIFOAlgorithmConfig(2));
+ erc.setRegionFqn(Fqn.ROOT);
+ ec.setDefaultEvictionRegionConfig(erc);
+ c.setEvictionConfig(ec);
+ Cache cache = new DefaultCacheFactory().createCache(c);
+ cache.put("/a/b/c", "a", "b");
+ cache.put("/a/b/c", "c", "d");
+ cache.put("/a/b/d", "a", "b");
+ cache.put("/a/b/e", "c", "d");
+
+ System.in.read();
+ }
+
+ public void testLocalWithEvictionXML() throws IOException
+ {
+ Cache cache = new
DefaultCacheFactory().createCache("config-samples/eviction-enabled.xml");
+ cache.put("/a/b/c", "a", "b");
+ cache.put("/a/b/c", "c", "d");
+ cache.put("/a/b/d", "a", "b");
+ cache.put("/a/b/e", "c", "d");
+
+ System.in.read();
+ }
+
+}
Modified:
core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTest.java 2009-02-03
22:29:46 UTC (rev 7635)
+++
core/trunk/src/test/java/org/jboss/cache/jmx/deprecated/CacheJmxWrapperTest.java 2009-02-04
11:19:35 UTC (rev 7636)
@@ -16,7 +16,6 @@
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.util.CachePrinter;
-import org.jboss.cache.util.TestingUtil;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
import static org.testng.AssertJUnit.*;
@@ -71,7 +70,9 @@
finally
{
if (registered)
+ {
mBeanServer.unregisterMBean(on);
+ }
}
}
@@ -155,7 +156,7 @@
{
CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();
String cfgFromJmx = wrapper.printConfigurationAsHtmlString();
- assertEquals(CacheJmxWrapper.formatHtml(cache.getConfiguration().toString()),
cfgFromJmx);
+ assertEquals(CachePrinter.formatHtml(cache.getConfiguration().toString()),
cfgFromJmx);
checkHtml(cfgFromJmx, false);
}
@@ -175,7 +176,7 @@
wrapper.create();
wrapper.start();
String cfgFromJmx = wrapper.printConfigurationAsHtmlString();
-
assertEquals(CacheJmxWrapper.formatHtml(wrapper.getCache().getConfiguration().toString()),
cfgFromJmx);
+
assertEquals(CachePrinter.formatHtml(wrapper.getCache().getConfiguration().toString()),
cfgFromJmx);
checkHtml(cfgFromJmx, false);
}
@@ -396,7 +397,9 @@
private void checkHtml(String html, boolean checkBR)
{
if (checkBR)
+ {
assertTrue("Has <br", html.contains("<br"));
+ }
assertTrue("No tabs", html.indexOf('\t') == -1);