@@ -36,7 +36,9 @@ declare function wrt:test-14-15-xml-payload ($pid)
3636
3737declare function wrt:test-01-processmodel-create ($options)
3838{
39- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/processmodel?rs:name=015-restapi-tests.bpmn& enable=true" )
39+ let $uri := fn:concat (
40+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
41+ "/v1/resources/processmodel?rs:name=015-restapi-tests.bpmn& enable=true" )
4042 let $file := doc ("/raw/data/015-restapi-tests.bpmn" )
4143 (: let $process := xdmp:http-put($uri, $options, $file)
4244:)
@@ -45,94 +47,132 @@ declare function wrt:test-01-processmodel-create ($options)
4547
4648declare function wrt:test-02-processmodel-read ($options)
4749{
48- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/processmodel?rs:publishedId=015-restapi-tests.bpmn" )
50+ let $uri := fn:concat (
51+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
52+ "/v1/resources/processmodel?rs:publishedId=015-restapi-tests.bpmn" )
4953 return xdmp:http-get ($uri, $options)
5054};
5155
5256declare function wrt:test-03-processmodel-update ($options)
5357{
54- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/processmodel?rs:name=015-restapi-tests.bpmn& rs:major=1& rs:minor=2" )
58+ let $uri := fn:concat (
59+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
60+ "/v1/resources/processmodel?rs:name=015-restapi-tests.bpmn& rs:major=1& rs:minor=2" )
5561 let $file := doc ("/raw/data/015-restapi-tests.bpmn" )
5662 return xdmp:http-put ($uri, $options, $file)
5763};
5864
5965declare function wrt:test-04-processmodel-publish ($options)
6066{
61- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/processmodel?rs:publishedId=015-restapi-tests__1__2" )
67+ let $uri := fn:concat (
68+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
69+ "/v1/resources/processmodel?rs:publishedId=015-restapi-tests__1__2" )
6270 let $file := <somexml/>
6371 return xdmp:http-post ($uri, $options, $file)
6472};
6573
6674declare function wrt:test-06-process-create ($options)
6775{
68- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/process" )
76+ let $uri := fn:concat (
77+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
78+ "/v1/resources/process" )
6979 let $file := doc ("/raw/data/06-payload.xml" )
7080 return xdmp:http-put ($uri, $options, $file)
7181};
7282
7383declare function wrt:test-07-process-read ($options, $pid)
7484{
75- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/process?rs:processid=" , $pid)
85+ let $uri := fn:concat (
86+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
87+ "/v1/resources/process?rs:processid=" , fn:encode-for-uri ($pid))
7688 return xdmp:http-get ($uri, $options)
7789};
7890
7991declare function wrt:test-08-processinbox-read ($options)
8092{
81- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/processinbox" )
93+ let $uri := fn:concat (
94+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
95+ "/v1/resources/processinbox" )
8296 return xdmp:http-get ($uri, $options)
8397};
8498
8599declare function wrt:test-09-process-update ($options, $pid)
86100{
87- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/process?rs:processid=" , $pid, "& rs:complete=true" )
101+ let $_ := xdmp:log (fn:concat ("options=" , xdmp:quote ($options)))
102+ let $_ := xdmp:log (fn:concat ("pid=" , $pid))
103+ let $uri := fn:concat (
104+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
105+ "/v1/resources/process?rs:processid=" ,
106+ fn:encode-for-uri ($pid), "& rs:complete=true" )
107+ let $_ := xdmp:log (fn:concat ("uri=" , $uri))
88108 let $file := wrt:test-09-11-12-xml-payload ($pid)
109+ let $_ := xdmp:log (fn:concat ("file=" , xdmp:quote ($file)))
89110 return xdmp:http-post ($uri, $options, $file)
90111};
91112
92113declare function wrt:test-10-processqueue-read ($options)
93114{
94- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/processqueue?rs:queue=Editors" )
115+ let $uri := fn:concat (
116+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
117+ "/v1/resources/processqueue?rs:queue=Editors" )
95118 return xdmp:http-get ($uri, $options)
96119};
97120
98121declare function wrt:test-11-process-update-lock ($options, $pid)
99122{
100- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/process?rs:processid=" , $pid, "& rs:lock=true" )
123+ let $uri := fn:concat (
124+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
125+ "/v1/resources/process?rs:processid=" , fn:encode-for-uri ($pid),
126+ "& rs:lock=true" )
101127 let $file := wrt:test-09-11-12-xml-payload ($pid)
102128 return xdmp:http-post ($uri, $options, $file)
103129};
104130
105131declare function wrt:test-12-process-update-lock-fail ($options, $pid)
106132{
107- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/process?rs:processid=" , $pid, "& rs:lock=true" )
133+ let $uri := fn:concat (
134+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
135+ "/v1/resources/process?rs:processid=" , fn:encode-for-uri ($pid),
136+ "& rs:lock=true" )
108137 let $file := wrt:test-09-11-12-xml-payload ($pid)
109138 return xdmp:http-post ($uri, $options, $file)
110139};
111140
112141declare function wrt:test-13-process-update-unlock ($options, $pid)
113142{
114- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/process?rs:processid=" , $pid, "& rs:unlock=true" )
143+ let $uri := fn:concat (
144+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
145+ "/v1/resources/process?rs:processid=" , fn:encode-for-uri ($pid),
146+ "& rs:unlock=true" )
115147 let $file := wrt:test-13-xml-payload ($pid)
116148 return xdmp:http-post ($uri, $options, $file)
117149};
118150
119151declare function wrt:test-14-process-update-lock ($options, $pid)
120152{
121- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/process?rs:processid=" , $pid, "& rs:lock=true" )
153+ let $uri := fn:concat (
154+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
155+ "/v1/resources/process?rs:processid=" , fn:encode-for-uri ($pid),
156+ "& rs:lock=true" )
122157 let $file := wrt:test-14-15-xml-payload ($pid)
123158 return xdmp:http-post ($uri, $options, $file)
124159};
125160
126161declare function wrt:test-15-process-update ($options, $pid)
127162{
128- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/process?rs:processid=" , $pid, "& rs:complete=true" )
163+ let $uri := fn:concat (
164+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
165+ "/v1/resources/process?rs:processid=" , fn:encode-for-uri ($pid),
166+ "& rs:complete=true" )
129167 let $file := wrt:test-14-15-xml-payload ($pid)
130168 return xdmp:http-post ($uri, $options, $file)
131169};
132170
133171declare function wrt:test-16-process-read ($options, $pid)
134172{
135- let $uri := fn:concat ("http://" , $c:RESTHOST, ':' , $c:RESTPORT, "/v1/resources/process?rs:processid=" , $pid)
173+ let $uri := fn:concat (
174+ "http://" , $c:RESTHOST, ':' , $c:RESTPORT,
175+ "/v1/resources/process?rs:processid=" , fn:encode-for-uri ($pid))
136176 return xdmp:http-get ($uri, $options)
137177};
138178
0 commit comments