summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/Format/WFST
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/Format/WFST
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/Format/WFST')
-rw-r--r--misc/openlayers/tests/Format/WFST/v1.html455
-rw-r--r--misc/openlayers/tests/Format/WFST/v1_0_0.html135
-rw-r--r--misc/openlayers/tests/Format/WFST/v1_1_0.html236
3 files changed, 826 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Format/WFST/v1.html b/misc/openlayers/tests/Format/WFST/v1.html
new file mode 100644
index 0000000..6cfb1ca
--- /dev/null
+++ b/misc/openlayers/tests/Format/WFST/v1.html
@@ -0,0 +1,455 @@
+<html>
+<head>
+ <script src="../../OLLoader.js"></script>
+ <script type="text/javascript">
+
+ function test_read(t) {
+ t.plan(1);
+
+ var data = readXML("FeatureCollection");
+ var format = new OpenLayers.Format.WFST({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states"
+ });
+ var features = format.read(data);
+
+ t.eq(features.length, 1, "number of features read from FeatureCollection is correct");
+ }
+
+ function test_write(t) {
+
+ var format = new OpenLayers.Format.WFST({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states",
+ featurePrefix: "topp",
+ geometryName: "the_geom"
+ });
+
+ var feature = new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(1,2),
+ {foo: "bar"}
+ );
+
+ var insertFeature = feature.clone();
+ // null value does not show up in insert
+ insertFeature.attributes.nul = null;
+ insertFeature.state = OpenLayers.State.INSERT;
+ var updateFeature = feature.clone();
+ // undefined value means don't create a Property element
+ updateFeature.attributes.unwritten = undefined;
+ // null value gets Property element with no Value
+ updateFeature.attributes.nul = null;
+ updateFeature.fid = "fid.42";
+ updateFeature.state = OpenLayers.State.UPDATE;
+ var deleteFeature = feature.clone();
+ deleteFeature.state = OpenLayers.State.DELETE;
+ deleteFeature.fid = "fid.37";
+
+ t.plan(8);
+ var snippets = {
+ "GetFeature": {handle: "handle_g", maxFeatures: 1, outputFormat: 'json'},
+ "Transaction": {handle: "handle_t"},
+ "Insert": {feature: insertFeature, options: {handle: "handle_i"}},
+ "Update": {feature: updateFeature, options: {handle: "handle_u"}},
+ "Delete": {feature: deleteFeature, options: {handle: "handle_d"}}
+ }
+
+ var arg;
+ for(var snippet in snippets) {
+ arg = snippets[snippet]
+ var expected = readXML(snippet);
+ var got = format.writers["wfs"][snippet].apply(format, [arg]);
+ t.xml_eq(got, expected, snippet + " request created correctly");
+ }
+
+ updateFeature.modified = {geometry: updateFeature.geometry.clone()};
+ updateFeature.geometry = new OpenLayers.Geometry.Point(2,3);
+ var expected = readXML("UpdateModified");
+ var got = format.writers["wfs"]["Update"].apply(format, [{feature: updateFeature}]);
+ t.xml_eq(got, expected, "Update request for feature with modified geometry created correctly");
+
+ updateFeature.modified.attributes = {foo: "bar"};
+ updateFeature.attributes.foo = "baz";
+ delete updateFeature.modified.geometry;
+ var expected = readXML("UpdateModifiedNoGeometry");
+ var got = format.writers["wfs"]["Update"].apply(format, [{feature: updateFeature}]);
+ t.xml_eq(got, expected, "Update request for feature with no modified geometry but modified attributes created correctly");
+
+ // test for a feature that originally had a null geometry and a null value for the attribute
+ updateFeature.modified = {attributes: {foo: null, nul: "nul"}, geometry: null};
+ updateFeature.attributes.foo = "bar";
+ updateFeature.geometry = new OpenLayers.Geometry.Point(2,3);
+ var expected = readXML("UpdateModified");
+ var got = format.writers["wfs"]["Update"].apply(format, [{feature: updateFeature}]);
+ t.xml_eq(got, expected, "Update request for feature with modified geometry created correctly even if original geometry was null");
+ }
+
+ function test_writeNative(t) {
+ t.plan(1);
+ var format = new OpenLayers.Format.WFST({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states",
+ version: "1.1.0",
+ featurePrefix: "topp",
+ geometryName: null
+ });
+ var output = format.write(null, {nativeElements: [
+ {
+ vendorId: "ORACLE",
+ safeToIgnore: true,
+ value: "ALTER SESSION ENABLE PARALLEL DML"
+ }, {
+ vendorId: "ORACLE",
+ safeToIgnore: false,
+ value: "Another native line goes here"
+ }]
+ });
+ var expected = '<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Native vendorId="ORACLE" safeToIgnore="true">ALTER SESSION ENABLE PARALLEL DML</wfs:Native><wfs:Native vendorId="ORACLE" safeToIgnore="false">Another native line goes here</wfs:Native></wfs:Transaction>';
+ t.xml_eq(output, expected, "Native elements written out correctly");
+ }
+
+ function test_write_no_geometry(t) {
+ var format = new OpenLayers.Format.WFST({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states",
+ featurePrefix: "topp",
+ geometryName: null
+ });
+
+ var feature = new OpenLayers.Feature.Vector(null, {foo: "bar"});
+ feature.state = OpenLayers.State.UPDATE;
+ feature.fid = "fid.36";
+
+ t.plan(1);
+ var snippets = {
+ "UpdateNoGeometry": {feature: feature}
+ }
+
+ var arg;
+ for(var snippet in snippets) {
+ arg = snippets[snippet]
+ var expected = readXML(snippet);
+ var got = format.writers["wfs"]["Update"].apply(format, [arg]);
+ t.xml_eq(got, expected, snippet + " request without geometry created correctly");
+ }
+ }
+
+ function test_setFilterProperty(t) {
+ t.plan(2);
+ var format = new OpenLayers.Format.WFST({
+ geometryName: "foo"
+ });
+ var filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: [new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.BBOX,
+ value: new OpenLayers.Bounds(1,2,3,4)
+ }), new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.DWITHIN,
+ property: "bar",
+ value: new OpenLayers.Geometry.Point(1,2),
+ distance: 10
+ })]
+ });
+ format.setFilterProperty(filter);
+ t.eq(filter.filters[0].property, "foo", "property set if not set on filter");
+ t.eq(filter.filters[1].property, "bar", "property not set if set on filter");
+ }
+
+ function test_update_null_geometry(t) {
+ var format = new OpenLayers.Format.WFST({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states",
+ featurePrefix: "topp",
+ geometryName: "the_geom"
+ });
+
+ var feature = new OpenLayers.Feature.Vector(null, {foo: "bar"});
+ feature.state = OpenLayers.State.UPDATE;
+ feature.fid = "fid.36";
+
+ t.plan(1);
+ var snippets = {
+ "UpdateNullGeometry": {feature: feature}
+ };
+
+ var arg;
+ for (var snippet in snippets) {
+ arg = snippets[snippet]
+ var expected = readXML(snippet);
+ var got = format.writers["wfs"]["Update"].apply(format, [arg]);
+ t.xml_eq(got, expected, snippet + " request with null geometry created correctly");
+ }
+ }
+
+ function test_write_multiple(t) {
+
+ var format = new OpenLayers.Format.WFST({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: ["states", "cities"],
+ featurePrefix: "topp",
+ geometryName: "the_geom"
+ });
+
+ t.plan(1);
+ var snippets = {
+ "GetFeatureMultiple": {}
+ }
+
+ var arg;
+ for(var snippet in snippets) {
+ arg = snippets[snippet]
+ var expected = readXML(snippet);
+ var got = format.writers["wfs"]["GetFeature"].apply(format, [arg]);
+ t.xml_eq(got, expected, snippet + " request created correctly with multiple typenames");
+ }
+ }
+
+ function test_write_multi(t) {
+ t.plan(2);
+ var format = new OpenLayers.Format.WFST({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states",
+ featurePrefix: "topp",
+ geometryName: "the_geom"
+ });
+
+ var feature = new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(1,2),
+ {foo: "bar"}
+ );
+
+ var insertFeature = feature.clone();
+ // null value does not show up in insert
+ insertFeature.attributes.nul = null;
+ insertFeature.state = OpenLayers.State.INSERT;
+ var updateFeature = feature.clone();
+ // undefined value means don't create a Property element
+ updateFeature.attributes.unwritten = undefined;
+ // null value gets Property element with no Value
+ updateFeature.attributes.nul = null;
+ updateFeature.fid = "fid.42";
+ updateFeature.state = OpenLayers.State.UPDATE;
+ var features = [insertFeature, updateFeature];
+
+ var expected = readXML("TransactionMulti");
+ var geomTypes = OpenLayers.Util.extend({}, format.geometryTypes);
+ var got = format.writers["wfs"]["Transaction"].apply(format, [{
+ features: features,
+ options: {multi: true}}
+ ]);
+ t.xml_eq(got, expected, "Transaction request with multi option created correctly");
+ t.eq(format.geometryTypes, geomTypes, "geometry types unchanged after write with multi option");
+ }
+
+ function readXML(id) {
+ var xml = document.getElementById(id).firstChild.nodeValue;
+ return new OpenLayers.Format.XML().read(xml).documentElement;
+ }
+
+ </script>
+</head>
+<body>
+<div id="map" style="width:512px; height:256px"> </div>
+
+<div id="FeatureCollection"><!--
+<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:gml="http://www.opengis.net/gml">
+ <gml:featureMember>
+ <topp:states fid="states.3">
+ <topp:the_geom>
+ <gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
+ <gml:polygonMember>
+ <gml:Polygon>
+ <gml:outerBoundaryIs>
+ <gml:LinearRing>
+ <gml:coordinates decimal="." cs="," ts=" ">-75.70742,38.557476 -75.71106,38.649551 -75.724937,38.83017 -75.752922,39.141548 -75.761658,39.247753 -75.764664,39.295849 -75.772697,39.383007 -75.791435,39.723755 -75.775269,39.724442 -75.745934,39.774818 -75.695114,39.820347 -75.644341,39.838196 -75.583794,39.840008 -75.470345,39.826435 -75.42083,39.79887 -75.412117,39.789658 -75.428009,39.77813 -75.460754,39.763248 -75.475128,39.741718 -75.476334,39.719971 -75.489639,39.714745 -75.610725,39.612793 -75.562996,39.566723 -75.590187,39.463768 -75.515572,39.36694 -75.402481,39.257637 -75.397728,39.073036 -75.324852,39.012386 -75.307899,38.945911 -75.190941,38.80867 -75.083138,38.799812 -75.045998,38.44949 -75.068298,38.449963 -75.093094,38.450451 -75.350204,38.455208 -75.69915,38.463066 -75.70742,38.557476</gml:coordinates>
+ </gml:LinearRing>
+ </gml:outerBoundaryIs>
+ </gml:Polygon>
+ </gml:polygonMember>
+ </gml:MultiPolygon>
+ </topp:the_geom>
+ <topp:STATE_NAME>Delaware</topp:STATE_NAME>
+ <topp:STATE_FIPS>10</topp:STATE_FIPS>
+ <topp:SUB_REGION>S Atl</topp:SUB_REGION>
+ <topp:STATE_ABBR>DE</topp:STATE_ABBR>
+ <topp:LAND_KM>5062.456</topp:LAND_KM>
+ <topp:WATER_KM>1385.022</topp:WATER_KM>
+ <topp:PERSONS>666168.0</topp:PERSONS>
+ <topp:FAMILIES>175867.0</topp:FAMILIES>
+ <topp:HOUSHOLD>247497.0</topp:HOUSHOLD>
+ <topp:MALE>322968.0</topp:MALE>
+ <topp:FEMALE>343200.0</topp:FEMALE>
+ <topp:WORKERS>247566.0</topp:WORKERS>
+ <topp:DRVALONE>258087.0</topp:DRVALONE>
+ <topp:CARPOOL>42968.0</topp:CARPOOL>
+ <topp:PUBTRANS>8069.0</topp:PUBTRANS>
+ <topp:EMPLOYED>335147.0</topp:EMPLOYED>
+ <topp:UNEMPLOY>13945.0</topp:UNEMPLOY>
+ <topp:SERVICE>87973.0</topp:SERVICE>
+ <topp:MANUAL>44140.0</topp:MANUAL>
+ <topp:P_MALE>0.485</topp:P_MALE>
+ <topp:P_FEMALE>0.515</topp:P_FEMALE>
+ <topp:SAMP_POP>102776.0</topp:SAMP_POP>
+ </topp:states>
+ </gml:featureMember>
+</wfs:FeatureCollection>
+--></div>
+
+<div id="GetFeature"><!--
+<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" handle="handle_g" outputFormat="json" maxFeatures="1" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Query typeName="topp:states" xmlns:topp="http://www.openplans.org/topp"/>
+</wfs:GetFeature>
+--></div>
+<div id="GetFeatureMultiple"><!--
+<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Query typeName="topp:states" xmlns:topp="http://www.openplans.org/topp"/>
+ <wfs:Query typeName="topp:cities" xmlns:topp="http://www.openplans.org/topp"/>
+</wfs:GetFeature>
+--></div>
+<div id="Transaction"><!--
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0"/>
+--></div>
+<div id="TransactionMulti"><!--
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0">
+ <wfs:Insert>
+ <feature:states xmlns:feature="http://www.openplans.org/topp">
+ <feature:the_geom>
+ <gml:MultiPoint xmlns:gml="http://www.opengis.net/gml">
+ <gml:pointMember>
+ <gml:Point>
+ <gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates>
+ </gml:Point>
+ </gml:pointMember>
+ </gml:MultiPoint>
+ </feature:the_geom>
+ <feature:foo>bar</feature:foo>
+ </feature:states>
+ </wfs:Insert>
+ <wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <wfs:Property>
+ <wfs:Name>the_geom</wfs:Name>
+ <wfs:Value>
+ <gml:MultiPoint xmlns:gml="http://www.opengis.net/gml">
+ <gml:pointMember>
+ <gml:Point>
+ <gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates>
+ </gml:Point>
+ </gml:pointMember>
+ </gml:MultiPoint>
+ </wfs:Value>
+ </wfs:Property>
+ <wfs:Property>
+ <wfs:Name>foo</wfs:Name>
+ <wfs:Value>bar</wfs:Value>
+ </wfs:Property>
+ <wfs:Property>
+ <wfs:Name>nul</wfs:Name>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="fid.42"/>
+ </ogc:Filter>
+ </wfs:Update>
+</wfs:Transaction>
+--></div>
+<div id="Insert"><!--
+<wfs:Insert xmlns:wfs="http://www.opengis.net/wfs" handle="handle_i">
+ <feature:states xmlns:feature="http://www.openplans.org/topp">
+ <feature:the_geom>
+ <gml:Point xmlns:gml="http://www.opengis.net/gml">
+ <gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates>
+ </gml:Point>
+ </feature:the_geom>
+ <feature:foo>bar</feature:foo>
+ </feature:states>
+</wfs:Insert>
+--></div>
+<div id="Update"><!--
+<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" handle="handle_u" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <wfs:Property>
+ <wfs:Name>the_geom</wfs:Name>
+ <wfs:Value>
+ <gml:Point xmlns:gml="http://www.opengis.net/gml">
+ <gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates>
+ </gml:Point>
+ </wfs:Value>
+ </wfs:Property>
+ <wfs:Property>
+ <wfs:Name>foo</wfs:Name>
+ <wfs:Value>bar</wfs:Value>
+ </wfs:Property>
+ <wfs:Property>
+ <wfs:Name>nul</wfs:Name>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="fid.42"/>
+ </ogc:Filter>
+</wfs:Update>
+--></div>
+<div id="UpdateModified"><!--
+<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <wfs:Property>
+ <wfs:Name>the_geom</wfs:Name>
+ <wfs:Value>
+ <gml:Point xmlns:gml="http://www.opengis.net/gml">
+ <gml:coordinates decimal="." cs="," ts=" ">2,3</gml:coordinates>
+ </gml:Point>
+ </wfs:Value>
+ </wfs:Property>
+ <wfs:Property>
+ <wfs:Name>foo</wfs:Name>
+ <wfs:Value>bar</wfs:Value>
+ </wfs:Property>
+ <wfs:Property>
+ <wfs:Name>nul</wfs:Name>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="fid.42"/>
+ </ogc:Filter>
+</wfs:Update>
+--></div>
+<div id="UpdateModifiedNoGeometry"><!--
+<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <wfs:Property>
+ <wfs:Name>foo</wfs:Name>
+ <wfs:Value>baz</wfs:Value>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="fid.42"/>
+ </ogc:Filter>
+</wfs:Update>
+--></div>
+<div id="Delete"><!--
+<wfs:Delete xmlns:wfs="http://www.opengis.net/wfs" handle="handle_d" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="fid.37"/>
+ </ogc:Filter>
+</wfs:Delete>
+--></div>
+<div id="UpdateNoGeometry"><!--
+<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <wfs:Property>
+ <wfs:Name>foo</wfs:Name>
+ <wfs:Value>bar</wfs:Value>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="fid.36"/>
+ </ogc:Filter>
+</wfs:Update>
+--></div>
+<div id="UpdateNullGeometry"><!--
+<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <wfs:Property>
+ <wfs:Name>the_geom</wfs:Name>
+ </wfs:Property>
+ <wfs:Property>
+ <wfs:Name>foo</wfs:Name>
+ <wfs:Value>bar</wfs:Value>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="fid.36"/>
+ </ogc:Filter>
+</wfs:Update>
+--></div>
+</body>
+</html>
diff --git a/misc/openlayers/tests/Format/WFST/v1_0_0.html b/misc/openlayers/tests/Format/WFST/v1_0_0.html
new file mode 100644
index 0000000..a8fce79
--- /dev/null
+++ b/misc/openlayers/tests/Format/WFST/v1_0_0.html
@@ -0,0 +1,135 @@
+<html>
+<head>
+ <script src="../../OLLoader.js"></script>
+ <script type="text/javascript">
+
+ function test_initialize(t) {
+ t.plan(1);
+
+ var format = new OpenLayers.Format.WFST.v1_0_0({});
+ t.ok(format instanceof OpenLayers.Format.WFST.v1_0_0, "constructor returns instance");
+ }
+
+ function test_read(t) {
+ t.plan(3);
+
+ var data = readXML("Transaction_Response");
+ var format = new OpenLayers.Format.WFST.v1_0_0({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states"
+ });
+ var result = format.read(data);
+ t.eq(result.insertIds[0], "parcelle.40", "First InsertId read correctly");
+ t.eq(result.insertIds[1], "parcelle.41", "Second InsertId read correctly");
+ t.eq(result.success, true, "Success read correctly");
+ }
+
+ function test_write(t) {
+
+ var format = new OpenLayers.Format.WFST.v1_0_0({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states",
+ featurePrefix: "topp",
+ geometryName: "the_geom"
+ });
+
+ var cases = [{
+ id: "query0",
+ writer: "wfs:Query",
+ arg: {
+ filter: new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.BBOX,
+ value: new OpenLayers.Bounds (1,2,3,4)
+ })
+ }
+ }, {
+ id: "query1",
+ writer: "wfs:Query",
+ arg: {
+ srsNameInQuery: true,
+ srsName: "EPSG:900913"
+ }
+ }, {
+ id: "getfeature0",
+ writer: "wfs:GetFeature",
+ arg: {
+ propertyNames: ["STATE_NAME", "STATE_FIPS", "STATE_ABBR"]
+ }
+ }];
+
+ t.plan(cases.length);
+
+ var test, got, exp;
+ for(var i=0; i<cases.length; ++i) {
+ test = cases[i];
+ exp = readXML(test.id);
+ got = format.writeNode(test.writer, test.arg);
+ t.xml_eq(got, exp, test.id + ": correct request");
+ }
+
+ }
+
+ function test_write_poorconfig(t) {
+ t.plan(1);
+ var format = new OpenLayers.Format.WFST.v1_0_0({
+ featureType: "states",
+ featurePrefix: "topp"
+ });
+ var exp = "topp:states";
+ var got = format.writeNode("wfs:Query").getAttribute("typeName");
+ t.eq(got, exp, "Query without featureNS but with featurePrefix queries for the correct featureType");
+ }
+
+ var xmlFormat = new OpenLayers.Format.XML();
+ function readXML(id) {
+ var xml = document.getElementById(id).firstChild.nodeValue;
+ return xmlFormat.read(xml).documentElement;
+ }
+
+ </script>
+</head>
+<body>
+<div id="Transaction_Response"><!--
+<wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc">
+ <wfs:InsertResult>
+ <ogc:FeatureId fid="parcelle.40"/>
+ <ogc:FeatureId fid="parcelle.41"/>
+ </wfs:InsertResult>
+ <wfs:TransactionResult>
+ <wfs:Status>
+ <wfs:SUCCESS/>
+ </wfs:Status>
+ </wfs:TransactionResult>
+</wfs:WFS_TransactionResponse>
+--></div>
+<div id="query0"><!--
+<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:BBOX>
+ <ogc:PropertyName>the_geom</ogc:PropertyName>
+ <gml:Box xmlns:gml="http://www.opengis.net/gml">
+ <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4</gml:coordinates>
+ </gml:Box>
+ </ogc:BBOX>
+ </ogc:Filter>
+</wfs:Query>
+--></div>
+<div id="query1"><!--
+<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="EPSG:900913" xmlns:topp="http://www.openplans.org/topp">
+</wfs:Query>
+--></div>
+<div id="getfeature0"><!--
+<wfs:GetFeature service="WFS" version="1.0.0" xmlns:topp="http://www.openplans.org/topp"
+ xmlns:wfs="http://www.opengis.net/wfs"
+ xmlns:ogc="http://www.opengis.net/ogc"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
+ <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <ogc:PropertyName>STATE_NAME</ogc:PropertyName>
+ <ogc:PropertyName>STATE_FIPS</ogc:PropertyName>
+ <ogc:PropertyName>STATE_ABBR</ogc:PropertyName>
+ </wfs:Query>
+</wfs:GetFeature>
+--></div>
+</body>
+</html>
diff --git a/misc/openlayers/tests/Format/WFST/v1_1_0.html b/misc/openlayers/tests/Format/WFST/v1_1_0.html
new file mode 100644
index 0000000..52c9cee
--- /dev/null
+++ b/misc/openlayers/tests/Format/WFST/v1_1_0.html
@@ -0,0 +1,236 @@
+<html>
+<head>
+ <script src="../../OLLoader.js"></script>
+ <script type="text/javascript">
+
+ function test_initialize(t) {
+ t.plan(1);
+
+ var format = new OpenLayers.Format.WFST.v1_1_0({});
+ t.ok(format instanceof OpenLayers.Format.WFST.v1_1_0, "constructor returns instance");
+ }
+
+ function test_read(t) {
+ t.plan(3);
+
+ var data = readXML("TransactionResponse");
+ var format = new OpenLayers.Format.WFST.v1_1_0({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states"
+ });
+ var result = format.read(data);
+ t.eq(result.insertIds[0], "parcelle.40", "First InsertId read correctly");
+ t.eq(result.insertIds[1], "parcelle.41", "Second InsertId read correctly");
+ t.eq(result.success, true, "Success read correctly");
+ }
+
+ function test_read_hits(t) {
+ t.plan(1);
+ var data = readXML("NumberOfFeatures");
+ var format = new OpenLayers.Format.WFST.v1_1_0({
+ featureNS: "http://mapserver.gis.umn.edu/mapserver",
+ featureType: "AAA64"
+ });
+ var result = format.read(data, {output: "object"});
+ t.eq(result.numberOfFeatures, 625, "numberOfFeatures of FeatureCollection correctly read");
+ }
+
+ function test_read_boundedBy(t) {
+ t.plan(4);
+ var data = readXML("boundedBy");
+ var format = new OpenLayers.Format.WFST.v1_1_0({
+ featureNS: "http://mapserver.gis.umn.edu/mapserver",
+ featureType: "AAA212"
+ });
+ var result = format.read(data, {output: "object"});
+ var bounds = result.bounds;
+ t.eq(bounds.left.toFixed(3), '3197.880', "Left bounds of the feature collection correctly parsed");
+ t.eq(bounds.bottom.toFixed(3), '306457.313', "Bottom bounds of the feature collection correctly parsed");
+ t.eq(bounds.right.toFixed(3), '280339.156', "Right bounds of the feature collection correctly parsed");
+ t.eq(bounds.top.toFixed(3), '613850.438', "Top bounds of the feature collection corectly parsed");
+ }
+
+ function test_write(t) {
+
+ var format = new OpenLayers.Format.WFST.v1_1_0({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states",
+ featurePrefix: "topp",
+ srsName: "urn:ogc:def:crs:EPSG::4326",
+ geometryName: "the_geom"
+ });
+
+ var cases = [{
+ id: "query0",
+ writer: "wfs:Query",
+ arg: {
+ filter: new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.BBOX,
+ value: new OpenLayers.Bounds (1,2,3,4)
+ })
+ }
+ }, {
+ id: "getfeature0",
+ writer: "wfs:GetFeature",
+ arg: {
+ resultType: "hits",
+ propertyNames: ["STATE_NAME", "STATE_FIPS", "STATE_ABBR"]
+ }
+ }, {
+ id: "getfeature1",
+ writer: "wfs:GetFeature",
+ arg: {
+ count: 10,
+ startIndex: 20
+ }
+ }];
+
+ t.plan(cases.length);
+
+ var test, got, exp;
+ for(var i=0; i<cases.length; ++i) {
+ test = cases[i];
+ exp = readXML(test.id);
+ got = format.writeNode(test.writer, test.arg);
+ t.xml_eq(got, exp, test.id + ": correct request");
+ }
+ }
+
+ function test_write_poorconfig(t) {
+ t.plan(1);
+ var format = new OpenLayers.Format.WFST.v1_1_0({
+ featureType: "states",
+ featurePrefix: "topp"
+ });
+ var exp = "topp:states";
+ var got = format.writeNode("wfs:Query").getAttribute("typeName");
+ t.eq(got, exp, "Query without featureNS but with featurePrefix queries for the correct featureType");
+ }
+
+ var xmlFormat = new OpenLayers.Format.XML();
+ function readXML(id) {
+ var xml = document.getElementById(id).firstChild.nodeValue;
+ return xmlFormat.read(xml).documentElement;
+ }
+
+ </script>
+</head>
+<body>
+<div id="map" style="width:512px; height:256px"> </div>
+<div id="NumberOfFeatures"><!--
+<?xml version='1.0' encoding="ISO-8859-1" ?>
+<wfs:FeatureCollection
+ xmlns:rws="http://mapserver.gis.umn.edu/mapserver"
+ xmlns:gml="http://www.opengis.net/gml"
+ xmlns:wfs="http://www.opengis.net/wfs"
+ xmlns:ogc="http://www.opengis.net/ogc"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://intranet.rijkswaterstaat.nl/services/geoservices/nwb_wegen?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=feature:AAA64&amp;OUTPUTFORMAT=text/xml; subtype=gml/3.1.1 http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" numberOfFeatures="625">
+</wfs:FeatureCollection>
+--></div>
+<div id="TransactionResponse"><!--
+<wfs:TransactionResponse version="1.1.0" xmlns:ogc="http://www.opengis.net/ogc" xmlns:tiger="http://www.census.gov" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:sf="http://www.openplans.org/spearfish" xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <wfs:TransactionSummary>
+ <wfs:totalInserted>0</wfs:totalInserted>
+ <wfs:totalUpdated>1</wfs:totalUpdated>
+ <wfs:totalDeleted>0</wfs:totalDeleted>
+ </wfs:TransactionSummary>
+ <wfs:TransactionResults/>
+ <wfs:InsertResults>
+ <wfs:Feature>
+ <ogc:FeatureId fid="parcelle.40"/>
+ </wfs:Feature>
+ <wfs:Feature>
+ <ogc:FeatureId fid="parcelle.41"/>
+ </wfs:Feature>
+ </wfs:InsertResults>
+</wfs:TransactionResponse>
+--></div>
+<div id="query0"><!--
+<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:BBOX>
+ <ogc:PropertyName>the_geom</ogc:PropertyName>
+ <gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG::4326">
+ <gml:lowerCorner>1 2</gml:lowerCorner>
+ <gml:upperCorner>3 4</gml:upperCorner>
+ </gml:Envelope>
+ </ogc:BBOX>
+ </ogc:Filter>
+</wfs:Query>
+--></div>
+<div id="getfeature0"><!--
+<wfs:GetFeature service="WFS" version="1.1.0" resultType="hits" xmlns:topp="http://www.openplans.org/topp"
+ xmlns:wfs="http://www.opengis.net/wfs"
+ xmlns:ogc="http://www.opengis.net/ogc"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
+ <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
+ <wfs:PropertyName>STATE_NAME</wfs:PropertyName>
+ <wfs:PropertyName>STATE_FIPS</wfs:PropertyName>
+ <wfs:PropertyName>STATE_ABBR</wfs:PropertyName>
+ </wfs:Query>
+</wfs:GetFeature>
+--></div>
+<div id="getfeature1"><!--
+<wfs:GetFeature service="WFS" version="1.1.0" startIndex="20" count="10" xmlns:topp="http://www.openplans.org/topp"
+ xmlns:wfs="http://www.opengis.net/wfs"
+ xmlns:ogc="http://www.opengis.net/ogc"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
+ <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
+ </wfs:Query>
+</wfs:GetFeature>
+--></div>
+<div id="boundedBy"><!--
+<?xml version='1.0' encoding="ISO-8859-1" ?>
+<wfs:FeatureCollection
+ xmlns:rws="http://mapserver.gis.umn.edu/mapserver"
+ xmlns:gml="http://www.opengis.net/gml"
+ xmlns:wfs="http://www.opengis.net/wfs"
+ xmlns:ogc="http://www.opengis.net/ogc"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://ontwikkel.intranet.rijkswaterstaat.nl/services/geoservices/ov_zonering?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=AAA212&amp;OUTPUTFORMAT=text/xml; subtype=gml/3.1.1 http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
+ <gml:boundedBy>
+ <gml:Envelope srsName="EPSG:28992">
+ <gml:lowerCorner>3197.880000 306457.313000</gml:lowerCorner>
+ <gml:upperCorner>280339.156000 613850.438000</gml:upperCorner>
+ </gml:Envelope>
+ </gml:boundedBy>
+ <gml:featureMember>
+
+ <rws:AAA212 gml:id="AAA212.791">
+ <gml:boundedBy>
+ <gml:Envelope srsName="EPSG:28992">
+ <gml:lowerCorner>196507.469000 502347.938000</gml:lowerCorner>
+ <gml:upperCorner>202430.844000 510383.719000</gml:upperCorner>
+ </gml:Envelope>
+ </gml:boundedBy>
+ <rws:geometry>
+
+ <gml:MultiSurface srsName="EPSG:28992">
+ <gml:surfaceMembers>
+ <gml:Polygon>
+ <gml:exterior>
+ <gml:LinearRing>
+ <gml:posList srsDimension="2">200448.047000 510383.719000 198475.031000 509253.875000 198477.422000 507339.688000 196507.469000 505841.969000 196507.625000 504980.281000 196621.359000 505029.969000 196825.328000 505114.000000 197310.031000 505183.469000 197636.609000 505148.750000 197837.594000 505061.563000 197941.031000 504953.688000 198003.094000 504817.719000 198023.781000 504721.688000 198016.391000 504597.531000 197907.234000 504363.219000 197716.734000 504013.969000 197700.156000 503567.563000 197775.531000 503373.969000 197930.688000 503153.781000 198034.234000 503045.594000 198170.078000 502932.125000 198504.047000 502725.250000 198858.719000 502550.875000 199138.000000 502460.719000 199336.000000 502347.938000 199044.125000 504910.969000 199549.359000 507065.781000 200280.594000 506878.938000 202430.844000 507474.625000 202430.844000 508850.906000 200448.047000 510383.719000 </gml:posList>
+ </gml:LinearRing>
+ </gml:exterior>
+
+ </gml:Polygon>
+ </gml:surfaceMembers>
+ </gml:MultiSurface>
+ </rws:geometry>
+ <rws:OBJECTID>791</rws:OBJECTID>
+ <rws:HECTARES>1800.89</rws:HECTARES>
+ <rws:ZONENR>4620</rws:ZONENR>
+
+ <rws:NULZONES> </rws:NULZONES>
+ <rws:AREA>0</rws:AREA>
+ <rws:PERIMETER>24305.1</rws:PERIMETER>
+ </rws:AAA212>
+ </gml:featureMember>
+</wfs:FeatureCollection>
+--></div>
+</body>
+</html>