JDO
  1. JDO
  2. JDO-557

Create tests in api2 & api2-legacy for JDO implementation's static method getPersistenceManagerFactory(Map,Map)

    Details

    • Type: Task Task
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JDO 2 maintenance release 1 (2.1)
    • Fix Version/s: JDO 3 (3.0)
    • Component/s: api, api2-legacy
    • Labels:
      None

      Description

      The code paths that lead to calling the JDO implementation's PersistenceManagerFactory class's static method getPersistenceManagerFactory(Map,Map) need to be tested. In order to avoid a dependency on a real implementation, a stub PMF implementation class should be used.

      1. jdo-557.patch
        26 kB
        Michelle Caisse

        Activity

        Hide
        Andy Jefferson added a comment -

        This also needs to update the SignatureTest for the API2 changes

        Show
        Andy Jefferson added a comment - This also needs to update the SignatureTest for the API2 changes
        Hide
        Craig L Russell added a comment -

        The code is now tested via the tck tests added for maintenance release 1. Adding tests to the api2 and api2-legacy projects should be evaluated to make sure that the code paths are all exercised.

        Show
        Craig L Russell added a comment - The code is now tested via the tck tests added for maintenance release 1. Adding tests to the api2 and api2-legacy projects should be evaluated to make sure that the code paths are all exercised.
        Hide
        Michael Bouschen added a comment -

        I think we need to add a mock PMF implementation (similar to the MockEnhancer class) and use the mock PMF implementation for the api2 test case..

        The class implements the PMF interface and should go into the directory api2/test/java/javax/jdo. It provides a static method getPersistenceManagerFactory (Map overrides, Map props). The class also needs to implement the setter and getter methods for the PMF properties. All other methods - especially the getPersistenceManager methods - should throw an exception. The api2 test case should then call the JDOHelper methods to create a PMF using the Mock PMF as the configured implementation class.

        Show
        Michael Bouschen added a comment - I think we need to add a mock PMF implementation (similar to the MockEnhancer class) and use the mock PMF implementation for the api2 test case.. The class implements the PMF interface and should go into the directory api2/test/java/javax/jdo. It provides a static method getPersistenceManagerFactory (Map overrides, Map props). The class also needs to implement the setter and getter methods for the PMF properties. All other methods - especially the getPersistenceManager methods - should throw an exception. The api2 test case should then call the JDOHelper methods to create a PMF using the Mock PMF as the configured implementation class.
        Hide
        Michelle Caisse added a comment -

        I'm not clear how we can use a dynamic proxy here.When JDOHelper() invokes the implementation's PMF's static getPMF method, it does so by reflection on the pmf class. Providing an instance that delegates to an invocation handler won't work. Also, I'm not sure that we could provide an implementation of a static method with a dynamic proxy.

        Do we need to provide our own implemetation of PMF, with stubs for most methods?

        Show
        Michelle Caisse added a comment - I'm not clear how we can use a dynamic proxy here.When JDOHelper() invokes the implementation's PMF's static getPMF method, it does so by reflection on the pmf class. Providing an instance that delegates to an invocation handler won't work. Also, I'm not sure that we could provide an implementation of a static method with a dynamic proxy. Do we need to provide our own implemetation of PMF, with stubs for most methods?
        Hide
        Michelle Caisse added a comment -

        Attached draft work for this issue containing three new files, along with error message that is currently output. Error text is appended to end of patch.

        Show
        Michelle Caisse added a comment - Attached draft work for this issue containing three new files, along with error message that is currently output. Error text is appended to end of patch.
        Hide
        Michelle Caisse added a comment -

        New draft patch for review.

        Show
        Michelle Caisse added a comment - New draft patch for review.
        Hide
        Michelle Caisse added a comment -

        First two tests work; third (passing props to JDOHelper.getPMF()) fails with cannot find PersistenceManagerFactoryClass.

        Show
        Michelle Caisse added a comment - First two tests work; third (passing props to JDOHelper.getPMF()) fails with cannot find PersistenceManagerFactoryClass.
        Hide
        Michelle Caisse added a comment -

        This patch is ready for review.

        Show
        Michelle Caisse added a comment - This patch is ready for review.
        Hide
        Michelle Caisse added a comment -

        Okay, this patch has the right stuff.

        Show
        Michelle Caisse added a comment - Okay, this patch has the right stuff.
        Hide
        Michelle Caisse added a comment -

        Complete w/ revision 956317. Tests all pass. Changes requested by reviewers added

        Show
        Michelle Caisse added a comment - Complete w/ revision 956317. Tests all pass. Changes requested by reviewers added

          People

          • Assignee:
            Michelle Caisse
            Reporter:
            Matthew T. Adams
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development