Merge lp:~zorba-coders/zorba/html-module-bug-1189804 into lp:zorba/html-module

Proposed by Matthias Brantner
Status: Merged
Merged at revision: 95
Proposed branch: lp:~zorba-coders/zorba/html-module-bug-1189804
Merge into: lp:zorba/html-module
Diff against target: 115 lines (+17/-17)
1 file modified
test/Queries/link_crawler2.xq2 (+17/-17)
To merge this branch: bzr merge lp:~zorba-coders/zorba/html-module-bug-1189804
Reviewer Review Type Date Requested Status
Ghislain Fourny Approve
Matthias Brantner Approve
Review via email: mp+182529@code.launchpad.net

Commit message

adapted test to use unordered-maps module

Description of the change

adapted test to use unordered-maps module

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Ghislain Fourny (gislenius) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test/Queries/link_crawler2.xq2'
2--- test/Queries/link_crawler2.xq2 2013-08-09 09:37:05 +0000
3+++ test/Queries/link_crawler2.xq2 2013-08-28 01:40:39 +0000
4@@ -15,7 +15,7 @@
5 :)
6
7 import module namespace http = "http://www.zorba-xquery.com/modules/http-client";
8-import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";
9+import module namespace map = "http://zorba.io/modules/unordered-maps";
10 import module namespace html = "http://www.zorba-xquery.com/modules/converters/html";
11 import module namespace x = "http://zorba.io/modules/xml";
12 import schema namespace opt = "http://zorba.io/modules/xml-options";
13@@ -32,8 +32,8 @@
14
15
16
17-declare variable $local:processed-internal-links := xs:QName("processed-internal-links");
18-declare variable $local:processed-external-links := xs:QName("processed-external-links");
19+declare variable $local:processed-internal-links := "processed-internal-links";
20+declare variable $local:processed-external-links := "processed-external-links";
21 declare variable $local:tidy-options := <options xmlns="http://www.zorba-xquery.com/modules/converters/html-options" >
22 <tidyParam name="output-xml" value="yes" />
23 <tidyParam name="doctype" value="omit" />
24@@ -54,7 +54,7 @@
25
26 declare %an:sequential function local:delete-containers(){
27 for $x in map:available-maps()
28- return map:delete($x);
29+ return map:drop($x);
30 };
31
32 declare function local:is-internal($x as xs:string) as xs:boolean
33@@ -76,9 +76,9 @@
34 }
35 catch *
36 {
37- map:insert($local:processed-external-links, (<FROM>{$start-uri}</FROM>,
38+ map:insert($local:processed-external-links, $href, (<FROM>{$start-uri}</FROM>,
39 <MESSAGE>malformed</MESSAGE>,
40- <RESULT>broken</RESULT>), $href);
41+ <RESULT>broken</RESULT>));
42 }
43 $absuri
44 };
45@@ -129,17 +129,17 @@
46 {
47 if(count($http-result) ge 1)
48 then
49- map:insert($map-name, (<STATUS>{fn:string($http-result[1]/@status)}</STATUS>,
50+ map:insert($map-name, $url, (<STATUS>{fn:string($http-result[1]/@status)}</STATUS>,
51 <MESSAGE>{fn:string($http-result[1]/@message)}</MESSAGE>,
52 <RESULT>{if(local:alive($http-result))
53 then "Ok"
54 else if(local:is-redirect($http-result))
55 then "redirect"
56 else "broken"
57- }</RESULT>), $url);
58- else map:insert($map-name, <RESULT>broken</RESULT>, $url);
59+ }</RESULT>));
60+ else map:insert($map-name, $url, <RESULT>broken</RESULT>);
61 if(local:is-redirect($http-result)) then
62- map:insert($map-name, <REDIRECT>{fn:string($http-result[1]/httpsch:header[@name = "Location"]/@value)}</REDIRECT>, $url);
63+ map:insert($map-name, $url, <REDIRECT>{fn:string($http-result[1]/httpsch:header[@name = "Location"]/@value)}</REDIRECT>);
64 else {}
65 };
66
67@@ -155,7 +155,7 @@
68 then exit returning false();
69 else {}
70 fn:trace($x, "HEAD external link");
71- map:insert($local:processed-external-links, <FROM>{$baseUri}</FROM>, $x);
72+ map:insert($local:processed-external-links, $x, <FROM>{$baseUri}</FROM>);
73 variable $http-call:=();
74 try{
75 $http-call:=http:send-request(<httpsch:request method="GET" href="{$x}"/>, (), ());
76@@ -185,7 +185,7 @@
77 then exit returning false();
78 else {}
79 fn:trace($x, "GET internal link");
80- map:insert($local:processed-internal-links, <FROM>{$baseUri}</FROM>, $x);
81+ map:insert($local:processed-internal-links, $x, <FROM>{$baseUri}</FROM>);
82 variable $http-call:=();
83 try{
84 $http-call:=http:send-request(<httpsch:request method="GET" href="{$x}" follow-redirect="false"/>, (), ());
85@@ -216,8 +216,8 @@
86 }
87 catch *
88 {
89- map:insert($local:processed-internal-links, (<MESSAGE>{concat("cannot tidy: ", $err:description)}</MESSAGE>,
90- <RESULT>broken</RESULT>), $x);
91+ map:insert($local:processed-internal-links, $x, (<MESSAGE>{concat("cannot tidy: ", $err:description)}</MESSAGE>,
92+ <RESULT>broken</RESULT>));
93 try{
94 $content:=x:parse($string-content,
95 <opt:options>
96@@ -225,7 +225,7 @@
97 </opt:options>);
98 }
99 catch *
100- { map:insert($local:processed-internal-links, <MESSAGE>{concat("cannot parse: ", $err:description)}</MESSAGE>, $x);}
101+ { map:insert($local:processed-internal-links, $x, <MESSAGE>{concat("cannot parse: ", $err:description)}</MESSAGE>);}
102 }
103 variable $links :=();
104 if(empty($content))
105@@ -240,9 +240,9 @@
106
107 declare function local:print-results() as element()*
108 {
109- for $x in map:keys($local:processed-internal-links)/map:attribute/@value/string()
110+ for $x in jn:members(map:keys($local:processed-internal-links))
111 return <INTERNAL><LINK>{$x}</LINK>{map:get($local:processed-internal-links,$x)}</INTERNAL>,
112- for $x in map:keys($local:processed-external-links)/map:attribute/@value/string()
113+ for $x in jn:members(map:keys($local:processed-external-links))
114 return <EXTERNAL><LINK>{$x}</LINK>{map:get($local:processed-external-links,$x)}</EXTERNAL>
115 };
116

Subscribers

People subscribed via source and target branches

to all changes: