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 Watzek made changes - 15/Oct/05 12:54 AM
Field Original Value New Value
Attachment JDO-161.patch [ 12314886 ]
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 Watzek made changes - 27/Oct/05 02:14 AM
Attachment JDO-161.patch2 [ 12320326 ]
Repository Revision Date User Message
ASF #328842 Thu Oct 27 09:47:10 UTC 2005 brazil JDO-161: Implement new JDO 2 query tests cases concerning variables.
Files Changed
MODIFY /incubator/jdo/trunk/tck20/test/sql/derby/applicationidentity/schema.sql
ADD /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java
MODIFY /incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/query/package-derby.orm
MODIFY /incubator/jdo/trunk/tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/query/package.jdo
MODIFY /incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/query/package-derby.orm
MODIFY /incubator/jdo/trunk/tck20/test/sql/derby/datastoreidentity/schema.sql
ADD /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/MixedVariables.java
ADD /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesWithoutExtent.java
MODIFY /incubator/jdo/trunk/tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/query/package.jdo
ADD /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesAndFields.java
MODIFY /incubator/jdo/trunk/tck20/test/conf/alltests.conf
ADD /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/query/NoExtent.java
MODIFY /incubator/jdo/trunk/tck20/project.properties

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.

Michael Watzek made changes - 27/Oct/05 06:50 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]