use of org.hibernate.tool.hbm2x.HibernateConfigurationExporter in project jbosstools-hibernate by jbosstools.
the class ExporterFacadeTest method testSetCustomProperties.
@Test
public void testSetCustomProperties() {
Properties properties = new Properties();
exporterFacade.setCustomProperties(properties);
assertNotSame(properties, ((TestExporter) exporterTarget).getProperties());
exporterTarget = new HibernateConfigurationExporter();
exporterFacade = new AbstractExporterFacade(FACADE_FACTORY, exporterTarget) {
};
assertNotSame(properties, ((HibernateConfigurationExporter) exporterTarget).getCustomProperties());
exporterFacade.setCustomProperties(properties);
assertSame(properties, ((HibernateConfigurationExporter) exporterTarget).getCustomProperties());
}
use of org.hibernate.tool.hbm2x.HibernateConfigurationExporter in project jbosstools-hibernate by jbosstools.
the class ExporterFacadeTest method testSetConfiguration.
@Test
public void testSetConfiguration() throws Exception {
exporterTarget = new HibernateConfigurationExporter();
exporterFacade = new AbstractExporterFacade(FACADE_FACTORY, exporterTarget) {
};
Properties properties = new Properties();
Configuration configurationTarget = new Configuration();
configurationTarget.setProperties(properties);
assertNotSame(properties, exporterTarget.getProperties());
assertNotSame(configurationTarget, exporterTarget.getConfiguration());
ConfigurationFacadeImpl configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configurationTarget);
exporterFacade.setConfiguration(configurationFacade);
assertSame(properties, exporterTarget.getProperties());
assertSame(configurationTarget, exporterTarget.getConfiguration());
}
use of org.hibernate.tool.hbm2x.HibernateConfigurationExporter in project jbosstools-hibernate by jbosstools.
the class ExporterFacadeTest method testSetCustomProperties.
@Test
public void testSetCustomProperties() {
Properties properties = new Properties();
exporterFacade.setCustomProperties(properties);
assertNotSame(properties, ((TestExporter) exporterTarget).getProperties());
exporterTarget = new HibernateConfigurationExporter();
exporterFacade = new ExporterFacadeImpl(FACADE_FACTORY, exporterTarget);
assertNotSame(properties, ((HibernateConfigurationExporter) exporterTarget).getCustomProperties());
exporterFacade.setCustomProperties(properties);
assertSame(properties, ((HibernateConfigurationExporter) exporterTarget).getCustomProperties());
}
use of org.hibernate.tool.hbm2x.HibernateConfigurationExporter 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);
}
use of org.hibernate.tool.hbm2x.HibernateConfigurationExporter in project jbosstools-hibernate by jbosstools.
the class ExporterFacadeTest method testSetOutput.
@Test
public void testSetOutput() {
StringWriter stringWriter = new StringWriter();
exporterFacade.setOutput(stringWriter);
assertNotSame(stringWriter, ((TestExporter) exporterTarget).writer);
exporterTarget = new HibernateConfigurationExporter();
exporterFacade = new ExporterFacadeImpl(FACADE_FACTORY, exporterTarget);
assertNotSame(stringWriter, ((HibernateConfigurationExporter) exporterTarget).getOutput());
exporterFacade.setOutput(stringWriter);
assertSame(stringWriter, ((HibernateConfigurationExporter) exporterTarget).getOutput());
}
Aggregations