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:
parent
ff1be35e7d
commit
468743d2a7
|
@ -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 {
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue