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 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 ServiceImplTest method testCreateExporter.
@Test
public void testCreateExporter() throws Exception {
IExporter exporter = service.createExporter(POJOExporter.class.getName());
assertNotNull(exporter);
Object target = ((IFacade) exporter).getTarget();
assertNotNull(target);
assertTrue(target instanceof POJOExporter);
Field metadataDescriptorField = AbstractExporter.class.getDeclaredField("metadataDescriptor");
metadataDescriptorField.setAccessible(true);
MetadataDescriptor metadataDescriptor = (MetadataDescriptor) metadataDescriptorField.get(target);
// Normal metadata descriptor
assertNotNull(metadataDescriptor.getProperties());
exporter = service.createExporter(HibernateConfigurationExporter.class.getName());
assertNotNull(exporter);
target = ((IFacade) exporter).getTarget();
assertNotNull(target);
assertTrue(target instanceof HibernateConfigurationExporter);
metadataDescriptor = (MetadataDescriptor) metadataDescriptorField.get(target);
// Dummy metadata descriptor
assertNull(metadataDescriptor.getProperties());
}
use of org.hibernate.tool.hbm2x.HibernateConfigurationExporter in project jbosstools-hibernate by jbosstools.
the class ExporterFacadeTest method testSetCustomProperties.
@Test
public void testSetCustomProperties() {
Exporter exporter = new GenericExporter();
exporterFacade = FACADE_FACTORY.createExporter(exporter);
Properties properties = new Properties();
exporterFacade.setCustomProperties(properties);
exporter = new HibernateConfigurationExporter();
exporterFacade = FACADE_FACTORY.createExporter(exporter);
exporterFacade.setCustomProperties(properties);
Assert.assertSame(properties, ((HibernateConfigurationExporter) exporter).getCustomProperties());
}
use of org.hibernate.tool.hbm2x.HibernateConfigurationExporter in project jbosstools-hibernate by jbosstools.
the class ExporterFacadeTest method testSetOutput.
@Test
public void testSetOutput() {
Exporter exporter = new GenericExporter();
exporterFacade = FACADE_FACTORY.createExporter(exporter);
StringWriter stringWriter = new StringWriter();
exporterFacade.setOutput(stringWriter);
exporter = new HibernateConfigurationExporter();
exporterFacade = FACADE_FACTORY.createExporter(exporter);
exporterFacade.setOutput(stringWriter);
Assert.assertSame(stringWriter, ((HibernateConfigurationExporter) exporter).getOutput());
}
Aggregations