use of org.infinispan.hibernate.cache.commons.InfinispanBaseRegion in project infinispan by infinispan.
the class EntityRegionImplTest method supportedAccessTypeTest.
@Override
protected void supportedAccessTypeTest(TestRegionFactory regionFactory, Properties properties) {
InfinispanBaseRegion region = regionFactory.buildEntityRegion("test", accessType);
assertNotNull(TEST_SESSION_ACCESS.entityAccess(region, accessType));
regionFactory.getCacheManager().administration().removeCache(CACHE_NAME);
}
use of org.infinispan.hibernate.cache.commons.InfinispanBaseRegion in project infinispan by infinispan.
the class QualifierTest method testRegionNamesQualified.
@Test
public void testRegionNamesQualified() {
TestRegionFactory factory = TestRegionFactoryProvider.INSTANCE.findRegionFactory(sessionFactory().getCache());
EmbeddedCacheManager cacheManager = factory.getCacheManager();
for (String cacheName : cacheManager.getCacheNames()) {
assertTrue(cacheName.startsWith(FOO_BAR));
}
// In Hibernate < 5.3 the region factory got qualified names and couldn't use any unqualified form
if (!TestRegionFactoryProvider.INSTANCE.getRegionFactoryClass().getName().contains(".v51.")) {
for (InfinispanBaseRegion region : TestSessionAccess.findTestSessionAccess().getAllRegions(sessionFactory())) {
assertFalse(region.getName().startsWith(FOO_BAR));
}
}
}
use of org.infinispan.hibernate.cache.commons.InfinispanBaseRegion in project infinispan by infinispan.
the class ReadOnlyTest method testEmptySecondLevelCacheEntry.
@Test
public void testEmptySecondLevelCacheEntry() {
sessionFactory().getCache().evictCollectionRegion(Item.class.getName() + ".items");
Statistics stats = sessionFactory().getStatistics();
stats.clear();
InfinispanBaseRegion region = TEST_SESSION_ACCESS.getRegion(sessionFactory(), Item.class.getName() + ".items");
assertEquals(0, region.getElementCountInMemory());
}
use of org.infinispan.hibernate.cache.commons.InfinispanBaseRegion in project infinispan by infinispan.
the class InfinispanRegionFactoryTestCase method testBuildEntityCollectionRegionOverridesOnly.
@Test
public void testBuildEntityCollectionRegionOverridesOnly() {
final String address = "com.acme.Address";
final String personAddressses = "com.acme.Person.addresses";
AdvancedCache cache;
Properties p = createProperties();
p.setProperty("hibernate.cache.infinispan.entity.memory.eviction.type", "MEMORY");
p.setProperty("hibernate.cache.infinispan.entity.memory.size", "30000");
p.setProperty("hibernate.cache.infinispan.entity.expiration.wake_up_interval", "3000");
p.setProperty("hibernate.cache.infinispan.collection.memory.eviction.type", "MEMORY");
p.setProperty("hibernate.cache.infinispan.collection.memory.size", "35000");
p.setProperty("hibernate.cache.infinispan.collection.expiration.wake_up_interval", "3500");
TestRegionFactory factory = createRegionFactory(p);
try {
factory.getCacheManager();
InfinispanBaseRegion region = factory.buildEntityRegion(address, AccessType.TRANSACTIONAL);
assertNull(factory.getBaseConfiguration(address));
cache = region.getCache();
Configuration cacheCfg = cache.getCacheConfiguration();
assertEquals(EvictionType.COUNT, cacheCfg.memory().evictionType());
assertEquals(3000, cacheCfg.expiration().wakeUpInterval());
assertEquals(30000, cacheCfg.memory().maxCount());
// Max idle value comes from base XML configuration
assertEquals(100000, cacheCfg.expiration().maxIdle());
InfinispanBaseRegion collectionRegion = factory.buildCollectionRegion(personAddressses, AccessType.TRANSACTIONAL);
assertNull(factory.getBaseConfiguration(personAddressses));
cache = collectionRegion.getCache();
cacheCfg = cache.getCacheConfiguration();
assertEquals(EvictionType.COUNT, cacheCfg.memory().evictionType());
assertEquals(3500, cacheCfg.expiration().wakeUpInterval());
assertEquals(35000, cacheCfg.memory().size());
assertEquals(100000, cacheCfg.expiration().maxIdle());
} finally {
factory.stop();
}
}
use of org.infinispan.hibernate.cache.commons.InfinispanBaseRegion in project infinispan by infinispan.
the class InfinispanRegionFactoryTestCase method testBuildTimestampsRegionWithCacheNameOverride.
@Test
public void testBuildTimestampsRegionWithCacheNameOverride() {
final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache";
final String myTimestampsCache = "mytimestamps-cache";
Properties p = createProperties();
p.setProperty(TIMESTAMPS_CACHE_RESOURCE_PROP, myTimestampsCache);
TestRegionFactory factory = createRegionFactory(p, m -> {
ClusteringConfigurationBuilder builder = new ConfigurationBuilder().clustering().cacheMode(CacheMode.LOCAL);
m.defineConfiguration(myTimestampsCache, builder.build());
});
try {
InfinispanBaseRegion region = factory.buildTimestampsRegion(timestamps);
assertTrue(isDefinedCache(factory, timestamps));
// default timestamps cache is async replicated
assertEquals(CacheMode.LOCAL, region.getCache().getCacheConfiguration().clustering().cacheMode());
} finally {
factory.stop();
}
}
Aggregations