use of org.jboss.tools.hibernate.runtime.v_5_4.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));
}
use of org.jboss.tools.hibernate.runtime.v_5_4.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("configurationFacade");
configurationFacadeField.setAccessible(true);
ConfigurationFacadeImpl configurationFacade2 = (ConfigurationFacadeImpl) configurationFacadeField.get(configurationMetadataDescriptor);
assertNotNull(configurationFacade2);
assertSame(configurationFacade1, configurationFacade2);
}
use of org.jboss.tools.hibernate.runtime.v_5_4.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("configurationFacade");
configurationFacadeField.setAccessible(true);
assertSame(configurationFacade, configurationFacadeField.get(cmdd));
Field outputDirField = AbstractExporter.class.getDeclaredField("outputdir");
outputDirField.setAccessible(true);
assertSame(tempDir, outputDirField.get(hibernateMappingExporterExtension));
}
use of org.jboss.tools.hibernate.runtime.v_5_4.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);
}
use of org.jboss.tools.hibernate.runtime.v_5_4.internal.util.ConfigurationMetadataDescriptor in project jbosstools-hibernate by jbosstools.
the class ConfigurationMetadataDescriptorTest method testCreateMetadata.
@Test
public void testCreateMetadata() {
MetadataSources metadataSources = new MetadataSources();
metadataSources.addInputStream(new ByteArrayInputStream(TEST_HBM_XML_STRING.getBytes()));
Configuration configuration = new Configuration(metadataSources);
configuration.setProperty(AvailableSettings.DIALECT, MockDialect.class.getName());
configuration.setProperty(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configuration);
PersistentClass persistentClass = new RootClass(null);
persistentClass.setEntityName("Bar");
IPersistentClass persistentClassFacade = FACADE_FACTORY.createPersistentClass(persistentClass);
configurationFacade.addClass(persistentClassFacade);
configurationMetadataDescriptor = new ConfigurationMetadataDescriptor(configurationFacade);
Metadata metadata = configurationMetadataDescriptor.createMetadata();
assertNotNull(metadata.getEntityBinding(Foo.class.getName()));
assertNotNull(metadata.getEntityBinding("Bar"));
}
Aggregations