Search in sources :

Example 26 with AbstractExporterFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade in project jbosstools-hibernate by jbosstools.

the class ExporterFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    exporter = (Exporter) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Exporter.class }, new TestInvocationHandler());
    exporterFacade = new AbstractExporterFacade(FACADE_FACTORY, exporter) {
    };
}
Also used : AbstractExporterFacade(org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade) Before(org.junit.Before)

Example 27 with AbstractExporterFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade 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 28 with AbstractExporterFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade in project jbosstools-hibernate by jbosstools.

the class ExporterFacadeTest method testGetHbm2DDLExporter.

@Test
public void testGetHbm2DDLExporter() {
    IHbm2DDLExporter hbm2DDLExporter = exporterFacade.getHbm2DDLExporter();
    Assert.assertNull(hbm2DDLExporter);
    exporter = new Hbm2DDLExporter();
    exporterFacade = new AbstractExporterFacade(FACADE_FACTORY, exporter) {
    };
    hbm2DDLExporter = exporterFacade.getHbm2DDLExporter();
    Assert.assertNotNull(hbm2DDLExporter);
    Assert.assertSame(exporter, ((IFacade) hbm2DDLExporter).getTarget());
}
Also used : IHbm2DDLExporter(org.jboss.tools.hibernate.runtime.spi.IHbm2DDLExporter) Hbm2DDLExporter(org.hibernate.tool.hbm2x.Hbm2DDLExporter) IHbm2DDLExporter(org.jboss.tools.hibernate.runtime.spi.IHbm2DDLExporter) AbstractExporterFacade(org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade) Test(org.junit.Test)

Example 29 with AbstractExporterFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade in project jbosstools-hibernate by jbosstools.

the class ExporterFacadeTest method setUp.

@Before
public void setUp() throws Exception {
    exporter = (Exporter) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Exporter.class }, new TestInvocationHandler());
    exporterFacade = new AbstractExporterFacade(FACADE_FACTORY, exporter) {
    };
}
Also used : AbstractExporterFacade(org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade) Before(org.junit.Before)

Example 30 with AbstractExporterFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade in project jbosstools-hibernate by jbosstools.

the class ExporterFacadeTest method testGetQueryExporter.

@Test
public void testGetQueryExporter() {
    IQueryExporter queryExporter = exporterFacade.getQueryExporter();
    Assert.assertNull(queryExporter);
    exporter = new QueryExporter();
    exporterFacade = new AbstractExporterFacade(FACADE_FACTORY, exporter) {
    };
    queryExporter = exporterFacade.getQueryExporter();
    Assert.assertNotNull(queryExporter);
    Assert.assertSame(exporter, ((IFacade) queryExporter).getTarget());
}
Also used : QueryExporter(org.hibernate.tool.hbm2x.QueryExporter) IQueryExporter(org.jboss.tools.hibernate.runtime.spi.IQueryExporter) IQueryExporter(org.jboss.tools.hibernate.runtime.spi.IQueryExporter) AbstractExporterFacade(org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade) Test(org.junit.Test)

Aggregations

AbstractExporterFacade (org.jboss.tools.hibernate.runtime.common.AbstractExporterFacade)32 Test (org.junit.Test)25 GenericExporter (org.hibernate.tool.hbm2x.GenericExporter)9 Hbm2DDLExporter (org.hibernate.tool.hbm2x.Hbm2DDLExporter)9 QueryExporter (org.hibernate.tool.hbm2x.QueryExporter)9 IGenericExporter (org.jboss.tools.hibernate.runtime.spi.IGenericExporter)9 IHbm2DDLExporter (org.jboss.tools.hibernate.runtime.spi.IHbm2DDLExporter)9 IQueryExporter (org.jboss.tools.hibernate.runtime.spi.IQueryExporter)9 Before (org.junit.Before)7 File (java.io.File)1 FileWriter (java.io.FileWriter)1 AbstractExporter (org.hibernate.tool.hbm2x.AbstractExporter)1 ArtifactCollector (org.hibernate.tool.hbm2x.ArtifactCollector)1 Exporter (org.hibernate.tool.hbm2x.Exporter)1 HibernateConfigurationExporter (org.hibernate.tool.hbm2x.HibernateConfigurationExporter)1 IArtifactCollector (org.jboss.tools.hibernate.runtime.spi.IArtifactCollector)1 IExporter (org.jboss.tools.hibernate.runtime.spi.IExporter)1