| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | TMP_DIR=/tmp/ |
|---|
| 4 | ZOO_URL=$1 |
|---|
| 5 | DESC_SERV="Buffer Boundary Centroid ConvexHull Simplify Union Intersection Difference SymDifference" |
|---|
| 6 | |
|---|
| 7 | if [ -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; |
|---|
| 14 | fi |
|---|
| 15 | |
|---|
| 16 | echo " * Test validity of the answer for GetCapabilities request" |
|---|
| 17 | xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsGetCapabilities_response.xsd "${ZOO_URL}?REQUEST=GetCapabilities&SERVICE=WPS" |
|---|
| 18 | |
|---|
| 19 | echo " * Test validity of the answer for DescribeProcess requests" |
|---|
| 20 | for 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}"; |
|---|
| 23 | done |
|---|
| 24 | |
|---|
| 25 | echo " * DescribeProcess for ${DESC_SERV}" |
|---|
| 26 | 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=$(echo ${DESC_SERV} | sed 's: :,:g')" |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | echo " * Test validity of the answer for Execute requests" |
|---|
| 30 | |
|---|
| 31 | echo " ** Test validity of the answer for a synchronous call using asReference" |
|---|
| 32 | curl -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&version=1.0.0&request=GetFeature&typename=Znieff1&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 | |
|---|
| 56 | xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "${TMP_DIR}execute_sync_ref.xml" |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | echo " ** Test validity of the answer for a synchronous call with data included" |
|---|
| 60 | curl -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&version=1.0.0&request=GetFeature&typename=Znieff1&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 | |
|---|
| 84 | xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "${TMP_DIR}execute_sync_woref.xml" |
|---|
| 85 | |
|---|
| 86 | echo " ** Test validity of the answer for an asynchronous call using asReference" |
|---|
| 87 | echo " ** 1) Check initial answer" |
|---|
| 88 | curl -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&version=1.0.0&request=GetFeature&typename=Znieff1&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 | |
|---|
| 112 | xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "${TMP_DIR}execute_async_ref.xml" |
|---|
| 113 | |
|---|
| 114 | echo " ** 2) Check the statusLocation" |
|---|
| 115 | xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "$(xsltproc ./extractStatusLocation.xsl "${TMP_DIR}execute_async_ref.xml")" |
|---|
| 116 | |
|---|
| 117 | |
|---|
| 118 | echo " ** Test validity of the answer for an asynchronous call with data included" |
|---|
| 119 | echo " ** 1) Check initial answer" |
|---|
| 120 | curl -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&version=1.0.0&request=GetFeature&typename=Znieff1&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 | |
|---|
| 144 | xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "${TMP_DIR}execute_async_woref.xml" |
|---|
| 145 | |
|---|
| 146 | echo " ** 2) Check the statusLocation" |
|---|
| 147 | xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd "$(xsltproc ./extractStatusLocation.xsl "${TMP_DIR}execute_async_ref.xml")" |
|---|