source: branches/PublicaMundi_David_integration_01-devel/testing/run.sh @ 908

Last change on this file since 908 was 543, checked in by djay, 10 years ago

Small fixes in cgal Makefile, update testing script, update HISTORY.txt

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:mime-type set to text/x-sh
File size: 8.2 KB
Line 
1#!/bin/bash
2
3Usage=$(cat <<EOF
4Please use the following syntaxe:
5
6  ./run.sh <WPSInstance> <ServiceName> <Request>
7
8where <WPSInstance> should be the url to a WPS Server, <ServiceName> should
9be the service name you want to run tests with (you can use multiple service
10names, use quote and seperate them using space), <Request> should contain the
11requests you want to use (you can use more than one at a time).
12
13For instance to test the Buffer service on a localhost WPS server, use the
14following command:
15
16  ./run.sh http://localhost/cgi-bin/zoo_loader.cgi Buffer "GetCapabilities DescribeProcess Execute"
17
18EOF
19)
20
21if [ -z "$1" ] || [ -z "$2" ]; then
22    echo "$Usage"
23    exit
24fi
25
26WPSInstance=$1
27ServiceName=$2
28NBRequests=1000
29NBConcurrents=50
30pstat=0
31
32iter=0
33
34function testPostRequests {
35#
36# Tests for Execute using POST requests
37#
38    for i in $1;
39    do
40        cat requests/${i}.xml | sed "s:ServiceName:${ServiceName}:g;s:InputName:$(cat tmp/inputName.txt):g" > tmp/${i}1.xml
41        if [ -z "$(echo $i | grep async)" ]; then
42            postRequest "${WPSInstance}" "tmp/outputE${i}.xml" "Execute" "tmp/${i}1.xml"
43        else
44            postRequest "${WPSInstance}" "tmp/outputE${i}.xml" "Execute" "tmp/${i}1.xml" "async"
45        fi
46        echo ""
47    done
48
49}
50
51function plotStat {
52    echo " **"
53    echo " * Plot statistics ..."
54    echo " **"
55    cp run.tsv tmp/run$1.tsv
56    sed "s:\[image\]:$2:g;s:\[file\]:$3:g" -i tmp/run$1.tsv
57    gnuplot tmp/run$1.tsv
58    cp run1.tsv tmp/run1$1.tsv
59    sed "s:\[image\]:$(echo $2 | sed "s:.jpg:1.jpg:g"):g;s:\[file\]:$3:g" -i tmp/run1$1.tsv
60    gnuplot tmp/run1$1.tsv
61}
62
63
64function kvpRequest {
65    echo " **"
66    echo " <h1> Simple KVP request start on $(date) </h1>"
67    echo " <a href='$1'>$1</a>"
68   
69    RESP=$(curl -v -o "$2" "$1" 2> tmp/temp.log; grep "< HTTP" tmp/temp.log | cut -d' ' -f3)
70    if [ "${3}" == "owsExceptionReport" ]; then
71        echo " *********************************"
72        if [ "$RESP" == "200" ]; then
73            echo " ! Invalid response code ($RESP)"
74        else
75            echo " * Valid response code ($RESP)"
76        fi
77        echo " *********************************"
78        echo " * Checking for ${3} response XML validity..."
79        echo " * Schema: [http://schemas.opengis.net/ows/1.1.0/${3}.xsd]"
80        echo " *********************************"
81        xmllint --noout --schema http://schemas.opengis.net/ows/1.1.0/${3}.xsd "$2" 2> tmp/res${iter}.txt
82        echo " *********************************"
83        echo "Verifying that the missing / wrong argument was referenced in locator and the exceptionCode take the corresponding value ..."
84        echo -n " *********************************"
85        xsltproc ./extractExceptionInfo.xsl "$2"
86        echo " *********************************"
87    else
88        if [ "$RESP" == "200" ]; then
89            echo " * Valid response code ($RESP)"
90        else
91            echo " ! Invalid response code ($RESP)"
92        fi
93        echo " * Checking for ${3} response XML validity..."
94        echo " * Schema: [http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd]"
95        xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd "$2" 2> tmp/res${iter}.txt
96        v="$(cat tmp/res${iter}.txt | grep validates)"
97        echo ""
98    fi
99    echo " **"
100    echo " * Sending $NBRequests ${3} requests starting on $(date) ..."
101    echo " **"
102    ab -g tmp/stat${3}${iter}.plot -e tmp/stat${3}${iter}.txt -n "$NBRequests" -c "$NBConcurrents" "$1"
103    if [ "$pstat" -eq 1 ]; then
104        plotStat ${iter} tmp/stat${3}${iter}.jpg tmp/stat${3}${iter}.plot
105    fi
106    iter=$(expr $iter + 1)
107    echo " ** Ending on $(date)"
108}
109
110function postRequest {
111    echo " **"
112    echo " * Simple POST request started on $(date)"
113    echo " **"
114    echo " * Checking for ${3} request XML validity..."
115    echo " * Schema: http://schemas.opengis.net/wps/1.0.0/wps${3}_request.xsd"
116    echo " *********************************"
117    xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_request.xsd "$4"
118    echo " *********************************"
119    curl -H "Content-type: text/xml" -d@"$4" -o "$2" "$1"
120    echo " * Checking for ${3} response XML validity on $(date) ..."
121    echo " * Schema: http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd"
122    echo " *********************************"
123    xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd "$2"
124    echo " *********************************"
125    if [ -z "$5" ]; then
126        echo ""
127    else
128        echo " * Schema: http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd"
129        echo " *********************************"
130        xmllint --noout --schema http://schemas.opengis.net/wps/1.0.0/wps${3}_response.xsd "$(xsltproc ./extractStatusLocation.xsl $2)"
131        echo " *********************************"
132    fi
133    echo " * Sending $NBRequests ${3} XML requests on $(date) ..."
134    ab -g tmp/stat${3}${iter}.plot -e tmp/stat${3}${iter}.txt -T "text/xml" -p "$4" -n "$NBRequests" -c "$NBConcurrents" "$1"
135    if [ "$pstat" -eq 1 ]; then
136        plotStat ${iter} tmp/stat${3}${iter}.jpg tmp/stat${3}${iter}.plot
137    fi
138    iter=$(expr $iter + 1)
139    echo " ** Ending on $(date)"
140}
141
142function kvpRequestWrite {
143    suffix=""
144    cnt=0
145    cnt0=0
146    for i in $2; do
147        if [ ! $1 -eq $cnt0 ]; then
148            if [ $cnt -gt 0 ]; then
149                suffix="$suffix&$(echo $i | sed 's:\"::g')"
150            else
151                suffix="$(echo $i | sed 's:\"::g')"
152            fi
153            cnt=$(expr $cnt + 1)
154        fi
155        cnt0=$(expr $cnt0 + 1)
156    done
157    echo $suffix
158}
159
160function kvpWrongRequestWrite {
161    suffix=""
162    cnt=0
163    cnt0=0
164    for i in $2; do
165        if [ ! $1 -eq $cnt0 ]; then
166            if [ $cnt -gt 0 ]; then
167                suffix="$suffix&$(echo $i | sed 's:\"::g')"
168            else
169                suffix="$(echo $i | sed 's:\"::g')"
170            fi
171            cnt=$(expr $cnt + 1)
172        else
173            cnt1=0
174            for j in $3; do
175                if [ $cnt1 -eq $1 ]; then
176                    suffix="$suffix&$(echo $j | sed 's:\"::g')"
177                fi
178                cnt1=$(expr $cnt1 + 1)
179            done
180        fi
181        cnt0=$(expr $cnt0 + 1)
182    done
183    echo $suffix
184}
185
186for i in $3; do
187    if [ "$i" == "GetCapabilities" ]; then
188#
189# Tests for GetCapabilities using KVP (including wrong requests) and POST requests
190#
191        kvpRequest "${WPSInstance}?REQUEST=GetCapabilities&SERVICE=WPS" "tmp/outputGC1.xml" "GetCapabilities"
192
193        params='"request=GetCapabilities" "service=WPS"'
194
195        suffix=$(kvpRequestWrite -1 "$params")
196        kvpRequest "${WPSInstance}?$suffix" "tmp/outputGC2.xml" "GetCapabilities"
197
198        for j in 0 1; do
199            suffix=$(kvpRequestWrite $j "$params")
200            kvpRequest "${WPSInstance}?$suffix" "tmp/outputGC$(expr $j + 3).xml" "owsExceptionReport"
201        done
202
203        paramsw='"request=GetCapabilitie" "service=WXS"'
204        for j in 0 1; do
205            suffix=$(kvpWrongRequestWrite $j "$params" "$paramsw")
206            kvpRequest "${WPSInstance}?$suffix" "tmp/outputGC$(expr $j + 5).xml" "owsExceptionReport"
207        done
208
209        echo "Check if differences between upper case and lower case parameter names"
210        diff -ru tmp/outputGC1.xml tmp/outputGC2.xml
211
212        echo ""
213
214        curl -o tmp/10_wpsGetCapabilities_request.xml http://schemas.opengis.net/wps/1.0.0/examples/10_wpsGetCapabilities_request.xml
215        postRequest "${WPSInstance}" "tmp/outputGCp.xml" "GetCapabilities" "tmp/10_wpsGetCapabilities_request.xml"
216        echo ""
217    fi
218    if [ "$i" == "DescribeProcess" ]; then
219#
220# Tests for DescribeProcess using KVP and POST requests
221#
222        kvpRequest "${WPSInstance}?request=DescribeProcess&service=WPS&version=1.0.0&Identifier=ALL" "tmp/outputDPall.xml" "DescribeProcess"
223
224        params='"request=DescribeProcess" "service=WPS" "version=1.0.0" "Identifier='${ServiceName}'"'
225
226        suffix=$(kvpRequestWrite -1 "$params")
227        kvpRequest "${WPSInstance}?$suffix" "tmp/outputDPb1.xml" "DescribeProcess"
228       
229        for j in 0 1 2 3; do
230            suffix=$(kvpRequestWrite $j "$params")
231            kvpRequest "${WPSInstance}?$suffix" "tmp/outputDPb$(expr $j + 2).xml" "owsExceptionReport"
232        done
233
234        paramsw='"request=DescribeProces" "service=WXS" "version=1.2.0" "Identifier=Undefined"'
235       
236        for j in 0 1 2 3; do
237            suffix=$(kvpWrongRequestWrite $j "$params")
238            kvpRequest "${WPSInstance}?$suffix" "tmp/outputDPb$(expr $j + 6).xml" "owsExceptionReport"
239        done
240
241
242        cat requests/dp.xml | sed "s:ServiceName:${ServiceName}:g" > tmp/dp1.xml
243        postRequest "${WPSInstance}" "tmp/outputDPp.xml" "DescribeProcess" "tmp/dp1.xml"
244        xsltproc extractInputs.xsl tmp/outputDPp.xml > tmp/inputName.txt
245        echo ""
246    fi
247    if [ "$i" == "ExecuteSync" ]; then
248        testPostRequests "ijson_o igml_o ir_o ir_or irb_o irb_or"
249        echo ""
250    fi
251    if [ "$i" == "ExecuteAsync" ]; then
252        testPostRequests "ir_o_async ir_or_async irb_o_async irb_or_async"
253        echo ""
254    fi
255done
Note: See TracBrowser for help on using the repository browser.

Search

Context Navigation

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