You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Michael Bouschen (JIRA)" <ji...@apache.org> on 2006/03/11 13:22:07 UTC

[jira] Created: (JDO-335) Close PMF after running each configuration

Close PMF after running each configuration
------------------------------------------

         Key: JDO-335
         URL: http://issues.apache.org/jira/browse/JDO-335
     Project: JDO
        Type: Improvement
  Components: tck20  
    Versions: JDO 2 rc1    
    Reporter: Michael Bouschen
 Assigned to: Michael Bouschen 
    Priority: Minor
     Fix For: JDO 2 final


Today method tearDown (that is run at the end of each test method) closes the pmf. 

The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-335) Close PMF after running each configuration

Posted by "Erik Bengtson (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-335?page=comments#action_12370022 ] 

Erik Bengtson commented on JDO-335:
-----------------------------------

I agree with Christian. I don't remember specific cases to detail, but I can recall from JPOX development that using new PMFs might expose bugs hidden when using a hot PMF.

> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-335) Close PMF after running each configuration

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-335?page=comments#action_12370035 ] 

Craig Russell commented on JDO-335:
-----------------------------------

Looks good.

The comment:
+     * <b>Note:</b>Method tearDown does not close the pmf. This is done at the
+     * end of each configuration.

probably should be changed to incorporate the closePMFAfterEachTest behavior.

+     * <b>Note:</b>By default, the method tearDown does not close the pmf. 
This is done at the
+     * end of each configuration, unless the property jdo.tck.closePMFAfterEachTest 
is set to true.


> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335-2.patch, JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-335) Close PMF after running each configuration

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-335?page=comments#action_12370020 ] 

Craig Russell commented on JDO-335:
-----------------------------------

I think it is ok to avoid closing the PMF until the end of the configuration. Each setUp and tearDown in the tests cleans up the persistent instances in the datastore.

If the JDO implementation is doing caching in the PMF, then the caching must not affect the results of running the TCK. 

Do you know that there is a specific issue with caching that can be explained in some more detail? 

> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (JDO-335) Close PMF after running each configuration

Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-335?page=all ]

Michael Bouschen updated JDO-335:
---------------------------------

    Attachment: JDO-335-2.patch

The new patch JDO-335-2.patch adds the system property jdo.tck.closePMFAfterEachTest to JDO_Test. If set to true closePMF is called as part of tearDown, otherwise the pmf is closed at the end of each configuration. The property defaults to false. It may be specified as -D option on the maven call. 

I also changed the maven output at the end of each configuration to include the configuration name.

> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335-2.patch, JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-335) Close PMF after running each configuration

Posted by "Michael Watzek (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-335?page=comments#action_12370194 ] 

Michael Watzek commented on JDO-335:
------------------------------------

One comment related to the patch checked in:

Does it make sense to call closePMF() in a finally block just to make sure it is executed in case of exceptions?


> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335-2.patch, JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (JDO-335) Close PMF after running each configuration

Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-335?page=all ]
     
Michael Bouschen resolved JDO-335:
----------------------------------

    Resolution: Fixed

Checked in the patch with the updated comment (see revision 385184).

> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335-2.patch, JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-335) Close PMF after running each configuration

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-335?page=comments#action_12370026 ] 

Craig Russell commented on JDO-335:
-----------------------------------

Perhaps we can add a flag jdo.tck.closePMFAfterEachTest that defaults to false for the TCK runs. Then you can debug your implementation with the flag set to true and the TCK can run faster for the normal case.

> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-335) Close PMF after running each configuration

Posted by "Christian Ernst (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-335?page=comments#action_12369989 ] 

Christian Ernst commented on JDO-335:
-------------------------------------

>From my point of view we might must close even the PMF more often.
So removing from teardown is in my eyes a bad idea.
The reason is that we never now what kind of caching the JDO Implementation is doing
and only the closing of a PMF allows us to be sure that there is nothing cached.

> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-335) Close PMF after running each configuration

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-335?page=comments#action_12370203 ] 

Craig Russell commented on JDO-335:
-----------------------------------

IIUC, the only place that close() will be called now is here:

+    /** Runs the specified test and close the pmf. */
+    public TestResult doRun(Test test) {
+        TestResult result = doRun(test, false);
+        JDO_Test.closePMF();
+        return result;
+    }

The question is whether doRun(test, false) will ever throw an exception, causing the closePMF call to be bypassed.

One other point. While looking at this method, I was wondering whether the PMF would be closed when running the test from maven, i.e. using the TestSuite procedure. It wasn't clear that this method is also invoked when running via TestSuite. I think a javadoc comment that this method is used for both TestCase and TestSuite would be nice.

+    /** Runs the specified test or test suite and closes the pmf. */


> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335-2.patch, JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-335) Close PMF after running each configuration

Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-335?page=comments#action_12370033 ] 

Michael Bouschen commented on JDO-335:
--------------------------------------

I like the idea of having a property jdo.tck.closePMFAfterEachTest that defaults to false. I will implement this and add a new patch.


> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (JDO-335) Close PMF after running each configuration

Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-335?page=all ]

Michael Bouschen updated JDO-335:
---------------------------------

    Attachment: JDO-335.patch

Attached you find a patch (JDO-335.patch) for review. It makes method JDO_Test.closePMF static, such that it can be called from BatchTestRunner. It also removes the call of closePMF from tearDown.

> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-335) Close PMF after running each configuration

Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-335?page=comments#action_12370225 ] 

Michael Bouschen commented on JDO-335:
--------------------------------------

Well, JDO_Test calls closePMF during tearDown if the property closePMFAfterEachTest is set to true.

I agree with Michael W's comment and propose to change the implementation to:

    /** Runs the specified test or test suite and closes the pmf. */
    public TestResult doRun(Test test) {
        TestResult result = null;
        try {
            result = doRun(test, false);
            JDO_Test.dumpSupportedOptions(LOG_DIRECTORY + "configuration");
        } finally {
            JDO_Test.closePMF();
        }
        return result;
    }


> Close PMF after running each configuration
> ------------------------------------------
>
>          Key: JDO-335
>          URL: http://issues.apache.org/jira/browse/JDO-335
>      Project: JDO
>         Type: Improvement
>   Components: tck20
>     Versions: JDO 2 rc1
>     Reporter: Michael Bouschen
>     Assignee: Michael Bouschen
>     Priority: Minor
>      Fix For: JDO 2 final
>  Attachments: JDO-335-2.patch, JDO-335.patch
>
> Today method tearDown (that is run at the end of each test method) closes the pmf. 
> The proposal is to keep the pmf open for the next test method and close it at the end of running a configuration. That would allow to reuse resources bound to the pmf in multiple test cases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira