Search in sources :

Example 6 with DelegatingReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy 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 7 with DelegatingReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy 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 8 with DelegatingReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy 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 9 with DelegatingReverseEngineeringStrategy

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

the class ServiceImplTest method testNewReverseEngineeringStrategy.

@Test
public void testNewReverseEngineeringStrategy() throws Exception {
    String defaultRevEngStratClassName = "org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy";
    IReverseEngineeringStrategy defaultStrategy = service.newDefaultReverseEngineeringStrategy();
    IReverseEngineeringStrategy newStrategy = service.newReverseEngineeringStrategy(defaultRevEngStratClassName, defaultStrategy);
    Assert.assertNotNull(newStrategy);
    Object target = ((IFacade) newStrategy).getTarget();
    Assert.assertNotNull(target);
    Assert.assertFalse(target instanceof DelegatingReverseEngineeringStrategy);
    newStrategy = service.newReverseEngineeringStrategy("org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy", defaultStrategy);
    Assert.assertNotNull(newStrategy);
    target = ((IFacade) newStrategy).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof DelegatingReverseEngineeringStrategy);
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DelegatingReverseEngineeringStrategy(org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.Test)

Example 10 with DelegatingReverseEngineeringStrategy

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

the class ServiceImplTest method testNewReverseEngineeringStrategy.

@Test
public void testNewReverseEngineeringStrategy() throws Exception {
    String defaultRevEngStratClassName = "org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy";
    IReverseEngineeringStrategy defaultStrategy = service.newDefaultReverseEngineeringStrategy();
    IReverseEngineeringStrategy newStrategy = service.newReverseEngineeringStrategy(defaultRevEngStratClassName, defaultStrategy);
    Assert.assertNotNull(newStrategy);
    Object target = ((IFacade) newStrategy).getTarget();
    Assert.assertNotNull(target);
    Assert.assertFalse(target instanceof DelegatingReverseEngineeringStrategy);
    newStrategy = service.newReverseEngineeringStrategy("org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy", defaultStrategy);
    Assert.assertNotNull(newStrategy);
    target = ((IFacade) newStrategy).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof DelegatingReverseEngineeringStrategy);
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DelegatingReverseEngineeringStrategy(org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.Test)

Aggregations

DelegatingReverseEngineeringStrategy (org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy)12 IReverseEngineeringStrategy (org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy)12 Test (org.junit.Test)12 Field (java.lang.reflect.Field)8 DefaultReverseEngineeringStrategy (org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy)8 ReverseEngineeringStrategy (org.hibernate.cfg.reveng.ReverseEngineeringStrategy)8 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)4