source: branches/branch-1.2/testing/run.sh

Last change on this file was 267, checked in by djay, 13 years ago

Add test requests for embedded JSON and GML content. Thanks to Luca Delluchi for pointing this.

  • Property svn:executable set to *
File size: 2.9 KB
Line 
1#!/bin/bash
2
3Usage=$(cat <<EOF
4Please use the following syntaxe:
5
6  ./run.sh <WPSInstance> <ServiceName>
7
8where <WPSInstance> should be the url to a WPS Server and <ServiceName> should
9be the service name you want to run tests with.
10
11For instance to test the Buffer service on a localhost WPS server, use the
12following command:
13
14  ./run.sh http://localhost/cgi-bin/zoo_loader.cgi Buffer
15
16EOF
17)
18
19if [ -z "$1" ] || [ -z "$2" ]; then
20    echo "$Usage"
21    exit
22fi
23
24WPSInstance=$1
25ServiceName=$2
26
27function kvpRequest {
28    echo "Simple KVP request "
29    echo "$1"
30    curl -o "$2" "$1"
31    echo "Checking for ${3} response XML validity..."
32    xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd "$2"
33}
34
35function postRequest {
36    echo "Simple POST request "
37    echo "Checking for ${3} request XML validity..."
38    xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_request.xsd "$4" 
39    curl -H "Content-type: text/xml" -d@"$4" -o "$2" "$1"
40    echo "Checking for ${3} response XML validity..."
41    xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd "$2"
42    if [ -z "$5" ]; then
43        echo ""
44    else
45        xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd "$(xsltproc ./extractStatusLocation.xsl $2)"
46    fi
47}
48
49
50#
51# Tests for GetCapabilities using KVP and POST requests
52#
53kvpRequest "${WPSInstance}?request=GetCapabilities&service=WPS" "tmp/outputGC1.xml" "GetCapabilities"
54
55kvpRequest "${WPSInstance}?REQUEST=GetCapabilities&SERVICE=WPS" "tmp/outputGC2.xml" "GetCapabilities"
56
57echo "Check if differences between upper case and lower case parameter names"
58diff -ru tmp/outputGC1.xml tmp/outputGC2.xml
59
60echo ""
61
62curl -o tmp/10_wpsGetCapabilities_request.xml http://schemas.opengis.net/wps/1.0.0/examples/10_wpsGetCapabilities_request.xml
63postRequest "${WPSInstance}" "tmp/outputGCp.xml" "GetCapabilities" "tmp/10_wpsGetCapabilities_request.xml"
64echo ""
65
66#
67# Tests for DescribeProcess using KVP and POST requests
68#
69kvpRequest "${WPSInstance}?request=DescribeProcess&service=WPS&version=1.0.0&Identifier=ALL" "tmp/outputDPall.xml" "DescribeProcess"
70
71kvpRequest "${WPSInstance}?request=DescribeProcess&service=WPS&version=1.0.0&Identifier=${ServiceName}" "tmp/outputDPb1.xml" "DescribeProcess"
72
73echo ""
74
75cat requests/dp.xml | sed "s:ServiceName:${ServiceName}:g" > tmp/dp1.xml
76postRequest "${WPSInstance}" "tmp/outputDPp.xml" "DescribeProcess" "tmp/dp1.xml"
77echo "" 
78
79#
80# Tests for Execute using KVP and POST requests
81#
82for i in ijson_o igml_o ir_o ir_o_async ir_or ir_or_async irb_o irb_o_async irb_or irb_or_async; 
83do
84    cat requests/${i}.xml | sed "s:ServiceName:${ServiceName}:g" > tmp/${i}1.xml
85    if [ -z "$(echo $i | grep async)" ]; then
86        postRequest "${WPSInstance}" "tmp/outputE${i}.xml" "Execute" "tmp/${i}1.xml"
87    else
88        postRequest "${WPSInstance}" "tmp/outputE${i}.xml" "Execute" "tmp/${i}1.xml" "async"
89    fi
90    echo ""
91done
92
93echo ""
Note: See TracBrowser for help on using the repository browser.

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