Refactor configuration of TransactionFactory

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14369 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Brian Stansberry 2008-02-27 17:48:50 +00:00
parent 834be2837a
commit 1ee489d79f
3 changed files with 14 additions and 12 deletions

View File

@ -69,7 +69,10 @@ public abstract class CacheTestCaseBase extends FunctionalTestCase {
cfg.setProperty(Environment.USE_QUERY_CACHE, String.valueOf(getUseQueryCache())); cfg.setProperty(Environment.USE_QUERY_CACHE, String.valueOf(getUseQueryCache()));
cfg.setProperty(Environment.CONNECTION_PROVIDER, getConnectionProviderClass().getName()); cfg.setProperty(Environment.CONNECTION_PROVIDER, getConnectionProviderClass().getName());
cfg.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, getTransactionManagerLookupClass().getName()); cfg.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, getTransactionManagerLookupClass().getName());
// cfg.setProperty( Environment.TRANSACTION_STRATEGY, CMTTransactionFactory.class.getName() );
Class transactionFactory = getTransactionFactoryClass();
if (transactionFactory != null)
cfg.setProperty( Environment.TRANSACTION_STRATEGY, transactionFactory.getName() );
configureCacheFactory(cfg); configureCacheFactory(cfg);
} }
@ -96,6 +99,10 @@ public abstract class CacheTestCaseBase extends FunctionalTestCase {
protected Class getTransactionManagerLookupClass() { protected Class getTransactionManagerLookupClass() {
return org.hibernate.test.tm.TransactionManagerLookupImpl.class; return org.hibernate.test.tm.TransactionManagerLookupImpl.class;
} }
protected Class getTransactionFactoryClass() {
return null;
}
@Override @Override
public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) { public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {

View File

@ -26,6 +26,7 @@ import org.hibernate.test.cache.jbc2.functional.util.DualNodeConnectionProviderI
import org.hibernate.test.cache.jbc2.functional.util.DualNodeTestUtil; import org.hibernate.test.cache.jbc2.functional.util.DualNodeTestUtil;
import org.hibernate.test.cache.jbc2.functional.util.DualNodeTransactionManagerLookup; import org.hibernate.test.cache.jbc2.functional.util.DualNodeTransactionManagerLookup;
import org.hibernate.test.cache.jbc2.functional.util.TestCacheInstanceManager; import org.hibernate.test.cache.jbc2.functional.util.TestCacheInstanceManager;
import org.hibernate.transaction.CMTTransactionFactory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -94,6 +95,11 @@ public abstract class DualNodeTestCaseBase extends CacheTestCaseBase
@Override @Override
protected Class getTransactionManagerLookupClass() { protected Class getTransactionManagerLookupClass() {
return DualNodeTransactionManagerLookup.class; return DualNodeTransactionManagerLookup.class;
}
@Override
protected Class getTransactionFactoryClass() {
return CMTTransactionFactory.class;
} }
@Override @Override

View File

@ -68,17 +68,6 @@ extends DualNodeTestCaseBase
{ {
super(name); super(name);
} }
@Override
public void configure(Configuration cfg)
{
cfg.setProperty( Environment.TRANSACTION_STRATEGY, CMTTransactionFactory.class.getName() );
super.configure(cfg);
}
@Override @Override
protected Class<? extends RegionFactory> getCacheRegionFactory() protected Class<? extends RegionFactory> getCacheRegionFactory()