HHH-13525 Make test SessionDelegatorBaseImplTest more resilient to previously existing alias definition

(cherry picked from commit d6abbe5124)
This commit is contained in:
Sanne Grinovero 2019-07-30 11:49:44 +01:00 committed by gbadner
parent 81d7be0ad3
commit 3dbf0166fe
1 changed files with 4 additions and 1 deletions

View File

@ -29,6 +29,7 @@ public class SessionDelegatorBaseImplTest extends BaseCoreFunctionalTestCase {
inTransaction( session -> { inTransaction( session -> {
session.doWork( connection -> { session.doWork( connection -> {
try (Statement statement = connection.createStatement()) { try (Statement statement = connection.createStatement()) {
statement.executeUpdate( "DROP ALIAS findOneUser IF EXISTS" );
statement.executeUpdate( statement.executeUpdate(
"CREATE ALIAS findOneUser AS $$\n" + "CREATE ALIAS findOneUser AS $$\n" +
"import org.h2.tools.SimpleResultSet;\n" + "import org.h2.tools.SimpleResultSet;\n" +
@ -55,7 +56,9 @@ public class SessionDelegatorBaseImplTest extends BaseCoreFunctionalTestCase {
try (Statement statement = connection.createStatement()) { try (Statement statement = connection.createStatement()) {
statement.executeUpdate( "DROP ALIAS findOneUser IF EXISTS" ); statement.executeUpdate( "DROP ALIAS findOneUser IF EXISTS" );
} }
catch (SQLException ignore) { catch (SQLException e) {
//Do not ignore as failure to cleanup might lead to other tests to fail:
throw new RuntimeException( e );
} }
} ); } );
} ); } );