use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class SessionFactoryFacadeTest method testGetAllCollectionMetadata.
@Test
public void testGetAllCollectionMetadata() {
Configuration configuration = new Configuration();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().buildServiceRegistry();
SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);
ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
Assert.assertTrue(sessionFactoryFacade.getAllCollectionMetadata().isEmpty());
sessionFactory.close();
configuration.addClass(Foo.class);
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
Map<String, ICollectionMetadata> allCollectionMetaData = sessionFactoryFacade.getAllCollectionMetadata();
Assert.assertNotNull(allCollectionMetaData.get("org.jboss.tools.hibernate.runtime.v_4_0.internal.test.Foo.bars"));
}
use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class SessionFactoryFacadeTest method testGetCollectionMetadata.
@Test
public void testGetCollectionMetadata() {
Configuration configuration = new Configuration();
configuration.addClass(Foo.class);
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().buildServiceRegistry();
SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);
ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
CollectionMetadata collectionMetadata = sessionFactory.getCollectionMetadata("org.jboss.tools.hibernate.runtime.v_4_0.internal.test.Foo.bars");
Assert.assertSame(collectionMetadata, ((IFacade) sessionFactoryFacade.getCollectionMetadata("org.jboss.tools.hibernate.runtime.v_4_0.internal.test.Foo.bars")).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class SessionFactoryFacadeTest method testClose.
@Test
public void testClose() {
Configuration configuration = new Configuration();
SessionFactory sessionFactory = configuration.buildSessionFactory(new ServiceRegistryBuilder().buildServiceRegistry());
sessionFactory.openSession();
ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
Assert.assertFalse(sessionFactory.isClosed());
sessionFactoryFacade.close();
Assert.assertTrue(sessionFactory.isClosed());
}
use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class ConfigurationFacadeTest method testBuildSessionFactory.
@Test
public void testBuildSessionFactory() throws Throwable {
ISessionFactory sessionFactoryFacade = configurationFacade.buildSessionFactory();
Assert.assertNotNull(sessionFactoryFacade);
Object sessionFactory = ((IFacade) sessionFactoryFacade).getTarget();
Assert.assertNotNull(sessionFactory);
Assert.assertTrue(sessionFactory instanceof SessionFactory);
}
use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class SessionFactoryFacadeTest method testGetCollectionMetadata.
@Test
public void testGetCollectionMetadata() {
Configuration configuration = new Configuration();
configuration.addClass(Foo.class);
SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build());
ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
CollectionMetadata collectionMetadata = sessionFactory.getCollectionMetadata("org.jboss.tools.hibernate.runtime.v_4_3.internal.test.Foo.bars");
Assert.assertSame(collectionMetadata, ((IFacade) sessionFactoryFacade.getCollectionMetadata("org.jboss.tools.hibernate.runtime.v_4_3.internal.test.Foo.bars")).getTarget());
}
Aggregations