[infinispan-commits] Infinispan SVN: r1072 - trunk/core/src/test/java/org/infinispan/test/fwk.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Thu Oct 29 11:56:06 EDT 2009


Author: manik.surtani at jboss.com
Date: 2009-10-29 11:56:05 -0400 (Thu, 29 Oct 2009)
New Revision: 1072

Modified:
   trunk/core/src/test/java/org/infinispan/test/fwk/TestCacheManagerFactory.java
Log:
Better support for colliding JMX domains

Modified: trunk/core/src/test/java/org/infinispan/test/fwk/TestCacheManagerFactory.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/fwk/TestCacheManagerFactory.java	2009-10-29 15:23:41 UTC (rev 1071)
+++ trunk/core/src/test/java/org/infinispan/test/fwk/TestCacheManagerFactory.java	2009-10-29 15:56:05 UTC (rev 1072)
@@ -22,6 +22,11 @@
    public static final String MARSHALLER = System.getProperties().getProperty("infinispan.marshaller.class");
    private static Log log = LogFactory.getLog(TestCacheManagerFactory.class);
 
+   private static DefaultCacheManager newDefaultCacheManager(GlobalConfiguration gc, Configuration c) {
+      gc.setJmxDomain("infinispan-" + Thread.currentThread().getName());
+      return new DefaultCacheManager(gc, c);
+   }
+
    /**
     * Creates an cache manager that does not support clustering or transactions.
     */
@@ -39,7 +44,7 @@
       amendMarshaller(globalConfiguration);
       Configuration c = new Configuration();
       if (transactional) amendJTA(c);
-      return new DefaultCacheManager(globalConfiguration, c);
+      return newDefaultCacheManager(globalConfiguration, c);
    }
 
    private static void amendJTA(Configuration c) {
@@ -55,7 +60,7 @@
       Properties newTransportProps = new Properties();
       newTransportProps.put(JGroupsTransport.CONFIGURATION_STRING, JGroupsConfigBuilder.getJGroupsConfig());
       globalConfiguration.setTransportProperties(newTransportProps);
-      return new DefaultCacheManager(globalConfiguration);
+      return newDefaultCacheManager(globalConfiguration, new Configuration());
    }
 
    /**
@@ -64,11 +69,10 @@
    public static CacheManager createClusteredCacheManager(Configuration defaultCacheConfig) {
       GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
       amendMarshaller(globalConfiguration);
-//      amendJmx(globalConfiguration);
       Properties newTransportProps = new Properties();
       newTransportProps.put(JGroupsTransport.CONFIGURATION_STRING, JGroupsConfigBuilder.getJGroupsConfig());
       globalConfiguration.setTransportProperties(newTransportProps);
-      return new DefaultCacheManager(globalConfiguration, defaultCacheConfig);
+      return newDefaultCacheManager(globalConfiguration, defaultCacheConfig);
    }
 
    /**
@@ -78,8 +82,7 @@
    public static CacheManager createCacheManager(GlobalConfiguration configuration) {
       amendMarshaller(configuration);
       amendTransport(configuration);
-//      amendJmx(configuration);
-      return new DefaultCacheManager(configuration);
+      return newDefaultCacheManager(configuration, new Configuration());
    }
 
    /**
@@ -98,23 +101,16 @@
    public static CacheManager createCacheManager(Configuration defaultCacheConfig, boolean transactional) {
       GlobalConfiguration globalConfiguration = GlobalConfiguration.getNonClusteredDefault();
       amendMarshaller(globalConfiguration);
-//      amendJmx(globalConfiguration);
       if (transactional) amendJTA(defaultCacheConfig);
-      return new DefaultCacheManager(globalConfiguration, defaultCacheConfig);
+      return newDefaultCacheManager(globalConfiguration, defaultCacheConfig);
    }
 
    public static DefaultCacheManager createCacheManager(GlobalConfiguration configuration, Configuration defaultCfg) {
       amendMarshaller(configuration);
       amendTransport(configuration);
-//      amendJmx(configuration);
-      return new DefaultCacheManager(configuration, defaultCfg);
+      return newDefaultCacheManager(configuration, defaultCfg);
    }
 
-   private static void amendJmx(GlobalConfiguration globalConfiguration) {
-      globalConfiguration.setExposeGlobalJmxStatistics(false);
-      globalConfiguration.setAllowDuplicateDomains(true);
-   }
-
    private static void amendTransport(GlobalConfiguration configuration) {
       if (configuration.getTransportClass() != null) { //this is local
          Properties newTransportProps = new Properties();



More information about the infinispan-commits mailing list