[hibernate-commits] Hibernate SVN: r16377 - core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Apr 21 09:15:48 EDT 2009


Author: jcosta at redhat.com
Date: 2009-04-21 09:15:48 -0400 (Tue, 21 Apr 2009)
New Revision: 16377

Modified:
   core/trunk/entitymanager/src/test/java/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 trunk

Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/EJB3TestCase.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/EJB3TestCase.java	2009-04-21 13:15:14 UTC (rev 16376)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/EJB3TestCase.java	2009-04-21 13:15:48 UTC (rev 16377)
@@ -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();




More information about the hibernate-commits mailing list