source: trunk/testing/run.sh @ 484

Last change on this file since 484 was 484, checked in by djay, 11 years ago

Update testing script for the WPS Benchmarking.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:mime-type set to text/x-sh
File size: 6.8 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
26NBRequests=1000
27NBConcurrents=50
28
29function kvpRequest {
30    echo " **"
31    echo " * Simple KVP request start on $(date)"
32    echo " * [$1] "
33    echo " **"
34   
35    RESP=$(curl -v -o "$2" "$1" 2> tmp/temp.log; grep "< HTTP" tmp/temp.log | cut -d' ' -f3)
36    if [ "${3}" == "owsExceptionReport" ]; then
37        echo " *********************************"
38        if [ "$RESP" == "200" ]; then
39            echo " ! Invalid response code ($RESP)"
40        else
41            echo " * Valid response code ($RESP)"
42        fi
43        echo " *********************************"
44        echo " * Checking for ${3} response XML validity..."
45        echo " * Schema: [http://schemas.opengis.net/ows/1.1.0/${3}.xsd]"
46        echo " *********************************"
47        xmllint --noout --schema http://schemas.opengis.net/ows/1.1.0/${3}.xsd "$2"
48        echo " *********************************"
49        echo "Verifying that the missing / wrong argument was referenced in locator and the exceptionCode take the corresponding value ..."
50        echo -n " *********************************"
51        xsltproc ./extractExceptionInfo.xsl "$2"
52        echo " *********************************"
53    else
54        if [ "$RESP" == "200" ]; then
55            echo " * Valid response code ($RESP)"
56        else
57            echo " ! Invalid response code ($RESP)"
58        fi
59        echo " * Checking for ${3} response XML validity..."
60        echo " * Schema: [http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd]"
61        xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd "$2"
62    fi
63    echo " **"
64    echo " * Sending 10000 ${3} requests starting on $(date) ..."
65    echo " **"
66    ab -n "$NBRequests" -c "$NBConcurrents" "$1"
67    echo " ** Ending on $(date)"
68}
69
70function postRequest {
71    echo " **"
72    echo " * Simple POST request started on $(date)"
73    echo " **"
74    echo " * Checking for ${3} request XML validity..."
75    echo " * Schema: http://schemas.opengis.net/wps/1.0.0/wps${3}_request.xsd"
76    echo " *********************************"
77    xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_request.xsd "$4"
78    echo " *********************************"
79    curl -H "Content-type: text/xml" -d@"$4" -o "$2" "$1"
80    echo " * Checking for ${3} response XML validity on $(date) ..."
81    echo " * Schema: http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd"
82    echo " *********************************"
83    xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd "$2"
84    echo " *********************************"
85    if [ -z "$5" ]; then
86        echo ""
87    else
88        echo " * Schema: http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd"
89        echo " *********************************"
90        xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd "$(xsltproc ./extractStatusLocation.xsl $2)"
91        echo " *********************************"
92    fi
93    echo " * Sending 10000 ${3} XML requests on $(date) ..."
94    ab -T "text/xml" -p "$4" -n "$NBRequests" -c "$NBConcurrents" "$1"
95    echo " ** Ending on $(date)"
96}
97
98function kvpRequestWrite {
99    suffix=""
100    cnt=0
101    cnt0=0
102    for i in $2; do
103        if [ ! $1 -eq $cnt0 ]; then
104            if [ $cnt -gt 0 ]; then
105                suffix="$suffix&$(echo $i | sed 's:\"::g')"
106            else
107                suffix="$(echo $i | sed 's:\"::g')"
108            fi
109            cnt=$(expr $cnt + 1)
110        fi
111        cnt0=$(expr $cnt0 + 1)
112    done
113    echo $suffix
114}
115
116function kvpWrongRequestWrite {
117    suffix=""
118    cnt=0
119    cnt0=0
120    for i in $2; do
121        if [ ! $1 -eq $cnt0 ]; then
122            if [ $cnt -gt 0 ]; then
123                suffix="$suffix&$(echo $i | sed 's:\"::g')"
124            else
125                suffix="$(echo $i | sed 's:\"::g')"
126            fi
127            cnt=$(expr $cnt + 1)
128        else
129            cnt1=0
130            for j in $3; do
131                if [ $cnt1 -eq $1 ]; then
132                    suffix="$suffix&$(echo $j | sed 's:\"::g')"
133                fi
134                cnt1=$(expr $cnt1 + 1)
135            done
136        fi
137        cnt0=$(expr $cnt0 + 1)
138    done
139    echo $suffix
140}
141
142
143#
144# Tests for GetCapabilities using KVP (including wrong requests) and POST requests
145#
146kvpRequest "${WPSInstance}?REQUEST=GetCapabilities&SERVICE=WPS" "tmp/outputGC1.xml" "GetCapabilities"
147
148params='"request=GetCapabilities" "service=WPS"'
149
150suffix=$(kvpRequestWrite -1 "$params")
151kvpRequest "${WPSInstance}?$suffix" "tmp/outputGC2.xml" "GetCapabilities"
152
153for j in 0 1; do
154    suffix=$(kvpRequestWrite $j "$params")
155    kvpRequest "${WPSInstance}?$suffix" "tmp/outputGC$(expr $j + 3).xml" "owsExceptionReport"
156done
157
158paramsw='"request=GetCapabilitie" "service=WXS"'
159for j in 0 1; do
160    suffix=$(kvpWrongRequestWrite $j "$params" "$paramsw")
161    kvpRequest "${WPSInstance}?$suffix" "tmp/outputGC$(expr $j + 5).xml" "owsExceptionReport"
162done
163
164echo "Check if differences between upper case and lower case parameter names"
165diff -ru tmp/outputGC1.xml tmp/outputGC2.xml
166
167echo ""
168
169curl -o tmp/10_wpsGetCapabilities_request.xml http://schemas.opengis.net/wps/1.0.0/examples/10_wpsGetCapabilities_request.xml
170postRequest "${WPSInstance}" "tmp/outputGCp.xml" "GetCapabilities" "tmp/10_wpsGetCapabilities_request.xml"
171echo ""
172
173#
174# Tests for DescribeProcess using KVP and POST requests
175#
176kvpRequest "${WPSInstance}?request=DescribeProcess&service=WPS&version=1.0.0&Identifier=ALL" "tmp/outputDPall.xml" "DescribeProcess"
177
178params='"request=DescribeProcess" "service=WPS" "version=1.0.0" "Identifier='${ServiceName}'"'
179
180suffix=$(kvpRequestWrite -1 "$params")
181kvpRequest "${WPSInstance}?$suffix" "tmp/outputDPb1.xml" "DescribeProcess"
182
183for j in 0 1 2 3; do
184    suffix=$(kvpRequestWrite $j "$params")
185    kvpRequest "${WPSInstance}?$suffix" "tmp/outputDPb$(expr $j + 2).xml" "owsExceptionReport"
186done
187
188paramsw='"request=DescribeProces" "service=WXS" "version=1.2.0" "Identifier=Undefined"'
189
190for j in 0 1 2 3; do
191    suffix=$(kvpWrongRequestWrite $j "$params")
192    kvpRequest "${WPSInstance}?$suffix" "tmp/outputDPb$(expr $j + 6).xml" "owsExceptionReport"
193done
194
195kvpRequest "${WPSInstance}?request=DescribeProcess&service=WPS&Identifier=${ServiceName}" "tmp/outputDPb10.xml" "DescribeProcess"
196
197echo ""
198
199cat requests/dp.xml | sed "s:ServiceName:${ServiceName}:g" > tmp/dp1.xml
200postRequest "${WPSInstance}" "tmp/outputDPp.xml" "DescribeProcess" "tmp/dp1.xml"
201echo ""
202
203#
204# Tests for Execute using KVP and POST requests
205#
206for 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;
207do
208    cat requests/${i}.xml | sed "s:ServiceName:${ServiceName}:g" > tmp/${i}1.xml
209    if [ -z "$(echo $i | grep async)" ]; then
210        postRequest "${WPSInstance}" "tmp/outputE${i}.xml" "Execute" "tmp/${i}1.xml"
211    else
212        postRequest "${WPSInstance}" "tmp/outputE${i}.xml" "Execute" "tmp/${i}1.xml" "async"
213    fi
214    echo ""
215done
216
217echo ""
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