HHH-11083 : Change references to "OldCacheKeyImplementation" to "CacheKeyImplementation" in MultTenancyTest; also override addSettings to use DefaultCacheKeysFactory

(cherry picked from commit 30974c1cd4)
(cherry picked from commit 6729643e63)

Conflicts:
	hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/MultiTenancyTest.java
This commit is contained in:
Gail Badner 2016-11-22 23:29:07 -08:00
parent fbc0d76789
commit 9a5df451b6
1 changed files with 13 additions and 2 deletions

View File

@ -5,6 +5,8 @@ import org.hibernate.boot.SessionFactoryBuilder;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cache.infinispan.entity.EntityRegionImpl;
import org.hibernate.cache.infinispan.util.Caches;
import org.hibernate.cache.internal.DefaultCacheKeysFactory;
import org.hibernate.cfg.Environment;
import org.hibernate.engine.jdbc.connections.spi.AbstractMultiTenantConnectionProvider;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
@ -13,11 +15,13 @@ import org.hibernate.test.cache.infinispan.tm.XaConnectionProvider;
import org.hibernate.testing.env.ConnectionProviderBuilder;
import org.infinispan.AdvancedCache;
import org.infinispan.commons.util.CloseableIterable;
import org.infinispan.commons.util.CloseableIterator;
import org.infinispan.context.Flag;
import org.junit.Test;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@ -39,6 +43,12 @@ public class MultiTenancyTest extends SingleNodeTest {
return Collections.singletonList(READ_ONLY_INVALIDATION);
}
@Override
protected void addSettings(Map settings) {
super.addSettings( settings );
settings.put( Environment.CACHE_KEYS_FACTORY, DefaultCacheKeysFactory.SHORT_NAME );
}
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder(ssrb);
@ -101,8 +111,9 @@ public class MultiTenancyTest extends SingleNodeTest {
// }
EntityRegionImpl region = (EntityRegionImpl) sessionFactory().getSecondLevelCacheRegion(Item.class.getName());
AdvancedCache localCache = region.getCache().withFlags(Flag.CACHE_MODE_LOCAL);
CloseableIterable keys = Caches.keys(localCache);
assertEquals(1, localCache.size());
assertEquals("OldCacheKeyImplementation", keys.iterator().next().getClass().getSimpleName());
try (CloseableIterator iterator = localCache.keySet().iterator()) {
assertEquals("CacheKeyImplementation", iterator.next().getClass().getSimpleName());
}
}
}