use of org.jboss.tools.hibernate.runtime.v_5_6.internal.util.ConfigurationMetadataDescriptor in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method createExporter.
@Override
public IExporter createExporter(String exporterClassName) {
Exporter exporter = (Exporter) Util.getInstance(exporterClassName, facadeFactory.getClassLoader());
exporter.setMetadataDescriptor(new ConfigurationMetadataDescriptor(newDefaultConfiguration()));
return facadeFactory.createExporter(exporter);
}
use of org.jboss.tools.hibernate.runtime.v_5_6.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));
}
use of org.jboss.tools.hibernate.runtime.v_5_6.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);
}
use of org.jboss.tools.hibernate.runtime.v_5_6.internal.util.ConfigurationMetadataDescriptor 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.jboss.tools.hibernate.runtime.v_5_6.internal.util.ConfigurationMetadataDescriptor in project jbosstools-hibernate by jbosstools.
the class ConfigurationMetadataDescriptorTest method beforeEach.
@BeforeEach
public void beforeEach() {
configurationTarget = new Configuration();
configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configurationTarget);
configurationMetadataDescriptor = new ConfigurationMetadataDescriptor(configurationFacade);
}
Aggregations