make sure tests close EMs and EMFs

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1022292 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2010-10-13 21:13:22 +00:00
parent ede1ebe30f
commit dbbb6bf815
7 changed files with 13 additions and 10 deletions

View File

@ -167,9 +167,4 @@ public class TestBiDirectionalJoinTable extends SQLListenerTestCase {
assertEquals(1+2*ADDRESS_COUNT, sql.size());
}
@Override
public void tearDown() {
}
}

View File

@ -57,8 +57,9 @@ public class TestOneSidedParentChildWithImplicitForeignKey extends
private static long CHILD_ID_COUNTER = System.currentTimeMillis();
private static int CHILD_COUNT = 3;
@Override
public void setUp() {
setUp(DROP_TABLES, ParentWithAppIdentity.class,
super.setUp(DROP_TABLES, ParentWithAppIdentity.class,
ParentWithSequenceIdentity.class, ParentWithAutoIdentity.class,
Child.class);
em = emf.createEntityManager();
@ -150,8 +151,10 @@ public class TestOneSidedParentChildWithImplicitForeignKey extends
em.getTransaction().commit();
}
public void tearDown() {
@Override
public void tearDown() throws Exception {
closeEM(em);
super.tearDown();
}
public IParent newParent(int parentType) {

View File

@ -95,6 +95,8 @@ public class TestQualifiedPath extends SQLListenerTestCase {
q = em.createQuery(query);
rs = q.getResultList();
assertEquals(1, rs.size());
em.close();
em = null;
}
private void createObj() {

View File

@ -247,6 +247,7 @@ public class TestSpec10_1_27 extends SQLListenerTestCase {
VicePresident vp = em.find(VicePresident.class, 1);
assertVicePresident(vp);
em.close();
}
public void assertItem1(Item1 item) {

View File

@ -182,8 +182,8 @@ public class TestSpec10_1_27_Ex5 extends SQLListenerTestCase {
c = em.find(Company.class, 1);
assertCompany(c);
deleteObj(em, c);
*/
em.close();
*/
}
public void updateObj1(EntityManager em, Company c) {

View File

@ -184,8 +184,8 @@ public class TestSpec10_1_27_Ex7 extends SQLListenerTestCase {
c = em.find(Company.class, 1);
assertCompany(c);
deleteObj(em, c);
*/
em.close();
*/
}
public void updateObj1(EntityManager em, Company c) {

View File

@ -59,6 +59,7 @@ public class TestMapUpdate extends SQLListenerTestCase {
ms = em.find(MultilingualString.class, entity1.getId());
assertEquals("Good evening", ms.getText("en"));
em.getTransaction().commit();
em.close();
}
public void testUpdateMapValue() throws Exception {
@ -79,6 +80,7 @@ public class TestMapUpdate extends SQLListenerTestCase {
// This assertion fails, the entity still has the old value.
assertEquals("Good evening", ms.getText("en"));
em.getTransaction().commit();
em.close();
}
private void createObj(EntityManagerFactory emf) {