summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/Format/WFS.html
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/WFS.html
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/WFS.html')
-rw-r--r--misc/openlayers/tests/Format/WFS.html81
1 files changed, 81 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Format/WFS.html b/misc/openlayers/tests/Format/WFS.html
new file mode 100644
index 0000000..7b3b737
--- /dev/null
+++ b/misc/openlayers/tests/Format/WFS.html
@@ -0,0 +1,81 @@
+<html>
+<head>
+ <script src="../OLLoader.js"></script>
+ <script>
+ function test_wfs_update_node(t) {
+ t.plan(2);
+ var expected = readXML("Update");
+ var updateFeature = new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(1,2),
+ {foo: "bar"});
+ updateFeature.fid = "fid.42";
+ updateFeature.state = OpenLayers.State.UPDATE;
+ var format = new OpenLayers.Format.WFS({
+ 'featureNS':'http://www.openplans.org/topp',
+ 'featureName': 'states',
+ 'geometryName': 'the_geom',
+ 'featurePrefix': 'topp'
+ }, {options:{}});
+ var updateNode = format.update(updateFeature);
+ t.xml_eq(updateNode, expected, "update node matches expected XML value.");
+ var format = new OpenLayers.Format.WFS({
+ 'featurePrefix': 'topp'
+ }, {options:{typename: 'states', 'featureNS': 'http://www.openplans.org/topp', 'geometry_column': 'the_geom' }});
+ var updateNode = format.update(updateFeature);
+ t.xml_eq(updateNode, expected, "update node matches expected XML value.");
+ }
+ function test_wfs_delete_node(t) {
+ t.plan(2);
+ var expected = readXML("Delete");
+ var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(0,0));
+ feature.state = OpenLayers.State.DELETE;
+ feature.fid = "fid.37";
+ var format = new OpenLayers.Format.WFS({
+ 'featureNS':'http://www.openplans.org/topp',
+ 'featureName': 'states',
+ 'featurePrefix': 'topp'
+ }, {options:{}});
+ var deleteNode = format.remove(feature);
+ t.xml_eq(deleteNode, expected, "delete node matches expected XML value.");
+ var format = new OpenLayers.Format.WFS({
+ 'featurePrefix': 'topp'
+ }, {options:{typename: 'states', 'featureNS': 'http://www.openplans.org/topp'}});
+ var deleteNode = format.remove(feature);
+ t.xml_eq(deleteNode, expected, "delete node matches expected XML value.");
+ }
+ function readXML(id) {
+ var xml = document.getElementById(id).firstChild.nodeValue;
+ return new OpenLayers.Format.XML().read(xml).documentElement;
+ }
+
+ </script>
+</head>
+<body>
+<div id="Update"><!--
+<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=" ">1,2</gml:coordinates>
+ </gml:Point>
+ </wfs:Value>
+ </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.42"/>
+ </ogc:Filter>
+</wfs:Update>
+--></div>
+<div id="Delete"><!--
+<wfs:Delete 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:FeatureId fid="fid.37"/>
+ </ogc:Filter>
+</wfs:Delete>
+--></div>
+</body>
+</html>