mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-03-01 15:29:11 +00:00
HHH-6702 mysql 51 test failures
This commit is contained in:
parent
3c07e5d6ba
commit
56ce194a29
@ -23,8 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.hibernate.test.schemaupdate;
|
package org.hibernate.test.schemaupdate;
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
@ -42,8 +40,9 @@ public abstract class SchemaExportTest extends BaseUnitTestCase {
|
|||||||
|
|
||||||
protected abstract SchemaExport createSchemaExport(Configuration cfg);
|
protected abstract SchemaExport createSchemaExport(Configuration cfg);
|
||||||
|
|
||||||
private boolean doesDialectSupportDropTableIfExist(){
|
private boolean doesDialectSupportDropTableIfExist() {
|
||||||
return Dialect.getDialect().supportsIfExistsAfterTableName() || Dialect.getDialect().supportsIfExistsBeforeTableName();
|
return Dialect.getDialect().supportsIfExistsAfterTableName() || Dialect.getDialect()
|
||||||
|
.supportsIfExistsBeforeTableName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -53,7 +52,12 @@ public void testCreateAndDropOnlyType() {
|
|||||||
SchemaExport schemaExport = createSchemaExport( cfg );
|
SchemaExport schemaExport = createSchemaExport( cfg );
|
||||||
// create w/o dropping first; (OK because tables don't exist yet
|
// create w/o dropping first; (OK because tables don't exist yet
|
||||||
schemaExport.execute( false, true, false, true );
|
schemaExport.execute( false, true, false, true );
|
||||||
|
if ( doesDialectSupportDropTableIfExist() ) {
|
||||||
assertEquals( 0, schemaExport.getExceptions().size() );
|
assertEquals( 0, schemaExport.getExceptions().size() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
assertEquals( 2, schemaExport.getExceptions().size() );
|
||||||
|
}
|
||||||
// create w/o dropping again; should be an exception for each table
|
// create w/o dropping again; should be an exception for each table
|
||||||
// (2 total) because the tables exist already
|
// (2 total) because the tables exist already
|
||||||
assertEquals( 0, schemaExport.getExceptions().size() );
|
assertEquals( 0, schemaExport.getExceptions().size() );
|
||||||
@ -91,8 +95,13 @@ public void testCreateAndDrop() {
|
|||||||
cfg.addResource( MAPPING );
|
cfg.addResource( MAPPING );
|
||||||
SchemaExport schemaExport = createSchemaExport( cfg );
|
SchemaExport schemaExport = createSchemaExport( cfg );
|
||||||
// should drop before creating, but tables don't exist yet
|
// should drop before creating, but tables don't exist yet
|
||||||
schemaExport.create( false, true);
|
schemaExport.create( false, true );
|
||||||
|
if ( doesDialectSupportDropTableIfExist() ) {
|
||||||
assertEquals( 0, schemaExport.getExceptions().size() );
|
assertEquals( 0, schemaExport.getExceptions().size() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
assertEquals( 2, schemaExport.getExceptions().size() );
|
||||||
|
}
|
||||||
// call create again; it should drop tables before re-creating
|
// call create again; it should drop tables before re-creating
|
||||||
schemaExport.create( false, true );
|
schemaExport.create( false, true );
|
||||||
assertEquals( 0, schemaExport.getExceptions().size() );
|
assertEquals( 0, schemaExport.getExceptions().size() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user