use of org.jboss.tools.hibernate.runtime.spi.IExporter in project jbosstools-hibernate by jbosstools.
the class ServiceImplTest method testCreateExporter.
@Test
public void testCreateExporter() {
IExporter exporter = service.createExporter("org.hibernate.tool.hbm2x.POJOExporter");
Assert.assertNotNull(exporter);
Object target = ((IFacade) exporter).getTarget();
Assert.assertNotNull(target);
Assert.assertTrue(target instanceof POJOExporter);
}
use of org.jboss.tools.hibernate.runtime.spi.IExporter in project jbosstools-hibernate by jbosstools.
the class ServiceImplTest method testCreateExporter.
@Test
public void testCreateExporter() {
IExporter exporter = service.createExporter("org.hibernate.tool.hbm2x.POJOExporter");
Assert.assertNotNull(exporter);
Object target = ((IFacade) exporter).getTarget();
Assert.assertNotNull(target);
Assert.assertTrue(target instanceof POJOExporter);
}
use of org.jboss.tools.hibernate.runtime.spi.IExporter in project jbosstools-hibernate by jbosstools.
the class NewConfigurationWizard method openContentStream.
/**
* We will initialize file contents with a sample text.
* @throws UnsupportedEncodingException
*/
private InputStream openContentStream(Properties props) {
StringWriter stringWriter = new StringWriter();
IService service = ServiceLookup.findService(connectionInfoPage.getHibernateVersion());
// $NON-NLS-1$
IExporter hce = service.createExporter("org.hibernate.tool.hbm2x.HibernateConfigurationExporter");
hce.setCustomProperties(props);
hce.setOutput(stringWriter);
hce.start();
try {
// $NON-NLS-1$
return new ByteArrayInputStream(stringWriter.toString().getBytes("UTF-8"));
} catch (UnsupportedEncodingException uec) {
HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.NewConfigurationWizard_problems_converting_to_utf8, uec);
return new ByteArrayInputStream(stringWriter.toString().getBytes());
}
}
Aggregations