HHH-11434 - prevent failures in some tests from freezing the whole test suite
This commit is contained in:
parent
ec9e8dbdfa
commit
e62d71b76b
|
@ -16,6 +16,7 @@ import org.hibernate.testing.TestForIssue;
|
|||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
|
||||
import static org.hamcrest.core.Is.is;
|
||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
|
@ -32,25 +33,18 @@ public class FilterInheritanceTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
@Override
|
||||
protected void prepareTest() throws Exception {
|
||||
openSession();
|
||||
session.beginTransaction();
|
||||
|
||||
persistTestData();
|
||||
|
||||
session.getTransaction().commit();
|
||||
session.close();
|
||||
doInHibernate( this::sessionFactory, session -> {
|
||||
persistTestData();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanupTest() throws Exception {
|
||||
super.cleanupTest();
|
||||
openSession();
|
||||
session.beginTransaction();
|
||||
|
||||
session.createQuery( "delete from Human" ).executeUpdate();
|
||||
session.createQuery( "delete from Mammal" ).executeUpdate();
|
||||
session.getTransaction().commit();
|
||||
session.close();
|
||||
doInHibernate( this::sessionFactory, session -> {
|
||||
session.createQuery("delete from Human").executeUpdate();
|
||||
session.createQuery("delete from Mammal").executeUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
protected void persistTestData() {
|
||||
|
|
|
@ -52,6 +52,7 @@ import org.hibernate.testing.BeforeClassOnce;
|
|||
import org.hibernate.testing.OnExpectedFailure;
|
||||
import org.hibernate.testing.OnFailure;
|
||||
import org.hibernate.testing.cache.CachingRegionFactory;
|
||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
|
@ -481,11 +482,9 @@ public class BaseNonConfigCoreFunctionalTestCase extends BaseUnitTestCase {
|
|||
}
|
||||
|
||||
protected void cleanupTestData() throws Exception {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
s.createQuery( "delete from java.lang.Object" ).executeUpdate();
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
doInHibernate(this::sessionFactory, s -> {
|
||||
s.createQuery("delete from java.lang.Object").executeUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue