HHH-6702 mysql 51 test failures

This commit is contained in:
Strong Liu 2011-10-01 02:30:09 +08:00
parent 3c07e5d6ba
commit 56ce194a29
1 changed files with 62 additions and 53 deletions

View File

@ -23,8 +23,6 @@
*/
package org.hibernate.test.schemaupdate;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.hibernate.cfg.Configuration;
@ -43,7 +41,8 @@ public abstract class SchemaExportTest extends BaseUnitTestCase {
protected abstract SchemaExport createSchemaExport(Configuration cfg);
private boolean doesDialectSupportDropTableIfExist() {
return Dialect.getDialect().supportsIfExistsAfterTableName() || Dialect.getDialect().supportsIfExistsBeforeTableName();
return Dialect.getDialect().supportsIfExistsAfterTableName() || Dialect.getDialect()
.supportsIfExistsBeforeTableName();
}
@Test
@ -53,7 +52,12 @@ public abstract class SchemaExportTest extends BaseUnitTestCase {
SchemaExport schemaExport = createSchemaExport( cfg );
// create w/o dropping first; (OK because tables don't exist yet
schemaExport.execute( false, true, false, true );
if ( doesDialectSupportDropTableIfExist() ) {
assertEquals( 0, schemaExport.getExceptions().size() );
}
else {
assertEquals( 2, schemaExport.getExceptions().size() );
}
// create w/o dropping again; should be an exception for each table
// (2 total) because the tables exist already
assertEquals( 0, schemaExport.getExceptions().size() );
@ -92,7 +96,12 @@ public abstract class SchemaExportTest extends BaseUnitTestCase {
SchemaExport schemaExport = createSchemaExport( cfg );
// should drop before creating, but tables don't exist yet
schemaExport.create( false, true );
if ( doesDialectSupportDropTableIfExist() ) {
assertEquals( 0, schemaExport.getExceptions().size() );
}
else {
assertEquals( 2, schemaExport.getExceptions().size() );
}
// call create again; it should drop tables before re-creating
schemaExport.create( false, true );
assertEquals( 0, schemaExport.getExceptions().size() );