JDO
  1. JDO
  2. JDO-653

Extra checks in PMF.close tests

    Details

    • Type: Test Test
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JDO 2 maintenance release 2 (2.2)
    • Fix Version/s: JDO 3 (3.0)
    • Component/s: tck
    • Labels:
      None

      Description

      Some of the implications of section 11.4 don't appear to be checked for in the case of an already-closed PersistenceManagerFactory.

      1. If close() is called on an already-closed PMF (with correct permission i.e. "closePersistenceManagerFactory"), no exception should be thrown.

      2. If close() is called on an already-closed PMF (without correct permission), exception should be thrown (even though it would otherwise do nothing).

      3. If close() fails (throws JDOUserException) due to active transaction(s), then none of the PersistenceManager objects belonging to the PMF should have actually been closed.

      4. Several get/set pairs are not tested for their behaviour after close()

      1. JDO-653-tck.patch
        11 kB
        Peter Dettman
      2. JDO-653-2nd.patch
        11 kB
        Peter Dettman
      3. JDO-653.patch
        9 kB
        Peter Dettman

        Activity

        Peter Dettman created issue -
        Hide
        Peter Dettman added a comment -

        Attaching a patch to add the missing checks described above.

        Note: there was also a "fail" missing in CloseWithoutPermissionThrowsSecurityException for the case where no exception is thrown (but one is expected).

        Show
        Peter Dettman added a comment - Attaching a patch to add the missing checks described above. Note: there was also a "fail" missing in CloseWithoutPermissionThrowsSecurityException for the case where no exception is thrown (but one is expected).
        Peter Dettman made changes -
        Field Original Value New Value
        Attachment JDO-653.patch [ 12442866 ]
        Hide
        Peter Dettman added a comment -

        Apologies, first patch gives errors running tests. Second patch replaces first.

        The tests now run without errors, though there are several failures against the RI.

        Show
        Peter Dettman added a comment - Apologies, first patch gives errors running tests. Second patch replaces first. The tests now run without errors, though there are several failures against the RI.
        Peter Dettman made changes -
        Attachment JDO-653-2nd.patch [ 12442953 ]
        Michael Bouschen made changes -
        Assignee Michelle Caisse [ mcaisse ]
        Hide
        Michelle Caisse added a comment -

        After applying the second patch, I get three test failures for each identity type:
        Description: All pmf tests with standard mapping, no testdata.
        Time: 026
        There were 3 failures:
        1) test(org.apache.jdo.tck.api.persistencemanagerfactory.AfterCloseSetMethodsThrowException)junit.framework.AssertionFailedError: Assertion A11.4-9A (AfterCloseSetMethodsThrowException) failed:
        Caught unexpected exception org.datanucleus.exceptions.NucleusUserException: Invalid TimeZone ID specified from setServerTimeZoneID
        at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:682)
        at org.apache.jdo.tck.api.persistencemanagerfactory.AfterCloseSetMethodsThrowException.test(AfterCloseSetMethodsThrowException.java:148)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:272)
        at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
        at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
        at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)
        2) test(org.apache.jdo.tck.api.persistencemanagerfactory.Close)junit.framework.AssertionFailedError: Assertions A11.4-2 (Close), A11.4-10 (isClosed) failed:
        Unexpected exception at repeated pmf.close(): javax.jdo.JDOUserException: Can't access or use persistence factory after it has been closed.
        at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:682)
        at org.apache.jdo.tck.api.persistencemanagerfactory.Close.test(Close.java:98)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:272)
        at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
        at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
        at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)
        3) test(org.apache.jdo.tck.api.persistencemanagerfactory.CloseWithoutPermissionThrowsSecurityException)junit.framework.AssertionFailedError: Assertions A11.4-3 (CloseWithoutPermissionThrowsSecurityException) failed:
        Unexpected exception at pmf.close(): javax.jdo.JDOUserException: Can't access or use persistence factory after it has been closed.
        at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:682)
        at org.apache.jdo.tck.api.persistencemanagerfactory.CloseWithoutPermissionThrowsSecurityException.closeWithMySecurityManager(CloseWithoutPermissionThrowsSecurityException.java:89)
        at org.apache.jdo.tck.api.persistencemanagerfactory.CloseWithoutPermissionThrowsSecurityException.test(CloseWithoutPermissionThrowsSecurityException.java:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:272)
        at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
        at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
        at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)
        FAILURES!!!
        derby-app-pmf-junit.txt:

          • Tests run: 067, Time: 026 seconds. Failures: 3, Errors: 0
        Show
        Michelle Caisse added a comment - After applying the second patch, I get three test failures for each identity type: Description: All pmf tests with standard mapping, no testdata. Time: 026 There were 3 failures: 1) test(org.apache.jdo.tck.api.persistencemanagerfactory.AfterCloseSetMethodsThrowException)junit.framework.AssertionFailedError: Assertion A11.4-9A (AfterCloseSetMethodsThrowException) failed: Caught unexpected exception org.datanucleus.exceptions.NucleusUserException: Invalid TimeZone ID specified from setServerTimeZoneID at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:682) at org.apache.jdo.tck.api.persistencemanagerfactory.AfterCloseSetMethodsThrowException.test(AfterCloseSetMethodsThrowException.java:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:272) at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108) at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148) at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123) 2) test(org.apache.jdo.tck.api.persistencemanagerfactory.Close)junit.framework.AssertionFailedError: Assertions A11.4-2 (Close), A11.4-10 (isClosed) failed: Unexpected exception at repeated pmf.close(): javax.jdo.JDOUserException: Can't access or use persistence factory after it has been closed. at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:682) at org.apache.jdo.tck.api.persistencemanagerfactory.Close.test(Close.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:272) at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108) at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148) at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123) 3) test(org.apache.jdo.tck.api.persistencemanagerfactory.CloseWithoutPermissionThrowsSecurityException)junit.framework.AssertionFailedError: Assertions A11.4-3 (CloseWithoutPermissionThrowsSecurityException) failed: Unexpected exception at pmf.close(): javax.jdo.JDOUserException: Can't access or use persistence factory after it has been closed. at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:682) at org.apache.jdo.tck.api.persistencemanagerfactory.CloseWithoutPermissionThrowsSecurityException.closeWithMySecurityManager(CloseWithoutPermissionThrowsSecurityException.java:89) at org.apache.jdo.tck.api.persistencemanagerfactory.CloseWithoutPermissionThrowsSecurityException.test(CloseWithoutPermissionThrowsSecurityException.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:272) at org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108) at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148) at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123) FAILURES!!! derby-app-pmf-junit.txt: Tests run: 067, Time: 026 seconds. Failures: 3, Errors: 0
        Hide
        Peter Dettman added a comment -

        Yes, those tests currently fail against the reference implementation (DN 2.0.x).

        I am looking firstly for confirmation that these failures represent violations of the spec; see "11.4 Close the PersistenceManagerFactory" (http://people.apache.org/~clr/jdo-2010-04-09.pdf).

        Then it is my intention to patch the reference implementation to fix these problems once I have that confirmation.

        Obviously there are some interdependencies; I am unsure whether these test cases must remain in limbo until the RI is fixed, or whether there is a mechanism for known-failing tests to be added to the TCK.

        Show
        Peter Dettman added a comment - Yes, those tests currently fail against the reference implementation (DN 2.0.x). I am looking firstly for confirmation that these failures represent violations of the spec; see "11.4 Close the PersistenceManagerFactory" ( http://people.apache.org/~clr/jdo-2010-04-09.pdf ). Then it is my intention to patch the reference implementation to fix these problems once I have that confirmation. Obviously there are some interdependencies; I am unsure whether these test cases must remain in limbo until the RI is fixed, or whether there is a mechanism for known-failing tests to be added to the TCK.
        Hide
        Peter Dettman added a comment -

        Revised patch that affects "tck" subfolder

        Show
        Peter Dettman added a comment - Revised patch that affects "tck" subfolder
        Peter Dettman made changes -
        Attachment JDO-653-tck.patch [ 12448126 ]
        Hide
        Peter Dettman added a comment -

        The reference implementation for JDO3 is DataNucleus 2.1.0, which passes these new test cases.

        The revised patch, which adds the test cases to "tck", can therefore now be safely applied, and I have confirmed that indeed all tests run without errors or failures (but in particular pmf.conf, which this patch affects).

        Show
        Peter Dettman added a comment - The reference implementation for JDO3 is DataNucleus 2.1.0, which passes these new test cases. The revised patch, which adds the test cases to "tck", can therefore now be safely applied, and I have confirmed that indeed all tests run without errors or failures (but in particular pmf.conf, which this patch affects).
        Hide
        Craig L Russell added a comment -

        Patch applied to trunk: svn commit -m "JDO-653 Thanks to Peter Dettman for the patch" src/java
        Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseSetMethodsThrowException.java
        Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java
        Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseFailsIfTransactionActive.java
        Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseWithoutPermissionThrowsSecurityException.java
        Transmitting file data ....
        Committed revision 959037.

        Patch applied to branches/3.0: svn commit -m "JDO-653 Thanks to Peter Dettman for the patch" src/java
        Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseSetMethodsThrowException.java
        Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java
        Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseFailsIfTransactionActive.java
        Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseWithoutPermissionThrowsSecurityException.java
        Transmitting file data ....
        Committed revision 959039.

        Show
        Craig L Russell added a comment - Patch applied to trunk: svn commit -m " JDO-653 Thanks to Peter Dettman for the patch" src/java Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseSetMethodsThrowException.java Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseFailsIfTransactionActive.java Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseWithoutPermissionThrowsSecurityException.java Transmitting file data .... Committed revision 959037. Patch applied to branches/3.0: svn commit -m " JDO-653 Thanks to Peter Dettman for the patch" src/java Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseSetMethodsThrowException.java Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseFailsIfTransactionActive.java Sending src/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseWithoutPermissionThrowsSecurityException.java Transmitting file data .... Committed revision 959039.
        Craig L Russell made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s JDO 3 [ 12313404 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        64d 1h 53m 1 Craig L Russell 29/Jun/10 18:14

          People

          • Assignee:
            Michelle Caisse
            Reporter:
            Peter Dettman
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development