Search in sources :

Example 16 with ConfigurationMetadataDescriptor

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

the class HibernateMappingExporterExtensionTest method testConstruction.

@Test
public void testConstruction() throws Exception {
    Field facadeFactoryField = HibernateMappingExporterExtension.class.getDeclaredField("facadeFactory");
    facadeFactoryField.setAccessible(true);
    assertSame(FACADE_FACTORY, facadeFactoryField.get(hibernateMappingExporterExtension));
    Field metadataDescriptorField = AbstractExporter.class.getDeclaredField("metadataDescriptor");
    metadataDescriptorField.setAccessible(true);
    ConfigurationMetadataDescriptor cmdd = (ConfigurationMetadataDescriptor) metadataDescriptorField.get(hibernateMappingExporterExtension);
    Field configurationFacadeField = ConfigurationMetadataDescriptor.class.getDeclaredField("configuration");
    configurationFacadeField.setAccessible(true);
    assertSame(configurationFacade, configurationFacadeField.get(cmdd));
    Field outputDirField = AbstractExporter.class.getDeclaredField("outputdir");
    outputDirField.setAccessible(true);
    assertSame(tempDir, outputDirField.get(hibernateMappingExporterExtension));
}
Also used : Field(java.lang.reflect.Field) ConfigurationMetadataDescriptor(org.jboss.tools.hibernate.runtime.v_5_3.internal.util.ConfigurationMetadataDescriptor) Test(org.junit.jupiter.api.Test)

Example 17 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("configuration");
    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_4.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