assert !existsDomains(jmxDomain);
}
public void testCorrectUnregistering() throws Exception {
assert !existsDomains("infinispan");
GlobalConfiguration globalConfiguration = GlobalConfiguration.getNonClusteredDefault();
globalConfiguration.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
cm = TestCacheManagerFactory.createCacheManager(globalConfiguration);
Configuration localCache = config();//local by default
cm.defineConfiguration("local_cache", localCache);
cm.getCache("local_cache");
String jmxDomain = cm.getGlobalConfiguration().getJmxDomain();
assert existsObject(getCacheObjectName(jmxDomain, "local_cache(local)", "Statistics"));
assert existsObject(getCacheObjectName(jmxDomain, "local_cache(local)", "Cache"));
//now register a global one
GlobalConfiguration globalConfiguration2 = GlobalConfiguration.getClusteredDefault();
globalConfiguration2.setExposeGlobalJmxStatistics(true);
globalConfiguration2.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
globalConfiguration2.setAllowDuplicateDomains(true);
cm2 = TestCacheManagerFactory.createCacheManager(globalConfiguration2);
Configuration remoteCache = new Configuration();
remoteCache.setExposeJmxStatistics(true);
remoteCache.setCacheMode(Configuration.CacheMode.REPL_SYNC);
cm2.defineConfiguration("remote_cache", remoteCache);