[HHH-5362] (Upgrade trunk to latest Infinispan 4.1) Updated to 4.1.0.CR1.

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19918 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Galder Zamarreno 2010-07-08 14:08:58 +00:00
parent cb2993cfbb
commit 76cc4c27e4
8 changed files with 46 additions and 42 deletions

View File

@ -18,7 +18,7 @@
<description>Integration of Hibernate with Infinispan</description> <description>Integration of Hibernate with Infinispan</description>
<properties> <properties>
<version.infinispan>4.0.0.FINAL</version.infinispan> <version.infinispan>4.1.0.CR1</version.infinispan>
<version.hsqldb>1.8.0.2</version.hsqldb> <version.hsqldb>1.8.0.2</version.hsqldb>
<version.cglib>2.2</version.cglib> <version.cglib>2.2</version.cglib>
<version.javassist>3.4.GA</version.javassist> <version.javassist>3.4.GA</version.javassist>

View File

@ -31,8 +31,8 @@ import org.hibernate.cfg.Settings;
import org.hibernate.util.PropertiesHelper; import org.hibernate.util.PropertiesHelper;
import org.infinispan.Cache; import org.infinispan.Cache;
import org.infinispan.config.Configuration; import org.infinispan.config.Configuration;
import org.infinispan.manager.CacheManager;
import org.infinispan.manager.DefaultCacheManager; import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.util.logging.Log; import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory; import org.infinispan.util.logging.LogFactory;
@ -132,7 +132,7 @@ public class InfinispanRegionFactory implements RegionFactory {
*/ */
public static final String DEF_QUERY_RESOURCE = "local-query"; public static final String DEF_QUERY_RESOURCE = "local-query";
private CacheManager manager; private EmbeddedCacheManager manager;
private final Map<String, TypeOverrides> typeOverrides = new HashMap<String, TypeOverrides>(); private final Map<String, TypeOverrides> typeOverrides = new HashMap<String, TypeOverrides>();
@ -227,11 +227,11 @@ public class InfinispanRegionFactory implements RegionFactory {
return System.currentTimeMillis() / 100; return System.currentTimeMillis() / 100;
} }
public void setCacheManager(CacheManager manager) { public void setCacheManager(EmbeddedCacheManager manager) {
this.manager = manager; this.manager = manager;
} }
public CacheManager getCacheManager() { public EmbeddedCacheManager getCacheManager() {
return manager; return manager;
} }
@ -283,10 +283,10 @@ public class InfinispanRegionFactory implements RegionFactory {
return Collections.unmodifiableSet(definedConfigurations); return Collections.unmodifiableSet(definedConfigurations);
} }
protected CacheManager createCacheManager(Properties properties) throws CacheException { protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
try { try {
String configLoc = PropertiesHelper.getString(INFINISPAN_CONFIG_RESOURCE_PROP, properties, DEF_INFINISPAN_CONFIG_RESOURCE); String configLoc = PropertiesHelper.getString(INFINISPAN_CONFIG_RESOURCE_PROP, properties, DEF_INFINISPAN_CONFIG_RESOURCE);
CacheManager manager = new DefaultCacheManager(configLoc, false); EmbeddedCacheManager manager = new DefaultCacheManager(configLoc, false);
String globalStats = PropertiesHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties); String globalStats = PropertiesHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
if (globalStats != null) { if (globalStats != null) {
manager.getGlobalConfiguration().setExposeGlobalJmxStatistics(Boolean.parseBoolean(globalStats)); manager.getGlobalConfiguration().setExposeGlobalJmxStatistics(Boolean.parseBoolean(globalStats));

View File

@ -31,7 +31,7 @@ import org.hibernate.cache.CacheException;
import org.hibernate.cache.RegionFactory; import org.hibernate.cache.RegionFactory;
import org.hibernate.util.NamingHelper; import org.hibernate.util.NamingHelper;
import org.hibernate.util.PropertiesHelper; import org.hibernate.util.PropertiesHelper;
import org.infinispan.manager.CacheManager; import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.util.logging.Log; import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory; import org.infinispan.util.logging.LogFactory;
@ -47,7 +47,7 @@ public class JndiInfinispanRegionFactory extends InfinispanRegionFactory {
private static final Log log = LogFactory.getLog(JndiInfinispanRegionFactory.class); private static final Log log = LogFactory.getLog(JndiInfinispanRegionFactory.class);
/** /**
* Specifies the JNDI name under which the {@link CacheManager} to use is bound. * Specifies the JNDI name under which the {@link EmbeddedCacheManager} to use is bound.
* There is no default value -- the user must specify the property. * There is no default value -- the user must specify the property.
*/ */
public static final String CACHE_MANAGER_RESOURCE_PROP = "hibernate.cache.infinispan.cachemanager"; public static final String CACHE_MANAGER_RESOURCE_PROP = "hibernate.cache.infinispan.cachemanager";
@ -61,18 +61,18 @@ public class JndiInfinispanRegionFactory extends InfinispanRegionFactory {
} }
@Override @Override
protected CacheManager createCacheManager(Properties properties) throws CacheException { protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
String name = PropertiesHelper.getString(CACHE_MANAGER_RESOURCE_PROP, properties, null); String name = PropertiesHelper.getString(CACHE_MANAGER_RESOURCE_PROP, properties, null);
if (name == null) if (name == null)
throw new CacheException("Configuration property " + CACHE_MANAGER_RESOURCE_PROP + " not set"); throw new CacheException("Configuration property " + CACHE_MANAGER_RESOURCE_PROP + " not set");
return locateCacheManager(name, NamingHelper.getJndiProperties(properties)); return locateCacheManager(name, NamingHelper.getJndiProperties(properties));
} }
private CacheManager locateCacheManager(String jndiNamespace, Properties jndiProperties) { private EmbeddedCacheManager locateCacheManager(String jndiNamespace, Properties jndiProperties) {
Context ctx = null; Context ctx = null;
try { try {
ctx = new InitialContext(jndiProperties); ctx = new InitialContext(jndiProperties);
return (CacheManager) ctx.lookup(jndiNamespace); return (EmbeddedCacheManager) ctx.lookup(jndiNamespace);
} catch (NamingException ne) { } catch (NamingException ne) {
String msg = "Unable to retrieve CacheManager from JNDI [" + jndiNamespace + "]"; String msg = "Unable to retrieve CacheManager from JNDI [" + jndiNamespace + "]";
log.info(msg, ne); log.info(msg, ne);

View File

@ -33,10 +33,10 @@ import org.hibernate.cache.infinispan.util.CacheAdapter;
import org.infinispan.config.Configuration; import org.infinispan.config.Configuration;
import org.infinispan.config.Configuration.CacheMode; import org.infinispan.config.Configuration.CacheMode;
import org.infinispan.eviction.EvictionStrategy; import org.infinispan.eviction.EvictionStrategy;
import org.infinispan.manager.CacheManager;
import org.infinispan.manager.DefaultCacheManager; import org.infinispan.manager.DefaultCacheManager;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.infinispan.manager.EmbeddedCacheManager;
/** /**
* InfinispanRegionFactoryTestCase. * InfinispanRegionFactoryTestCase.
@ -118,7 +118,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
p.setProperty("hibernate.cache.infinispan.collection.eviction.max_entries", "25000"); p.setProperty("hibernate.cache.infinispan.collection.eviction.max_entries", "25000");
InfinispanRegionFactory factory = new InfinispanRegionFactory(); InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
manager.getGlobalConfiguration().setTransportClass(null); manager.getGlobalConfiguration().setTransportClass(null);
try { try {
assertFalse(manager.getGlobalConfiguration().isExposeGlobalJmxStatistics()); assertFalse(manager.getGlobalConfiguration().isExposeGlobalJmxStatistics());
@ -213,7 +213,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
p.setProperty("hibernate.cache.infinispan.collection.eviction.max_entries", "35000"); p.setProperty("hibernate.cache.infinispan.collection.eviction.max_entries", "35000");
InfinispanRegionFactory factory = new InfinispanRegionFactory(); InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); factory.getCacheManager();
try { try {
EntityRegionImpl region = (EntityRegionImpl) factory.buildEntityRegion("com.acme.Address", p, null); EntityRegionImpl region = (EntityRegionImpl) factory.buildEntityRegion("com.acme.Address", p, null);
assertNull(factory.getTypeOverrides().get("com.acme.Address")); assertNull(factory.getTypeOverrides().get("com.acme.Address"));
@ -250,7 +250,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000"); p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000");
InfinispanRegionFactory factory = new InfinispanRegionFactory(); InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
manager.getGlobalConfiguration().setTransportClass(null); manager.getGlobalConfiguration().setTransportClass(null);
try { try {
assertNotNull(factory.getTypeOverrides().get(person)); assertNotNull(factory.getTypeOverrides().get(person));
@ -275,7 +275,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
final DefaultCacheManager manager = new DefaultCacheManager(); final DefaultCacheManager manager = new DefaultCacheManager();
InfinispanRegionFactory factory = new InfinispanRegionFactory() { InfinispanRegionFactory factory = new InfinispanRegionFactory() {
@Override @Override
protected CacheManager createCacheManager(Properties properties) throws CacheException { protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
return manager; return manager;
} }
}; };
@ -294,7 +294,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
Properties p = new Properties(); Properties p = new Properties();
InfinispanRegionFactory factory = new InfinispanRegionFactory(); InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
try { try {
assertTrue(factory.getDefinedConfigurations().contains("timestamps")); assertTrue(factory.getDefinedConfigurations().contains("timestamps"));
assertTrue(factory.getTypeOverrides().get("timestamps").getCacheName().equals("timestamps")); assertTrue(factory.getTypeOverrides().get("timestamps").getCacheName().equals("timestamps"));
@ -319,7 +319,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
p.setProperty("hibernate.cache.infinispan.timestamps.cfg", "unrecommended-timestamps"); p.setProperty("hibernate.cache.infinispan.timestamps.cfg", "unrecommended-timestamps");
InfinispanRegionFactory factory = new InfinispanRegionFactory(); InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
try { try {
assertFalse(factory.getDefinedConfigurations().contains("timestamp")); assertFalse(factory.getDefinedConfigurations().contains("timestamp"));
assertTrue(factory.getDefinedConfigurations().contains("unrecommended-timestamps")); assertTrue(factory.getDefinedConfigurations().contains("unrecommended-timestamps"));
@ -346,7 +346,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
InfinispanRegionFactory factory = new InfinispanRegionFactory(); InfinispanRegionFactory factory = new InfinispanRegionFactory();
p.setProperty("hibernate.cache.infinispan.timestamps.cfg", "mytimestamps-cache"); p.setProperty("hibernate.cache.infinispan.timestamps.cfg", "mytimestamps-cache");
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
manager.getGlobalConfiguration().setTransportClass(null); manager.getGlobalConfiguration().setTransportClass(null);
try { try {
factory.buildTimestampsRegion(timestamps, p); factory.buildTimestampsRegion(timestamps, p);
@ -366,7 +366,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
p.setProperty("hibernate.cache.infinispan.timestamps.eviction.max_entries", "10000"); p.setProperty("hibernate.cache.infinispan.timestamps.eviction.max_entries", "10000");
try { try {
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
manager.getGlobalConfiguration().setTransportClass(null); manager.getGlobalConfiguration().setTransportClass(null);
factory.buildTimestampsRegion(timestamps, p); factory.buildTimestampsRegion(timestamps, p);
assertTrue(factory.getDefinedConfigurations().contains("mytimestamps-cache")); assertTrue(factory.getDefinedConfigurations().contains("mytimestamps-cache"));
@ -386,7 +386,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
p.setProperty("hibernate.cache.infinispan.timestamps.eviction.wake_up_interval", "3000"); p.setProperty("hibernate.cache.infinispan.timestamps.eviction.wake_up_interval", "3000");
p.setProperty("hibernate.cache.infinispan.timestamps.eviction.max_entries", "10000"); p.setProperty("hibernate.cache.infinispan.timestamps.eviction.max_entries", "10000");
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
manager.getGlobalConfiguration().setTransportClass(null); manager.getGlobalConfiguration().setTransportClass(null);
try { try {
factory.buildTimestampsRegion(timestamps, p); factory.buildTimestampsRegion(timestamps, p);
@ -401,7 +401,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
Properties p = new Properties(); Properties p = new Properties();
InfinispanRegionFactory factory = new InfinispanRegionFactory(); InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
manager.getGlobalConfiguration().setTransportClass(null); manager.getGlobalConfiguration().setTransportClass(null);
try { try {
assertTrue(factory.getDefinedConfigurations().contains("local-query")); assertTrue(factory.getDefinedConfigurations().contains("local-query"));
@ -424,7 +424,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
p.setProperty("hibernate.cache.infinispan.myquery.eviction.wake_up_interval", "2222"); p.setProperty("hibernate.cache.infinispan.myquery.eviction.wake_up_interval", "2222");
p.setProperty("hibernate.cache.infinispan.myquery.eviction.max_entries", "11111"); p.setProperty("hibernate.cache.infinispan.myquery.eviction.max_entries", "11111");
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
manager.getGlobalConfiguration().setTransportClass(null); manager.getGlobalConfiguration().setTransportClass(null);
try { try {
assertTrue(factory.getDefinedConfigurations().contains("local-query")); assertTrue(factory.getDefinedConfigurations().contains("local-query"));
@ -452,7 +452,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000"); p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000");
InfinispanRegionFactory factory = new InfinispanRegionFactory(); InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
try { try {
assertTrue(manager.getGlobalConfiguration().isExposeGlobalJmxStatistics()); assertTrue(manager.getGlobalConfiguration().isExposeGlobalJmxStatistics());
EntityRegionImpl region = (EntityRegionImpl) factory.buildEntityRegion("com.acme.Address", p, null); EntityRegionImpl region = (EntityRegionImpl) factory.buildEntityRegion("com.acme.Address", p, null);
@ -500,7 +500,7 @@ public class InfinispanRegionFactoryTestCase extends TestCase {
p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000"); p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000");
InfinispanRegionFactory factory = new InfinispanRegionFactory(); InfinispanRegionFactory factory = new InfinispanRegionFactory();
factory.start(null, p); factory.start(null, p);
CacheManager manager = factory.getCacheManager(); EmbeddedCacheManager manager = factory.getCacheManager();
try { try {
assertFalse(manager.getGlobalConfiguration().isExposeGlobalJmxStatistics()); assertFalse(manager.getGlobalConfiguration().isExposeGlobalJmxStatistics());
EntityRegionImpl region = (EntityRegionImpl) factory.buildEntityRegion("com.acme.Address", p, null); EntityRegionImpl region = (EntityRegionImpl) factory.buildEntityRegion("com.acme.Address", p, null);

View File

@ -34,7 +34,8 @@ import org.hibernate.test.cache.infinispan.functional.cluster.DualNodeTestCase;
import org.hibernate.test.cache.infinispan.functional.cluster.ClusterAwareRegionFactory; import org.hibernate.test.cache.infinispan.functional.cluster.ClusterAwareRegionFactory;
import org.hibernate.test.cache.infinispan.functional.cluster.DualNodeJtaTransactionManagerImpl; import org.hibernate.test.cache.infinispan.functional.cluster.DualNodeJtaTransactionManagerImpl;
import org.infinispan.Cache; import org.infinispan.Cache;
import org.infinispan.manager.CacheManager; import org.infinispan.manager.CacheContainer;
import org.infinispan.manager.EmbeddedCacheManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -120,11 +121,11 @@ public class IsolatedClassLoaderTest extends DualNodeTestCase {
public void testIsolatedSetup() throws Exception { public void testIsolatedSetup() throws Exception {
// Bind a listener to the "local" cache // Bind a listener to the "local" cache
// Our region factory makes its CacheManager available to us // Our region factory makes its CacheManager available to us
CacheManager localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL); CacheContainer localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL);
Cache localReplicatedCache = localManager.getCache("replicated-entity"); Cache localReplicatedCache = localManager.getCache("replicated-entity");
// Bind a listener to the "remote" cache // Bind a listener to the "remote" cache
CacheManager remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE); CacheContainer remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE);
Cache remoteReplicatedCache = remoteManager.getCache("replicated-entity"); Cache remoteReplicatedCache = remoteManager.getCache("replicated-entity");
ClassLoader cl = Thread.currentThread().getContextClassLoader(); ClassLoader cl = Thread.currentThread().getContextClassLoader();
@ -164,9 +165,9 @@ public class IsolatedClassLoaderTest extends DualNodeTestCase {
protected void queryTest(boolean useNamedRegion) throws Exception { protected void queryTest(boolean useNamedRegion) throws Exception {
// Bind a listener to the "local" cache // Bind a listener to the "local" cache
// Our region factory makes its CacheManager available to us // Our region factory makes its CacheManager available to us
CacheManager localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL); EmbeddedCacheManager localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL);
// Bind a listener to the "remote" cache // Bind a listener to the "remote" cache
CacheManager remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE); EmbeddedCacheManager remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE);
String cacheName; String cacheName;
if (useNamedRegion) { if (useNamedRegion) {
cacheName = "AccountRegion"; // As defined by ClassLoaderTestDAO via calls to query.setCacheRegion cacheName = "AccountRegion"; // As defined by ClassLoaderTestDAO via calls to query.setCacheRegion

View File

@ -34,7 +34,8 @@ import org.hibernate.cache.TimestampsRegion;
import org.hibernate.cache.access.AccessType; import org.hibernate.cache.access.AccessType;
import org.hibernate.cache.infinispan.InfinispanRegionFactory; import org.hibernate.cache.infinispan.InfinispanRegionFactory;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
import org.infinispan.manager.CacheManager; import org.infinispan.manager.CacheContainer;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.util.logging.Log; import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory; import org.infinispan.util.logging.LogFactory;
@ -47,7 +48,7 @@ import org.infinispan.util.logging.LogFactory;
public class ClusterAwareRegionFactory implements RegionFactory { public class ClusterAwareRegionFactory implements RegionFactory {
private static final Log log = LogFactory.getLog(ClusterAwareRegionFactory.class); private static final Log log = LogFactory.getLog(ClusterAwareRegionFactory.class);
private static final Hashtable<String, CacheManager> cacheManagers = new Hashtable<String, CacheManager>(); private static final Hashtable<String, EmbeddedCacheManager> cacheManagers = new Hashtable<String, EmbeddedCacheManager>();
private final InfinispanRegionFactory delegate = new InfinispanRegionFactory(); private final InfinispanRegionFactory delegate = new InfinispanRegionFactory();
private String cacheManagerName; private String cacheManagerName;
@ -56,16 +57,16 @@ public class ClusterAwareRegionFactory implements RegionFactory {
public ClusterAwareRegionFactory(Properties props) { public ClusterAwareRegionFactory(Properties props) {
} }
public static CacheManager getCacheManager(String name) { public static EmbeddedCacheManager getCacheManager(String name) {
return cacheManagers.get(name); return cacheManagers.get(name);
} }
public static void addCacheManager(String name, CacheManager manager) { public static void addCacheManager(String name, EmbeddedCacheManager manager) {
cacheManagers.put(name, manager); cacheManagers.put(name, manager);
} }
public static void clearCacheManagers() { public static void clearCacheManagers() {
for (CacheManager manager : cacheManagers.values()) { for (EmbeddedCacheManager manager : cacheManagers.values()) {
try { try {
manager.stop(); manager.stop();
} catch (Exception e) { } catch (Exception e) {
@ -78,7 +79,7 @@ public class ClusterAwareRegionFactory implements RegionFactory {
public void start(Settings settings, Properties properties) throws CacheException { public void start(Settings settings, Properties properties) throws CacheException {
cacheManagerName = properties.getProperty(DualNodeTestCase.NODE_ID_PROP); cacheManagerName = properties.getProperty(DualNodeTestCase.NODE_ID_PROP);
CacheManager existing = getCacheManager(cacheManagerName); EmbeddedCacheManager existing = getCacheManager(cacheManagerName);
locallyAdded = (existing == null); locallyAdded = (existing == null);
if (locallyAdded) { if (locallyAdded) {

View File

@ -34,7 +34,7 @@ import org.hibernate.cache.infinispan.util.CacheHelper;
import org.hibernate.test.cache.infinispan.functional.Contact; import org.hibernate.test.cache.infinispan.functional.Contact;
import org.hibernate.test.cache.infinispan.functional.Customer; import org.hibernate.test.cache.infinispan.functional.Customer;
import org.infinispan.Cache; import org.infinispan.Cache;
import org.infinispan.manager.CacheManager; import org.infinispan.manager.CacheContainer;
import org.infinispan.notifications.Listener; import org.infinispan.notifications.Listener;
import org.infinispan.notifications.cachelistener.annotation.CacheEntryVisited; import org.infinispan.notifications.cachelistener.annotation.CacheEntryVisited;
import org.infinispan.notifications.cachelistener.event.CacheEntryVisitedEvent; import org.infinispan.notifications.cachelistener.event.CacheEntryVisitedEvent;
@ -67,7 +67,7 @@ public class EntityCollectionInvalidationTestCase extends DualNodeTestCase {
// Bind a listener to the "local" cache // Bind a listener to the "local" cache
// Our region factory makes its CacheManager available to us // Our region factory makes its CacheManager available to us
CacheManager localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL); CacheContainer localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL);
// Cache localCache = localManager.getCache("entity"); // Cache localCache = localManager.getCache("entity");
Cache localCustomerCache = localManager.getCache(Customer.class.getName()); Cache localCustomerCache = localManager.getCache(Customer.class.getName());
Cache localContactCache = localManager.getCache(Contact.class.getName()); Cache localContactCache = localManager.getCache(Contact.class.getName());
@ -79,7 +79,7 @@ public class EntityCollectionInvalidationTestCase extends DualNodeTestCase {
TransactionManager localTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.LOCAL); TransactionManager localTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.LOCAL);
// Bind a listener to the "remote" cache // Bind a listener to the "remote" cache
CacheManager remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE); CacheContainer remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE);
Cache remoteCustomerCache = remoteManager.getCache(Customer.class.getName()); Cache remoteCustomerCache = remoteManager.getCache(Customer.class.getName());
Cache remoteContactCache = remoteManager.getCache(Contact.class.getName()); Cache remoteContactCache = remoteManager.getCache(Contact.class.getName());
Cache remoteCollectionCache = remoteManager.getCache(Customer.class.getName() + ".contacts"); Cache remoteCollectionCache = remoteManager.getCache(Customer.class.getName() + ".contacts");

View File

@ -30,7 +30,7 @@ import org.hibernate.cfg.Environment;
import org.hibernate.test.cache.infinispan.functional.classloader.Account; import org.hibernate.test.cache.infinispan.functional.classloader.Account;
import org.hibernate.test.cache.infinispan.functional.classloader.ClassLoaderTestDAO; import org.hibernate.test.cache.infinispan.functional.classloader.ClassLoaderTestDAO;
import org.infinispan.Cache; import org.infinispan.Cache;
import org.infinispan.manager.CacheManager; import org.infinispan.manager.CacheContainer;
import org.infinispan.test.TestingUtil; import org.infinispan.test.TestingUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -90,12 +90,14 @@ public class SessionRefreshTestCase extends DualNodeTestCase {
public void testRefreshAfterExternalChange() throws Exception { public void testRefreshAfterExternalChange() throws Exception {
// First session factory uses a cache // First session factory uses a cache
CacheManager localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL); CacheContainer localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL);
localCache = localManager.getCache(Account.class.getName()); localCache = localManager.getCache(Account.class.getName());
TransactionManager localTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.LOCAL); TransactionManager localTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.LOCAL);
SessionFactory localFactory = getEnvironment().getSessionFactory(); SessionFactory localFactory = getEnvironment().getSessionFactory();
// Second session factory doesn't; just needs a transaction manager // Second session factory doesn't; just needs a transaction manager
// However, start at least the cache to avoid issues with replication and cache not being there
ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE).getCache(Account.class.getName());
TransactionManager remoteTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.REMOTE); TransactionManager remoteTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.REMOTE);
SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory(); SessionFactory remoteFactory = getSecondNodeEnvironment().getSessionFactory();