Search in sources :

Example 6 with IDatabaseCollector

use of org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateDatabaseCollector.

@Test
public void testCreateDatabaseCollector() {
    DatabaseCollector databaseCollector = (DatabaseCollector) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { DatabaseCollector.class }, new TestInvocationHandler());
    IDatabaseCollector facade = facadeFactory.createDatabaseCollector(databaseCollector);
    Assert.assertSame(databaseCollector, ((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) IDatabaseCollector(org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector) DatabaseCollector(org.hibernate.cfg.reveng.DatabaseCollector) IDatabaseCollector(org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector) Test(org.junit.Test)

Example 7 with IDatabaseCollector

use of org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewDatabaseCollector.

@Test
public void testNewDatabaseCollector() {
    IJDBCReader jdbcReader = FACADE_FACTORY.createJDBCReader(JDBCReaderFactory.newJDBCReader(new Configuration().getProperties(), new DefaultReverseEngineeringStrategy(), new StandardServiceRegistryBuilder().build()));
    IDatabaseCollector databaseCollectorFacade = service.newDatabaseCollector(jdbcReader);
    Assert.assertNotNull(databaseCollectorFacade);
    DatabaseCollector databaseCollector = (DatabaseCollector) ((IFacade) databaseCollectorFacade).getTarget();
    Assert.assertNotNull(databaseCollector);
}
Also used : Configuration(org.hibernate.cfg.Configuration) JDBCMetaDataConfiguration(org.hibernate.cfg.JDBCMetaDataConfiguration) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) IDatabaseCollector(org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector) IJDBCReader(org.jboss.tools.hibernate.runtime.spi.IJDBCReader) DatabaseCollector(org.hibernate.cfg.reveng.DatabaseCollector) IDatabaseCollector(org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector) Test(org.junit.Test)

Example 8 with IDatabaseCollector

use of org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateDatabaseCollector.

@Test
public void testCreateDatabaseCollector() {
    DatabaseCollector databaseCollector = (DatabaseCollector) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { DatabaseCollector.class }, new TestInvocationHandler());
    IDatabaseCollector facade = facadeFactory.createDatabaseCollector(databaseCollector);
    Assert.assertSame(databaseCollector, ((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) IDatabaseCollector(org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector) DatabaseCollector(org.hibernate.cfg.reveng.DatabaseCollector) IDatabaseCollector(org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector) Test(org.junit.Test)

Example 9 with IDatabaseCollector

use of org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector in project jbosstools-hibernate by jbosstools.

the class LazyDatabaseSchemaWorkbenchAdapter method readDatabaseSchema.

protected IDatabaseCollector readDatabaseSchema(final IProgressMonitor monitor, final ConsoleConfiguration consoleConfiguration, final IReverseEngineeringStrategy strategy) {
    final IConfiguration configuration = consoleConfiguration.buildWith(null, false);
    return (IDatabaseCollector) consoleConfiguration.execute(new ExecutionContext.Command() {

        public Object execute() {
            IDatabaseCollector db = null;
            try {
                IService service = consoleConfiguration.getHibernateExtension().getHibernateService();
                IJDBCReader reader = service.newJDBCReader(configuration, strategy);
                db = service.newDatabaseCollector(reader);
                reader.readDatabaseSchema(db, new ProgressListener(monitor));
            } catch (UnsupportedOperationException he) {
                throw new HibernateException(he);
            } catch (Exception he) {
                he.printStackTrace();
                throw new HibernateException(he.getMessage(), he.getCause());
            }
            return db;
        }
    });
}
Also used : IProgressListener(org.jboss.tools.hibernate.runtime.spi.IProgressListener) HibernateException(org.jboss.tools.hibernate.runtime.spi.HibernateException) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) IDatabaseCollector(org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector) IService(org.jboss.tools.hibernate.runtime.spi.IService) HibernateException(org.jboss.tools.hibernate.runtime.spi.HibernateException) IJDBCReader(org.jboss.tools.hibernate.runtime.spi.IJDBCReader)

Example 10 with IDatabaseCollector

use of org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewDatabaseCollector.

@Test
public void testNewDatabaseCollector() {
    Configuration cfg = new Configuration();
    IJDBCReader jdbcReader = FACADE_FACTORY.createJDBCReader(JDBCReaderFactory.newJDBCReader(cfg.getProperties(), cfg.buildSettings(), new DefaultReverseEngineeringStrategy()));
    IDatabaseCollector databaseCollectorFacade = service.newDatabaseCollector(jdbcReader);
    Assert.assertNotNull(databaseCollectorFacade);
    DatabaseCollector databaseCollector = (DatabaseCollector) ((IFacade) databaseCollectorFacade).getTarget();
    Assert.assertNotNull(databaseCollector);
}
Also used : IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) Configuration(org.hibernate.cfg.Configuration) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) IDatabaseCollector(org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector) IJDBCReader(org.jboss.tools.hibernate.runtime.spi.IJDBCReader) DatabaseCollector(org.hibernate.cfg.reveng.DatabaseCollector) IDatabaseCollector(org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector) Test(org.junit.Test)

Aggregations

IDatabaseCollector (org.jboss.tools.hibernate.runtime.spi.IDatabaseCollector)18 DatabaseCollector (org.hibernate.cfg.reveng.DatabaseCollector)16 Test (org.junit.Test)16 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)9 IJDBCReader (org.jboss.tools.hibernate.runtime.spi.IJDBCReader)9 Configuration (org.hibernate.cfg.Configuration)8 DefaultReverseEngineeringStrategy (org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy)8 PersistentClass (org.hibernate.mapping.PersistentClass)8 RootClass (org.hibernate.mapping.RootClass)8 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)8 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)8 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)8 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)5 JDBCMetaDataConfiguration (org.hibernate.cfg.JDBCMetaDataConfiguration)3 HibernateException (org.jboss.tools.hibernate.runtime.spi.HibernateException)2 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 List (java.util.List)1