From be7c55f4325d9fd1da9cdc51344c55cfc6186352 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Thu, 27 Dec 2012 14:28:46 +0100 Subject: [PATCH] Added full suite of wcs 1.1.0 tests, all are passing --- .../Format/WCSCapabilities/v1_1_0.js | 11 +- tests/Format/WCSCapabilities/v1.html | 195 ++++-------------- 2 files changed, 46 insertions(+), 160 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 7e2061afcb..cdd1db21f9 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -65,15 +65,14 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( }, "Contents": function(node, request) { - var contents = []; - this.readChildNodes(node, contents); - - request.contents = contents; + request.contents = []; + this.readChildNodes(node, request.contents); }, "CoverageSummary": function(node, contents) { - contents.coverageSummary = {}; - this.readChildNodes(node, contents.coverageSummary); + var coverageSummary = {}; + this.readChildNodes(node, coverageSummary); // Read the summary + contents.push(coverageSummary); // Add it to the contents array }, "Identifier": function(node, coverageSummary) { diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html index 646ca47f3e..7579cdb98c 100644 --- a/tests/Format/WCSCapabilities/v1.html +++ b/tests/Format/WCSCapabilities/v1.html @@ -7,21 +7,21 @@ t.plan(1); var parser = new OpenLayers.Format.WCSCapabilities(); var text = '' + -'' + -' ' + -' Update error: Error occured updating features' + -' Second exception line' + -' ' + -''; + '' + + ' ' + + ' Update error: Error occured updating features' + + ' Second exception line' + + ' ' + + ''; var obj = parser.read(text); t.ok(!!obj.error, "Error reported correctly"); // The above should place an error in obj.error } function test_read(t) { - t.plan(26); // Number of tests performed: If you add a test below, be sure to increment this accordingly + t.plan(34); // Number of tests performed: If you add a test below, be sure to increment this accordingly var parser = new OpenLayers.Format.WCSCapabilities(); @@ -30,7 +30,6 @@ var res = parser.read(text); - t.ok(!res.error, "Parsing XML generated no errors"); t.eq(res.service.fees, "mucho dinero", "Service>Fees correctly parsed"); t.eq(res.service.accessConstraints, "Open to the public", "Service>AccessConstraints correctly parsed"); @@ -38,162 +37,50 @@ t.eq(res.service.keywords[0], "Geospatial WebServices", "Service>Keywords correctly parsed"); t.eq(res.service.label, "WCS Sample Data Server 1.0.0", "Service>Label correctly parsed"); t.eq(res.service.name, "MapServer WCS", "Service>Name correctly parsed"); - t.eq(res.service.responsibleParty.individualName, "Franko Lemmer", "Service>ResponsibleParty>IndividualName correctly parsed"); - t.eq(res.service.responsibleParty.organisationName, "CRP Henri Tudor", "Service>ResponsibleParty>OrganisationName correctly parsed"); - t.eq(res.service.responsibleParty.positionName, "R+D engineer", "Service>ResponsibleParty>PositionName correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.city, "Esch-sur-Alzette", "Service>responsibleParty>ContactInfo>Address>City correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.country, "Luxembourg", "Service>responsibleParty>ContactInfo>Address>Country correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.deliveryPoint, "66, rue de Luxembourg", "Service>responsibleParty>ContactInfo>Address>DeliveryPoint correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.electronicMailAddress, "franko.lemmer@flensburger.de", "Service>responsibleParty>ContactInfo>Address>ElectronicMailAddress correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.postalCode, "97202", "Service>responsibleParty>ContactInfo>Address>PostalCode correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.phone.facsimile, "6465955", "Service>responsibleParty>ContactInfo>Phone>Facsimile correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.phone.voice, "6463320", "Service>responsibleParty>ContactInfo>Phone>Voice correctly parsed"); + + var responsibleParty = res.service.responsibleParty; + t.eq(responsibleParty.individualName, "Franko Lemmer", "Service>ResponsibleParty>IndividualName correctly parsed"); + t.eq(responsibleParty.organisationName, "CRP Henri Tudor", "Service>ResponsibleParty>OrganisationName correctly parsed"); + t.eq(responsibleParty.positionName, "R+D engineer", "Service>ResponsibleParty>PositionName correctly parsed"); + t.eq(responsibleParty.contactInfo.address.city, "Esch-sur-Alzette", "Service>responsibleParty>ContactInfo>Address>City correctly parsed"); + t.eq(responsibleParty.contactInfo.address.country, "Luxembourg", "Service>responsibleParty>ContactInfo>Address>Country correctly parsed"); + t.eq(responsibleParty.contactInfo.address.deliveryPoint, "66, rue de Luxembourg", "Service>responsibleParty>ContactInfo>Address>DeliveryPoint correctly parsed"); + t.eq(responsibleParty.contactInfo.address.electronicMailAddress, "franko.lemmer@flensburger.de", "Service>responsibleParty>ContactInfo>Address>ElectronicMailAddress correctly parsed"); + t.eq(responsibleParty.contactInfo.address.postalCode, "97202", "Service>responsibleParty>ContactInfo>Address>PostalCode correctly parsed"); + t.eq(responsibleParty.contactInfo.phone.facsimile, "6465955", "Service>responsibleParty>ContactInfo>Phone>Facsimile correctly parsed"); + t.eq(responsibleParty.contactInfo.phone.voice, "6463320", "Service>responsibleParty>ContactInfo>Phone>Voice correctly parsed"); + + var metadata = res.contentMetadata[0]; + t.eq(metadata.name, "ro_dsm", "ContentMetadata>Name correctly parsed"); + t.eq(metadata.label, "Rotterdam DSM", "ContentMetadata>Label correctly parsed"); + t.eq(metadata.lonLatEnvelope.min.lat, "51.515151", "ContentMetadata>lonLatEnvelope>Min>Lat correctly parsed"); + t.eq(metadata.lonLatEnvelope.min.lon, "4.44444", "ContentMetadata>lonLatEnvelope>Min>Lon correctly parsed"); + t.eq(metadata.lonLatEnvelope.max.lat, "52.525252", "ContentMetadata>lonLatEnvelope>Max>Lat correctly parsed"); + t.eq(metadata.lonLatEnvelope.max.lon, "5.55555", "ContentMetadata>lonLatEnvelope>Max>Lon correctly parsed"); + t.eq(metadata.lonLatEnvelope.srsName, "urn:ogc:def:crs:OGC:1.3:CRS84", "ContentMetadata>lonLatEnvelope>SrsName correctly parsed"); t.eq(res.contentMetadata.length, 4, "Correct number of metadata records found"); - t.eq(res.contentMetadata[0].label, "Rotterdam DSM", "ContentMetadata>Label correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.min.lat, "51.515151", "ContentMetadata>lonLatEnvelope>Min>Lat correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.min.lon, "4.44444", "ContentMetadata>lonLatEnvelope>Min>Lon correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.max.lat, "52.525252", "ContentMetadata>lonLatEnvelope>Max>Lat correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.max.lon, "5.55555", "ContentMetadata>lonLatEnvelope>Max>Lon correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.srsName, "urn:ogc:def:crs:OGC:1.3:CRS84", "ContentMetadata>lonLatEnvelope>SrsName correctly parsed"); - t.eq(res.contentMetadata[0].name, "ro_dsm", "ContentMetadata>Name correctly parsed"); // GeoServer, v1.1.0 text = 'Web-Service Demo with data stored at TUDOR siteThis installation serves different Web-Service types (WMS, WFS) for testingGeospatial WebServicesKeyword OneKeyword Two!!OGC WCS1.1.0No fee!Unconstrained!CRP Henri TudorRoy DumerdeR+D engineer6463320646595566, rue de LuxembourgEsch-sur-Alzette97202Luxembourgflappy@tutones.com24/7by phoneGIS-AnalystWCS1.1.0WCS1.1.0ro_dsmro_dsm_miniro_irraro_irra_extWCS1.1.0ro_dsmro_dsm_miniro_irraro_irra_extNEAREST_NEIGHBOURBILINEARimage/tiffimage/pngimage/jpegimage/gifimage/png; mode=8bitfalseurn:ogc:def:crs:epsg::4326Rotterdam DSMDigital Surface Model (DSM) raster data set of inner city Rotterdam4.471333734139 51.9128134273834.4808508475645 51.9248713705576urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_dsmRotterdam sample DSM subsetThis a test data set of Rotterdams DSM subset4.47489346945755 51.91594537869274.47687824892444 51.9170706688033urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_dsm_miniRotterdam (Ljinbaan) solar irradiation data 2010This a result data set of a solar computation of Ljinbaan area. It shows the sum of kWh/a per sqmeter for 20104.471333734139 51.9128134273834.4808508475645 51.9248713705576urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_irraRotterdam (extended) solar irradiation data 2010This a result data set of a solar computation of extended Rotterdam area. It shows the sum of kWh/a per sqmeter for 20104.10024171314823 51.93597649928444.21909054278063 52.001415228243urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_irra_ext'; - res = parser.read(text); + // Most of the parsing is handled by other objects, so not much actually requires testing here t.ok(!res.error, "Parsing XML generated no errors"); - // ft = res.featureTypeList.featureTypes; - // t.eq(ft.length, 14, "number of feature types correct"); - // t.eq(ft[0]["abstract"], "Manhattan landmarks, identifies water, lakes, parks, interesting buildilngs", "abstract of first feature type correct"); - // t.eq(ft[0]["title"], "Manhattan (NY) landmarks", "title of first feature type correct"); - // t.eq(ft[0]["name"], "poly_landmarks", "name of first feature type correct"); - // t.eq(ft[0]["featureNS"], "http://www.census.gov", "ns of first feature type correct"); - // t.eq(ft[0]["srs"], "EPSG:4326", "srs of first feature type correct"); + t.eq(res.contents.length, 4, "number of features correct"); - // var service = res.service; - // t.eq(service.name, 'WFS', "service name correct"); - // t.eq(service.title, 'GeoServer Web Feature Service', "service title correct"); - // t.eq(service.abstract, 'This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.', "service title correct"); - // t.eq(service.keywords[0], 'WFS', "service keyword [0] correct"); - // t.eq(service.keywords[2], 'GEOSERVER', "service keyword [2] correct"); - // t.eq(service.onlineResource, 'http://localhost:80/geoserver/wfs', "service onlineresource correct"); - // t.ok(typeof service.fees == 'undefined', "service fees correct"); - // t.ok(typeof service.accessConstraints == 'undefined', "service accessconstraints correct"); - - // t.eq(res.capability.request.getfeature.href.post, "http://localhost:80/geoserver/wfs?", "getfeature request post href correct"); - // t.eq(res.capability.request.getfeature.href.get, "http://localhost:80/geoserver/wfs?request=GetFeature", "getfeature request get href correct"); - - // t.eq(res.capability.request.getfeature.formats[0], "GML2", "getfeature response format [0] correct"); - // t.eq(res.capability.request.getfeature.formats[4], "GML3", "getfeature response format [4] correct"); - - // // UMN Mapserer, v1.0.0 - // text = - // '' + - // '' + - // '' + - // '' + - // '' + - // '' + - // ' MapServer WFS' + - // ' GMap WMS Demo Server' + - // ' http://127.0.0.1/cgi-bin/mapserv_40?map=/msroot/apache/htdocs/gmap/htdocs/gmap75_wfs.map&service=WFS&' + - // '' + - // '' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // '' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // ' park' + - // ' Parks' + - // ' EPSG:42304' + - // ' ' + - // ' ' + - // ' ' + - // ' popplace' + - // '' + - // ' Cities' + - // ' EPSG:42304' + - // ' ' + - // ' ' + - // '' + - // '' + - // '' + - // ' ' + - // ' ' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // '' + - // ''; - // res = parser.read(text); - // var ft = res.featureTypeList.featureTypes; - // t.eq(ft.length, 2, "number of feature types correct"); - // t.eq(ft[0]["title"], "Parks", "title of first feature type correct"); - // t.eq(ft[0]["name"], "park", "name of first feature type correct"); - // t.eq(ft[0]["srs"], "EPSG:42304", "srs of first feature type correct"); - - // var service = res.service; - // t.eq(service.name, 'MapServer WFS', "service name correct"); - // t.eq(service.title, 'GMap WMS Demo Server', "service title correct"); - // t.eq(service.onlineResource, 'http://127.0.0.1/cgi-bin/mapserv_40?map=/msroot/apache/htdocs/gmap/htdocs/gmap75_wfs.map&service=WFS&', "service onlineresource correct"); - // t.eq(res.capability.request.getfeature.href.get, "http://127.0.0.1/cgi-bin/mapserv_40?map=/msroot/apache/htdocs/gmap/htdocs/gmap75_wfs.map&service=WFS&", "getfeature request get href correct"); - // t.eq(res.capability.request.getfeature.formats[0], "GML2", "getfeature response format [0] correct"); + var contents = res.contents[0]; + t.eq(contents.identifier, "ro_dsm", "correct identifier"); + t.eq(contents.title, "Rotterdam DSM", "correct title"); + t.eq(contents.abstract, "Digital Surface Model (DSM) raster data set of inner city Rotterdam", "correct abstract"); + t.eq(contents.supportedFormat.length, 1, "correct number of supported formats"); + t.eq(contents.supportedFormat[0], "image/tiff", "correct format"); + t.eq(contents.supportedCRS.length, 4, "correct number of CRS records"); + t.eq(contents.supportedCRS[2], "urn:ogc:def:crs:EPSG::3857", "correct CRS"); } - - +