Issue Details (XML | Word | Printable)

Key: JDO-48
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Michael Watzek
Reporter: Michelle Caisse
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JDO

Tests fail attempting to delete from PCPOINT

Created: 19/May/05 01:48 PM   Updated: 23/Apr/06 02:30 AM
Return to search
Component/s: tck11, tck2
Affects Version/s: None
Fix Version/s: JDO 2 beta

Time Tracking:
Not Specified

Resolution Date: 23/Apr/06 02:30 AM


 Description  « Hide
In tck20, 34 tests fail attempting to delete PCPoint objects from the datastore. The problem is that lifecycle.HollowInstanceMantainsPK leaves a PCRect object behind that references the PCPoint that query tests attempt to delete.

I think we need to globally examine how all the tests in the TCK clean up. The persistencemanager package has one way of cleaning up after the test runs, the query package has another mechanism of cleaning up before the test runs, and some packages don't seem to do any clean up at all.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Michael Watzek added a comment - 26/May/05 07:30 PM
Actually, JDO-48 describes two issues:

1) Query tests fail cleaning up the database because of a foreign key constraint violation. The reason is that HollowInstanceMaintainsPK an other life cycle tests do not clean up the database.

2) Different TCK tests have different strategies for clean up.

Current status:

Class JDOTest is the super class of all TCK tests. Amongst others, this class defines methods setUp() and tearDown(). Method setUp() creates the PMF instance. Method tearDown() closes the PM instance (created by tests) and it closes the PMF instance. Furthermore, method tearDown() implements the semantics that takes care for throwing the right exception in case of tests and/or tear down failures: Exceptions during tear down do not affect the test result in case of test failures. In such cases, method tearDown() logs exceptions. However, if tests succeed and tearDown() throws an exception then that exception determines the test result.

Problem:

Some tests override method tearDown() cleaning up the database, some tests clean up the database inside the test methods (testXXX).

Objectives:

1) Tests should not need to override method tearDown() as the semantics is not trivial and error-prone. Instead, tests have hooks into setUp() and tearDown(). There, they may allocate/release resources and/or data.

2) Tests may register created (persistent) data. That data is cleaned up automatically during tearDown().

Solution:

1) We add 2 methods to class JDOTest localSetUp() and localTearDown(). These methods are called by setUp() and by tearDown(). They are hooks into the two methods and they may be overridden by subclasses.

2) Furthermore, we add 3 methods to class JDOTest registering oid, persistence capable instances, and persistence capable classses (addTearDownObjectId(Object), ddTearDownInstance(Object), addTearDownClass(Class)). The default implementation of localTearDown() cleans up all registered persistent data.

3) We change all tests in order to comply to 1) and 2).

Obviously, issue 3) is most time-consuming. For this reason, I suggest to solve 1) and 2) in a first step. In a second step, we solve issue 3) per TCK package, e.g. starting with "org.apache.jdo.tck.lifecycle". If there are life cycle tests relying on the execution of other life cycle tests, then we'll take care that those tests set up the database properly. If there are non-life cycle tests, relying on the execution of life cycle tests, then those tests will fail. In that case, we'll adapt those tests also.

Michael Watzek added a comment - 26/May/05 07:38 PM
This fix contains an improvement of the TCK test output: Exceptions during test execution are logged. At the time we solve JDO-33, we can very easily rollback this additional fix.

Michael Bouschen added a comment - 23/Apr/06 02:18 AM
Reopened to set the Fix Version/s field to JDO 2 beta.