more testcase comments about what gets cleaned up and print err msg if an EM or EMF cannot be closed.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1022698 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2010-10-14 20:39:11 +00:00
parent c479f35f68
commit db1ce09390
4 changed files with 14 additions and 7 deletions

View File

@ -234,7 +234,9 @@ public abstract class AbstractPersistenceTestCase extends TestCase {
} finally {
emf.close();
brc = !emf.isOpen();
emf = null;
if (!brc) {
System.err.println("AbstractPersistenceTestCase().closeEMF() - EMF is still open.");
}
}
return brc;
}
@ -253,7 +255,11 @@ public abstract class AbstractPersistenceTestCase extends TestCase {
em.getTransaction().rollback();
}
em.close();
return true;
boolean brc = !em.isOpen();
if (!brc) {
System.err.println("AbstractPersistenceTestCase().closeEM() - EM is still open.");
}
return brc;
}
/**

View File

@ -31,7 +31,8 @@ import org.apache.openjpa.lib.jdbc.JDBCListener;
/**
* Base class for tests that need to check generated SQL.
* Extends SingleEMFTestCase, which will cleanup the EMF it provides.
* Extends SingleEMFTestCase, which will cleanup the EMF it provides,
* along with any EMs generated by that EMF.
*
* @author Patrick Linskey
*/

View File

@ -38,8 +38,8 @@ import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
* OpenJPA-extended SPI interface <code>OpenJPAEntityManagerFactorySPI</code>
* so that derived classes can access internal mapping/metadata/configuration
* and other structures.
* Extends AbstractCachedEMFTestCase, which extends AbstractPersistenceTestCase
* and cleans up the EMF it provides in tearDown().
* Extends AbstractCachedEMFTestCase, which extends AbstractPersistenceTestCase.
* Cleans up the EMF it provides and any EMs created from it in tearDown().
*
*/
public abstract class SingleEMFTestCase

View File

@ -59,8 +59,8 @@ public abstract class SingleEMTestCase
@Override
public void tearDown() throws Exception {
rollback();
close();
closeEM(em);
em = null;
super.tearDown();
}