Issue Details (XML | Word | Printable)

Key: JDO-166
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Michael Watzek
Reporter: Michael Watzek
Votes: 0
Watchers: 0
Operations

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

Implement new JDO 2 query tests cases concerning deletion by query.

Created: 04/Oct/05 09:45 PM   Updated: 02/Dec/05 02:32 AM
Return to search
Component/s: tck2
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works JDO-166.patch 2005-11-24 05:46 PM Michael Watzek 43 kB
File Licensed for inclusion in ASF works JDO-166.patch2 2005-11-28 10:08 PM Michael Watzek 44 kB

Resolution Date: 02/Dec/05 02:32 AM


 Description  « Hide
We need 4 new test classes, one for each of the following assertions:

- A14.8-1: These methods delete the instances of affected classes that pass the filter, and all dependent instances. Affected classes are the candidate class and its persistence-capable subclasses.
- A14.8-2: The number of instances of affected classes that were deleted is returned. Embedded instances and dependent instances are not counted in the return value.
- A14.8-3: Query elements filter, parameters, imports, variables, and unique are valid in queries used for delete. Elements result, result class, range, grouping, and ordering are invalid. If any of these elements is set to its non-default value when one of the deletePersistentAll methods is called, a JDOUserException is thrown and no instances are deleted.
- A14.8-4: Dirty instances of affected classes are first flushed to the datastore. Instances already in the cache when deleted via these methods or brought into the cache as a result of these methods undergo the life cycle transitions as if deletePersistent had been called on them. That is, if an affected class implements the DeleteCallback interface, the instances to be deleted are instantiated in memory and the jdoPreDelete method is called prior to deleting the instance in the datastore. If any LifecycleListener instances are registered with affected classes, these listeners are called for each deleted instance. Before returning control to the application, instances of affected classes in the cache are refreshed by the implementation so their status in the cache reflects whether they were deleted from the datastore.

Details can be found on Wiki page http://wiki.apache.org/jdo/QueryTests#DeletionByQuery.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Michael Watzek added a comment - 24/Nov/05 05:46 PM
The attched patch implements the assertions above.

Michael Bouschen added a comment - 25/Nov/05 10:49 PM
A few comments about JDO-166.patch:

DeleteCallback:
- There is a type in the javadoc of method queryUpdateDeleteVerify: hoplder. The javadoc says: "... makes dirty all queried pc instances calling ...". I would say: "marks all queried pc instances as dirty by calling ... ".
- Method verifyCallbacksAndStates lists the oids of the deleted instances in an error message. Maybe it should say that the values are oids and not pc instances.

DeleteQueryElements
- I like the idea of describing why a query listed in INVALID_QUERIES is not valid for delete by query. Maybe you can add this for all the queries: Invalid for delete by query, because ...
- The valid query is a unique query, but the expected number of deleted instances is 3!

Michael Watzek added a comment - 28/Nov/05 10:08 PM
The second patch implements the comments above.

Michael Bouschen added a comment - 01/Dec/05 08:33 PM
Looks good.

However, I propose to update the comments in DeleteQueryElements, because I think some of them are misleading, e.g. "The query may fail because there is a result, or because there is a result class". This sounds like you try to test two scenarios with a single query. Actually, there is one test query having a result clause, another having a result class and this test query has both a result clause and a result class. So I think your test class coveres everything we should test.

I propose to change the comment to: "This query is an invalid delete query, because it defines a result clause and a result class". Please have a look at the other comments in INVALID_QUERIES.

Michael Watzek added a comment - 02/Dec/05 02:32 AM
The comments above have been incorporated into the second patch. The second patch has been checked in (Revision 350282).