HHH-12833 Fix UniqueConstraintDropTest with DB2
This commit is contained in:
parent
ad5f96c613
commit
9286f9147b
|
@ -20,6 +20,7 @@ import org.hibernate.boot.registry.StandardServiceRegistry;
|
|||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.DB2Dialect;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.dialect.MySQLDialect;
|
||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
|
@ -111,6 +112,9 @@ public class UniqueConstraintDropTest {
|
|||
is( true )
|
||||
);
|
||||
}
|
||||
else if ( getDialect() instanceof DB2Dialect ) {
|
||||
checkDB2DropIndex( "test_entity_item", "item" );
|
||||
}
|
||||
else {
|
||||
assertThat(
|
||||
"The test_entity_item table unique constraint has not been dropped",
|
||||
|
@ -154,6 +158,12 @@ public class UniqueConstraintDropTest {
|
|||
return isMatching( matches, regex );
|
||||
}
|
||||
|
||||
private boolean checkDB2DropIndex(String tableName, String columnName) throws IOException {
|
||||
boolean matches = false;
|
||||
String regex = "drop index " + tableName + ".uk_(.)*";
|
||||
return isMatching( matches, regex );
|
||||
}
|
||||
|
||||
private boolean isMatching(boolean matches, String regex) throws IOException {
|
||||
final String fileContent = new String( Files.readAllBytes( output.toPath() ) ).toLowerCase();
|
||||
final String[] split = fileContent.split( System.lineSeparator() );
|
||||
|
|
Loading…
Reference in New Issue