EJB-407 - Fixing the test cases, to close the EM and/or finish the active transaction

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@15676 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Juraci Krohling 2008-12-10 12:01:47 +00:00
parent ff1be35e7d
commit 468743d2a7
5 changed files with 8 additions and 0 deletions

View File

@ -116,6 +116,7 @@ public class CallbacksTest extends TestCase {
em.flush(); em.flush();
assertNotNull( rc.getCreationDate() ); assertNotNull( rc.getCreationDate() );
em.getTransaction().rollback(); em.getTransaction().rollback();
em.close();
} }
public void testCallBackListenersHierarchy() throws Exception { public void testCallBackListenersHierarchy() throws Exception {

View File

@ -66,6 +66,9 @@ public class FlushTest extends TestCase {
for (Decorate value : founds) { for (Decorate value : founds) {
assertTrue( names.contains( value.getPet().getName() ) ); assertTrue( names.contains( value.getPet().getName() ) );
} }
manager.getTransaction().rollback();
manager.close();
} }

View File

@ -99,6 +99,7 @@ public class ExceptionTest extends TestCase {
catch( PersistenceException e ) { catch( PersistenceException e ) {
Throwable t = e.getCause(); Throwable t = e.getCause();
assertTrue("Should be a constraint violation", t instanceof ConstraintViolationException); assertTrue("Should be a constraint violation", t instanceof ConstraintViolationException);
em.getTransaction().rollback();
} }
finally { finally {
em.close(); em.close();

View File

@ -30,6 +30,8 @@ public class LockTest extends TestCase {
assertEquals( "surname", lock.getName() ); assertEquals( "surname", lock.getName() );
em.remove( lock ); em.remove( lock );
em.getTransaction().commit(); em.getTransaction().commit();
em.close();
} }
public void testLockWrite() throws Exception { public void testLockWrite() throws Exception {

View File

@ -42,6 +42,7 @@ public class FlushAndTransactionTest extends TestCase {
em.getTransaction().begin(); em.getTransaction().begin();
em.remove( em.find( Book.class, book.id ) ); em.remove( em.find( Book.class, book.id ) );
em.getTransaction().commit(); em.getTransaction().commit();
em.close();
} }
// public void testTransactionalOperationsWhenTransactional() throws Exception { // public void testTransactionalOperationsWhenTransactional() throws Exception {