Search in sources :

Example 6 with Exporter

use of org.hibernate.tool.hbm2x.Exporter in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateExporter.

@Test
public void testCreateExporter() {
    Exporter exporter = (Exporter) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Exporter.class }, new TestInvocationHandler());
    IExporter facade = facadeFactory.createExporter(exporter);
    assertSame(exporter, ((IFacade) facade).getTarget());
}
Also used : PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) IExporter(org.jboss.tools.hibernate.runtime.spi.IExporter) IHibernateMappingExporter(org.jboss.tools.hibernate.runtime.spi.IHibernateMappingExporter) QueryExporter(org.hibernate.tool.hbm2x.QueryExporter) HibernateMappingExporter(org.hibernate.tool.hbm2x.HibernateMappingExporter) Hbm2DDLExporter(org.hibernate.tool.hbm2x.Hbm2DDLExporter) IQueryExporter(org.jboss.tools.hibernate.runtime.spi.IQueryExporter) IGenericExporter(org.jboss.tools.hibernate.runtime.spi.IGenericExporter) GenericExporter(org.hibernate.tool.hbm2x.GenericExporter) Exporter(org.hibernate.tool.hbm2x.Exporter) IHbm2DDLExporter(org.jboss.tools.hibernate.runtime.spi.IHbm2DDLExporter) IExporter(org.jboss.tools.hibernate.runtime.spi.IExporter) Test(org.junit.jupiter.api.Test)

Example 7 with Exporter

use of org.hibernate.tool.hbm2x.Exporter in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateExporter.

@Test
public void testCreateExporter() {
    Exporter exporter = (Exporter) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Exporter.class }, new TestInvocationHandler());
    IExporter facade = facadeFactory.createExporter(exporter);
    assertTrue(facade instanceof ExporterFacadeImpl);
    assertSame(exporter, ((IFacade) facade).getTarget());
}
Also used : PersistentClass(org.hibernate.mapping.PersistentClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IExporter(org.jboss.tools.hibernate.runtime.spi.IExporter) QueryExporter(org.hibernate.tool.hbm2x.QueryExporter) HibernateMappingExporter(org.hibernate.tool.hbm2x.HibernateMappingExporter) Hbm2DDLExporter(org.hibernate.tool.hbm2x.Hbm2DDLExporter) IQueryExporter(org.jboss.tools.hibernate.runtime.spi.IQueryExporter) Exporter(org.hibernate.tool.hbm2x.Exporter) IHibernateMappingExporter(org.jboss.tools.hibernate.runtime.spi.IHibernateMappingExporter) IGenericExporter(org.jboss.tools.hibernate.runtime.spi.IGenericExporter) GenericExporter(org.hibernate.tool.hbm2x.GenericExporter) IHbm2DDLExporter(org.jboss.tools.hibernate.runtime.spi.IHbm2DDLExporter) IExporter(org.jboss.tools.hibernate.runtime.spi.IExporter) Test(org.junit.jupiter.api.Test)

Example 8 with Exporter

use of org.hibernate.tool.hbm2x.Exporter in project jbosstools-hibernate by jbosstools.

the class ExporterFacadeTest method testStart.

@Test
public void testStart() throws Exception {
    Exporter exporter = new AbstractExporter() {

        @Override
        protected void doStart() {
            methodName = "start";
        }
    };
    ArtifactCollector artifactCollector = new ArtifactCollector();
    File testFile = File.createTempFile("test", "xml");
    FileWriter writer = new FileWriter(testFile);
    writer.write("<test/>");
    writer.flush();
    writer.close();
    artifactCollector.addFile(testFile, "xml");
    exporter.setArtifactCollector(artifactCollector);
    exporterFacade = new AbstractExporterFacade(FACADE_FACTORY, exporter) {
    };
    exporterFacade.start();
    Assert.assertEquals("start", methodName);
}
Also used : AbstractExporter(org.hibernate.tool.hbm2x.AbstractExporter) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) FileWriter(java.io.FileWriter) GenericExporter(org.hibernate.tool.hbm2x.GenericExporter) Exporter(org.hibernate.tool.hbm2x.Exporter) QueryExporter(org.hibernate.tool.hbm2x.QueryExporter) HibernateConfigurationExporter(org.hibernate.tool.hbm2x.HibernateConfigurationExporter) Hbm2DDLExporter(org.hibernate.tool.hbm2x.Hbm2DDLExporter) IQueryExporter(org.jboss.tools.hibernate.runtime.spi.IQueryExporter) AbstractExporter(org.hibernate.tool.hbm2x.AbstractExporter) IHbm2DDLExporter(org.jboss.tools.hibernate.runtime.spi.IHbm2DDLExporter) IExporter(org.jboss.tools.hibernate.runtime.spi.IExporter) IGenericExporter(org.jboss.tools.hibernate.runtime.spi.IGenericExporter) File(java.io.File) AbstractExporterFacade(org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade) Test(org.junit.Test)

Example 9 with Exporter

use of org.hibernate.tool.hbm2x.Exporter in project jbosstools-hibernate by jbosstools.

the class ExporterFacadeTest method testStart.

@Test
public void testStart() throws Exception {
    Exporter exporter = new AbstractExporter() {

        @Override
        protected void doStart() {
            methodName = "start";
        }

        @Override
        protected Metadata buildMetadata() {
            return null;
        }
    };
    ArtifactCollector artifactCollector = new ArtifactCollector();
    File testFile = File.createTempFile("test", "xml");
    FileWriter writer = new FileWriter(testFile);
    writer.write("<test/>");
    writer.flush();
    writer.close();
    artifactCollector.addFile(testFile, "xml");
    exporter.setArtifactCollector(artifactCollector);
    exporterFacade = new ExporterFacadeImpl(FACADE_FACTORY, exporter);
    exporterFacade.start();
    Assert.assertEquals("start", methodName);
}
Also used : AbstractExporter(org.hibernate.tool.hbm2x.AbstractExporter) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) FileWriter(java.io.FileWriter) GenericExporter(org.hibernate.tool.hbm2x.GenericExporter) Exporter(org.hibernate.tool.hbm2x.Exporter) QueryExporter(org.hibernate.tool.hbm2x.QueryExporter) HibernateConfigurationExporter(org.hibernate.tool.hbm2x.HibernateConfigurationExporter) Hbm2DDLExporter(org.hibernate.tool.hbm2x.Hbm2DDLExporter) IQueryExporter(org.jboss.tools.hibernate.runtime.spi.IQueryExporter) AbstractExporter(org.hibernate.tool.hbm2x.AbstractExporter) IHbm2DDLExporter(org.jboss.tools.hibernate.runtime.spi.IHbm2DDLExporter) IExporter(org.jboss.tools.hibernate.runtime.spi.IExporter) IGenericExporter(org.jboss.tools.hibernate.runtime.spi.IGenericExporter) File(java.io.File) Test(org.junit.Test)

Example 10 with Exporter

use of org.hibernate.tool.hbm2x.Exporter 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));
}
Also used : ConfigurationMetadataDescriptor(org.jboss.tools.hibernate.runtime.v_5_3.internal.util.ConfigurationMetadataDescriptor) Exporter(org.hibernate.tool.hbm2x.Exporter)

Aggregations

Exporter (org.hibernate.tool.hbm2x.Exporter)20 IExporter (org.jboss.tools.hibernate.runtime.spi.IExporter)16 GenericExporter (org.hibernate.tool.hbm2x.GenericExporter)15 Hbm2DDLExporter (org.hibernate.tool.hbm2x.Hbm2DDLExporter)15 QueryExporter (org.hibernate.tool.hbm2x.QueryExporter)15 IGenericExporter (org.jboss.tools.hibernate.runtime.spi.IGenericExporter)15 IHbm2DDLExporter (org.jboss.tools.hibernate.runtime.spi.IHbm2DDLExporter)15 IQueryExporter (org.jboss.tools.hibernate.runtime.spi.IQueryExporter)15 IHibernateMappingExporter (org.jboss.tools.hibernate.runtime.spi.IHibernateMappingExporter)12 PersistentClass (org.hibernate.mapping.PersistentClass)11 RootClass (org.hibernate.mapping.RootClass)11 HibernateMappingExporter (org.hibernate.tool.hbm2x.HibernateMappingExporter)11 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)11 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)11 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)11 Test (org.junit.jupiter.api.Test)10 Test (org.junit.Test)5 HibernateConfigurationExporter (org.hibernate.tool.hbm2x.HibernateConfigurationExporter)4 File (java.io.File)2 FileWriter (java.io.FileWriter)2