use of org.hibernate.tool.hbm2ddl.SchemaExport in project jbosstools-hibernate by jbosstools.
the class SchemaExportFacadeTest method testCreate.
@Test
public void testCreate() throws Exception {
String urlString = "jdbc:h2:mem:create_test";
Connection connection = DriverManager.getConnection(urlString);
configuration.setProperty(Environment.URL, urlString);
ISchemaExport schemaExportFacade = FACADE_FACTORY.createSchemaExport(new SchemaExport(configuration));
Assert.assertFalse(connection.getMetaData().getTables(null, null, "FOO", null).next());
schemaExportFacade.create();
Assert.assertTrue(connection.getMetaData().getTables(null, null, "FOO", null).next());
}
use of org.hibernate.tool.hbm2ddl.SchemaExport in project jbosstools-hibernate by jbosstools.
the class SchemaExportFacadeTest method testGetExceptions.
@Test
public void testGetExceptions() throws Throwable {
String urlString = "jdbc:h2:tcp://localhost/~/some_weird_unexistant_location";
configuration.setProperty(Environment.URL, urlString);
SchemaExport schemaExport = new SchemaExport(configuration);
ISchemaExport schemaExportFacade = FACADE_FACTORY.createSchemaExport(schemaExport);
Assert.assertTrue(schemaExportFacade.getExceptions().isEmpty());
schemaExport.create(false, true);
Assert.assertFalse(schemaExportFacade.getExceptions().isEmpty());
}
use of org.hibernate.tool.hbm2ddl.SchemaExport in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateSchemaExport.
@Test
public void testCreateSchemaExport() {
Configuration configuration = new Configuration();
configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
SchemaExport schemaExport = new SchemaExport(configuration);
ISchemaExport facade = facadeFactory.createSchemaExport(schemaExport);
Assert.assertSame(schemaExport, ((IFacade) facade).getTarget());
}
use of org.hibernate.tool.hbm2ddl.SchemaExport in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateSchemaExport.
@Test
public void testCreateSchemaExport() {
Configuration configuration = new Configuration();
configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
SchemaExport schemaExport = new SchemaExport((MetadataImplementor) MetadataHelper.getMetadata(configuration));
ISchemaExport facade = facadeFactory.createSchemaExport(schemaExport);
Assert.assertSame(schemaExport, ((IFacade) facade).getTarget());
}
use of org.hibernate.tool.hbm2ddl.SchemaExport in project jbosstools-hibernate by jbosstools.
the class SchemaExportFacadeTest method testCreate.
@Test
public void testCreate() throws Exception {
String urlString = "jdbc:h2:mem:create_test";
Connection connection = DriverManager.getConnection(urlString);
configuration.setProperty(Environment.URL, urlString);
MetadataImplementor metadataImplementor = (MetadataImplementor) MetadataHelper.getMetadata(configuration);
ISchemaExport schemaExportFacade = FACADE_FACTORY.createSchemaExport(new SchemaExport(metadataImplementor));
Assert.assertFalse(connection.getMetaData().getTables(null, null, "FOO", null).next());
schemaExportFacade.create();
Assert.assertTrue(connection.getMetaData().getTables(null, null, "FOO", null).next());
}
Aggregations