use of org.hibernate.tool.internal.export.cfg.CfgExporter 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).properties);
exporterTarget = new CfgExporter();
exporterFacade = new ExporterFacadeImpl(FACADE_FACTORY, exporterTarget);
assertNotSame(properties, ((CfgExporter) exporterTarget).getCustomProperties());
exporterFacade.setCustomProperties(properties);
assertSame(properties, ((CfgExporter) exporterTarget).getCustomProperties());
}
use of org.hibernate.tool.internal.export.cfg.CfgExporter 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 CfgExporter();
exporterFacade = new ExporterFacadeImpl(FACADE_FACTORY, exporterTarget);
exporterFacade.setOutput(stringWriter);
assertSame(stringWriter, ((CfgExporter) exporterTarget).getOutput());
}
use of org.hibernate.tool.internal.export.cfg.CfgExporter in project jbosstools-hibernate by jbosstools.
the class ExporterFacadeTest method testSetConfiguration.
@Test
public void testSetConfiguration() throws Exception {
exporterTarget = new CfgExporter();
exporterFacade = new ExporterFacadeImpl(FACADE_FACTORY, exporterTarget);
Properties properties = new Properties();
Configuration configurationTarget = new Configuration();
configurationTarget.setProperties(properties);
ConfigurationFacadeImpl configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configurationTarget);
exporterFacade.setConfiguration(configurationFacade);
assertSame(properties, ((CfgExporter) exporterTarget).getCustomProperties());
Object object = exporterTarget.getProperties().get(ExporterConstants.METADATA_DESCRIPTOR);
assertNotNull(object);
assertTrue(object instanceof ConfigurationMetadataDescriptor);
ConfigurationMetadataDescriptor configurationMetadataDescriptor = (ConfigurationMetadataDescriptor) object;
Field field = ConfigurationMetadataDescriptor.class.getDeclaredField("configurationFacade");
field.setAccessible(true);
object = field.get(configurationMetadataDescriptor);
assertNotNull(object);
assertTrue(object instanceof ConfigurationFacadeImpl);
assertSame(object, configurationFacade);
}
use of org.hibernate.tool.internal.export.cfg.CfgExporter in project jbosstools-hibernate by jbosstools.
the class ServiceImplTest method testCreateExporter.
@Test
public void testCreateExporter() {
IExporter exporter = service.createExporter(JavaExporter.class.getName());
assertNotNull(exporter);
Object target = ((IFacade) exporter).getTarget();
assertNotNull(target);
assertTrue(target instanceof JavaExporter);
MetadataDescriptor metadataDescriptor = (MetadataDescriptor) ((JavaExporter) target).getProperties().get(ExporterConstants.METADATA_DESCRIPTOR);
// Normal metadata descriptor
assertNotNull(metadataDescriptor.getProperties());
exporter = service.createExporter(CfgExporter.class.getName());
assertNotNull(exporter);
target = ((IFacade) exporter).getTarget();
assertNotNull(target);
assertTrue(target instanceof CfgExporter);
metadataDescriptor = (MetadataDescriptor) ((CfgExporter) target).getProperties().get(ExporterConstants.METADATA_DESCRIPTOR);
// Dummy metadata descriptor
assertNull(metadataDescriptor.getProperties());
}
Aggregations