[OpenLayers-Commits] r12007 - in sandbox/bartvde/wps/openlayers:
lib/OpenLayers/Format tests/Format
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed May 25 11:24:09 EDT 2011
Author: bartvde
Date: 2011-05-25 08:24:08 -0700 (Wed, 25 May 2011)
New Revision: 12007
Modified:
sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
Log:
another testcase for WPSExecute
Modified: sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
===================================================================
--- sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js 2011-05-25 15:00:15 UTC (rev 12006)
+++ sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js 2011-05-25 15:24:08 UTC (rev 12007)
@@ -116,7 +116,9 @@
"ResponseDocument": function(responseDocument) {
var node = this.createElementNSPlus("wps:ResponseDocument", {
attributes: {
- storeExecuteResponse: responseDocument.storeExecuteResponse
+ storeExecuteResponse: responseDocument.storeExecuteResponse,
+ lineage: responseDocument.lineage,
+ status: responseDocument.status
}
});
if (responseDocument.output) {
@@ -173,7 +175,12 @@
return node;
},
"LiteralData": function(literalData) {
- var node = this.createElementNSPlus("wps:LiteralData", {value: literalData});
+ var node = this.createElementNSPlus("wps:LiteralData", {
+ attributes: {
+ uom: literalData.uom
+ },
+ value: literalData.value
+ });
return node;
},
"Reference": function(reference) {
@@ -181,7 +188,9 @@
attributes: {
mimeType: reference.mimeType,
"xlink:href": reference.href,
- method: reference.method
+ method: reference.method,
+ encoding: reference.encoding,
+ schema: reference.schema
}
});
if (reference.body) {
Modified: sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
===================================================================
--- sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html 2011-05-25 15:00:15 UTC (rev 12006)
+++ sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html 2011-05-25 15:24:08 UTC (rev 12007)
@@ -144,7 +144,9 @@
identifier: 'BufferDistance',
title: 'Distance which people will walk to get to a playground.',
data: {
- literalData: 400
+ literalData: {
+ value: 400
+ }
}
}
]
@@ -206,7 +208,9 @@
identifier: 'BufferDistance',
title: 'Distance which people will walk to get to a playground.',
data: {
- literalData: 400
+ literalData: {
+ value: 400
+ }
}
}
]
@@ -226,6 +230,82 @@
t.xml_eq(result, expected, "WPS Execute written out correctly");
}
+ function test_write_request_responseDoc_specifiedFormat(t) {
+ t.plan(1);
+ // taken from http://geoprocessing.info/schemas/wps/1.0/examples/52_wpsExecute_request_ResponseDocument.xml
+ var expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
+'<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/wpsAll.xsd">' +
+' <ows:Identifier>Buffer</ows:Identifier>' +
+' <wps:DataInputs>' +
+' <wps:Input>' +
+' <ows:Identifier>InputPolygon</ows:Identifier>' +
+' <ows:Title>Playground area</ows:Title>' +
+' <wps:Reference xlink:href="http://foo.bar/some_WFS_request.xml" method="POST" mimeType="text/xml" encoding="UTF-8" schema="http://foo.bar/gml_polygon_schema.xsd"/>' +
+' </wps:Input>' +
+' <wps:Input>' +
+' <ows:Identifier>BufferDistance</ows:Identifier>' +
+' <ows:Title>Distance which people will walk to get to a playground.</ows:Title>' +
+' <wps:Data>' +
+' <wps:LiteralData uom="feet">400</wps:LiteralData>' +
+' </wps:Data>' +
+' </wps:Input>' +
+' </wps:DataInputs>' +
+' <wps:ResponseForm>' +
+' <wps:ResponseDocument storeExecuteResponse="true" lineage="true" status="true">' +
+' <wps:Output asReference="true">' +
+' <ows:Identifier>BufferedPolygon</ows:Identifier>' +
+' <ows:Title>Area serviced by playground.</ows:Title>' +
+' <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract>' +
+' </wps:Output>' +
+' </wps:ResponseDocument>' +
+' </wps:ResponseForm>' +
+'</wps:Execute>';
+
+ var format = new OpenLayers.Format.WPSExecute();
+ var result = format.write({
+ identifier: "Buffer",
+ dataInputs: {
+ inputs: [
+ {
+ identifier: 'InputPolygon',
+ title: 'Playground area',
+ reference: {
+ href: 'http://foo.bar/some_WFS_request.xml',
+ method: "POST",
+ mimeType: "text/xml",
+ encoding: "UTF-8",
+ schema: "http://foo.bar/gml_polygon_schema.xsd"
+ }
+ }, {
+ identifier: 'BufferDistance',
+ title: 'Distance which people will walk to get to a playground.',
+ data: {
+ literalData: {
+ value: 400,
+ uom: 'feet'
+ }
+ }
+ }
+ ]
+ },
+ responseForm: {
+ responseDocument: {
+ storeExecuteResponse: true,
+ lineage: true,
+ status: true,
+ output: {
+ asReference: true,
+ identifier: 'BufferedPolygon',
+ title: 'Area serviced by playground.',
+ abstract: 'Area within which most users of this playground will live.'
+ }
+ }
+ }
+ });
+ t.xml_eq(result, expected, "WPS Execute written out correctly");
+ }
</script>
</head>
<body>
More information about the Commits
mailing list