use of org.jboss.tools.hibernate.runtime.spi.ISessionFactory in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateSessionFactory.
@Test
public void testCreateSessionFactory() {
SessionFactory sessionFactory = (SessionFactory) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { SessionFactory.class }, new TestInvocationHandler());
ISessionFactory facade = facadeFactory.createSessionFactory(sessionFactory);
Assert.assertSame(sessionFactory, ((IFacade) facade).getTarget());
}
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();
SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build());
ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
Assert.assertTrue(sessionFactoryFacade.getAllCollectionMetadata().isEmpty());
sessionFactory.close();
configuration.addClass(Foo.class);
sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build());
sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
Map<String, ICollectionMetadata> allCollectionMetaData = sessionFactoryFacade.getAllCollectionMetadata();
Assert.assertNotNull(allCollectionMetaData.get("org.jboss.tools.hibernate.runtime.v_5_2.internal.test.Foo.bars"));
}
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_5_1.internal.test.Foo.bars");
Assert.assertSame(collectionMetadata, ((IFacade) sessionFactoryFacade.getCollectionMetadata("org.jboss.tools.hibernate.runtime.v_5_1.internal.test.Foo.bars")).getTarget());
}
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();
SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build());
ISessionFactory sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
Assert.assertTrue(sessionFactoryFacade.getAllCollectionMetadata().isEmpty());
sessionFactory.close();
configuration.addClass(Foo.class);
sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build());
sessionFactoryFacade = FACADE_FACTORY.createSessionFactory(sessionFactory);
Map<String, ICollectionMetadata> allCollectionMetaData = sessionFactoryFacade.getAllCollectionMetadata();
Assert.assertNotNull(allCollectionMetaData.get("org.jboss.tools.hibernate.runtime.v_5_1.internal.test.Foo.bars"));
}
Aggregations