Index: maven.xml =================================================================== --- maven.xml (Revision 385042) +++ maven.xml (Arbeitskopie) @@ -381,6 +381,8 @@ value="${jdo.tck.requiredOptions}"/> + @@ -388,6 +390,7 @@ + Finished configuration="${jdo.tck.cfg}" with database="${jdo.tck.database}" identitytype="${jdo.tck.identitytype}" mapping="${jdo.tck.mapping}". @@ -442,6 +445,8 @@ value="${jdo.tck.requiredOptions}"/> + @@ -449,7 +454,7 @@ - Finished run with database="${jdo.tck.database}" identitytype="${jdo.tck.identitytype}" mapping="${jdo.tck.mapping}". + Finished configuration="${jdo.tck.cfg}" with database="${jdo.tck.database}" identitytype="${jdo.tck.identitytype}" mapping="${jdo.tck.mapping}". Index: src/java/org/apache/jdo/tck/JDO_Test.java =================================================================== --- src/java/org/apache/jdo/tck/JDO_Test.java (Revision 385042) +++ src/java/org/apache/jdo/tck/JDO_Test.java (Arbeitskopie) @@ -155,12 +155,18 @@ */ protected static boolean cleanupData = System.getProperty("jdo.tck.cleanupaftertest", "true").equalsIgnoreCase("true"); + + /** Flag indicating whether to close the PMF after each test or not. + * It defaults to false. + */ + protected static final boolean closePMFAfterEachTest = + System.getProperty("jdo.tck.closePMFAfterEachTest", "false").equalsIgnoreCase("true"); /** The Properties object for the PersistenceManagerFactory. */ protected static Properties PMFPropertiesObject; /** The PersistenceManagerFactory. */ - protected PersistenceManagerFactory pmf; + protected static PersistenceManagerFactory pmf; /** The PersistenceManager. */ protected PersistenceManager pm; @@ -261,7 +267,10 @@ * That exception is thrown as a nested exception of JDOFatalException * if and only if the testcase executed successful. * Otherwise that exception is logged using fatal log level. - * All other exceptions are logged using fatal log level, always. + * All other exceptions are logged using fatal log level, always.

+ * + * Note:Method tearDown does not close the pmf. This is done at the + * end of each configuration. */ protected final void tearDown() { try { @@ -287,12 +296,14 @@ setTearDownThrowable("localTearDown", t); } - try { - closePMF(); + if (closePMFAfterEachTest) { + try { + closePMF(); + } + catch (Throwable t) { + setTearDownThrowable("closePMF", t); + } } - catch (Throwable t) { - setTearDownThrowable("closePMF", t); - } if (this.tearDownThrowable != null) { Throwable t = this.tearDownThrowable; @@ -473,7 +484,7 @@ } /** Closes the pmf stored in this instance. */ - protected void closePMF() { + public static void closePMF() { JDOException failure = null; while (pmf != null) { try { @@ -499,7 +510,7 @@ } /** */ - protected PersistenceManager[] getFailedPersistenceManagers( + protected static PersistenceManager[] getFailedPersistenceManagers( String assertionFailure, JDOException ex) { Throwable[] nesteds = ex.getNestedExceptions(); int numberOfExceptions = nesteds==null ? 0 : nesteds.length; @@ -510,7 +521,7 @@ if (exc.getFailedObject() instanceof PersistenceManager) { result[i] = (PersistenceManager)failedObject; } else { - fail(assertionFailure, + throw new JDOFatalException(assertionFailure, "Unexpected failed object of type: " + failedObject.getClass().getName()); } Index: src/java/org/apache/jdo/tck/util/BatchTestRunner.java =================================================================== --- src/java/org/apache/jdo/tck/util/BatchTestRunner.java (Revision 385042) +++ src/java/org/apache/jdo/tck/util/BatchTestRunner.java (Arbeitskopie) @@ -32,6 +32,8 @@ import javax.jdo.JDOFatalException; +import org.apache.jdo.tck.JDO_Test; + /** * TestRunner class for running a single test or a test suite in batch * mode. The format of the test output is specified by the result printer @@ -85,6 +87,13 @@ new BatchTestRunner().doRun(suite, true); } + /** Runs the specified test and close the pmf. */ + public TestResult doRun(Test test) { + TestResult result = doRun(test, false); + JDO_Test.closePMF(); + return result; + } + /** * Runs in batch mode and sets an exit code. If the specified String * array includes a single fully qualified class name, this test class