Search in sources :

Example 6 with DefaultStrategy

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

the class JdbcMetadataConfigurationTest method testSetReverseEngineeringStrategy.

@Test
public void testSetReverseEngineeringStrategy() {
    RevengStrategy strategy = new DefaultStrategy();
    assertNull(jdbcMetadataConfiguration.revengStrategy);
    jdbcMetadataConfiguration.setReverseEngineeringStrategy(strategy);
    assertSame(strategy, jdbcMetadataConfiguration.revengStrategy);
}
Also used : RevengStrategy(org.hibernate.tool.api.reveng.RevengStrategy) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) Test(org.junit.jupiter.api.Test)

Example 7 with DefaultStrategy

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

the class JdbcMetadataConfigurationTest method testGetReverseEngineeringStrategy.

@Test
public void testGetReverseEngineeringStrategy() {
    RevengStrategy strategy = new DefaultStrategy();
    assertNull(jdbcMetadataConfiguration.getReverseEngineeringStrategy());
    jdbcMetadataConfiguration.revengStrategy = strategy;
    assertSame(strategy, jdbcMetadataConfiguration.getReverseEngineeringStrategy());
}
Also used : RevengStrategy(org.hibernate.tool.api.reveng.RevengStrategy) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) Test(org.junit.jupiter.api.Test)

Example 8 with DefaultStrategy

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

the class JdbcMetadataConfigurationTest method testReadFromJdbc.

@Test
public void testReadFromJdbc() throws Exception {
    Connection connection = DriverManager.getConnection("jdbc:h2:mem:test");
    Statement statement = connection.createStatement();
    statement.execute("CREATE TABLE FOO(id int primary key, bar varchar(255))");
    jdbcMetadataConfiguration.properties.put("hibernate.connection.url", "jdbc:h2:mem:test");
    jdbcMetadataConfiguration.revengStrategy = new DefaultStrategy();
    assertNull(jdbcMetadataConfiguration.metadata);
    jdbcMetadataConfiguration.readFromJdbc();
    assertNotNull(jdbcMetadataConfiguration.metadata);
    statement.execute("DROP TABLE FOO");
    statement.close();
    connection.close();
}
Also used : Statement(java.sql.Statement) Connection(java.sql.Connection) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) Test(org.junit.jupiter.api.Test)

Example 9 with DefaultStrategy

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

the class ConfigurationFacadeTest method testSetReverseEngineeringStrategy.

@Test
public void testSetReverseEngineeringStrategy() {
    JdbcMetadataConfiguration configuration = new JdbcMetadataConfiguration();
    configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configuration);
    RevengStrategy reverseEngineeringStrategy = new DefaultStrategy();
    IReverseEngineeringStrategy strategyFacade = FACADE_FACTORY.createReverseEngineeringStrategy(reverseEngineeringStrategy);
    assertNotSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
    configurationFacade.setReverseEngineeringStrategy(strategyFacade);
    assertSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
}
Also used : RevengStrategy(org.hibernate.tool.api.reveng.RevengStrategy) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) JdbcMetadataConfiguration(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.JdbcMetadataConfiguration) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) Test(org.junit.jupiter.api.Test) MetadataHelperTest(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MetadataHelperTest)

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