ZOOWPSImplementationReport: testXmlValidation.sh

File testXmlValidation.sh, 7.6 KB (added by djay, 14 years ago)

testXmlValidation.sh Bash script to run XML validity tests on a WPS Server. To run properly it requires the extractStatusLocation.xsl XSL file in the same directory and the following tools present from the PATH environment variable : xmllint, xsltproc, curl.

Line 
1#!/bin/bash
2
3TMP_DIR=/tmp/
4ZOO_URL=$1
5DESC_SERV="Buffer Boundary Centroid ConvexHull Simplify Union Intersection Difference SymDifference"
6
7if [ -z "${ZOO_URL}" ] ; then
8    echo "Usage : "
9    echo " testXmlValiation.sh <ZOO Kernel URL>"
10    echo ""
11    echo "For example to test a local ZOO Kernel use the following :"
12    echo "./testXmlValiation.sh http://localhost/cgi-bin/zoo_loader.cgi"
13    exit;
14fi
15
16echo " * Test validity of the answer for GetCapabilities request"
17xmllint  --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsGetCapabilities_response.xsd "${ZOO_URL}?REQUEST=GetCapabilities&SERVICE=WPS"
18
19echo " * Test validity of the answer for DescribeProcess requests"
20for i in ${DESC_SERV}; do 
21    echo " * DescribeProcess for $i";
22    xmllint  --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_response.xsd "${ZOO_URL}?REQUEST=DescribeProcess&SERVICE=WPS&version=1.0.0&Identifier=${i}";
23done
24
25echo " * DescribeProcess for ${DESC_SERV}"
26xmllint  --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_response.xsd "${ZOO_URL}?REQUEST=DescribeProcess&SERVICE=WPS&version=1.0.0&Identifier=$(echo ${DESC_SERV} | sed 's: :,:g')"
27
28
29echo " * Test validity of the answer for Execute requests"
30
31echo " ** Test validity of the answer for a synchronous call using asReference"
32curl -H "Content-Type: text/xml" -d '<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd">
33<ows:Identifier>Buffer</ows:Identifier>
34<wps:DataInputs>
35<wps:Input>
36<ows:Identifier>InputPolygon</ows:Identifier>
37<ows:Title>Playground area</ows:Title>
38<wps:Reference xlink:href="http://dreal-official.geolabs.fr/mapjax/webservices/wfs/dreal_lr_general/?VERSION=1.1.0&amp;version=1.0.0&amp;request=GetFeature&amp;typename=Znieff1&amp;maxfeatures=1"/></wps:Input>
39<wps:Input>
40<ows:Identifier>BufferDistance</ows:Identifier>
41<ows:Title>Distance which people will walk to get to a playground.</ows:Title>
42<wps:Data>
43<wps:LiteralData>10</wps:LiteralData>
44</wps:Data>
45</wps:Input>
46</wps:DataInputs>
47<wps:ResponseForm>
48<wps:ResponseDocument storeExecuteResponse="false">
49<wps:Output asReference="true">
50<ows:Identifier>Result</ows:Identifier>
51</wps:Output>
52</wps:ResponseDocument>
53</wps:ResponseForm>
54</wps:Execute>' "${ZOO_URL}" -o "${TMP_DIR}execute_sync_ref.xml" 2> "${TMP_DIR}log"
55
56xmllint  --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "${TMP_DIR}execute_sync_ref.xml"
57
58
59echo " ** Test validity of the answer for a synchronous call with data included"
60curl -H "Content-Type: text/xml" -d '<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd">
61<ows:Identifier>Buffer</ows:Identifier>
62<wps:DataInputs>
63<wps:Input>
64<ows:Identifier>InputPolygon</ows:Identifier>
65<ows:Title>Playground area</ows:Title>
66<wps:Reference xlink:href="http://dreal-official.geolabs.fr/mapjax/webservices/wfs/dreal_lr_general/?VERSION=1.1.0&amp;version=1.0.0&amp;request=GetFeature&amp;typename=Znieff1&amp;maxfeatures=1"/></wps:Input>
67<wps:Input>
68<ows:Identifier>BufferDistance</ows:Identifier>
69<ows:Title>Distance which people will walk to get to a playground.</ows:Title>
70<wps:Data>
71<wps:LiteralData>10</wps:LiteralData>
72</wps:Data>
73</wps:Input>
74</wps:DataInputs>
75<wps:ResponseForm>
76<wps:ResponseDocument storeExecuteResponse="false">
77<wps:Output asReference="false">
78<ows:Identifier>Result</ows:Identifier>
79</wps:Output>
80</wps:ResponseDocument>
81</wps:ResponseForm>
82</wps:Execute>' http://www.zoo-project.org/cgi-bin-new1/zoo_loader.cgi -o "${TMP_DIR}execute_sync_woref.xml"  2> "${TMP_DIR}log"
83
84xmllint  --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "${TMP_DIR}execute_sync_woref.xml"
85
86echo " ** Test validity of the answer for an asynchronous call using asReference"
87echo " ** 1) Check initial answer"
88curl -H "Content-Type: text/xml" -d '<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd">
89<ows:Identifier>Buffer</ows:Identifier>
90<wps:DataInputs>
91<wps:Input>
92<ows:Identifier>InputPolygon</ows:Identifier>
93<ows:Title>Playground area</ows:Title>
94<wps:Reference xlink:href="http://dreal-official.geolabs.fr/mapjax/webservices/wfs/dreal_lr_general/?VERSION=1.1.0&amp;version=1.0.0&amp;request=GetFeature&amp;typename=Znieff1&amp;maxfeatures=1"/></wps:Input>
95<wps:Input>
96<ows:Identifier>BufferDistance</ows:Identifier>
97<ows:Title>Distance which people will walk to get to a playground.</ows:Title>
98<wps:Data>
99<wps:LiteralData>10</wps:LiteralData>
100</wps:Data>
101</wps:Input>
102</wps:DataInputs>
103<wps:ResponseForm>
104<wps:ResponseDocument storeExecuteResponse="true" status="true">
105<wps:Output asReference="true">
106<ows:Identifier>Result</ows:Identifier>
107</wps:Output>
108</wps:ResponseDocument>
109</wps:ResponseForm>
110</wps:Execute>' http://www.zoo-project.org/cgi-bin-new1/zoo_loader.cgi -o "${TMP_DIR}execute_async_ref.xml"  2> "${TMP_DIR}log"
111
112xmllint  --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "${TMP_DIR}execute_async_ref.xml"
113
114echo " ** 2) Check the statusLocation"
115xmllint  --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "$(xsltproc ./extractStatusLocation.xsl "${TMP_DIR}execute_async_ref.xml")"
116
117
118echo " ** Test validity of the answer for an asynchronous call with data included"
119echo " ** 1) Check initial answer"
120curl -H "Content-Type: text/xml" -d '<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd">
121<ows:Identifier>Buffer</ows:Identifier>
122<wps:DataInputs>
123<wps:Input>
124<ows:Identifier>InputPolygon</ows:Identifier>
125<ows:Title>Playground area</ows:Title>
126<wps:Reference xlink:href="http://dreal-official.geolabs.fr/mapjax/webservices/wfs/dreal_lr_general/?VERSION=1.1.0&amp;version=1.0.0&amp;request=GetFeature&amp;typename=Znieff1&amp;maxfeatures=1"/></wps:Input>
127<wps:Input>
128<ows:Identifier>BufferDistance</ows:Identifier>
129<ows:Title>Distance which people will walk to get to a playground.</ows:Title>
130<wps:Data>
131<wps:LiteralData>10</wps:LiteralData>
132</wps:Data>
133</wps:Input>
134</wps:DataInputs>
135<wps:ResponseForm>
136<wps:ResponseDocument storeExecuteResponse="true" status="true">
137<wps:Output asReference="false">
138<ows:Identifier>Result</ows:Identifier>
139</wps:Output>
140</wps:ResponseDocument>
141</wps:ResponseForm>
142</wps:Execute>' http://www.zoo-project.org/cgi-bin-new1/zoo_loader.cgi -o "${TMP_DIR}execute_async_woref.xml"  2> "${TMP_DIR}log"
143
144xmllint  --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "${TMP_DIR}execute_async_woref.xml"
145
146echo " ** 2) Check the statusLocation"
147xmllint  --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "$(xsltproc ./extractStatusLocation.xsl "${TMP_DIR}execute_async_ref.xml")"

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png