Search in sources :

Example 1 with TransactionalDataRegion

use of org.hibernate.cache.spi.TransactionalDataRegion in project hibernate-orm by hibernate.

the class AbstractEntityCollectionRegionTest method testGetCacheDataDescription.

@Test
public void testGetCacheDataDescription() throws Exception {
    StandardServiceRegistryBuilder ssrb = CacheTestUtil.buildBaselineStandardServiceRegistryBuilder("test", InfinispanRegionFactory.class, true, false, jtaPlatform);
    final StandardServiceRegistry registry = ssrb.build();
    try {
        Properties properties = CacheTestUtil.toProperties(ssrb.getSettings());
        InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(registry, getCacheTestSupport());
        TransactionalDataRegion region = (TransactionalDataRegion) createRegion(regionFactory, "test/test", properties, getCacheDataDescription());
        CacheDataDescription cdd = region.getCacheDataDescription();
        assertNotNull(cdd);
        CacheDataDescription expected = getCacheDataDescription();
        assertEquals(expected.isMutable(), cdd.isMutable());
        assertEquals(expected.isVersioned(), cdd.isVersioned());
        assertEquals(expected.getVersionComparator(), cdd.getVersionComparator());
    } finally {
        StandardServiceRegistryBuilder.destroy(registry);
    }
}
Also used : InfinispanRegionFactory(org.hibernate.cache.infinispan.InfinispanRegionFactory) CacheDataDescription(org.hibernate.cache.spi.CacheDataDescription) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) TransactionalDataRegion(org.hibernate.cache.spi.TransactionalDataRegion) Properties(java.util.Properties) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) Test(org.junit.Test)

Example 2 with TransactionalDataRegion

use of org.hibernate.cache.spi.TransactionalDataRegion in project hibernate-orm by hibernate.

the class AbstractEntityCollectionRegionTest method testIsTransactionAware.

@Test
public void testIsTransactionAware() throws Exception {
    StandardServiceRegistryBuilder ssrb = CacheTestUtil.buildBaselineStandardServiceRegistryBuilder("test", InfinispanRegionFactory.class, true, false, jtaPlatform);
    final StandardServiceRegistry registry = ssrb.build();
    try {
        Properties properties = CacheTestUtil.toProperties(ssrb.getSettings());
        InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(registry, getCacheTestSupport());
        TransactionalDataRegion region = (TransactionalDataRegion) createRegion(regionFactory, "test/test", properties, getCacheDataDescription());
        assertTrue("Region is transaction-aware", region.isTransactionAware());
        CacheTestUtil.stopRegionFactory(regionFactory, getCacheTestSupport());
    } finally {
        StandardServiceRegistryBuilder.destroy(registry);
    }
}
Also used : InfinispanRegionFactory(org.hibernate.cache.infinispan.InfinispanRegionFactory) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) TransactionalDataRegion(org.hibernate.cache.spi.TransactionalDataRegion) Properties(java.util.Properties) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) Test(org.junit.Test)

Aggregations

Properties (java.util.Properties)2 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)2 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)2 InfinispanRegionFactory (org.hibernate.cache.infinispan.InfinispanRegionFactory)2 TransactionalDataRegion (org.hibernate.cache.spi.TransactionalDataRegion)2 Test (org.junit.Test)2 CacheDataDescription (org.hibernate.cache.spi.CacheDataDescription)1