Issue Details (XML | Word | Printable)

Key: JDO-304
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Craig Russell
Reporter: Craig Russell
Votes: 0
Watchers: 0
Operations

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

Query failure should print the query that failed in addition to the expected and actual results

Created: 12/Feb/06 06:04 AM   Updated: 22/Feb/06 02:41 AM
Return to search
Component/s: tck2
Affects Version/s: JDO 2 beta
Fix Version/s: JDO 2 rc1

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works Query.patch 2006-02-13 07:55 AM Craig Russell 24 kB
Text File Licensed for inclusion in ASF works QueryTest.patch 2006-02-12 06:06 AM Craig Russell 4 kB

Resolution Date: 22/Feb/06 02:41 AM


 Description  « Hide
The failure message doesn't contain the failing query:
    [java] There were 2 failures:
    [java] 1) testNoNavigation(org.apache.jdo.tck.query.result.VariableInResult)junit.framework.AssertionFailedError: Assertion A14.6.9-3 (VariableInResult) failed:
    [java] Wrong query result:
    [java] expected: [Project(1, name orange, budget 2500000.99), Project(1, name orange, budget 2500000.99), Project(1, name orange, budget 2500000.99)]
    [java] got: [Project(1, name orange, budget 2500000.99)]


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Craig Russell added a comment - 12/Feb/06 06:06 AM
Please review this patch. After applying the patch, failing queries print the query and the expected and actual results.

    [java] 1) testNoNavigation(org.apache.jdo.tck.query.result.VariableInResult)junit.framework.AssertionFailedError: Assertion A14.6.9-3 (VariableInResult) failed:
    [java] Wrong query result:
    [java] query: SELECT p FROM org.apache.jdo.tck.pc.company.Employee WHERE projects.contains(p) & p.name == 'orange' VARIABLES Project p
    [java] expected: [Project(1, name orange, budget 2500000.99), Project(1, name orange, budget 2500000.99), Project(1, name orange, budget 2500000.99)]
    [java] got: [Project(1, name orange, budget 2500000.99)]

Michael Bouschen added a comment - 12/Feb/06 06:47 AM
I like the idea of including the JDOQL query string into the error message. The patch QueryTest.patch changes the signature of methods checkQueryResultWithOrder checkQueryResultWithoutOrder defined in the query test superclass QueryTest. These methods are protected and a couple of test classes directly call these methods. These classes fail to compile after applying the patch (I got 56 compile errors). Either we change all the callers or we restore the methods with the old signature such that we have two overloaded versions of the methods. What do you think?

karan singh malhi added a comment - 12/Feb/06 07:39 AM
I think if just a couple of calls are being made to these methods then we should simply make changes in the the callers

Craig Russell added a comment - 13/Feb/06 07:55 AM
Please review this patch.

There were 19 test cases affected by the change. Both versions of the check methods are available. The version without the filter should only be used if the filter is null. This allows us to avoid updating the other test cases.


Craig Russell added a comment - 22/Feb/06 02:41 AM
svn commit -m "JDO-304 updated query checking to include query filter"
Sending query/api/CompileQuery.java
Sending query/api/DeclareImports.java
Sending query/api/DeclareParameters.java
Sending query/api/ExecuteQuery.java
Sending query/api/ExecuteQueryWithArray.java
Sending query/api/ExecuteQueryWithMap.java
Sending query/api/NewQueryFromRestoredSerializedQuery.java
Sending query/api/NewQueryWithCandidateClassAndFilter.java
Sending query/api/NewQueryWithCandidateClassCollectionFilter.java
Sending query/api/NewQueryWithExtentAndFilter.java
Sending query/api/SetFilter.java
Sending query/jdoql/MultipleActiveQueryInstanceInSamePersistenceManager.java
Sending query/jdoql/MultipleIdenticalImports.java
Sending query/jdoql/OrderingSpecification.java
Sending query/jdoql/ParenthesesMarkOperatorPrecedence.java
Sending query/jdoql/QueryResultPassedToAnotherQuery.java
Sending query/jdoql/WhiteSpaceIsACharacterAndIgnored.java
Sending query/jdoql/keywords/UseOfThisToAcessHiddenField.java
Sending query/jdoql/parameters/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java
Transmitting file data ...................
Committed revision 379541.