HHH-11434 - prevent failures in some tests from freezing the whole test suite
This commit is contained in:
parent
e62d71b76b
commit
8f6e4d5675
|
@ -34,20 +34,6 @@ public class FilterInheritanceTest extends BaseCoreFunctionalTestCase {
|
|||
@Override
|
||||
protected void prepareTest() throws Exception {
|
||||
doInHibernate( this::sessionFactory, session -> {
|
||||
persistTestData();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanupTest() throws Exception {
|
||||
super.cleanupTest();
|
||||
doInHibernate( this::sessionFactory, session -> {
|
||||
session.createQuery("delete from Human").executeUpdate();
|
||||
session.createQuery("delete from Mammal").executeUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
protected void persistTestData() {
|
||||
Mammal mammal = new Mammal();
|
||||
mammal.setName( "unimportant" );
|
||||
session.persist( mammal );
|
||||
|
@ -59,28 +45,25 @@ public class FilterInheritanceTest extends BaseCoreFunctionalTestCase {
|
|||
Human human1 = new Human();
|
||||
human1.setName( "unimportant_1" );
|
||||
session.persist( human1 );
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-8895")
|
||||
public void testSlectFromHuman() throws Exception {
|
||||
openSession();
|
||||
public void testSelectFromHuman() throws Exception {
|
||||
doInHibernate( this::sessionFactory, session -> {
|
||||
session.enableFilter( "nameFilter" ).setParameter( "name", "unimportant" );
|
||||
try {
|
||||
transaction = session.beginTransaction();
|
||||
|
||||
List humans = session.createQuery( "SELECT h FROM Human h" ).list();
|
||||
|
||||
assertThat( humans.size(), is( 1 ) );
|
||||
Human human = (Human) humans.get( 0 );
|
||||
assertThat(human.getName(), is("unimportant"));
|
||||
|
||||
transaction.commit();
|
||||
}
|
||||
catch (Exception e) {
|
||||
if ( transaction != null ) {
|
||||
transaction.rollback();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
assertThat( human.getName(), is( "unimportant" ) );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue