[OpenLayers-Commits] r12062 - sandbox/bartvde/exception/openlayers/tests/Format

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Jun 7 16:21:48 EDT 2011


Author: bartvde
Date: 2011-06-07 13:21:47 -0700 (Tue, 07 Jun 2011)
New Revision: 12062

Modified:
   sandbox/bartvde/exception/openlayers/tests/Format/OGCExceptionReport.html
Log:
add WMS 1.1.1 support for exception parsing

Modified: sandbox/bartvde/exception/openlayers/tests/Format/OGCExceptionReport.html
===================================================================
--- sandbox/bartvde/exception/openlayers/tests/Format/OGCExceptionReport.html	2011-06-07 19:57:57 UTC (rev 12061)
+++ sandbox/bartvde/exception/openlayers/tests/Format/OGCExceptionReport.html	2011-06-07 20:21:47 UTC (rev 12062)
@@ -5,7 +5,7 @@
 
     function test_read_exception(t) {
 
-        t.plan(15);
+        t.plan(21);
 
         // OCG WMS 1.3.0 exceptions
         var text = '<?xml version="1.0" encoding="UTF-8"?> ' +
@@ -29,13 +29,36 @@
         var result = parser.read(text);
 
         var exceptions = result.exceptionReport.exceptions;
-        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. ", "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");
 
+        var testWMS = function(exceptions) {
+            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. ", "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");
+        };
+
+        testWMS(exceptions);
+
+        // OGC WMS 1.1.1 exceptions
+        text = '<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <!DOCTYPE ServiceExceptionReport SYSTEM "http://schemas.opengis.net/wms/1.1.1/WMS_exception_1_1_1.dtd"> ' +
+'<ServiceExceptionReport version="1.1.1">' +
+'    <ServiceException> Plain text message about an error. </ServiceException>' +
+'    <ServiceException code="InvalidUpdateSequence"> Another error message, this one with a service exception code supplied. </ServiceException>' +
+'    <ServiceException>' +
+'        <![CDATA[ Error in module <foo.c>, line 42' +
+'A 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:' +
+']]>' +
+'    </ServiceException>' +
+'    <ServiceException>' +
+'        <![CDATA[ <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> ]]>' +
+'    </ServiceException>' +
+'</ServiceExceptionReport>';
+        result = parser.read(text);
+        exceptions = result.exceptionReport.exceptions;
+        testWMS(exceptions);
+
         // OGC WFS 1.0.0 exceptions
         text = '<?xml version="1.0" ?> ' +
 '<ServiceExceptionReport version="1.2.0" xmlns="http://www.opengis.net/ogc"' +



More information about the Commits mailing list