Author: bstansberry(a)jboss.com
Date: 2008-10-29 18:16:17 -0400 (Wed, 29 Oct 2008)
New Revision: 15446
Modified:
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
Log:
Add hooks for changing the JBC config resource
Modified:
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
===================================================================
---
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2008-10-29
21:33:52 UTC (rev 15445)
+++
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2008-10-29
22:16:17 UTC (rev 15446)
@@ -171,9 +171,12 @@
node2Failure = null;
}
- protected static Configuration createConfiguration(String configName) {
+ protected static Configuration createConfiguration(String configName, String
configResource) {
Configuration cfg = CacheTestUtil.buildConfiguration(REGION_PREFIX,
MultiplexedJBossCacheRegionFactory.class, true, false);
cfg.setProperty(MultiplexingCacheInstanceManager.ENTITY_CACHE_RESOURCE_PROP,
configName);
+ if (configResource != null) {
+ cfg.setProperty(MultiplexingCacheInstanceManager.CACHE_FACTORY_RESOURCE_PROP,
configResource);
+ }
return cfg;
}
@@ -546,12 +549,18 @@
private static final String PREFER_IPV4STACK =
"java.net.preferIPv4Stack";
- private String configName;
+ private final String configResource;
+ private final String configName;
private String preferIPv4Stack;
public AccessStrategyTestSetup(Test test, String configName) {
+ this(test, configName, null);
+ }
+
+ public AccessStrategyTestSetup(Test test, String configName, String
configResource) {
super(test);
this.configName = configName;
+ this.configResource = configResource;
}
@Override
@@ -562,11 +571,11 @@
preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
System.setProperty(PREFER_IPV4STACK, "true");
- localCfg = createConfiguration(configName);
+ localCfg = createConfiguration(configName, configResource);
localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
localCache =
localRegionFactory.getCacheInstanceManager().getCollectionCacheInstance();
- remoteCfg = createConfiguration(configName);
+ remoteCfg = createConfiguration(configName, configResource);
remoteRegionFactory = CacheTestUtil.startRegionFactory(remoteCfg);
remoteCache =
remoteRegionFactory.getCacheInstanceManager().getCollectionCacheInstance();
}
Modified:
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
===================================================================
---
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2008-10-29
21:33:52 UTC (rev 15445)
+++
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2008-10-29
22:16:17 UTC (rev 15446)
@@ -95,15 +95,23 @@
public static Test getTestSetup(Class testClass, String configName) {
- TestSuite suite = new TestSuite(testClass);
- return new AccessStrategyTestSetup(suite, configName);
+ return getTestSetup(testClass, configName, null);
}
public static Test getTestSetup(Test test, String configName) {
- return new AccessStrategyTestSetup(test, configName);
+ return getTestSetup(test, configName, null);
+ }
+
+ public static Test getTestSetup(Class testClass, String configName, String
configResource) {
+ TestSuite suite = new TestSuite(testClass);
+ return new AccessStrategyTestSetup(suite, configName, configResource);
}
+ public static Test getTestSetup(Test test, String configName, String configResource)
{
+ return new AccessStrategyTestSetup(test, configName, configResource);
+ }
+
/**
* Create a new TransactionalAccessTestCase.
*
@@ -169,9 +177,12 @@
node2Failure = null;
}
- protected static Configuration createConfiguration(String configName) {
+ protected static Configuration createConfiguration(String configName, String
configResource) {
Configuration cfg = CacheTestUtil.buildConfiguration(REGION_PREFIX,
MultiplexedJBossCacheRegionFactory.class, true, false);
cfg.setProperty(MultiplexingCacheInstanceManager.ENTITY_CACHE_RESOURCE_PROP,
configName);
+ if (configResource != null) {
+ cfg.setProperty(MultiplexingCacheInstanceManager.CACHE_FACTORY_RESOURCE_PROP,
configResource);
+ }
return cfg;
}
@@ -755,12 +766,18 @@
private static final String PREFER_IPV4STACK =
"java.net.preferIPv4Stack";
- private String configName;
+ private final String configResource;
+ private final String configName;
private String preferIPv4Stack;
public AccessStrategyTestSetup(Test test, String configName) {
+ this(test, configName, null);
+ }
+
+ public AccessStrategyTestSetup(Test test, String configName, String
configResource) {
super(test);
this.configName = configName;
+ this.configResource = configResource;
}
@Override
@@ -779,11 +796,11 @@
preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
System.setProperty(PREFER_IPV4STACK, "true");
- localCfg = createConfiguration(configName);
+ localCfg = createConfiguration(configName, configResource);
localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
localCache =
localRegionFactory.getCacheInstanceManager().getEntityCacheInstance();
- remoteCfg = createConfiguration(configName);
+ remoteCfg = createConfiguration(configName, configResource);
remoteRegionFactory = CacheTestUtil.startRegionFactory(remoteCfg);
remoteCache =
remoteRegionFactory.getCacheInstanceManager().getEntityCacheInstance();