Search in sources :

Example 11 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateReverseEngineeringStrategy.

@Test
public void testCreateReverseEngineeringStrategy() {
    ReverseEngineeringStrategy res = (ReverseEngineeringStrategy) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { ReverseEngineeringStrategy.class }, new TestInvocationHandler());
    IReverseEngineeringStrategy facade = facadeFactory.createReverseEngineeringStrategy(res);
    Assert.assertSame(res, ((IFacade) facade).getTarget());
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) Test(org.junit.Test)

Example 12 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class OverrideRepositoryFacadeTest method testGetReverseEngineeringStrategy.

@Test
public void testGetReverseEngineeringStrategy() throws Exception {
    ReverseEngineeringStrategy res = new DefaultReverseEngineeringStrategy();
    IReverseEngineeringStrategy resFacade = FACADE_FACTORY.createReverseEngineeringStrategy(res);
    IReverseEngineeringStrategy result = overrideRepositoryFacade.getReverseEngineeringStrategy(resFacade);
    DelegatingReverseEngineeringStrategy resultTarget = (DelegatingReverseEngineeringStrategy) ((IFacade) result).getTarget();
    Field delegateField = DelegatingReverseEngineeringStrategy.class.getDeclaredField("delegate");
    delegateField.setAccessible(true);
    Assert.assertSame(res, delegateField.get(resultTarget));
}
Also used : Field(java.lang.reflect.Field) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DelegatingReverseEngineeringStrategy(org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DelegatingReverseEngineeringStrategy(org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) Test(org.junit.Test)

Example 13 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateReverseEngineeringStrategy.

@Test
public void testCreateReverseEngineeringStrategy() {
    ReverseEngineeringStrategy res = (ReverseEngineeringStrategy) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { ReverseEngineeringStrategy.class }, new TestInvocationHandler());
    IReverseEngineeringStrategy facade = facadeFactory.createReverseEngineeringStrategy(res);
    Assert.assertSame(res, ((IFacade) facade).getTarget());
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) Test(org.junit.Test)

Example 14 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testSetReverseEngineeringStrategy.

@Test
public void testSetReverseEngineeringStrategy() {
    JDBCMetaDataConfiguration configuration = new JDBCMetaDataConfiguration();
    configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
    ReverseEngineeringStrategy reverseEngineeringStrategy = new DefaultReverseEngineeringStrategy();
    IReverseEngineeringStrategy strategyFacade = FACADE_FACTORY.createReverseEngineeringStrategy(reverseEngineeringStrategy);
    Assert.assertNotSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
    configurationFacade.setReverseEngineeringStrategy(strategyFacade);
    Assert.assertSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
}
Also used : JDBCMetaDataConfiguration(org.hibernate.cfg.JDBCMetaDataConfiguration) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) Test(org.junit.Test)

Example 15 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class OverrideRepositoryFacadeTest method testGetReverseEngineeringStrategy.

@Test
public void testGetReverseEngineeringStrategy() throws Exception {
    ReverseEngineeringStrategy res = new DefaultReverseEngineeringStrategy();
    IReverseEngineeringStrategy resFacade = FACADE_FACTORY.createReverseEngineeringStrategy(res);
    IReverseEngineeringStrategy result = overrideRepositoryFacade.getReverseEngineeringStrategy(resFacade);
    DelegatingReverseEngineeringStrategy resultTarget = (DelegatingReverseEngineeringStrategy) ((IFacade) result).getTarget();
    Field delegateField = DelegatingReverseEngineeringStrategy.class.getDeclaredField("delegate");
    delegateField.setAccessible(true);
    Assert.assertSame(res, delegateField.get(resultTarget));
}
Also used : Field(java.lang.reflect.Field) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DelegatingReverseEngineeringStrategy(org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DelegatingReverseEngineeringStrategy(org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) Test(org.junit.Test)

Aggregations

DefaultReverseEngineeringStrategy (org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy)36 ReverseEngineeringStrategy (org.hibernate.cfg.reveng.ReverseEngineeringStrategy)36 IReverseEngineeringStrategy (org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy)36 Test (org.junit.Test)28 DelegatingReverseEngineeringStrategy (org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy)12 PersistentClass (org.hibernate.mapping.PersistentClass)12 RootClass (org.hibernate.mapping.RootClass)12 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)12 Field (java.lang.reflect.Field)8 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)8 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)8 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)8 JDBCMetaDataConfiguration (org.hibernate.cfg.JDBCMetaDataConfiguration)7 HibernateConsoleRuntimeException (org.hibernate.console.HibernateConsoleRuntimeException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 SQLException (java.sql.SQLException)1 HibernateException (org.jboss.tools.hibernate.runtime.spi.HibernateException)1 JdbcMetadataConfiguration (org.jboss.tools.hibernate.runtime.v_5_3.internal.util.JdbcMetadataConfiguration)1