Search in sources :

Example 71 with IFacade

use of org.jboss.tools.hibernate.runtime.common.IFacade in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewJDBCMetaDataConfiguration.

@Test
public void testNewJDBCMetaDataConfiguration() {
    IConfiguration configuration = service.newJDBCMetaDataConfiguration();
    Assert.assertNotNull(configuration);
    Object target = ((IFacade) configuration).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof JdbcMetadataConfiguration);
}
Also used : JdbcMetadataConfiguration(org.jboss.tools.hibernate.runtime.v_5_3.internal.util.JdbcMetadataConfiguration) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.Test)

Example 72 with IFacade

use of org.jboss.tools.hibernate.runtime.common.IFacade in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testSimpleValue.

@Test
public void testSimpleValue() {
    IValue simpleValue = service.newSimpleValue();
    Assert.assertNotNull(simpleValue);
    Object target = ((IFacade) simpleValue).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof SimpleValue);
}
Also used : IValue(org.jboss.tools.hibernate.runtime.spi.IValue) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.Test)

Example 73 with IFacade

use of org.jboss.tools.hibernate.runtime.common.IFacade in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewJDBCReader.

@Test
public void testNewJDBCReader() {
    IConfiguration configuration = service.newDefaultConfiguration();
    configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
    IReverseEngineeringStrategy strategy = service.newDefaultReverseEngineeringStrategy();
    IJDBCReader jdbcReader = service.newJDBCReader(configuration, strategy);
    Assert.assertNotNull(jdbcReader);
    Object target = ((IFacade) jdbcReader).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof JDBCReader);
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) IJDBCReader(org.jboss.tools.hibernate.runtime.spi.IJDBCReader) IJDBCReader(org.jboss.tools.hibernate.runtime.spi.IJDBCReader) JDBCReader(org.hibernate.cfg.reveng.JDBCReader) Test(org.junit.Test)

Example 74 with IFacade

use of org.jboss.tools.hibernate.runtime.common.IFacade 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);
}
Also used : ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) SessionFactory(org.hibernate.SessionFactory) ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.Test)

Example 75 with IFacade

use of org.jboss.tools.hibernate.runtime.common.IFacade in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewHQLQueryPlan.

@Test
public void testNewHQLQueryPlan() throws Exception {
    IConfiguration configuration = service.newDefaultConfiguration();
    configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
    File testFile = File.createTempFile("test", "tmp");
    testFile.deleteOnExit();
    FileWriter fileWriter = new FileWriter(testFile);
    fileWriter.write(TEST_HBM_STRING);
    fileWriter.close();
    configuration.addFile(testFile);
    ISessionFactory sfi = configuration.buildSessionFactory();
    IHQLQueryPlan queryPlan = service.newHQLQueryPlan("from ServiceImplTest$Foo", true, sfi);
    Assert.assertNotNull(queryPlan);
    Object target = ((IFacade) queryPlan).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof HQLQueryPlan);
}
Also used : HQLQueryPlan(org.hibernate.engine.query.spi.HQLQueryPlan) IHQLQueryPlan(org.jboss.tools.hibernate.runtime.spi.IHQLQueryPlan) FileWriter(java.io.FileWriter) ISessionFactory(org.jboss.tools.hibernate.runtime.spi.ISessionFactory) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) IHQLQueryPlan(org.jboss.tools.hibernate.runtime.spi.IHQLQueryPlan) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) File(java.io.File) Test(org.junit.Test)

Aggregations

IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)188 Test (org.junit.Test)156 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)60 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)40 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)29 Configuration (org.hibernate.cfg.Configuration)20 IReverseEngineeringStrategy (org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy)20 RootClass (org.hibernate.mapping.RootClass)19 Table (org.hibernate.mapping.Table)15 JDBCMetaDataConfiguration (org.hibernate.cfg.JDBCMetaDataConfiguration)13 File (java.io.File)12 PersistentClass (org.hibernate.mapping.PersistentClass)12 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)12 ISessionFactory (org.jboss.tools.hibernate.runtime.spi.ISessionFactory)12 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)11 Field (java.lang.reflect.Field)9 JDBCReader (org.hibernate.cfg.reveng.JDBCReader)9 IJDBCReader (org.jboss.tools.hibernate.runtime.spi.IJDBCReader)9 HashMap (java.util.HashMap)8 Map (java.util.Map)8