Search in sources :

Example 6 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_5_5.internal.ConfigurationFacadeImpl in project jbosstools-hibernate by jbosstools.

the class SchemaExportFacadeTest method testSetConfiguration.

@Test
public void testSetConfiguration() throws Exception {
    Field metadataField = SchemaExportFacadeImpl.class.getDeclaredField("metadata");
    metadataField.setAccessible(true);
    Configuration configurationTarget = new Configuration();
    configurationTarget.setProperty(AvailableSettings.DIALECT, MockDialect.class.getName());
    configurationTarget.setProperty(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    ConfigurationFacadeImpl configuration = new ConfigurationFacadeImpl(FACADE_FACTORY, configurationTarget);
    Metadata metadata = configuration.getMetadata();
    assertNull(metadataField.get(schemaExportFacade));
    schemaExportFacade.setConfiguration(configuration);
    assertSame(metadata, metadataField.get(schemaExportFacade));
}
Also used : MockConnectionProvider(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.MockConnectionProvider) Field(java.lang.reflect.Field) Configuration(org.hibernate.cfg.Configuration) MockDialect(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.MockDialect) Metadata(org.hibernate.boot.Metadata) Test(org.junit.jupiter.api.Test)

Example 7 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_5_5.internal.ConfigurationFacadeImpl in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewHibernateMappingExporter.

@Test
public void testNewHibernateMappingExporter() {
    IConfiguration configuration = service.newDefaultConfiguration();
    configuration.setProperty(AvailableSettings.DIALECT, MockDialect.class.getName());
    configuration.setProperty(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    File file = new File("");
    IHibernateMappingExporter hibernateMappingExporter = service.newHibernateMappingExporter(configuration, file);
    HibernateMappingExporterExtension hmee = (HibernateMappingExporterExtension) ((IFacade) hibernateMappingExporter).getTarget();
    assertSame(file, hmee.getOutputDirectory());
    assertSame(((ConfigurationFacadeImpl) configuration).getMetadata(), hmee.getMetadata());
}
Also used : MockConnectionProvider(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.MockConnectionProvider) IHibernateMappingExporter(org.jboss.tools.hibernate.runtime.spi.IHibernateMappingExporter) MockDialect(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.MockDialect) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 8 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_5_5.internal.ConfigurationFacadeImpl in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method beforeEach.

@BeforeEach
public void beforeEach() {
    configuration = new Configuration();
    configuration.setProperty(AvailableSettings.DIALECT, MockDialect.class.getName());
    configuration.setProperty(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configuration);
}
Also used : MockConnectionProvider(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.MockConnectionProvider) Configuration(org.hibernate.cfg.Configuration) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) JdbcMetadataConfiguration(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.JdbcMetadataConfiguration) MockDialect(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.MockDialect) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 9 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_5_5.internal.ConfigurationFacadeImpl 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);
    ReverseEngineeringStrategy reverseEngineeringStrategy = new DefaultReverseEngineeringStrategy();
    IReverseEngineeringStrategy strategyFacade = FACADE_FACTORY.createReverseEngineeringStrategy(reverseEngineeringStrategy);
    assertNotSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
    configurationFacade.setReverseEngineeringStrategy(strategyFacade);
    assertSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) JdbcMetadataConfiguration(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.JdbcMetadataConfiguration) 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.jupiter.api.Test)

Example 10 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_5_5.internal.ConfigurationFacadeImpl in project jbosstools-hibernate by jbosstools.

the class ConfigurationMetadataDescriptorTest method beforeEach.

@BeforeEach
public void beforeEach() {
    configurationTarget = new Configuration();
    configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configurationTarget);
    configurationMetadataDescriptor = new ConfigurationMetadataDescriptor(configurationFacade);
}
Also used : Configuration(org.hibernate.cfg.Configuration) ConfigurationFacadeImpl(org.jboss.tools.hibernate.runtime.v_6_0.internal.ConfigurationFacadeImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Configuration (org.hibernate.cfg.Configuration)13 Test (org.junit.jupiter.api.Test)12 PersistentClass (org.hibernate.mapping.PersistentClass)10 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)10 Metadata (org.hibernate.boot.Metadata)7 Field (java.lang.reflect.Field)6 BeforeEach (org.junit.jupiter.api.BeforeEach)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 MetadataSources (org.hibernate.boot.MetadataSources)5 RootClass (org.hibernate.mapping.RootClass)5 JdbcMetadataConfiguration (org.jboss.tools.hibernate.runtime.v_5_5.internal.util.JdbcMetadataConfiguration)5 HashMap (java.util.HashMap)4 MetadataImpl (org.hibernate.boot.internal.MetadataImpl)4 ConfigurationFacadeImpl (org.jboss.tools.hibernate.runtime.v_5_3.internal.ConfigurationFacadeImpl)3 ConfigurationFacadeImpl (org.jboss.tools.hibernate.runtime.v_5_4.internal.ConfigurationFacadeImpl)3 ConfigurationFacadeImpl (org.jboss.tools.hibernate.runtime.v_5_5.internal.ConfigurationFacadeImpl)3 MockConnectionProvider (org.jboss.tools.hibernate.runtime.v_5_5.internal.util.MockConnectionProvider)3 MockDialect (org.jboss.tools.hibernate.runtime.v_5_5.internal.util.MockDialect)3 ConfigurationFacadeImpl (org.jboss.tools.hibernate.runtime.v_5_6.internal.ConfigurationFacadeImpl)3 Connection (java.sql.Connection)2