Index: src/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java =================================================================== --- src/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java (revision 389217) +++ src/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java (working copy) @@ -27,10 +27,12 @@ *
*Keywords: persistencemanagerfactory *
- *Assertion IDs: A11.4-2 + *Assertion IDs: A11.4-2, A11.4-10 *
*Assertion Description: * PersistenceManagerFactory.close() closes this PersistenceManagerFactory. + *Assertion Description: + * PersistenceManagerFactory.isClosed(); Return true if this PersistenceManagerFactory is closed; and false otherwise. */ @@ -38,8 +40,8 @@ /** */ private static final String ASSERTION_FAILED = - "Assertions A11.4-2 (Close) failed: "; - + "Assertions A11.4-2 (Close), A11.4-10 (isClosed) failed: "; + /** * The main is called when the class * is directly executed from the command line. @@ -52,9 +54,32 @@ /** */ public void test() { pmf = getPMF(); - pmf.close(); - //check that pmf is really closed by trying to get a getPersistenceManager + + // check pmf.isClosed() before and after pmf.close() try { + if (pmf.isClosed()) { + fail(ASSERTION_FAILED, + "PMF.isClosed() returned true on an open pmf"); + } + + pmf.close(); + + if (!pmf.isClosed()) { + fail(ASSERTION_FAILED, + "PMF.isClosed() returned false on a closed pmf"); + } + } catch (JDOUserException ex) { + // unexpected exception + fail(ASSERTION_FAILED, + "Unexpected exception at pmf.close()/isClosed(): " + ex); + } catch (JDOFatalUserException ex) { + // unexpected exception + fail(ASSERTION_FAILED, + "Unexpected exception at pmf.close()/isClosed(): " + ex); + } + + // trying to get a getPersistenceManager should result in a exception + try { pm = pmf.getPersistenceManager(); fail(ASSERTION_FAILED, "JDOUserException was not thrown when calling pmf.getPersistenceManager() after pmf was closed");