[hibernate-commits] Hibernate SVN: r14198 - in core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test: cache/jbc2/collection and 3 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Tue Nov 13 15:55:50 EST 2007
Author: bstansberry at jboss.com
Date: 2007-11-13 15:55:50 -0500 (Tue, 13 Nov 2007)
New Revision: 14198
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/AbstractJBossCacheTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/CacheTestCaseBase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/util/CacheTestSupport.java
Log:
Run tests w/ java.net.preferIPv4Stack=true; cluster formation is very slow otherwise on some systems
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/AbstractJBossCacheTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/AbstractJBossCacheTestCase.java 2007-11-13 17:12:02 UTC (rev 14197)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/AbstractJBossCacheTestCase.java 2007-11-13 20:55:50 UTC (rev 14198)
@@ -27,7 +27,6 @@
private CacheTestSupport testSupport = new CacheTestSupport();
protected final Logger log = LoggerFactory.getLogger(getClass());
-
public AbstractJBossCacheTestCase(String name) {
super(name);
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2007-11-13 17:12:02 UTC (rev 14197)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2007-11-13 20:55:50 UTC (rev 14198)
@@ -503,7 +503,10 @@
private static class AccessStrategyTestSetup extends TestSetup {
+ private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
+
private String configName;
+ private String preferIPv4Stack;
public AccessStrategyTestSetup(Test test, String configName) {
super(test);
@@ -512,7 +515,12 @@
@Override
protected void setUp() throws Exception {
- super.setUp();
+ super.setUp();
+
+ // Try to ensure we use IPv4; otherwise cluster formation is very slow
+ preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
+ System.setProperty(PREFER_IPV4STACK, "true");
+
localCfg = createConfiguration(configName);
localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
localCache = localRegionFactory.getCacheInstanceManager().getCollectionCacheInstance();
@@ -523,8 +531,16 @@
}
@Override
- protected void tearDown() throws Exception {
- super.tearDown();
+ protected void tearDown() throws Exception {
+ try {
+ super.tearDown();
+ }
+ finally {
+ if (preferIPv4Stack == null)
+ System.clearProperty(PREFER_IPV4STACK);
+ else
+ System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
+ }
if (localRegionFactory != null)
localRegionFactory.stop();
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2007-11-13 17:12:02 UTC (rev 14197)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2007-11-13 20:55:50 UTC (rev 14198)
@@ -696,7 +696,10 @@
private static class AccessStrategyTestSetup extends TestSetup {
+ private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
+
private String configName;
+ private String preferIPv4Stack;
public AccessStrategyTestSetup(Test test, String configName) {
super(test);
@@ -705,7 +708,20 @@
@Override
protected void setUp() throws Exception {
- super.setUp();
+ try {
+ super.tearDown();
+ }
+ finally {
+ if (preferIPv4Stack == null)
+ System.clearProperty(PREFER_IPV4STACK);
+ else
+ System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
+ }
+
+ // Try to ensure we use IPv4; otherwise cluster formation is very slow
+ preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
+ System.setProperty(PREFER_IPV4STACK, "true");
+
localCfg = createConfiguration(configName);
localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
localCache = localRegionFactory.getCacheInstanceManager().getEntityCacheInstance();
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/CacheTestCaseBase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/CacheTestCaseBase.java 2007-11-13 17:12:02 UTC (rev 14197)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/CacheTestCaseBase.java 2007-11-13 20:55:50 UTC (rev 14198)
@@ -3,6 +3,8 @@
import org.hibernate.cache.RegionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
+import org.hibernate.cfg.Mappings;
+import org.hibernate.dialect.Dialect;
import org.hibernate.junit.functional.FunctionalTestCase;
import org.hibernate.test.tm.DummyConnectionProvider;
import org.hibernate.test.tm.DummyTransactionManagerLookup;
@@ -14,6 +16,10 @@
*/
public abstract class CacheTestCaseBase extends FunctionalTestCase {
+ private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
+
+ private String preferIPv4Stack;
+
// note that a lot of the functionality here is intended to be used
// in creating specific tests for each CacheProvider that would extend
// from a base test case (this) for common requirement testing...
@@ -44,7 +50,7 @@
public String getCacheConcurrencyStrategy() {
return "transactional";
- }
+ }
/**
* The cache provider to be tested.
@@ -78,4 +84,30 @@
* @return The config resource location.
*/
protected abstract String getConfigResourceLocation();
+
+ @Override
+ public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
+
+ super.afterConfigurationBuilt(mappings, dialect);
+
+ // Try to ensure we use IPv4; otherwise cluster formation is very slow
+ preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
+ System.setProperty(PREFER_IPV4STACK, "true");
+ }
+
+ @Override
+ protected void cleanupTest() throws Exception {
+ try {
+ super.cleanupTest();
+ }
+ finally {
+ if (preferIPv4Stack == null)
+ System.clearProperty(PREFER_IPV4STACK);
+ else
+ System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
+ }
+
+ }
+
+
}
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/util/CacheTestSupport.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/util/CacheTestSupport.java 2007-11-13 17:12:02 UTC (rev 14197)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/util/CacheTestSupport.java 2007-11-13 20:55:50 UTC (rev 14198)
@@ -31,9 +31,12 @@
*/
public class CacheTestSupport {
+ private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
+
private Set<Cache> caches = new HashSet();
private Set<RegionFactory> factories = new HashSet();
private Exception exception;
+ private String preferIPv4Stack;
public void registerCache(Cache cache) {
caches.add(cache);
@@ -51,12 +54,23 @@
factories.remove(factory);
}
- public void setUp() throws Exception {
+ public void setUp() throws Exception {
+
+ // Try to ensure we use IPv4; otherwise cluster formation is very slow
+ preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
+ System.setProperty(PREFER_IPV4STACK, "true");
+
cleanUp();
throwStoredException();
}
public void tearDown() throws Exception {
+
+ if (preferIPv4Stack == null)
+ System.clearProperty(PREFER_IPV4STACK);
+ else
+ System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
+
cleanUp();
throwStoredException();
}
More information about the hibernate-commits
mailing list