[Pywps-commits] r1009 - in branches/pywps-foss4g2010/tests: . Templates/1_0_0/inc processes
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Sep 6 11:20:39 CEST 2010
Author: jachym
Date: 2010-09-06 11:20:39 +0200 (Mon, 06 Sep 2010)
New Revision: 1009
Added:
branches/pywps-foss4g2010/tests/processes/buffer.py
Modified:
branches/pywps-foss4g2010/tests/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl
branches/pywps-foss4g2010/tests/perform_requests.py
branches/pywps-foss4g2010/tests/processes/__init__.py
branches/pywps-foss4g2010/tests/processes/dummyprocess.py
branches/pywps-foss4g2010/tests/processes/tests.py
Log:
merged up to rev. r1008 from trunk
Modified: branches/pywps-foss4g2010/tests/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl
===================================================================
--- branches/pywps-foss4g2010/tests/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl 2010-09-06 09:18:23 UTC (rev 1008)
+++ branches/pywps-foss4g2010/tests/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl 2010-09-06 09:20:39 UTC (rev 1009)
@@ -1,8 +1,8 @@
<Default>
- <CRS xlink:href="<TMPL_VAR crs>" />
+ <CRS><TMPL_VAR crs></CRS>
</Default>
<Supported>
<TMPL_LOOP CRSs>
- <CRS xlink:href="<TMPL_VAR crs>" />
+ <CRS><TMPL_VAR crs></CRS>
</TMPL_LOOP>
</Supported>
Modified: branches/pywps-foss4g2010/tests/perform_requests.py
===================================================================
--- branches/pywps-foss4g2010/tests/perform_requests.py 2010-09-06 09:18:23 UTC (rev 1008)
+++ branches/pywps-foss4g2010/tests/perform_requests.py 2010-09-06 09:20:39 UTC (rev 1009)
@@ -28,6 +28,7 @@
getdescribeprocessrequest = "service=wps&request=describeprocess&version=1.0.0&identifier=dummyprocess"
getexecuterequest = "service=wps&request=execute&version=1.0.0&identifier=dummyprocess&datainputs=[input1=20;input2=10]"
wfsurl = "http://www2.dmsolutions.ca/cgi-bin/mswfs_gmap?version=1.0.0&request=getfeature&service=wfs&typename=park"
+ wcsurl = "http://www.bnhelp.cz/cgi-bin/crtopo?service=WMS&request=GetMap&LAYERS=sitwgs&TRANSPARENT=true&FORMAT=image%2Ftiff&EXCEPTIONS=application%2Fvnd.ogc.se_xml&VERSION=1.1.1&STYLES=default&SRS=EPSG%3A4326&BBOX=-10,-10,10,10&WIDTH=50&HEIGHT=50"
wpsns = "http://www.opengis.net/wps/1.0.0"
xmldom = None
@@ -179,9 +180,11 @@
postpywps.performRequest(postinputs)
origData = open(os.path.join(pywpsPath,"tests","datainputs","dem.tiff"),"rb")
- self.assertEquals(postpywps.response.read(),origData.read())
+ rasterWpsData = base64.encodestring(origData.read())
+ resp = postpywps.response.read();
+ self.assertEquals(resp.strip(),rasterWpsData.strip())
- def _test09ParseExecuteComplexVectorInputs(self):
+ def test09ParseExecuteComplexVectorInputs(self):
"""Test, if pywps can parse complex vector input values, given as reference, output given directly"""
self._setFromEnv()
import urllib
@@ -209,36 +212,7 @@
# output GML should be the same, as input GML
self.assertTrue(xmldom, outputgml)
- def _test10ParseExecuteComplexVectorInputsAsReference(self):
- """Test, if pywps can parse complex vector input values, given as reference"""
- self._setFromEnv()
- import urllib
- import tempfile
- gmlfile = open(tempfile.mktemp(prefix="pywps-test-wfs"),"w")
- gmlfile.write(urllib.urlopen(self.wfsurl).read())
- gmlfile.close()
- request = "service=wps&request=execute&version=1.0.0&identifier=complexVector&datainputs=[indata=%s]&responsedocument=[outdata=@asreference=true]" % (urllib.quote(self.wfsurl))
- mypywps = pywps.Pywps(pywps.METHOD_GET)
- inputs = mypywps.parseRequest(request)
- mypywps.performRequest()
- xmldom = minidom.parseString(mypywps.response)
- self.assertFalse(len(xmldom.getElementsByTagNameNS(self.wpsns,"ExceptionReport")), 0)
-
- # try to get out the Reference elemengt
- gmlout = xmldom.getElementsByTagNameNS(self.wpsns,"Reference")[0].getAttribute("xlink:href")
-
- # download, store, parse XML
- gmlfile2 = open(tempfile.mktemp(prefix="pywps-test-wfs"),"w")
- gmlfile2.write(urllib.urlopen(gmlout).read())
- gmlfile2.close()
- xmldom2 = minidom.parse(gmlfile2.name)
- xmldom = minidom.parse(gmlfile.name)
-
- # check, if they fit
- # TODO: this test failes, but no power to get it trough
- # self.assertEquals(xmldom, xmldom2)
-
def testT11ParseExecuteComplexVectorAndRasterInputsAsReferenceOutpu(self):
"""Test, if pywps can store complex values as reference"""
postpywps = pywps.Pywps(pywps.METHOD_POST)
@@ -269,6 +243,31 @@
######################################################################################
+ def test13ParseExecuteComplexVectorInputsAsReferenceMapServer(self):
+ """Test if PyWPS can return correct WFS and WCS services for output
+ data reference"""
+ self._setFromEnv()
+ import urllib
+ import tempfile
+
+ getpywps = pywps.Pywps(pywps.METHOD_GET)
+ inputs = getpywps.parseRequest("service=wps&version=1.0.0&request=execute&identifier=complexprocessows&datainputs=[rasterin=%s;vectorin=%s]&responsedocument=[rasterout=@asreference=true;vectorout=@asreference=true]" % (urllib.quote(self.wcsurl), urllib.quote(self.wfsurl)))
+ getpywps.performRequest()
+ xmldom = minidom.parseString(getpywps.response)
+
+ self.assertFalse(len(xmldom.getElementsByTagNameNS(self.wpsns,"ExceptionReport")), 0)
+
+ # try to get out the Reference elemengt
+ wfsurl = xmldom.getElementsByTagNameNS(self.wpsns,"Reference")[0].getAttribute("xlink:href")
+ wcsurl = xmldom.getElementsByTagNameNS(self.wpsns,"Reference")[1].getAttribute("xlink:href")
+
+ # test, if there are WFS and WCS request strings
+ self.assertTrue(wfsurl.find("WFS") > -1)
+ self.assertTrue(wcsurl.find("WCS") > -1)
+ print urllib.unquote(wfsurl)
+ print urllib.unquote(wcsurl)
+
+
def _setFromEnv(self):
os.putenv("PYWPS_PROCESSES", os.path.join(pywpsPath,"tests","processes"))
os.environ["PYWPS_PROCESSES"] = os.path.join(pywpsPath,"tests","processes")
Modified: branches/pywps-foss4g2010/tests/processes/__init__.py
===================================================================
--- branches/pywps-foss4g2010/tests/processes/__init__.py 2010-09-06 09:18:23 UTC (rev 1008)
+++ branches/pywps-foss4g2010/tests/processes/__init__.py 2010-09-06 09:20:39 UTC (rev 1009)
@@ -1 +1 @@
-__all__ = ["returner","dummyprocess","moreInOne","moreInstancesInOne","tests"]
+__all__ = ["returner","dummyprocess","moreInOne","moreInstancesInOne","tests","buffer"]
Copied: branches/pywps-foss4g2010/tests/processes/buffer.py (from rev 1008, trunk/tests/processes/buffer.py)
Modified: branches/pywps-foss4g2010/tests/processes/dummyprocess.py
===================================================================
--- branches/pywps-foss4g2010/tests/processes/dummyprocess.py 2010-09-06 09:18:23 UTC (rev 1008)
+++ branches/pywps-foss4g2010/tests/processes/dummyprocess.py 2010-09-06 09:20:39 UTC (rev 1009)
@@ -18,10 +18,10 @@
self.Input1 = self.addLiteralInput(identifier = "input1",
title = "Input1 number",
- default="100")
+ default=100)
self.Input2= self.addLiteralInput(identifier="input2",
title="Input2 number",
- default="200")
+ default=200)
self.Output1=self.addLiteralOutput(identifier="output1",
title="Output1 add 1 result")
self.Output2=self.addLiteralOutput(identifier="output2",title="Output2 subtract 1 result" )
Modified: branches/pywps-foss4g2010/tests/processes/tests.py
===================================================================
--- branches/pywps-foss4g2010/tests/processes/tests.py 2010-09-06 09:18:23 UTC (rev 1008)
+++ branches/pywps-foss4g2010/tests/processes/tests.py 2010-09-06 09:20:39 UTC (rev 1009)
@@ -88,6 +88,47 @@
time.sleep(5)
return
+class ComplexProcessOWS(WPSProcess):
+ def __init__(self):
+
+ WPSProcess.__init__(self, identifier = "complexprocessows",
+ title="Complex process",
+ storeSupported=True)
+
+ self.vectorin = self.addComplexInput(identifier="vectorin",
+ title="Vector file")
+
+ self.rasterin = self.addComplexInput(identifier="rasterin",
+ title="Raster file",
+ formats = [{"mimeType":"image/tiff"}])
+
+ self.pausein = self.addLiteralInput(identifier="pause",
+ title="Pause the process",
+ abstract="Pause the process for several seconds, so that status=true can be tested",
+ default = False,
+ type = type(True))
+
+ self.vectorout = self.addComplexOutput(identifier="vectorout",
+ title="Vector file",
+ useMapscript=True)
+
+ self.rasterout = self.addComplexOutput(identifier="rasterout",
+ title="Raster file",
+ formats = [{"mimeType":"image/tiff"}],
+ useMapscript=True)
+
+ def execute(self):
+ self.vectorout.setValue(self.vectorin.getValue())
+ self.rasterout.setValue(self.rasterin.getValue())
+
+
+ if self.pausein.getValue():
+ import time
+ for i in range(5):
+ self.status.set("Processing process",i*20)
+ time.sleep(5)
+ return
+
class BBoxProcess(WPSProcess):
"""This process defines bounding box in- and outputs"""
More information about the Pywps-commits
mailing list