use of org.hibernate.tool.api.metadata.MetadataDescriptor 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());
}
Aggregations