Merge lp:~zorba-coders/zorba/fixing_issues_FOTS_driver into lp:zorba

Proposed by Sorin Marian Nasoi
Status: Merged
Approved by: Chris Hillery
Approved revision: 11280
Merged at revision: 11323
Proposed branch: lp:~zorba-coders/zorba/fixing_issues_FOTS_driver
Merge into: lp:zorba
Diff against target: 220 lines (+75/-42)
3 files modified
test/fots/CMakeLists.txt (+4/-17)
test/fots_driver/environment.xq (+53/-19)
test/fots_driver/evaluate.xq (+18/-6)
To merge this branch: bzr merge lp:~zorba-coders/zorba/fixing_issues_FOTS_driver
Reviewer Review Type Date Requested Status
Chris Hillery Approve
Sorin Marian Nasoi Approve
Review via email: mp+155294@code.launchpad.net

Commit message

- implemented support for <assert-xml ignore-prefixes='true'>; as a result 2 more test cases pass.
- fixed 'qischema016'
- added bug number for test cases 'qischema040' and 'qischema040a'
- added correct validation type for the source documents
- in 'assert-xml' we now first try to see if deep-equal is true, then we try to canonicalize (fixed 4 test cases)
- document URL resolving is now done using URL resolver. Fixed 6 test cases.

Description of the change

- implemented support for <assert-xml ignore-prefixes='true'>; as a result 2 more test cases pass.
- fixed 'qischema016'
- added bug number for test cases 'qischema040' and 'qischema040a'
- added correct validation type for the source documents
- in 'assert-xml' we now first try to see if deep-equal is true, then we try to canonicalize (fixed 4 test cases)
- document URL resolving is now done using URL resolver. Fixed 6 test cases.

To post a comment you must log in.
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fixing_issues_FOTS_driver-2013-03-25T17-38-55.092Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 1 Approve.

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fixing_issues_FOTS_driver-2013-03-26T16-29-45.841Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 1 Approve.

Revision history for this message
Chris Hillery (ceejatec) wrote :

I don't think it's correct to try deep-equal() for <assert-xml> test cases. Certainly this doesn't match with the description of that assertion at http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml .

Can you tell me why you did that? I'm also confused how this could have corrected 4 test cases.

The remainder of the changes seem fine.

review: Needs Information
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

> I don't think it's correct to try deep-equal() for <assert-xml> test cases.
> Certainly this doesn't match with the description of that assertion at
> http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml.
"As an alternative to canonicalizing, the results may be compared using the fn:deep-equal() function."

> Can you tell me why you did that? I'm also confused how this could have
> corrected 4 test cases.
These fixed 4 test cases where the parsing of the serialized XML content with libxml2 raised errors.
Although parsing the same exact thing with parse-xml did not. This is how, for these 4 cases,
fn:deep-equal(parse-xml($x1), parse-xml($x2)) returned correct result while
$x1 eq $x2 raised errors where $x1, $x2 are xml:canonicalize(....)

Take for example this example "namespaceDecl-24" from "prod-NamespaceDecl":

This works:
import module namespace zorba-xml = "http://www.zorba-xquery.com/modules/xml#2.1";
import schema namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

 declare variable $serParamXml :=
  <output:serialization-parameters>
    <output:method value="xml" />
    <output:indent value="no" />
    <output:omit-xml-declaration value="yes" />
  </output:serialization-parameters>;

let $content := <abc:someElement xmlns:abc="mailto:<email address hidden>">some content</abc:someElement>
return
parse-xml(fn:serialize($content, $serParamXml))

while this fails:
import module namespace zorba-xml =
  "http://www.zorba-xquery.com/modules/xml#2.1";

import schema namespace output =
  "http://www.w3.org/2010/xslt-xquery-serialization";

 declare variable $serParamXml :=
  <output:serialization-parameters>
    <output:method value="xml" />
    <output:indent value="no" />
    <output:omit-xml-declaration value="yes" />
  </output:serialization-parameters>;

let $content := <abc:someElement xmlns:abc="mailto:<email address hidden>">some content</abc:someElement>
return
zorba-xml:canonicalize(fn:serialize($content, $serParamXml))

Error:

C14N error : Relative namespace UR is invalid here : mailto
C14N error : Internal error : checking for relative namespaces
C14N error : Internal error : processing docs children list
C14N error : Internal error : saving doc to output buffer
</home/spungi/work/zorba/repo/tmp/bump_FOTS_snapshot/build/URI_PATH/com/zorba-xquery/www/modules/xml_2.xq>:444,3: dynamic error [err:FOCZ0001]: invalid content passed to x:canonicalize(): "<abc:someElement xmlns:abc="mailto:<email address hidden>">some content</abc:someElement>"

Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fixing_issues_FOTS_driver-2013-03-27T09-03-54.253Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test/fots/CMakeLists.txt'
2--- test/fots/CMakeLists.txt 2013-03-23 15:23:57 +0000
3+++ test/fots/CMakeLists.txt 2013-03-26 16:30:37 +0000
4@@ -441,11 +441,7 @@
5 EXPECTED_FOTS_FAILURE (prod-CastableExpr cbcl-castable-duration-002 0)
6 EXPECTED_FOTS_FAILURE (prod-CastableExpr cbcl-castable-yearMonthDuration-001 0)
7 EXPECTED_FOTS_FAILURE (prod-CastableExpr cbcl-castable-yearMonthDuration-002 0)
8-EXPECTED_FOTS_FAILURE (prod-CompAttrConstructor K2-ComputeConAttr-51 0)
9-EXPECTED_FOTS_FAILURE (prod-CompAttrConstructor K2-ComputeConAttr-53 0)
10-EXPECTED_FOTS_FAILURE (prod-CompAttrConstructor K2-ComputeConAttr-58 0)
11 EXPECTED_FOTS_FAILURE (prod-CompDocConstructor K2-ConDocNode-2 0)
12-EXPECTED_FOTS_FAILURE (prod-CompNamespaceConstructor nscons-039 0)
13 EXPECTED_FOTS_FAILURE (prod-ContextItemDecl contextDecl-016 0)
14 EXPECTED_FOTS_FAILURE (prod-ContextItemDecl contextDecl-017 0)
15 EXPECTED_FOTS_FAILURE (prod-ContextItemDecl contextDecl-047 0)
16@@ -515,7 +511,6 @@
17 EXPECTED_FOTS_FAILURE (prod-ModuleImport modules-pub-priv-30 0)
18 EXPECTED_FOTS_FAILURE (prod-ModuleImport modules-pub-priv-34 0)
19 EXPECTED_FOTS_FAILURE (prod-ModuleImport cbcl-module-004 0)
20-EXPECTED_FOTS_FAILURE (prod-NamespaceDecl namespaceDecl-24 0)
21 EXPECTED_FOTS_FAILURE (prod-OptionDecl K-OptionDeclarationProlog-1b 0)
22 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-003 0)
23 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-004 0)
24@@ -527,8 +522,8 @@
25 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-030 0)
26 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-031 0)
27 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-032 0)
28-EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy20 0)
29-EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy21 0)
30+EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy20 1156249)
31+EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy21 1156249)
32 EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy40 0)
33 EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy41 0)
34 EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy49 0)
35@@ -564,11 +559,9 @@
36 EXPECTED_FOTS_FAILURE (prod-RequireProhibitFeature require-all-optional-features-2-ns2 0)
37 EXPECTED_FOTS_FAILURE (prod-RequireProhibitFeature prohibit-all-optional-features-1 0)
38 EXPECTED_FOTS_FAILURE (prod-RequireProhibitFeature require-all-optional-features-7-s 0)
39-EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema016 0)
40 EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema031 0)
41-EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema032c 0)
42-EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema040 0)
43-EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema040a 0)
44+EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema040 21339)
45+EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema040a 21339)
46 EXPECTED_FOTS_FAILURE (prod-SchemaImport substitution-001 0)
47 EXPECTED_FOTS_FAILURE (prod-SchemaImport substitution-002 0)
48 EXPECTED_FOTS_FAILURE (prod-SchemaImport substitution-003 0)
49@@ -631,10 +624,7 @@
50 EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-009 0)
51 EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-018 0)
52 EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-020 0)
53-EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-022 0)
54-EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-024 0)
55 EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-062 0)
56-EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-366 0)
57 EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-370 0)
58 EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-372 0)
59 EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-374 0)
60@@ -671,10 +661,7 @@
61 EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof140 0)
62 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-018 0)
63 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-020 0)
64-EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-022 0)
65-EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-024 0)
66 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-062 0)
67-EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-366 0)
68 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-370 0)
69 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-372 0)
70 EXPECTED_FOTS_FAILURE (prod-NamedFunctionRef function-literal-374 0)
71
72=== modified file 'test/fots_driver/environment.xq'
73--- test/fots_driver/environment.xq 2013-03-21 18:43:40 +0000
74+++ test/fots_driver/environment.xq 2013-03-26 16:30:37 +0000
75@@ -424,28 +424,32 @@
76 $needsDTDValidation as xs:boolean
77 ) as xs:string
78 {
79- let $ciURI := resolve-uri($env/fots:source[@role = "."]/@file, $envBaseURI)
80+ let $ciURI := if(exists($env/fots:source[@role = "."]/@uri))
81+ then xs:string($env/fots:source[@role = "."]/@uri)
82+ else resolve-uri($env/fots:source[@role = "."]/@file, $envBaseURI)
83+ let $needsSchemaValidation := exists($env/fots:source/@validation)
84 return
85- if (empty($env/fots:source[@validation = "strict"]))
86- then
87- {
88- if($needsDTDValidation)
89+ if($needsDTDValidation)
90 then concat('variable $contextItem := zorba-xml:parse(fn:unparsed-text("',
91 $ciURI,
92 '"),<opt:options><opt:DTD-validate/></opt:options> );')
93- else concat('variable $contextItem := doc("', $ciURI, '");')
94- }
95- else
96- string-join
97- (
98+ else if(empty($env/fots:source[@role = "."]/@uri) and
99+ not($needsSchemaValidation))
100+ then concat('variable $contextItem := doc("', $ciURI, '");')
101+ else
102+ {
103+ string-join(
104 (
105 "&#xA;",
106-
107 "variable $contextItemQuery := xqxq:prepare-main-module",
108 "(",
109 "'",
110- env:get-schema-import($env),
111- concat('validate { doc("', $ciURI, '")', " }"),
112+ if ($needsSchemaValidation) then env:get-schema-import($env) else (),
113+ if ($needsSchemaValidation)
114+ then concat('validate ', xs:string($env/fots:source/@validation),' { ',
115+ concat(' doc("', $ciURI, '")'),
116+ " }")
117+ else concat(' doc("', $ciURI, '")'),
118 "',",
119 "(), mapper:uri-mapper#2",
120 ");",
121@@ -453,8 +457,8 @@
122 "variable $contextItem := xqxq:evaluate($contextItemQuery);"
123 )
124 ,
125- "&#xA;"
126- )
127+ "&#xA;")
128+ }
129 };
130
131
132@@ -653,11 +657,23 @@
133 $testSetBaseURI as xs:anyURI
134 ) as xs:string?
135 {
136- let $envSchema := $env/fots:schema,
137- $tcSchema := $case/fots:environment/fots:schema,
138- $schemas := ($envSchema, $tcSchema)
139+ let $envSchema := $env/fots:schema
140+ let $tcSchema := $case/fots:environment/fots:schema
141+ (:
142+ Schema documents are identified in the environment in a similar way to source
143+ documents. The role attribute indicates whether the schema is imported into
144+ the query, or used for source document validation.
145+ :)
146+ let $schemas := ($envSchema, $tcSchema)
147+ let $envSource := for $s in $env/fots:source
148+ where exists($s/@uri)
149+ return $s
150+ let $tcSource := for $s in $case/fots:environment/fots:source
151+ where exists($s/@uri)
152+ return $s
153+ let $sources := ($envSource, $tcSource)
154 return
155- if (empty($schemas))
156+ if (empty($schemas) and empty($sources))
157 then ()
158 else string-join(
159 ("declare function mapper:uri-mapper($namespace as xs:string, $entity as xs:string) {",
160@@ -680,6 +696,24 @@
161 " default return ()")),
162 "&#xA;")
163 else (),
164+ if (exists($sources))
165+ then string-join(("case ''",
166+ " return switch($namespace)",
167+ (for $source in $envSource
168+ return concat(" case '",
169+ data($source/@uri),
170+ "' return '",
171+ resolve-uri($source/@file, $envBaseURI),
172+ "'"),
173+ for $source in $tcSource
174+ return concat(" case '",
175+ data($source/@uri),
176+ "' return '",
177+ resolve-uri($source/@file, $testSetBaseURI),
178+ "'"),
179+ " default return ()")),
180+ "&#xA;")
181+ else (),
182 "default return ()","};"),
183 "&#xA;")
184 };
185
186=== modified file 'test/fots_driver/evaluate.xq'
187--- test/fots_driver/evaluate.xq 2013-03-21 18:31:19 +0000
188+++ test/fots_driver/evaluate.xq 2013-03-26 16:30:37 +0000
189@@ -486,13 +486,25 @@
190 )
191 {
192 try {
193- let $actualResult := zorba-xml:canonicalize(concat('<root>', fn:serialize($result, $util:serParamXml), '</root>'))
194- let $expectedResult := zorba-xml:canonicalize(concat('<root>', util:get-value($expResult, $baseURI, "assert-xml"), '</root>'))
195-
196+ let $actualResult := concat('<root>', fn:serialize($result, $util:serParamXml), '</root>')
197+ let $expectedResult := concat('<root>', util:get-value($expResult, $baseURI, "assert-xml"), '</root>')
198 return
199- if ($actualResult eq $expectedResult)
200- then ()
201- else concat("'assert-xml' returned: result &#xA;'", $actualResult, "'&#xA; is different from the expected result &#xA;'", $expectedResult,"'&#xA;")
202+ (: first try to see if deep-equal is true:)
203+ if(deep-equal(parse-xml($actualResult), parse-xml($expectedResult)))
204+ then ()
205+ else (: second try to canonicalize :)
206+ {
207+ let $canActualResult := zorba-xml:canonicalize($actualResult)
208+ let $canExpectedResult := zorba-xml:canonicalize($expectedResult)
209+ return
210+ if(empty($expResult[@ignore-prefixes='true']) and
211+ ($canActualResult eq $canExpectedResult))
212+ then ()
213+ else if(exists($expResult[@ignore-prefixes='true']) and
214+ fn:parse-xml($canActualResult) eq fn:parse-xml($canExpectedResult)) (: the namespace prefixes are ignored in this comparison :)
215+ then ()
216+ else concat("'assert-xml' returned: result &#xA;'", $canActualResult, "'&#xA; is different from the expected result &#xA;'", $canExpectedResult,"'&#xA;")
217+ }
218 } catch * {
219 concat("'assert-xml' returned: fail with error ",
220 $err:code, " : ", $err:description)

Subscribers

People subscribed via source and target branches