use of org.hibernate.boot.registry.StandardServiceRegistry 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);
}
}
use of org.hibernate.boot.registry.StandardServiceRegistry in project hibernate-orm by hibernate.
the class ProxoolConnectionProviderTest method testPoolsClosed.
@Test
public void testPoolsClosed() {
// zero-length-vararg used as parameter
assertDefinedPools();
StandardServiceRegistry serviceRegistry = buildServiceRegistry("pool-one");
ConnectionProvider providerOne = serviceRegistry.getService(ConnectionProvider.class);
assertDefinedPools("pool-one");
StandardServiceRegistry serviceRegistryTwo = buildServiceRegistry("pool-two");
ConnectionProvider providerTwo = serviceRegistryTwo.getService(ConnectionProvider.class);
assertDefinedPools("pool-one", "pool-two");
StandardServiceRegistryBuilder.destroy(serviceRegistry);
assertDefinedPools("pool-two");
StandardServiceRegistryBuilder.destroy(serviceRegistryTwo);
assertDefinedPools();
}
use of org.hibernate.boot.registry.StandardServiceRegistry in project hibernate-orm by hibernate.
the class ServiceRegistryClosingCascadeTest method testSessionFactoryClosing.
@Test
public void testSessionFactoryClosing() {
BootstrapServiceRegistry bsr = new BootstrapServiceRegistryBuilder().build();
StandardServiceRegistry sr = new StandardServiceRegistryBuilder(bsr).build();
assertTrue(((BootstrapServiceRegistryImpl) bsr).isActive());
Configuration config = new Configuration();
SessionFactory sf = config.buildSessionFactory(sr);
sf.close();
assertFalse(((BootstrapServiceRegistryImpl) bsr).isActive());
}
use of org.hibernate.boot.registry.StandardServiceRegistry in project hibernate-orm by hibernate.
the class CollectionAsBasicTest method testCollectionAsBasic.
@Test
public void testCollectionAsBasic() {
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build();
try {
Metadata metadata = new MetadataSources(ssr).addAnnotatedClass(Post.class).getMetadataBuilder().applyBasicType(new DelimitedStringsType()).build();
PersistentClass postBinding = metadata.getEntityBinding(Post.class.getName());
Property tagsAttribute = postBinding.getProperty("tags");
} finally {
StandardServiceRegistryBuilder.destroy(ssr);
}
}
use of org.hibernate.boot.registry.StandardServiceRegistry in project hibernate-orm by hibernate.
the class OrmXmlEnumTypeTest method testOrmXmlDefinedEnumType.
@Test
public void testOrmXmlDefinedEnumType() {
StandardServiceRegistry ssr = ServiceRegistryBuilder.buildServiceRegistry();
try {
MetadataSources ms = new MetadataSources(ssr);
ms.addResource("org/hibernate/test/annotations/enumerated/ormXml/orm.xml");
Metadata metadata = ms.buildMetadata();
Type bindingPropertyType = metadata.getEntityBinding(BookWithOrmEnum.class.getName()).getProperty("bindingStringEnum").getType();
CustomType customType = ExtraAssertions.assertTyping(CustomType.class, bindingPropertyType);
EnumType enumType = ExtraAssertions.assertTyping(EnumType.class, customType.getUserType());
assertFalse(enumType.isOrdinal());
} finally {
ServiceRegistryBuilder.destroy(ssr);
}
}
Aggregations