EJB-418 - Added tearDown method to EJB3TestCase, as the current behaviour was keeping some dirt in the database after the execution of the last test in the EJB3TestCase hierarquy. For trunk

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@16377 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Juraci Krohling 2009-04-21 13:15:48 +00:00
parent 70362709f6
commit 4ff6065093
1 changed files with 7 additions and 1 deletions

View File

@ -113,11 +113,17 @@ public abstract class EJB3TestCase extends junit.framework.TestCase {
}
protected void setUp() throws Exception {
if ( getSessions() == null || lastTestClass != getClass() ) {
if ( getSessions() == null || lastTestClass != getClass() || getSessions().isClosed() ) {
buildSessionFactory( getMappings() );
lastTestClass = getClass();
}
}
protected void tearDown() throws Exception {
if (getSessions() != null && !getSessions().isClosed()) {
getSessions().close();
}
}
protected void runTest() throws Throwable {
final boolean stats = ( (SessionFactoryImplementor) sessions ).getStatistics().isStatisticsEnabled();