mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 12:44:49 +00:00
HHH-7711 Added test for SchemaExport
This commit is contained in:
parent
eaa18d286b
commit
847bbc2a36
@ -36,6 +36,7 @@
|
||||
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
@ -110,6 +111,27 @@ public void testBothType() {
|
||||
assertEquals( 0, schemaExport.getExceptions().size() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenerateDdlToFile() {
|
||||
Configuration cfg = new Configuration();
|
||||
cfg.addResource( MAPPING );
|
||||
SchemaExport schemaExport = createSchemaExport( cfg );
|
||||
java.io.File outFile = new java.io.File("schema.ddl");
|
||||
schemaExport.setOutputFile(outFile.getPath());
|
||||
// do not script to console or export to database
|
||||
schemaExport.execute( false, false, false, true );
|
||||
if ( doesDialectSupportDropTableIfExist() ) {
|
||||
assertEquals( 0, schemaExport.getExceptions().size() );
|
||||
}
|
||||
else {
|
||||
assertEquals( 2, schemaExport.getExceptions().size() );
|
||||
}
|
||||
assertTrue( outFile.exists() );
|
||||
//check file is not empty
|
||||
assertTrue( outFile.length() > 0 );
|
||||
outFile.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndDrop() {
|
||||
Configuration cfg = new Configuration();
|
||||
|
Loading…
x
Reference in New Issue
Block a user