Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dash in MS_MAP_PATTERN #172

Merged
merged 3 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ENV APACHE_CONFDIR=/etc/apache2 \
LANG=C \
TERM=linux \
MS_MAPFILE=/etc/mapserver/mapserver.map \
MS_MAP_PATTERN=^\\/etc\\/mapserver\\/([^\\.][_A-Za-z0-9\\-\\.]+\\/{1})*([_A-Za-z0-9\\-\\.]+\\.map)$
MS_MAP_PATTERN=^\\/etc\\/mapserver\\/([^\\.][-_A-Za-z0-9\\.]+\\/{1})*([-_A-Za-z0-9\\.]+\\.map)$

RUN apt update && \
apt upgrade --assume-yes && \
Expand Down
6 changes: 2 additions & 4 deletions acceptance_tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM camptocamp/c2cwsgiutils:5

COPY . /acceptance_tests/

WORKDIR /acceptance_tests
COPY . ./

CMD tail -f /dev/null
CMD py.test -vv --color=yes --junitxml /tmp/junitxml/results.xml
CMD ["tail", "-f", "/dev/null"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no more py.test ? It's done elsewhere ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, this file was not used I just do some cleaning then this file is used again :-)

121 changes: 121 additions & 0 deletions acceptance_tests/config/mapserver/AZ_az-0.9.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
MAP
NAME "test"

EXTENT -180 -90 180 90
UNITS METERS

# RESOLUTION and DEFRESOLUTION default to 96. If you
# change RESOLUTION to some other value, also change
# DEFRESOLUTION. See
# http://mapserver.org/development/rfc/ms-rfc-55.html
RESOLUTION 96 ## Also set in Openlayers especially for legends
DEFRESOLUTION 96

# MAXSIZE shouldn't be less than 5000 for MF print on A3
MAXSIZE 5000

SHAPEPATH '/var/sig/c2cgeoportal'

IMAGECOLOR 255 255 255
STATUS ON

#FONTSET "fonts.conf"
#SYMBOLSET "symbol.sym"

OUTPUTFORMAT
NAME jpeg
DRIVER "AGG/JPEG"
MIMETYPE "image/jpeg"
IMAGEMODE RGB
EXTENSION "jpeg"
FORMATOPTION "QUALITY=75,PROGRESSIVE=TRUE"
END

OUTPUTFORMAT
NAME png
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGBA
EXTENSION "png"
FORMATOPTION "INTERLACE=OFF"
FORMATOPTION "QUANTIZE_DITHER=OFF"
FORMATOPTION "QUANTIZE_FORCE=ON"
FORMATOPTION "QUANTIZE_COLORS=256"
END

OUTPUTFORMAT
NAME "geojson"
DRIVER "OGR/GEOJSON"
MIMETYPE "application/json; subtype=geojson; charset=utf-8"
FORMATOPTION "STORAGE=stream"
FORMATOPTION "FORM=SIMPLE"
END

PROJECTION
"init=epsg:4326"
END

WEB
METADATA
"wms_title" "test"
"wms_abstract" "MapServer Docker test"
#"wms_onlineresource" "http://mapserver//mapserv"
"wms_srs" "EPSG:4326"
"wms_encoding" "UTF-8"
"wms_enable_request" "*"
"wfs_enable_request" "!*"
"wfs_encoding" "UTF-8"
"wfs_getfeature_formatlist" "gml,geojson"
END
END

LEGEND
LABEL
ENCODING "UTF-8"
TYPE TRUETYPE
FONT "Arial"
SIZE 9
END
END

LAYER
NAME "polygons"
TYPE POLYGON
TEMPLATE fooOnlyForWMSGetFeatureInfo # For GetFeatureInfo
EXTENT -180 -90 180 90
CONNECTIONTYPE postgis
PROCESSING "CLOSE_CONNECTION=DEFER" # For performance
CONNECTION "user=www-data password=www-data dbname=test host=db"
DATA "geom FROM (SELECT * FROM polygons) AS foo USING unique name USING srid=4326"
METADATA
"wms_title" "polygons" # For WMS
"wms_srs" "EPSG:4326" # For WMS

"wfs_enable_request" "*" # Enable WFS for this layer
"gml_include_items" "all" # For GetFeatureInfo and WFS GetFeature (QueryBuilder)
"ows_geom_type" "Polygon" # For returning geometries in GetFeatureInfo
"ows_geometries" "geom" # For returning geometries in GetFeatureInfo
"wfs_featureid" "name"

"wms_metadataurl_href" "http://www.example.com/bar" # For metadata URL
"wms_metadataurl_format" "text/html" # For metadata URL
"wms_metadataurl_type" "TC211" # For metadata URL
END
STATUS ON
PROJECTION
"init=epsg:4326"
END
CLASS
NAME "polygon"
STYLE
OUTLINECOLOR 255 0 0
WIDTH 2
END
STYLE
COLOR 255 0 0
OPACITY 40
END
END
END

END
121 changes: 121 additions & 0 deletions acceptance_tests/config/mapserver/AZ_az-0.9/AZ_az-0.9.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
MAP
NAME "test"

EXTENT -180 -90 180 90
UNITS METERS

# RESOLUTION and DEFRESOLUTION default to 96. If you
# change RESOLUTION to some other value, also change
# DEFRESOLUTION. See
# http://mapserver.org/development/rfc/ms-rfc-55.html
RESOLUTION 96 ## Also set in Openlayers especially for legends
DEFRESOLUTION 96

# MAXSIZE shouldn't be less than 5000 for MF print on A3
MAXSIZE 5000

SHAPEPATH '/var/sig/c2cgeoportal'

IMAGECOLOR 255 255 255
STATUS ON

#FONTSET "fonts.conf"
#SYMBOLSET "symbol.sym"

OUTPUTFORMAT
NAME jpeg
DRIVER "AGG/JPEG"
MIMETYPE "image/jpeg"
IMAGEMODE RGB
EXTENSION "jpeg"
FORMATOPTION "QUALITY=75,PROGRESSIVE=TRUE"
END

OUTPUTFORMAT
NAME png
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGBA
EXTENSION "png"
FORMATOPTION "INTERLACE=OFF"
FORMATOPTION "QUANTIZE_DITHER=OFF"
FORMATOPTION "QUANTIZE_FORCE=ON"
FORMATOPTION "QUANTIZE_COLORS=256"
END

OUTPUTFORMAT
NAME "geojson"
DRIVER "OGR/GEOJSON"
MIMETYPE "application/json; subtype=geojson; charset=utf-8"
FORMATOPTION "STORAGE=stream"
FORMATOPTION "FORM=SIMPLE"
END

PROJECTION
"init=epsg:4326"
END

WEB
METADATA
"wms_title" "test"
"wms_abstract" "MapServer Docker test"
#"wms_onlineresource" "http://mapserver//mapserv"
"wms_srs" "EPSG:4326"
"wms_encoding" "UTF-8"
"wms_enable_request" "*"
"wfs_enable_request" "!*"
"wfs_encoding" "UTF-8"
"wfs_getfeature_formatlist" "gml,geojson"
END
END

LEGEND
LABEL
ENCODING "UTF-8"
TYPE TRUETYPE
FONT "Arial"
SIZE 9
END
END

LAYER
NAME "polygons"
TYPE POLYGON
TEMPLATE fooOnlyForWMSGetFeatureInfo # For GetFeatureInfo
EXTENT -180 -90 180 90
CONNECTIONTYPE postgis
PROCESSING "CLOSE_CONNECTION=DEFER" # For performance
CONNECTION "user=www-data password=www-data dbname=test host=db"
DATA "geom FROM (SELECT * FROM polygons) AS foo USING unique name USING srid=4326"
METADATA
"wms_title" "polygons" # For WMS
"wms_srs" "EPSG:4326" # For WMS

"wfs_enable_request" "*" # Enable WFS for this layer
"gml_include_items" "all" # For GetFeatureInfo and WFS GetFeature (QueryBuilder)
"ows_geom_type" "Polygon" # For returning geometries in GetFeatureInfo
"ows_geometries" "geom" # For returning geometries in GetFeatureInfo
"wfs_featureid" "name"

"wms_metadataurl_href" "http://www.example.com/bar" # For metadata URL
"wms_metadataurl_format" "text/html" # For metadata URL
"wms_metadataurl_type" "TC211" # For metadata URL
END
STATUS ON
PROJECTION
"init=epsg:4326"
END
CLASS
NAME "polygon"
STYLE
OUTLINECOLOR 255 0 0
WIDTH 2
END
STYLE
COLOR 255 0 0
OPACITY 40
END
END
END

END
3 changes: 2 additions & 1 deletion acceptance_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def connection_map():
Fixture that returns a connection to a running batch container.
"""
utils.wait_url(
BASE_URL_MAP + "?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=polygons&featureId=xxx"
BASE_URL_MAP
+ "?MAP=/etc/mapserver/mapserver.map&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=polygons&featureId=xxx"
)
return Connection(BASE_URL_MAP, "http://localhost")
20 changes: 19 additions & 1 deletion acceptance_tests/test_map.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
def test_get_capabilities(connection_map):
def test_get_std_map(connection_map):
ns = "{http://www.opengis.net/wms}"
answer = connection_map.get_xml(
"?MAP=/etc/mapserver/mapserver.map&SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0"
)
assert [e.text for e in answer.findall("%sService/%sTitle" % (ns, ns))] == ["test"]
assert [e.text for e in answer.findall(".//%sLayer/%sName" % (ns, ns))] == ["test", "polygons"]


def test_get_multi_char_map(connection_map):
ns = "{http://www.opengis.net/wms}"
answer = connection_map.get_xml(
"?MAP=/etc/mapserver/AZ_az-0.9.map&SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0"
)
assert [e.text for e in answer.findall("%sService/%sTitle" % (ns, ns))] == ["test"]
assert [e.text for e in answer.findall(".//%sLayer/%sName" % (ns, ns))] == ["test", "polygons"]


def test_get_folder_map(connection_map):
ns = "{http://www.opengis.net/wms}"
answer = connection_map.get_xml(
"?MAP=/etc/mapserver/AZ_az-0.9/AZ_az-0.9.map&SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0"
)
assert [e.text for e in answer.findall("%sService/%sTitle" % (ns, ns))] == ["test"]
assert [e.text for e in answer.findall(".//%sLayer/%sName" % (ns, ns))] == ["test", "polygons"]