Author: jcosta(a)redhat.com
Date: 2009-04-21 09:14:49 -0400 (Tue, 21 Apr 2009)
New Revision: 16375
Modified:
entitymanager/branches/v3_4_0_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_4_0_GA_CP
Modified:
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java
===================================================================
---
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21
11:48:01 UTC (rev 16374)
+++
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/EJB3TestCase.java 2009-04-21
13:14:49 UTC (rev 16375)
@@ -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();