Issue Details (XML | Word | Printable)

Key: JDO-161
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 variables.

Created: 04/Oct/05 09:27 PM   Updated: 27/Oct/05 06:50 PM
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-161.patch 2005-10-15 12:54 AM Michael Watzek 25 kB
File Licensed for inclusion in ASF works JDO-161.patch2 2005-10-27 02:14 AM Michael Watzek 27 kB

Resolution Date: 27/Oct/05 06:50 PM


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

- A14.6.5-1: ?? A variable that is not constrained with an explicit contains clause is constrained by the extent of the persistence capable class (including subclasses).
- A14.6.5-2: ?? If the class does not manage an Extent, then no results will satisfy the query.
- A14.6.5-3: All variables must be explicitly declared, or all variables must be implicitly declared.
- A14.6.5-4: Names are treated as variable names if they are explicitly declared via declareVariables. Otherwise, names are treated as field names if they are members of the candidate class. Finally, names are treated as implicitly defined variable names.

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


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Michael Watzek added a comment - 15/Oct/05 12:54 AM
The patch implments the assertions above.

Michael Bouschen added a comment - 26/Oct/05 07:25 PM
Some comments:

datastoreidentity/schema.sql:
- The patch replaces table JDOQLKeywordsAsFieldNames with table NoExtent. instad of adding table NoExtent.

MixedVariables.java:
- Should we put parenthesis around the two contains clauses and have them on separate line, to improve readability?
  (team.contains(employee) & employee.firstname == 'emp1First') &
  (projects.contains(project) & project.name == 'orange')"

UnconstrainedVariable.java:
- How about replacing the test query with the folowing:
  SELECT FROM Employee WHERE this.hireDate > e.hireDate & e.personid = :id VARIABLES Employee e

VariablesAndFields.java:
- How about adding two more test queries? The first query could use a variable having a name of a field (e.g. manager):
  SELECT FROM Employee WHERE team.contains(manager) & manager.firstname = 'emp1First' VARIABLES Employee manager
The second query uses the same filter w/o variable declaration. The query result is different because now manager denotes the field and not a variable.

VariablesWithoutExtent
- How about replcacing the test query with
  SELECT FROM Person WHERE this.personid = noExtent.id VARIABLES NoExtent noExtent
There should be a NoExtent instance having the id of an exsting Person in the database, but since class NoExtent does not have an extent the query result is empty.

Michael Watzek added a comment - 27/Oct/05 02:14 AM
The second patch implements the comments above.

Michael Bouschen added a comment - 27/Oct/05 06:01 PM
The new patch looks good.

Just one comment: I think support for unconstrained variables is optional, so classes UnconstrainedVariable and VariablesWithoutExtent should execute the tests only if the JDO implementation under test supports option javax.jdo.option.UnconstrainedQueryVariables. Other than that the patch is ready for checkin.

Michael Watzek added a comment - 27/Oct/05 06:50 PM
The check on javax.jdo.option.UnconstrainedQueryVariables is already part of the second patch. The patch has been checked in as supplied.