Search in sources :

Example 1 with DefaultStrategy

use of org.hibernate.tool.internal.reveng.strategy.DefaultStrategy in project jbosstools-hibernate by jbosstools.

the class OverrideRepositoryFacadeTest method testGetReverseEngineeringStrategy.

@Test
public void testGetReverseEngineeringStrategy() throws Exception {
    RevengStrategy res = new DefaultStrategy();
    IReverseEngineeringStrategy resFacade = FACADE_FACTORY.createReverseEngineeringStrategy(res);
    IReverseEngineeringStrategy result = overrideRepositoryFacade.getReverseEngineeringStrategy(resFacade);
    DelegatingStrategy resultTarget = (DelegatingStrategy) ((IFacade) result).getTarget();
    Field delegateField = DelegatingStrategy.class.getDeclaredField("delegate");
    delegateField.setAccessible(true);
    assertSame(res, delegateField.get(resultTarget));
}
Also used : Field(java.lang.reflect.Field) RevengStrategy(org.hibernate.tool.api.reveng.RevengStrategy) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DelegatingStrategy(org.hibernate.tool.internal.reveng.strategy.DelegatingStrategy) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) Test(org.junit.jupiter.api.Test)

Example 2 with DefaultStrategy

use of org.hibernate.tool.internal.reveng.strategy.DefaultStrategy in project jbosstools-hibernate by jbosstools.

the class ReverseEngineeringStrategyFacadeTest method testSetSettings.

@Test
public void testSetSettings() throws Exception {
    RevengStrategy revengStrategyTarget = new DefaultStrategy();
    RevengSettings revengSettingsTarget = new RevengSettings(revengStrategyTarget);
    IReverseEngineeringSettings revengSettingsFacade = FACADE_FACTORY.createReverseEngineeringSettings(revengSettingsTarget);
    IReverseEngineeringStrategy revengStrategyFacade = new ReverseEngineeringStrategyFacadeImpl(FACADE_FACTORY, revengStrategyTarget);
    Field field = AbstractStrategy.class.getDeclaredField("settings");
    field.setAccessible(true);
    assertNotSame(field.get(revengStrategyTarget), revengSettingsTarget);
    revengStrategyFacade.setSettings(revengSettingsFacade);
    assertSame(field.get(revengStrategyTarget), revengSettingsTarget);
}
Also used : Field(java.lang.reflect.Field) RevengSettings(org.hibernate.tool.api.reveng.RevengSettings) IReverseEngineeringSettings(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringSettings) RevengStrategy(org.hibernate.tool.api.reveng.RevengStrategy) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) Test(org.junit.jupiter.api.Test)

Example 3 with DefaultStrategy

use of org.hibernate.tool.internal.reveng.strategy.DefaultStrategy in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewReverseEngineeringStrategy.

@Test
public void testNewReverseEngineeringStrategy() throws Exception {
    IReverseEngineeringStrategy defaultStrategy = service.newDefaultReverseEngineeringStrategy();
    IReverseEngineeringStrategy newStrategy = service.newReverseEngineeringStrategy(DefaultStrategy.class.getName(), defaultStrategy);
    assertNotNull(newStrategy);
    Object target = ((IFacade) newStrategy).getTarget();
    assertNotNull(target);
    assertFalse(target instanceof DelegatingStrategy);
    newStrategy = service.newReverseEngineeringStrategy(DelegatingStrategy.class.getName(), defaultStrategy);
    assertNotNull(newStrategy);
    target = ((IFacade) newStrategy).getTarget();
    assertNotNull(target);
    assertTrue(target instanceof DelegatingStrategy);
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DelegatingStrategy(org.hibernate.tool.internal.reveng.strategy.DelegatingStrategy) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) Test(org.junit.jupiter.api.Test)

Example 4 with DefaultStrategy

use of org.hibernate.tool.internal.reveng.strategy.DefaultStrategy in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewDefaultReverseEngineeringStrategy.

@Test
public void testNewDefaultReverseEngineeringStrategy() throws Exception {
    IReverseEngineeringStrategy reverseEngineeringStrategy = service.newDefaultReverseEngineeringStrategy();
    assertNotNull(reverseEngineeringStrategy);
    Object target = ((IFacade) reverseEngineeringStrategy).getTarget();
    assertNotNull(target);
    assertTrue(target instanceof DefaultStrategy);
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) Test(org.junit.jupiter.api.Test)

Example 5 with DefaultStrategy

use of org.hibernate.tool.internal.reveng.strategy.DefaultStrategy in project jbosstools-hibernate by jbosstools.

the class ReverseEngineeringSettingsFacadeTest method beforeEach.

@BeforeEach
public void beforeEach() {
    revengSettingsTarget = new RevengSettings(new DefaultStrategy());
    revengSettingsFacade = new AbstractReverseEngineeringSettingsFacade(FACADE_FACTORY, revengSettingsTarget) {
    };
}
Also used : RevengSettings(org.hibernate.tool.api.reveng.RevengSettings) AbstractReverseEngineeringSettingsFacade(org.jboss.tools.hibernate.runtime.common.AbstractReverseEngineeringSettingsFacade) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

DefaultStrategy (org.hibernate.tool.internal.reveng.strategy.DefaultStrategy)9 Test (org.junit.jupiter.api.Test)8 RevengStrategy (org.hibernate.tool.api.reveng.RevengStrategy)5 IReverseEngineeringStrategy (org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy)5 Field (java.lang.reflect.Field)2 RevengSettings (org.hibernate.tool.api.reveng.RevengSettings)2 DelegatingStrategy (org.hibernate.tool.internal.reveng.strategy.DelegatingStrategy)2 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)2 Connection (java.sql.Connection)1 Statement (java.sql.Statement)1 AbstractReverseEngineeringSettingsFacade (org.jboss.tools.hibernate.runtime.common.AbstractReverseEngineeringSettingsFacade)1 IReverseEngineeringSettings (org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringSettings)1 JdbcMetadataConfiguration (org.jboss.tools.hibernate.runtime.v_6_0.internal.util.JdbcMetadataConfiguration)1 MetadataHelperTest (org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MetadataHelperTest)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1