HHH-16900 Refactor integration tests
This commit is contained in:
parent
430929d3c3
commit
f0969d295a
|
@ -47,6 +47,7 @@ import org.hibernate.query.sqm.mutation.internal.temptable.GlobalTemporaryTableS
|
|||
import org.hibernate.query.sqm.mutation.internal.temptable.LocalTemporaryTableStrategy;
|
||||
import org.hibernate.query.sqm.mutation.internal.temptable.PersistentTableStrategy;
|
||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||
import org.hibernate.sql.model.MutationOperation;
|
||||
import org.hibernate.sql.model.MutationOperationGroup;
|
||||
import org.hibernate.sql.model.PreparableMutationOperation;
|
||||
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||
|
@ -408,38 +409,51 @@ public class DefaultCatalogAndSchemaTest {
|
|||
// This will include SQL generated by ID generators in some cases, which will be validated here
|
||||
// because ID generators table/sequence names are prefixed with the owning entity name.
|
||||
|
||||
final MutationOperationGroup staticSqlInsertGroup = persister.getInsertCoordinator().getStaticInsertGroup();
|
||||
final String[] insertSqls = new String[ staticSqlInsertGroup.getNumberOfOperations()];
|
||||
staticSqlInsertGroup.forEachOperation( (tablePosition, insertOperation) -> {
|
||||
if ( insertOperation instanceof PreparableMutationOperation ) {
|
||||
insertSqls[tablePosition] = ( (PreparableMutationOperation) insertOperation ).getSqlString();
|
||||
{
|
||||
final MutationOperationGroup staticSqlInsertGroup = persister.getInsertCoordinator().getStaticInsertGroup();
|
||||
final String[] insertSqls = new String[staticSqlInsertGroup.getNumberOfOperations()];
|
||||
for ( int tablePosition = 0;
|
||||
tablePosition < staticSqlInsertGroup.getNumberOfOperations();
|
||||
tablePosition++ ) {
|
||||
final MutationOperation insertOperation = staticSqlInsertGroup.getOperation( tablePosition );
|
||||
if ( insertOperation instanceof PreparableMutationOperation ) {
|
||||
insertSqls[tablePosition] = ( (PreparableMutationOperation) insertOperation ).getSqlString();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
verifyOnlyQualifier( insertSqls, SqlType.RUNTIME, jpaEntityName, expectedQualifier );
|
||||
verifyOnlyQualifier( insertSqls, SqlType.RUNTIME, jpaEntityName, expectedQualifier );
|
||||
}
|
||||
|
||||
String identitySelectString = persister.getIdentitySelectString();
|
||||
if ( identitySelectString != null ) {
|
||||
verifyOnlyQualifierOptional( identitySelectString, SqlType.RUNTIME, jpaEntityName, expectedQualifier );
|
||||
}
|
||||
|
||||
final MutationOperationGroup staticSqlUpdateGroup = persister.getUpdateCoordinator().getStaticUpdateGroup();
|
||||
final String[] sqlUpdateStrings = new String[staticSqlUpdateGroup.getNumberOfOperations()];
|
||||
staticSqlUpdateGroup.forEachOperation( (tablePosition, operation) -> {
|
||||
if ( operation instanceof PreparableMutationOperation ) {
|
||||
sqlUpdateStrings[tablePosition] = ( (PreparableMutationOperation) operation ).getSqlString();
|
||||
{
|
||||
final MutationOperationGroup staticSqlUpdateGroup = persister.getUpdateCoordinator().getStaticUpdateGroup();
|
||||
final String[] sqlUpdateStrings = new String[staticSqlUpdateGroup.getNumberOfOperations()];
|
||||
for ( int tablePosition = 0;
|
||||
tablePosition < staticSqlUpdateGroup.getNumberOfOperations();
|
||||
tablePosition++ ) {
|
||||
final MutationOperation operation = staticSqlUpdateGroup.getOperation( tablePosition );
|
||||
if ( operation instanceof PreparableMutationOperation ) {
|
||||
sqlUpdateStrings[tablePosition] = ( (PreparableMutationOperation) operation ).getSqlString();
|
||||
}
|
||||
}
|
||||
} );
|
||||
verifyOnlyQualifier( sqlUpdateStrings, SqlType.RUNTIME, jpaEntityName, expectedQualifier );
|
||||
verifyOnlyQualifier( sqlUpdateStrings, SqlType.RUNTIME, jpaEntityName, expectedQualifier );
|
||||
}
|
||||
|
||||
final MutationOperationGroup staticDeleteGroup = persister.getDeleteCoordinator().getStaticDeleteGroup();
|
||||
final String[] sqlDeleteStrings = new String[staticDeleteGroup.getNumberOfOperations()];
|
||||
staticDeleteGroup.forEachOperation( (tablePosition, operation) -> {
|
||||
if ( operation instanceof PreparableMutationOperation ) {
|
||||
sqlDeleteStrings[tablePosition] = ( (PreparableMutationOperation) operation ).getSqlString();
|
||||
|
||||
{
|
||||
final MutationOperationGroup staticDeleteGroup = persister.getDeleteCoordinator().getStaticDeleteGroup();
|
||||
final String[] sqlDeleteStrings = new String[staticDeleteGroup.getNumberOfOperations()];
|
||||
for ( int tablePosition = 0; tablePosition < staticDeleteGroup.getNumberOfOperations(); tablePosition++ ) {
|
||||
final MutationOperation operation = staticDeleteGroup.getOperation( tablePosition );
|
||||
if ( operation instanceof PreparableMutationOperation ) {
|
||||
sqlDeleteStrings[tablePosition] = ( (PreparableMutationOperation) operation ).getSqlString();
|
||||
}
|
||||
}
|
||||
} );
|
||||
verifyOnlyQualifier( sqlDeleteStrings, SqlType.RUNTIME, jpaEntityName, expectedQualifier );
|
||||
verifyOnlyQualifier( sqlDeleteStrings, SqlType.RUNTIME, jpaEntityName, expectedQualifier );
|
||||
}
|
||||
|
||||
// This is used in the "select" id generator in particular.
|
||||
verifyOnlyQualifierOptional( persister.getSelectByUniqueKeyString( "basic" ), SqlType.RUNTIME,
|
||||
|
|
Loading…
Reference in New Issue