summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/Protocol/SOS.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/Protocol/SOS.html
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-0.0.4.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/Protocol/SOS.html')
-rw-r--r--misc/openlayers/tests/Protocol/SOS.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Protocol/SOS.html b/misc/openlayers/tests/Protocol/SOS.html
new file mode 100644
index 0000000..58e6607
--- /dev/null
+++ b/misc/openlayers/tests/Protocol/SOS.html
@@ -0,0 +1,57 @@
+<html>
+<head>
+ <script src="../OLLoader.js"></script>
+ <script type="text/javascript">
+
+ function test_constructor(t) {
+ t.plan(4);
+ var a = new OpenLayers.Protocol.SOS({
+ url: "foo",
+ fois: ["a", "b", "c"]
+ });
+
+ t.eq(a.url, "foo", "constructor sets url");
+ t.eq(a.options.url, a.url, "constructor copies url to options.url");
+ t.eq(a.fois[0], "a", "constructor sets the fois correctly");
+ t.eq((a.format instanceof OpenLayers.Format.SOSGetFeatureOfInterest), true, "Constructor sets format correctly");
+ }
+
+ function test_read(t) {
+ t.plan(4);
+
+ var protocol = new OpenLayers.Protocol.SOS({
+ url: "http://some.url.org/sos?",
+ fois: ["foi1", "foi2"],
+ parseFeatures: function(request) {
+ t.eq(request.responseText, "foo", "parseFeatures called properly");
+ return "foo";
+ }
+ });
+
+ var _POST = OpenLayers.Request.POST;
+
+ var expected, status;
+ OpenLayers.Request.POST = function(obj) {
+ t.xml_eq(new OpenLayers.Format.XML().read(obj.data).documentElement, expected, "GetFeatureOfInterest request is correct");
+ obj.status = status;
+ obj.responseText = "foo";
+ obj.options = {};
+ t.delay_call(0.1, function() {obj.callback.call(this)});
+ return obj;
+ };
+
+ var xml = '<GetFeatureOfInterest xmlns="http://www.opengis.net/sos/1.0" version="1.0.0" service="SOS" xsi:schemaLocation="http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosAll.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><FeatureOfInterestId>foi1</FeatureOfInterestId><FeatureOfInterestId>foi2</FeatureOfInterestId></GetFeatureOfInterest>';
+ expected = new OpenLayers.Format.XML().read(xml).documentElement;
+ status = 200;
+ var response = protocol.read({callback: function(response) {
+ t.eq(response.features, "foo", "user callback properly called with features");
+ t.eq(response.code, OpenLayers.Protocol.Response.SUCCESS, "success reported properly");
+ }});
+
+ }
+
+ </script>
+</head>
+<body>
+</body>
+</html>