[OpenLayers-Commits] r12061 - in sandbox/bartvde/exception/openlayers: lib/OpenLayers/Format tests/Format

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Jun 7 15:57:59 EDT 2011


Author: bartvde
Date: 2011-06-07 12:57:57 -0700 (Tue, 07 Jun 2011)
New Revision: 12061

Modified:
   sandbox/bartvde/exception/openlayers/lib/OpenLayers/Format/OGCExceptionReport.js
   sandbox/bartvde/exception/openlayers/tests/Format/OGCExceptionReport.html
Log:
adding WFS 1.0 error handling into the mix

Modified: sandbox/bartvde/exception/openlayers/lib/OpenLayers/Format/OGCExceptionReport.js
===================================================================
--- sandbox/bartvde/exception/openlayers/lib/OpenLayers/Format/OGCExceptionReport.js	2011-06-07 19:45:54 UTC (rev 12060)
+++ sandbox/bartvde/exception/openlayers/lib/OpenLayers/Format/OGCExceptionReport.js	2011-06-07 19:57:57 UTC (rev 12061)
@@ -96,6 +96,7 @@
             "ServiceException": function(node, exceptionReport) {
                 var exception = {
                     code: node.getAttribute("code"),
+                    locator: node.getAttribute("locator"),
                     text: this.getChildValue(node)
                 };
                 exceptionReport.exceptions.push(exception);

Modified: sandbox/bartvde/exception/openlayers/tests/Format/OGCExceptionReport.html
===================================================================
--- sandbox/bartvde/exception/openlayers/tests/Format/OGCExceptionReport.html	2011-06-07 19:45:54 UTC (rev 12060)
+++ sandbox/bartvde/exception/openlayers/tests/Format/OGCExceptionReport.html	2011-06-07 19:57:57 UTC (rev 12061)
@@ -4,7 +4,9 @@
     <script type="text/javascript">
 
     function test_read_exception(t) {
-        t.plan(12);
+
+        t.plan(15);
+
         // OCG WMS 1.3.0 exceptions
         var text = '<?xml version="1.0" encoding="UTF-8"?> ' +
 '<ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc"' +
@@ -30,10 +32,22 @@
         t.eq(exceptions.length, 4, "We expect 4 exception messages");
         t.eq(exceptions[0].text, " Plain text message about an error. ", "First error message correctly parsed");
         t.eq(exceptions[1].code, "InvalidUpdateSequence", "Code of second error message correctly parsed");
-        t.eq(exceptions[1].text, " Another error message, this one with a service exception code supplied. ");
+        t.eq(exceptions[1].text, " Another error message, this one with a service exception code supplied. ", "Text of second error message correctly parsed");
         t.eq(OpenLayers.String.trim(exceptions[2].text), "Error in module <foo.c>, line 42A message that includes angle brackets in text must be enclosed in a Character Data Section as in this example. All XML-like markup is ignored except for this sequence of three closing characters:", "Third message correctly parsed");
         t.eq(OpenLayers.String.trim(exceptions[3].text), "<Module>foo.c</Module> <Error>An error occurred</Error> <Explanation>Similarly, actual XML can be enclosed in a CDATA section. A generic parser will ignore that XML, but application-specific software may choose to process it.</Explanation>", "Fourth message correctly parsed");
 
+        // OGC WFS 1.0.0 exceptions
+        text = '<?xml version="1.0" ?> ' +
+'<ServiceExceptionReport version="1.2.0" xmlns="http://www.opengis.net/ogc"' +
+'    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
+'    xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">' +
+'    <ServiceException code="999" locator="INSERT STMT 01"> parse error: missing closing tag for element WKB_GEOM </ServiceException>' +
+'</ServiceExceptionReport>';
+        result = parser.read(text);
+        t.eq(result.exceptionReport.exceptions[0].code, "999", "code parsed correctly");
+        t.eq(result.exceptionReport.exceptions[0].locator, "INSERT STMT 01", "locator parsed correctly");
+        t.eq(result.exceptionReport.exceptions[0].text, " parse error: missing closing tag for element WKB_GEOM ", "error text parsed correctly");
+
         // OGC WFS 1.1.0 exceptions that use OWSCommon 1.0
         text = '<?xml version="1.0" encoding="UTF-8"?>' +
 '<ows:ExceptionReport language="en" version="1.0.0"' +



More information about the Commits mailing list