use of org.hibernate.boot.registry.StandardServiceRegistryBuilder in project hibernate-orm by hibernate.
the class ServiceBootstrappingTest method testBasicBuild.
@Test
public void testBasicBuild() {
// this test requires that SHOW_SQL property isn't passed from the outside (eg. via Gradle)
final String showSqlPropertyFromOutside = System.getProperty(Environment.SHOW_SQL);
Assume.assumeFalse("true".equals(showSqlPropertyFromOutside));
final StandardServiceRegistryImpl serviceRegistry = (StandardServiceRegistryImpl) new StandardServiceRegistryBuilder().applySettings(ConnectionProviderBuilder.getConnectionProviderProperties()).build();
try {
final JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
assertTrue(jdbcServices.getDialect() instanceof H2Dialect);
final ConnectionProviderJdbcConnectionAccess connectionAccess = assertTyping(ConnectionProviderJdbcConnectionAccess.class, jdbcServices.getBootstrapJdbcConnectionAccess());
assertTrue(connectionAccess.getConnectionProvider().isUnwrappableAs(DriverManagerConnectionProviderImpl.class));
assertFalse(jdbcServices.getSqlStatementLogger().isLogToStdout());
} finally {
serviceRegistry.destroy();
}
}
use of org.hibernate.boot.registry.StandardServiceRegistryBuilder 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);
}
}
use of org.hibernate.boot.registry.StandardServiceRegistryBuilder in project hibernate-orm by hibernate.
the class AbstractNonFunctionalTest method createStandardServiceRegistryBuilder.
protected StandardServiceRegistryBuilder createStandardServiceRegistryBuilder() {
final StandardServiceRegistryBuilder ssrb = CacheTestUtil.buildBaselineStandardServiceRegistryBuilder(REGION_PREFIX, getRegionFactoryClass(), true, false, jtaPlatform);
ssrb.applySetting(TestInfinispanRegionFactory.TRANSACTIONAL, accessType == AccessType.TRANSACTIONAL);
ssrb.applySetting(TestInfinispanRegionFactory.CACHE_MODE, cacheMode);
return ssrb;
}
use of org.hibernate.boot.registry.StandardServiceRegistryBuilder in project hibernate-orm by hibernate.
the class AbstractRegionAccessStrategyTest method createStandardServiceRegistryBuilder.
@Override
protected StandardServiceRegistryBuilder createStandardServiceRegistryBuilder() {
StandardServiceRegistryBuilder ssrb = super.createStandardServiceRegistryBuilder();
ssrb.applySetting(TestInfinispanRegionFactory.TIME_SERVICE, TIME_SERVICE);
return ssrb;
}
use of org.hibernate.boot.registry.StandardServiceRegistryBuilder in project hibernate-orm by hibernate.
the class JndiInfinispanRegionFactoryTestCase method testConstruction.
@Test
public void testConstruction() {
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().applySetting(AvailableSettings.CACHE_REGION_FACTORY, JndiInfinispanRegionFactory.class.getName()).build();
try {
RegionFactory regionFactory = ssr.getService(RegionFactory.class);
assertTyping(JndiInfinispanRegionFactory.class, regionFactory);
} finally {
StandardServiceRegistryBuilder.destroy(ssr);
}
}
Aggregations