Author: jcosta(a)redhat.com
Date: 2009-04-21 09:15:14 -0400 (Tue, 21 Apr 2009)
New Revision: 16376
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java
Log:
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 branch v3_3_2_GA_CP
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java
===================================================================
---
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21
13:14:49 UTC (rev 16375)
+++
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21
13:15:14 UTC (rev 16376)
@@ -113,11 +113,17 @@
}
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();