[Commits] r217 - in sandbox/opengeo/drake/trunk/core: lib tests tests/data
commits at geoext.org
commits at geoext.org
Wed Mar 11 22:08:02 CET 2009
Author: dwins
Date: 2009-03-11 22:08:01 +0100 (Wed, 11 Mar 2009)
New Revision: 217
Added:
sandbox/opengeo/drake/trunk/core/tests/data/WMSCapabilitiesReader.html
Modified:
sandbox/opengeo/drake/trunk/core/lib/GeoExt.js
sandbox/opengeo/drake/trunk/core/tests/data/FeatureReader.html
sandbox/opengeo/drake/trunk/core/tests/list-tests.html
Log:
Add tests for WMSCapabilitiesReader.
Modified: sandbox/opengeo/drake/trunk/core/lib/GeoExt.js
===================================================================
--- sandbox/opengeo/drake/trunk/core/lib/GeoExt.js 2009-03-10 18:17:56 UTC (rev 216)
+++ sandbox/opengeo/drake/trunk/core/lib/GeoExt.js 2009-03-11 21:08:01 UTC (rev 217)
@@ -88,7 +88,6 @@
"GeoExt/data/ProtocolProxy.js",
"GeoExt/data/AttributesReader.js",
"GeoExt/data/AttributesStore.js",
- "GeoExt/util/Parser.js",
"GeoExt/widgets/FilterBuilder.js",
"GeoExt/widgets/FilterPanel.js",
"GeoExt/widgets/grid/FeatureSelectionModel.js",
Modified: sandbox/opengeo/drake/trunk/core/tests/data/FeatureReader.html
===================================================================
--- sandbox/opengeo/drake/trunk/core/tests/data/FeatureReader.html 2009-03-10 18:17:56 UTC (rev 216)
+++ sandbox/opengeo/drake/trunk/core/tests/data/FeatureReader.html 2009-03-11 21:08:01 UTC (rev 217)
@@ -19,7 +19,7 @@
t.eq(fields.items.length, 2, 'number of items is correct');
t.ok(fields.items[0].name == 'foo' &&
fields.items[1].name == 'bar',
- 'field values are correct');
+ 'field names are correct');
}
function test_readRecords(t) {
t.plan(9);
Added: sandbox/opengeo/drake/trunk/core/tests/data/WMSCapabilitiesReader.html
===================================================================
--- sandbox/opengeo/drake/trunk/core/tests/data/WMSCapabilitiesReader.html (rev 0)
+++ sandbox/opengeo/drake/trunk/core/tests/data/WMSCapabilitiesReader.html 2009-03-11 21:08:01 UTC (rev 217)
@@ -0,0 +1,224 @@
+<!DOCTYPE html>
+<html debug="true">
+ <head>
+ <script type="text/javascript"></script>
+ <script type="text/javascript" src="../../../externals/ext/adapter/ext/ext-base.js"></script>
+ <script type="text/javascript" src="../../../externals/ext/ext-all-debug.js"></script>
+
+ <script type="text/javascript" src="../../../externals/openlayers/lib/OpenLayers.js"></script>
+ <script type="text/javascript" src="../../lib/GeoExt.js"></script>
+
+ <script type="text/javascript">
+
+ var file = 'wmscapabilities.v1_1.xml';
+ function test_constructor(t) {
+ t.plan(2);
+ var reader = new GeoExt.data.WMSCapabilitiesReader({});
+ var fields = reader.recordType.prototype.fields;
+ // 2 tests
+ t.eq(fields.items.length, 8, 'number of items is correct');
+
+ t.ok(fields.items[0].name == 'name' &&
+ fields.items[1].name == 'abstract' &&
+ fields.items[2].name == 'title' &&
+ fields.items[3].name == 'prefix' &&
+ fields.items[4].name == 'llbbox' &&
+ fields.items[5].name == 'styles' &&
+ fields.items[6].name == 'formats' &&
+ fields.items[7].name == 'queryable',
+ 'field names are correct');
+ }
+
+ function test_readRecords(t) {
+ t.plan(7);
+ var xml = new OpenLayers.Format.XML().read($(file).firstChild.nodeValue);
+ var reader = new GeoExt.data.WMSCapabilitiesReader();
+ var data = reader.read({responseXML: xml});
+ console.log(data);
+ var record = data.records[0].data;
+ t.eq(data.totalRecords, 2, 'total records checks out');
+ t.eq(record.title, 'Open Spaces in New York', 'title parsed okay');
+ t.eq(record.name, 'topp:open_space', 'name parsed okay');
+ t.eq(record.styles.length, 1, 'correct number of styles parsed');
+ t.eq(record.formats.length, 28, 'correct number of formats parsed');
+ t.eq(record.formats[0], "image/png", 'first format looks good');
+ t.ok(record.queryable, 'queryability parsed correctly');
+ }
+ </script>
+ <body>
+<div id='wmscapabilities.v1_1.xml'><!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://geo.openplans.org:80/geoserver/schemas/wms/1.1.1/WMS_MS_Capabilities.dtd">
+<WMT_MS_Capabilities version="1.1.1" updateSequence="61">
+ <Service>
+ <Name>OGC:WMS</Name>
+ <Title>My GeoServer WMS</Title>
+ <Abstract>
+This is a description of your Web Map Server.
+ </Abstract>
+ <KeywordList>
+ <Keyword>WFS</Keyword>
+ <Keyword>WMS</Keyword>
+ <Keyword>GEOSERVER</Keyword>
+ </KeywordList>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://geo.openplans.org:80/geoserver/wms"/>
+ <ContactInformation>
+ <ContactPersonPrimary>
+ <ContactPerson/>
+ <ContactOrganization/>
+ </ContactPersonPrimary>
+ <ContactPosition/>
+ <ContactAddress>
+ <AddressType/>
+ <Address/>
+ <City/>
+ <StateOrProvince/>
+ <PostCode/>
+ <Country/>
+ </ContactAddress>
+ <ContactVoiceTelephone/>
+ <ContactFacsimileTelephone/>
+ <ContactElectronicMailAddress/>
+ </ContactInformation>
+ <Fees>NONE</Fees>
+ <AccessConstraints>NONE</AccessConstraints>
+ </Service>
+ <Capability>
+ <Request>
+ <GetCapabilities>
+ <Format>application/vnd.ogc.wms_xml</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://geo.openplans.org:80/geoserver/wms?SERVICE=WMS&"/>
+ </Get>
+ <Post>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://geo.openplans.org:80/geoserver/wms?SERVICE=WMS&"/>
+ </Post>
+ </HTTP>
+ </DCPType>
+ </GetCapabilities>
+ <GetMap>
+ <Format>image/png</Format>
+ <Format>application/atom xml</Format>
+ <Format>application/atom+xml</Format>
+ <Format>application/openlayers</Format>
+ <Format>application/pdf</Format>
+ <Format>application/rss xml</Format>
+ <Format>application/rss+xml</Format>
+ <Format>application/vnd.google-earth.kml</Format>
+ <Format>application/vnd.google-earth.kml xml</Format>
+ <Format>application/vnd.google-earth.kml+xml</Format>
+ <Format>application/vnd.google-earth.kmz</Format>
+ <Format>application/vnd.google-earth.kmz xml</Format>
+ <Format>application/vnd.google-earth.kmz+xml</Format>
+ <Format>atom</Format>
+ <Format>image/geotiff</Format>
+ <Format>image/geotiff8</Format>
+ <Format>image/gif</Format>
+ <Format>image/jpeg</Format>
+ <Format>image/png8</Format>
+ <Format>image/svg</Format>
+ <Format>image/svg xml</Format>
+ <Format>image/svg+xml</Format>
+ <Format>image/tiff</Format>
+ <Format>image/tiff8</Format>
+ <Format>kml</Format>
+ <Format>kmz</Format>
+ <Format>openlayers</Format>
+ <Format>rss</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://geo.openplans.org:80/geoserver/wms?SERVICE=WMS&"/>
+ </Get>
+ </HTTP>
+ </DCPType>
+ </GetMap>
+ <GetFeatureInfo>
+ <Format>text/plain</Format>
+ <Format>text/html</Format>
+ <Format>application/vnd.ogc.gml</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://geo.openplans.org:80/geoserver/wms?SERVICE=WMS&"/>
+ </Get>
+ <Post>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://geo.openplans.org:80/geoserver/wms?SERVICE=WMS&"/>
+ </Post>
+ </HTTP>
+ </DCPType>
+ </GetFeatureInfo>
+ <DescribeLayer>
+ <Format>application/vnd.ogc.wms_xml</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://geo.openplans.org:80/geoserver/wms?SERVICE=WMS&"/>
+ </Get>
+ </HTTP>
+ </DCPType>
+ </DescribeLayer>
+ <GetLegendGraphic>
+ <Format>image/png</Format>
+ <Format>image/jpeg</Format>
+ <Format>image/gif</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://geo.openplans.org:80/geoserver/wms?SERVICE=WMS&"/>
+ </Get>
+ </HTTP>
+ </DCPType>
+ </GetLegendGraphic>
+ </Request>
+ <Exception>
+ <Format>application/vnd.ogc.se_xml</Format>
+ </Exception>
+ <UserDefinedSymbolization SupportSLD="1" UserLayer="1" UserStyle="1" RemoteWFS="1"/>
+ <Layer>
+ <Title>My GeoServer WMS</Title>
+ <Abstract>
+This is a description of your Web Map Server.
+ </Abstract>
+ <SRS>EPSG:WGS84(DD)</SRS>
+ <LatLonBoundingBox minx="-180.00000003333" miny="-90.0" maxx="180.0" maxy="90.000000033333"/>
+ <Layer>
+ <Name>open_space</Name>
+ <Title>open_space</Title>
+ <Layer queryable="1">
+ <Name>topp:open_space</Name>
+ <Title>Open Spaces in New York</Title>
+ <Abstract>This layer contains the borders of open spaces such as parks in New York City, New York.</Abstract>
+ <KeywordList>
+ <Keyword>open</Keyword>
+ <Keyword>parks</Keyword>
+ <Keyword>New</Keyword>
+ <Keyword>York</Keyword>
+ <Keyword>space</Keyword>
+ <Keyword>City</Keyword>
+ </KeywordList>
+ <SRS>EPSG:2908</SRS>
+ <LatLonBoundingBox minx="-74.26866863046939" miny="40.495746694449196" maxx="-73.70728214571051" maxy="40.92049344235473"/>
+ <BoundingBox SRS="EPSG:2908" minx="820246.5789744107" miny="31326.55701619591" maxx="1154942.9196240017" maxy="363332.51379847835"/>
+ <Style>
+ <Name>nyc_open_space</Name>
+ <Title>NY Parks</Title>
+ <Abstract>Green parks</Abstract>
+ <LegendURL width="20" height="20">
+ <Format>image/png</Format>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://geo.openplans.org:80/geoserver/wms/GetLegendGraphic?VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:open_space"/>
+ </LegendURL>
+ </Style>
+ </Layer>
+ </Layer>
+ </Layer>
+ </Capability>
+</WMT_MS_Capabilities>
+-->
+</div>
+
+
+ </body>
+</html>
Modified: sandbox/opengeo/drake/trunk/core/tests/list-tests.html
===================================================================
--- sandbox/opengeo/drake/trunk/core/tests/list-tests.html 2009-03-10 18:17:56 UTC (rev 216)
+++ sandbox/opengeo/drake/trunk/core/tests/list-tests.html 2009-03-11 21:08:01 UTC (rev 217)
@@ -3,5 +3,6 @@
<li>data/FeatureStoreMediator.html</li>
<li>data/LayerStoreMediator.html</li>
<li>data/ProtocolProxy.html</li>
+ <li>data/WMSCapabilitiesReader.html</li>
<li>widgets/Popup.html</li>
</ul>
More information about the Commits
mailing list