[OpenLayers-Commits] r12005 - in sandbox/bartvde/wps/openlayers:
lib/OpenLayers/Format tests/Format
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed May 25 07:17:05 EDT 2011
Author: bartvde
Date: 2011-05-25 04:17:04 -0700 (Wed, 25 May 2011)
New Revision: 12005
Modified:
sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
Log:
more WPSExecute coverage
Modified: sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
===================================================================
--- sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js 2011-05-25 10:55:58 UTC (rev 12004)
+++ sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js 2011-05-25 11:17:04 UTC (rev 12005)
@@ -127,11 +127,28 @@
"Input": function(input) {
var node = this.createElementNSPlus("wps:Input", {});
this.writeNode("ows:Identifier", input.identifier, node);
+ if (input.title) {
+ this.writeNode("ows:Title", input.title, node);
+ }
+ if (input.data) {
+ this.writeNode("wps:Data", input.data, node);
+ }
if (input.reference) {
this.writeNode("wps:Reference", input.reference, node);
}
return node;
},
+ "Data": function(data) {
+ var node = this.createElementNSPlus("wps:Data", {});
+ if (data.literalData) {
+ this.writeNode("wps:LiteralData", data.literalData, node);
+ }
+ return node;
+ },
+ "LiteralData": function(literalData) {
+ var node = this.createElementNSPlus("wps:LiteralData", {value: literalData});
+ return node;
+ },
"Reference": function(reference) {
var node = this.createElementNSPlus("wps:Reference", {
attributes: {
Modified: sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
===================================================================
--- sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html 2011-05-25 10:55:58 UTC (rev 12004)
+++ sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html 2011-05-25 11:17:04 UTC (rev 12005)
@@ -100,6 +100,64 @@
t.xml_eq(result, expected, "WPS Execute written out correctly");
}
+ function test_write_raw_data_output(t) {
+ t.plan(1);
+ // example request taken from: http://geoprocessing.info/wpsdoc/1x0ExecutePOST
+ 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"/>' +
+' </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>400</wps:LiteralData>' +
+' </wps:Data>' +
+' </wps:Input>' +
+' </wps:DataInputs>' +
+' <wps:ResponseForm>' +
+' <wps:RawDataOutput>' +
+' <ows:Identifier>BufferedPolygon</ows:Identifier>' +
+' </wps:RawDataOutput>' +
+' </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'
+ }
+ }, {
+ identifier: 'BufferDistance',
+ title: 'Distance which people will walk to get to a playground.',
+ data: {
+ literalData: 400
+ }
+ }
+ ]
+ },
+ responseForm: {
+ rawDataOutput: {
+ identifier: "BufferedPolygon"
+ }
+ }
+ });
+ t.xml_eq(result, expected, "WPS Execute written out correctly");
+ }
+
</script>
</head>
<body>
More information about the Commits
mailing list