Search in sources :

Example 11 with ConfigurationMetadataDescriptor

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

the class ExporterFacadeImpl method setConfiguration.

@Override
public void setConfiguration(IConfiguration configuration) {
    Exporter exporter = (Exporter) getTarget();
    setCustomProperties(configuration.getProperties());
    exporter.setMetadataDescriptor(new ConfigurationMetadataDescriptor(configuration));
}
Also used : ConfigurationMetadataDescriptor(org.jboss.tools.hibernate.runtime.v_5_4.internal.util.ConfigurationMetadataDescriptor) Exporter(org.hibernate.tool.hbm2x.Exporter)

Example 12 with ConfigurationMetadataDescriptor

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

the class ExporterFacadeImpl method setConfiguration.

@Override
public void setConfiguration(IConfiguration configuration) {
    Exporter exporter = (Exporter) getTarget();
    setCustomProperties(configuration.getProperties());
    exporter.setMetadataDescriptor(new ConfigurationMetadataDescriptor(configuration));
}
Also used : ConfigurationMetadataDescriptor(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.ConfigurationMetadataDescriptor) Exporter(org.hibernate.tool.hbm2x.Exporter)

Example 13 with ConfigurationMetadataDescriptor

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

the class ExporterFacadeImpl method setConfiguration.

@Override
public void setConfiguration(IConfiguration configuration) {
    setCustomProperties(configuration.getProperties());
    ((Exporter) getTarget()).getProperties().put(ExporterConstants.METADATA_DESCRIPTOR, new ConfigurationMetadataDescriptor((ConfigurationFacadeImpl) configuration));
}
Also used : ConfigurationMetadataDescriptor(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.ConfigurationMetadataDescriptor)

Example 14 with ConfigurationMetadataDescriptor

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

the class ExporterFacadeImpl method setConfiguration.

@Override
public void setConfiguration(IConfiguration configuration) {
    Exporter exporter = (Exporter) getTarget();
    setCustomProperties(configuration.getProperties());
    exporter.setMetadataDescriptor(new ConfigurationMetadataDescriptor(configuration));
}
Also used : ConfigurationMetadataDescriptor(org.jboss.tools.hibernate.runtime.v_5_3.internal.util.ConfigurationMetadataDescriptor) Exporter(org.hibernate.tool.hbm2x.Exporter)

Example 15 with ConfigurationMetadataDescriptor

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

the class ExporterFacadeTest method testSetConfiguration.

@Test
public void testSetConfiguration() throws Exception {
    exporterTarget = new HibernateConfigurationExporter();
    exporterFacade = new ExporterFacadeImpl(FACADE_FACTORY, exporterTarget);
    Properties properties = new Properties();
    Configuration configurationTarget = new Configuration();
    configurationTarget.setProperties(properties);
    ConfigurationFacadeImpl configurationFacade1 = new ConfigurationFacadeImpl(FACADE_FACTORY, configurationTarget);
    exporterFacade.setConfiguration(configurationFacade1);
    assertSame(properties, ((HibernateConfigurationExporter) exporterTarget).getCustomProperties());
    Field metadataDescriptorField = AbstractExporter.class.getDeclaredField("metadataDescriptor");
    metadataDescriptorField.setAccessible(true);
    ConfigurationMetadataDescriptor configurationMetadataDescriptor = (ConfigurationMetadataDescriptor) metadataDescriptorField.get(exporterTarget);
    assertNotNull(configurationMetadataDescriptor);
    Field configurationFacadeField = ConfigurationMetadataDescriptor.class.getDeclaredField("configurationFacade");
    configurationFacadeField.setAccessible(true);
    ConfigurationFacadeImpl configurationFacade2 = (ConfigurationFacadeImpl) configurationFacadeField.get(configurationMetadataDescriptor);
    assertNotNull(configurationFacade2);
    assertSame(configurationFacade1, configurationFacade2);
}
Also used : Field(java.lang.reflect.Field) ConfigurationMetadataDescriptor(org.jboss.tools.hibernate.runtime.v_5_5.internal.util.ConfigurationMetadataDescriptor) HibernateConfigurationExporter(org.hibernate.tool.hbm2x.HibernateConfigurationExporter) Configuration(org.hibernate.cfg.Configuration) Properties(java.util.Properties) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)10 Field (java.lang.reflect.Field)9 Configuration (org.hibernate.cfg.Configuration)7 Properties (java.util.Properties)5 Exporter (org.hibernate.tool.hbm2x.Exporter)5 HibernateConfigurationExporter (org.hibernate.tool.hbm2x.HibernateConfigurationExporter)4 ConfigurationMetadataDescriptor (org.jboss.tools.hibernate.runtime.v_5_3.internal.util.ConfigurationMetadataDescriptor)4 ConfigurationMetadataDescriptor (org.jboss.tools.hibernate.runtime.v_5_4.internal.util.ConfigurationMetadataDescriptor)3 ConfigurationMetadataDescriptor (org.jboss.tools.hibernate.runtime.v_5_5.internal.util.ConfigurationMetadataDescriptor)3 ConfigurationMetadataDescriptor (org.jboss.tools.hibernate.runtime.v_5_6.internal.util.ConfigurationMetadataDescriptor)3 ConfigurationFacadeImpl (org.jboss.tools.hibernate.runtime.v_5_5.internal.ConfigurationFacadeImpl)2 ConfigurationMetadataDescriptor (org.jboss.tools.hibernate.runtime.v_6_0.internal.util.ConfigurationMetadataDescriptor)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Metadata (org.hibernate.boot.Metadata)1 MetadataSources (org.hibernate.boot.MetadataSources)1 PersistentClass (org.hibernate.mapping.PersistentClass)1 RootClass (org.hibernate.mapping.RootClass)1 CfgExporter (org.hibernate.tool.internal.export.cfg.CfgExporter)1 IExporter (org.jboss.tools.hibernate.runtime.spi.IExporter)1 IHibernateMappingExporter (org.jboss.tools.hibernate.runtime.spi.IHibernateMappingExporter)1