Skip to content

Commit

Permalink
msautotest: add some testing of msLoadMapContextLayer()
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jan 10, 2024
1 parent ae706b8 commit 5ac56b1
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 1 deletion.
2 changes: 1 addition & 1 deletion msautotest/etc/mapserv.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CONFIG
ENV
MS_MAP_PATTERN "."
MS_CONTEXT_PATTERN "ows_context\.xml"
MS_CONTEXT_PATTERN "ows_context.*\.xml"

# Workaround current issues with demo.mapserver.org with HTTP/2
CURL_HTTP_VERSION "1.1"
Expand Down
136 changes: 136 additions & 0 deletions msautotest/wxs/expected/ows_context_with_layer_list_caps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
Content-Type: application/vnd.ogc.wms_xml; charset=UTF-8

<?xml version='1.0' encoding="UTF-8" standalone="no" ?>
<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd"
[
<!ELEMENT VendorSpecificCapabilities EMPTY>
]> <!-- end of DOCTYPE declaration -->

<WMT_MS_Capabilities version="1.1.1">
<Service>
<Name>OGC:WMS</Name>
<Title>Map Context demo</Title>
<Abstract>Demo for map context document</Abstract>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/>
<ContactInformation>
</ContactInformation>
</Service>

<Capability>
<Request>
<GetCapabilities>
<Format>application/vnd.ogc.wms_xml</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Post>
</HTTP>
</DCPType>
</GetCapabilities>
<GetMap>
<Format>image/png</Format>
<Format>image/jpeg</Format>
<Format>image/png; mode=8bit</Format>
<Format>image/vnd.jpeg-png</Format>
<Format>image/vnd.jpeg-png8</Format>
<Format>application/x-pdf</Format>
<Format>image/svg+xml</Format>
<Format>image/tiff</Format>
<Format>application/vnd.google-earth.kml+xml</Format>
<Format>application/vnd.google-earth.kmz</Format>
<Format>application/vnd.mapbox-vector-tile</Format>
<Format>application/x-protobuf</Format>
<Format>application/json</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Post>
</HTTP>
</DCPType>
</GetMap>
<GetFeatureInfo>
<Format>text/plain</Format>
<Format>application/vnd.ogc.gml</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Post>
</HTTP>
</DCPType>
</GetFeatureInfo>
<DescribeLayer>
<Format>text/xml</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Post>
</HTTP>
</DCPType>
</DescribeLayer>
<GetLegendGraphic>
<Format>image/png</Format>
<Format>image/jpeg</Format>
<Format>image/png; mode=8bit</Format>
<Format>image/vnd.jpeg-png</Format>
<Format>image/vnd.jpeg-png8</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Post>
</HTTP>
</DCPType>
</GetLegendGraphic>
<GetStyles>
<Format>text/xml</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;"/></Post>
</HTTP>
</DCPType>
</GetStyles>
</Request>
<Exception>
<Format>application/vnd.ogc.se_xml</Format>
<Format>application/vnd.ogc.se_inimage</Format>
<Format>application/vnd.ogc.se_blank</Format>
</Exception>
<VendorSpecificCapabilities />
<UserDefinedSymbolization SupportSLD="1" UserLayer="0" UserStyle="1" RemoteWFS="0"/>
<Layer>
<Name>mapcontext</Name>
<Title>Map Context demo</Title>
<Abstract>Demo for map context document</Abstract>
<SRS>EPSG:4326</SRS>
<LatLonBoundingBox minx="-180.000000" miny="-90.000000" maxx="180.000000" maxy="90.000000" />
<BoundingBox SRS="EPSG:4326"
minx="-180.000000" miny="-90.000000" maxx="180.000000" maxy="90.000000" />
<Layer queryable="0" opaque="0" cascaded="0">
<Name>province</Name>
<Title>province</Title>
<LatLonBoundingBox minx="-66.724329" miny="41.770508" maxx="-57.721680" maxy="48.477314" />
<MetadataURL type="TC211">
<Format>text/xml</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;request=GetMetadata&amp;layer=province"/>
</MetadataURL>
<Style>
<Name>default</Name>
<Title>default</Title>
<LegendURL width="85" height="20">
<Format>image/png</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=province&amp;format=image/png&amp;STYLE=default"/>
</LegendURL>
</Style>
</Layer>
<Layer queryable="0" opaque="0" cascaded="1">
<Name>test</Name>
<Title>test</Title>
<!-- WARNING: Optional LatLonBoundingBox could not be established for this layer. Consider setting the EXTENT in the LAYER object, or wms_extent metadata. Also check that your data exists in the DATA statement -->
<MetadataURL type="TC211">
<Format>text/xml</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost/path/to/wfs_simple?myparam=something&amp;request=GetMetadata&amp;layer=test"/>
</MetadataURL>
</Layer>
</Layer>
</Capability>
</WMT_MS_Capabilities>
1 change: 1 addition & 0 deletions msautotest/wxs/ows_context.map
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Capabilities updatesequence (less than)
# RUN_PARMS: ows_context_caps.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&CONTEXT=ows_context.xml&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities" > [RESULT_DEVERSION]
# RUN_PARMS: ows_context_with_layer_list_caps.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&CONTEXT=ows_context_with_layer_list.xml&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities" > [RESULT_DEVERSION]

MAP

Expand Down
23 changes: 23 additions & 0 deletions msautotest/wxs/ows_context_with_layer_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
<ViewContext version="1.1.0" id="mapcontext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.opengis.net/context" xmlns:sld="http://www.opengis.net/sld" xsi:schemaLocation="http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd">
<General>
<Window width="400" height="300"/>
<!-- Bounding box corners and spatial reference system -->
<BoundingBox SRS="EPSG:4326" minx="-180.000000" miny="-90.000000" maxx="180.000000" maxy="90.000000"/>
<!-- Title of Context -->
<Title>Map Context demo</Title>
<Abstract>Demo for map context document</Abstract>
<ContactInformation>
</ContactInformation>
</General>
<LayerList>
<!-- probably wrong definition below, but at least exercices a bit msLoadMapContextLayer() -->
<Layer queryable="0" hidden="0">
<Name>test</Name>
<Title>test</Title>
<Server service="OGC:WMS" version="1.3.0">
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://example.com"/>
</Server>
</Layer>
</LayerList>
</ViewContext>

0 comments on commit 5ac56b1

Please sign in to comment.