diff --git a/hibernate-infinispan/hibernate-infinispan.gradle b/hibernate-infinispan/hibernate-infinispan.gradle index 1f46608ca6..9d4ab161af 100644 --- a/hibernate-infinispan/hibernate-infinispan.gradle +++ b/hibernate-infinispan/hibernate-infinispan.gradle @@ -35,6 +35,8 @@ test { systemProperties['jgroups.ping.num_initial_members'] = 1 systemProperties['jgroups.udp.enable_bundling'] = false systemProperties['jgroups.bind_addr'] = 'localhost' + // Use Infinispan's test JGroups stack that uses TEST_PING + systemProperties['hibernate.cache.infinispan.jgroups_cfg'] = 'stacks/tcp.xml' // systemProperties['log4j.configuration'] = 'file:/log4j/log4j-infinispan.xml' enabled = true } diff --git a/hibernate-infinispan/src/main/resources/org/hibernate/cache/infinispan/builder/infinispan-configs.xml b/hibernate-infinispan/src/main/resources/org/hibernate/cache/infinispan/builder/infinispan-configs.xml index ab5d7996a5..0f1634b167 100644 --- a/hibernate-infinispan/src/main/resources/org/hibernate/cache/infinispan/builder/infinispan-configs.xml +++ b/hibernate-infinispan/src/main/resources/org/hibernate/cache/infinispan/builder/infinispan-configs.xml @@ -11,7 +11,8 @@ - + diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/AbstractNonFunctionalTestCase.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/AbstractNonFunctionalTestCase.java index aa5286a3d4..9a4ffa85e4 100644 --- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/AbstractNonFunctionalTestCase.java +++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/AbstractNonFunctionalTestCase.java @@ -42,70 +42,77 @@ import org.hibernate.test.cache.infinispan.util.CacheTestSupport; * @since 3.5 */ public abstract class AbstractNonFunctionalTestCase extends org.hibernate.testing.junit4.BaseUnitTestCase { - private static final Logger log = Logger.getLogger( AbstractNonFunctionalTestCase.class ); + private static final Logger log = Logger.getLogger(AbstractNonFunctionalTestCase.class); - public static final String REGION_PREFIX = "test"; + public static final String REGION_PREFIX = "test"; - private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack"; - private String preferIPv4Stack; + private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack"; + private String preferIPv4Stack; + private static final String JGROUPS_CFG_FILE = "hibernate.cache.infinispan.jgroups_cfg"; + private String jgroupsCfgFile; - private CacheTestSupport testSupport = new CacheTestSupport(); + private CacheTestSupport testSupport = new CacheTestSupport(); - @Before - public void prepareCacheSupport() throws Exception { - preferIPv4Stack = System.getProperty( PREFER_IPV4STACK ); - System.setProperty( PREFER_IPV4STACK, "true" ); + @Before + public void prepareCacheSupport() throws Exception { + preferIPv4Stack = System.getProperty(PREFER_IPV4STACK); + System.setProperty(PREFER_IPV4STACK, "true"); + jgroupsCfgFile = System.getProperty(JGROUPS_CFG_FILE); + System.setProperty(JGROUPS_CFG_FILE, "stacks/tcp.xml"); - testSupport.setUp(); - } + testSupport.setUp(); + } - @After - public void releaseCachSupport() throws Exception { - testSupport.tearDown(); + @After + public void releaseCachSupport() throws Exception { + testSupport.tearDown(); - if ( preferIPv4Stack == null ) { - System.clearProperty( PREFER_IPV4STACK ); - } - else { - System.setProperty( PREFER_IPV4STACK, preferIPv4Stack ); - } - } + if (preferIPv4Stack == null) { + System.clearProperty(PREFER_IPV4STACK); + } else { + System.setProperty(PREFER_IPV4STACK, preferIPv4Stack); + } + + if (jgroupsCfgFile == null) + System.clearProperty(JGROUPS_CFG_FILE); + else + System.setProperty(JGROUPS_CFG_FILE, jgroupsCfgFile); + } - protected void registerCache(Cache cache) { - testSupport.registerCache(cache); - } + protected void registerCache(Cache cache) { + testSupport.registerCache(cache); + } - protected void unregisterCache(Cache cache) { - testSupport.unregisterCache(cache); - } + protected void unregisterCache(Cache cache) { + testSupport.unregisterCache(cache); + } - protected void registerFactory(RegionFactory factory) { - testSupport.registerFactory(factory); - } + protected void registerFactory(RegionFactory factory) { + testSupport.registerFactory(factory); + } - protected void unregisterFactory(RegionFactory factory) { - testSupport.unregisterFactory(factory); - } + protected void unregisterFactory(RegionFactory factory) { + testSupport.unregisterFactory(factory); + } - protected CacheTestSupport getCacheTestSupport() { - return testSupport; - } + protected CacheTestSupport getCacheTestSupport() { + return testSupport; + } - protected void sleep(long ms) { - try { - Thread.sleep(ms); - } - catch (InterruptedException e) { - log.warn("Interrupted during sleep", e); - } - } + protected void sleep(long ms) { + try { + Thread.sleep(ms); + } catch (InterruptedException e) { + log.warn("Interrupted during sleep", e); + } + } - protected void avoidConcurrentFlush() { - testSupport.avoidConcurrentFlush(); - } + protected void avoidConcurrentFlush() { + testSupport.avoidConcurrentFlush(); + } - protected int getValidKeyCount(Set keys) { - return keys.size(); + protected int getValidKeyCount(Set keys) { + return keys.size(); } } \ No newline at end of file