MFS - Map File Service - Test Cases
1. Test the MFS GetMapFile request.
MAP-172
1a. Create a token using get_map_file as the resource and tests as the project_name:
{
"appkey": "insert-your-appkey-here",
"resource": "get_map_file",
"project_name": "tests"
}
1b. Using the header X-API-KEY with the value from step 1a, send a message using the following URL:
```url
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.0.0&request=GetMapFile&project=tests&map=osm-tests-wms&format=text/plain
**1c.** After sending a message, the response should look like:
```text
MAP
NAME "OSM_Basemap"
STATUS ON
SIZE 256 256
SYMBOLSET "/img/shared/symbols/test.sym"
...
WIDTH 2
END # STYLE
END # CLASS
END # LAYER
END # MAP
2. Test the MFS GetMapFile request returning a JSON mapfile.
MAP-172
2a. Create a token using get_map_file as the resource and tests as the project_name:
{
"appkey": "insert-your-appkey-here",
"resource": "get_map_file"
"project_name": "tests"
}
2b. Using the header X-API-KEY with the value from step 2a, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.0.0&request=GetMapFile&project=tests&map=osm-tests-wms&format=application/json
2c. After sending a message, the response should look like this:
{
"__type__": "map",
"name": "OSM_Basemap",
"status": "ON",
"size": [
...
}
]
}
]
}
3.1 Test the MFS ListMapFiles by appkey request.
MAP-167
3a. Create a token using list_map_files as the resource:
{
"appkey": "insert-your-appkey-here",
"resource": "list_map_files"
}
3b. Using the header X-API-KEY with the value from step 3.1a, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.1.0&request=ListMapFiles
3c. After sending a message, the response should look like this:
{
"response": "success",
"message": [
{
"project": "tests",
"id": 2,
"map_name": "osm-tests-wfs",
"map_description": "OSM map test",
"service_id": 7,
"enabled_flag": true,
"create_user": "DB0400",
"create_timestamp": "2021-04-13T09:41:00",
"last_update_user": "unit-test",
"last_update_timestamp": "2021-08-20T10:11:27",
"map_project_id": 1,
"map_editable": false,
"app_enabled": true,
"support_files": [
{
"ms_errorfile": "osm-tests-wfs.log",
"fontset": {},
"symbolset": {},
"headers": null,
"templates": null,
"footers": null
}
]
},
...
{
"project": "attca",
"id": 371,
"map_name": "attca-plant",
"map_description": "ATT plant map for WMTS",
"service_id": 7,
"enabled_flag": true,
"create_user": "DB0400",
"create_timestamp": "2022-09-26T16:39:40",
"last_update_user": "DB0400",
"last_update_timestamp": "2022-09-26T16:39:40",
"map_project_id": 8,
"map_editable": true,
"app_enabled": true,
"support_files": [
{
"ms_errorfile": null,
"fontset": null,
"symbolset": null,
"headers": null,
"templates": null,
"footers": null
}
]
},
{
"project": "demo",
"id": 372,
"map_name": "dannys-changed-map",
"map_description": "This is a test map updated",
"service_id": 7,
"enabled_flag": true,
"create_user": "DB0095",
"create_timestamp": "2022-10-05T12:56:16",
"last_update_user": "DB0095",
"last_update_timestamp": "2022-10-05T13:01:30",
"map_project_id": 12,
"map_editable": null,
"app_enabled": true,
"support_files": [
{
"ms_errorfile": null,
"fontset": null,
"symbolset": null,
"headers": null,
"templates": null,
"footers": null
}
]
},
{
"project": "tests",
"id": 373,
"map_name": "my-new-map-testing1",
"map_description": "This is a new test map for QA",
"service_id": 7,
"enabled_flag": true,
"create_user": "DB0400",
"create_timestamp": "2022-10-10T13:50:58",
"last_update_user": "DB0400",
"last_update_timestamp": "2022-10-10T13:50:58",
"map_project_id": 1,
"map_editable": null,
"app_enabled": true,
"support_files": [
{
"ms_errorfile": null,
"fontset": null,
"symbolset": null,
"headers": null,
"templates": null,
"footers": null
}
]
},
{
"project": "pge",
"id": 376,
"map_name": "pge-plant-wms",
"map_description": "PGE Plant map",
"service_id": 7,
"enabled_flag": true,
"create_user": "DB0400",
"create_timestamp": "2022-10-15T00:01:37",
"last_update_user": "DB0400",
"last_update_timestamp": "2022-10-15T00:01:37",
"map_project_id": 15,
"map_editable": null,
"app_enabled": true,
"support_files": [
{
"ms_errorfile": null,
"fontset": null,
"symbolset": null,
"headers": null,
"templates": null,
"footers": null
}
]
}
]
}
3.2 Test the MFS ListMapFiles by project request.
MAP-167
3a. Create a token using list_map_files as the resource:
{
"appkey": "insert-your-appkey-here",
"resource": "list_map_files"
}
3b. Using the header X-API-KEY with the value from step 3.2a, send a message using the following URL:
Note: make sure to add project query parameter in the request
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.1.0&request=ListMapFiles&project=tests
3c. After sending a message, the response should look like this:
{
"response": "success",
"message": [
{
"project": "tests",
"mapfile": "test-stringify.map",
"supporting files": {
"ms_errorfile": null,
"fontset": {},
"symbolset": {},
"headers": null,
"templates": null,
"footers": null
}
},
{
"project": "tests",
"mapfile": "map-test-edit-name.map",
"supporting files": {
"ms_errorfile": "osm-tests-wms.log",
"fontset": "/img/shared/shared.font",
"symbolset": "/img/shared/shared.sym",
"headers": null,
"templates": [
"osm-tests-wms.html"
],
"footers": null
}
},
{
"project": "tests",
"mapfile": "osm-tests-wfs.map",
"supporting files": {
"ms_errorfile": "osm-tests-wfs.log",
"fontset": {},
"symbolset": {},
"headers": null,
"templates": null,
"footers": null
}
},
...
{
"project": "tests",
"mapfile": "osm-tests-wms.map",
"supporting files": {
"ms_errorfile": "osm-tests-wms.log",
"fontset": "/img/shared/shared.font",
"symbolset": "/img/shared/shared.sym",
"headers": null,
"templates": [
"osm-tests-wms.html"
],
"footers": null
}
}
]
}
3.3 Test the MFS ListMapFiles request by mapfile.
MAP-167
3a. Create a token using list_map_files as the resource:
{
"appkey": "insert-your-appkey-here",
"resource": "list_map_files"
}
3b. Using the header X-API-KEY with the value from step 3.3a, send a message using the following URL:
Note: make sure to add project and mapfile query parameters in the request
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.1.0&request=ListMapFiles&map=osm-tests-wms&project=tests
3c. After sending a message, the response should look like this:
{
"response": "success",
"message": {
"mapfile": "osm-tests-wms.map",
"supporting files": {
"ms_errorfile": "osm-tests-wms.log",
"fontset": "/img/shared/shared.font",
"symbolset": "/img/shared/shared.sym",
"headers": null,
"templates": [
"osm-tests-wms.html"
],
"footers": null
}
}
}
4. Test the MFS PutMapFile request to create a new mapfile.
MAP-176
4a. Create a token using put_map_file as the resource and tests as the project_name:
{
"appkey": "insert-your-appkey-here",
"resource": "create_map_file"
"project_name": "tests"
}
4b. Using the header X-API-KEY with the value from step 4a, send a message using the following URL with the following payload:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.0.0&request=PutMapFile&project=tests&map=createmap-test1&username=DB0400&newmapdescription=This is a new test map for QA
payload:
MAP
NAME "WGL PLANT WMS"
STATUS ON
SIZE 256 256
EXTENT -126.166992 23.644524 -66.005859 49.525208
UNITS DD
IMAGECOLOR 255 255 255
FONTSET "/img/shared/shared.font"
IMAGETYPE "PNG"
CONFIG "MS_ERRORFILE" "wgl-plant-wms.log"
CONFIG "CPL_DEBUG" "ON"
CONFIG "CPL_LOG" "cpl-debug.log"
DEBUG 5 # CONFIG "CPL_TIMESTAMP" "ON" # CONFIG "PROJ_DEBUG" "ON"
SYMBOLSET "wgl.sym"
WEB
IMAGEPATH "/img//img/cache/wms/temp/"
IMAGEURL "/tmp/"
METADATA
"wms_title" "WGL PLANT WMS"
"wms_onlineresource" "https://maptimus-dev.certusview.com/api/v2/mapserver?project=wgl&map=wgl-plant-wms"
"wms_srs" "EPSG:4326 EPSG:3857"
"wms_accessconstraints" "Access restricted to Dycom Inc, its subsidiaries and business partners."
"wms_contactperson" "Davis Black,Cory Hair"
"wms_contactorganization" "Dycom GIS"
"wms_enable_request" "*"
"ms_enable_modes" "*"
"labelcache_map_edge_buffer" "4"
"wms_feature_info_mime_type" "text/html"
"ows_sld_enabled" "true"
"wms_sld_symbol_url" "https://maptimus-dev.certusview.com/api/v2/mapfile?service=mfs&version=1.1.0&request=GetFile&project=wgl&file="
END # METADATA
END # WEB
PROJECTION
"init=epsg:4326"
END # PROJECTION
# WEB
# PROJECTION
# WEB
# PROJECTION
OUTPUTFORMAT
NAME "mvt"
DRIVER "MVT"
MIMETYPE "application/x-protobuf"
IMAGEMODE RGB
EXTENSION "mvt"
END # OUTPUTFORMAT
# OUTPUTFORMAT
# OUTPUTFORMAT
LEGEND
IMAGECOLOR 235 235 235
KEYSIZE 20 10
KEYSPACING 10 10
LABEL
TYPE TRUETYPE
ANTIALIAS TRUE
FONT "arial"
SIZE 10
COLOR 114 114 114
END # LABEL
END # LEGEND
# LEGEND
# LEGEND
################
#### LAYERS ####
################
LAYER
NAME "cemetery_area"
TYPE POLYGON # METADATA
STATUS ON
GROUP "INFRASTRUCTURE_ELEMENTS"
CONNECTIONTYPE POSTGIS
CONNECTION "gis_conversion"
DATA "geom FROM (SELECT id,contract_id,layer_name,subtype_code,source_data_object,active_flag,logical_delete_flag,geom FROM maptimus_omnilume.maptimus_stage WHERE layer_name = 'gis_cemetery_area' AND active_flag = 't' AND logical_delete_flag != 't') AS subquery USING UNIQUE id USING SRID=4326"
MAXSCALEDENOM 100000
PROCESSING "CLOSE_CONNECTION=DEFER"
METADATA
"wms_title" "Cemetery"
"wms_srs" "EPSG:4326"
"gml_include_items" "all"
"gml_featureid" "id"
"wms_enable_request" "*"
"wms_extent" "-126.166992 23.644524 -66.005859 49.525208"
END # METADATA
# METADATA
# METADATA
CLASS
STYLE
COLOR 249 253 191
OUTLINECOLOR 190 190 190
WIDTH 2.0
END # STYLE
END # CLASS
END # LAYER
# LAYER
4c. After sending a message, the response should look like this:
{
"response": "success",
"message": "New map file createmap-test1 created in tests project"
}
If createmap-test1 already exists in EFS drive, the response should look like this:
{
"response": "success",
"message": "Map file createmap-test1 was edited"
}
4d. To verify that createmap-test1 exists, run through steps 3a - 3c to view all map files
5. Test the MFS PutMapFile request to edit an existing mapfile name.
MAP-176
5a. Create a token using put_map_file as the resource and tests as the project_name:
{
"appkey": "insert-your-appkey-here",
"resource": "edit_map_file"
"project_name": "tests"
}
5b. Using the header X-API-KEY with the value from step 5a, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.0.0&request=PutMapFile&project=tests&map=map-test-edit-name&username=DB0400&newmapname=map-test-edit-name2
5c. After sending a message, the response should look like this:
{
"response": "success",
"message": "Map file map-test-edit-name was edited"
}
If map-test-edit-name does not exist, the response should look like this:
{
"response": "success",
"message": "New map file map-test-edit-name created in tests project"
}
Revert the map file name back to the original name
5d. Create a new token using edit_map_file as the resource and tests as the project_name:
{
"appkey": "insert-your-appkey-here",
"resource": "edit_map_file",
"project_name": "tests"
}
5e. Using the header X-API-KEY with the value from step 5d, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.0.0&request=PutMapFile&project=tests&map=map-test-edit-name&newmapname=map-test-edit-name
5f. After sending a message, the response should look like this:
{
"response": "success",
"message": "Map file map-test-edit-name2 was edited"
}
6. Test the MFS PutMapFile request to edit an existing mapfile project name.
MAP-176
6a. Create a token using edit_map_file as the resource tests as the project_name:
{
"appkey": "insert-your-appkey-here",
"resource": "edit_map_file"
"project_name": "tests"
}
6b. Using the header X-API-KEY with the value from step 6a, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.0.0&request=PutMapFile&project=tests&map=edited-map&newprojectname=tests2
6c. After sending a message, the response should look like this:
{
"response": "success",
"message": "Map file edited-map is moved to tests2 project"
}
If edited-map does not exist, the response should look like this:
{
"response": "success",
"message": "New map file edited-map created in tests2 project"
}
Revert the map file project back to the original tests project
6d. Create a new token using edit_map_file as the resource and tests2 as the project_name:
{
"appkey": "insert-your-appkey-here",
"resource": "edit_map_file",
"project_name": "tests2"
}
6e. Using the header X-API-KEY with the value from step 8d, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.0.0&request=PutMapFile&project=tests2&map=edited-map&newprojectname=tests
6f. After sending a message, the response should look like this:
{
"response": "success",
"message": "Map file edited-map was edited"
}
7. Test the MFS PutMapFile request to edit the contents of an existing mapfile.
MAP-176
7a. Create a token using edit_map_file as the resource and tests as the project_name:
{
"appkey": "insert-your-appkey-here",
"resource": "edit_map_file",
"project_name": "tests"
}
7b. Use the following text as the body of the request:
text
MAP NAME new LAYER NAME test layer END END END
7c. Using the header X-API-KEY with the value from step 7a, and the body from step 7b, send a message using the following URL:
```url
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.0.0&request=PutMapFile&project=tests&map=edited-map-contents
**7d.** After sending a message, the response should look like this:
```json
{
"response": "success",
"message": "Map file contents were edited"
}
```
## 7.1 Test the MFS PutMapFile request to edit the multiple items. [MAP-176](https://dycominc.atlassian.net/browse/MAP-176)
Edit the contents of an existing mapfile as well as the changing the project name
**7.1a.** Create a token using `edit_map_file` as the resource and `tests` as the project_name:
```json
{
"appkey": "insert-your-appkey-here",
"resource": "edit_map_file",
"project_name": "tests"
}
7.1b. Use the following text as the body of the request:
text
MAP
NAME "TEST WMS"
STATUS ON
SIZE 256 256
EXTENT -126.166992 23.644524 -66.005859 49.525208
UNITS DD
IMAGECOLOR 255 255 255
FONTSET "/img/shared/shared.font"
IMAGETYPE "PNG"
CONFIG "MS_ERRORFILE" "wgl-plant-wms.log"
CONFIG "CPL_DEBUG" "ON"
CONFIG "CPL_LOG" "cpl-debug.log"
DEBUG 5 # CONFIG "CPL_TIMESTAMP" "ON" # CONFIG "PROJ_DEBUG" "ON"
SYMBOLSET "wgl.sym"
WEB
IMAGEPATH "/img//img/cache/wms/temp/"
IMAGEURL "/tmp/"
METADATA
"wms_title" "WGL PLANT WMS"
"wms_onlineresource" "https://maptimus-dev.certusview.com/api/v2/mapserver?project=wgl&map=wgl-plant-wms"
"wms_srs" "EPSG:4326 EPSG:3857"
"wms_accessconstraints" "Access restricted to Dycom Inc, its subsidiaries and business partners."
"wms_contactperson" "Davis Black,Cory Hair"
"wms_contactorganization" "Dycom GIS"
"wms_enable_request" "*"
"ms_enable_modes" "*"
"labelcache_map_edge_buffer" "4"
"wms_feature_info_mime_type" "text/html"
"ows_sld_enabled" "true"
"wms_sld_symbol_url" "https://maptimus-dev.certusview.com/api/v2/mapfile?service=mfs&version=1.1.0&request=GetFile&project=wgl&file="
END # METADATA
END # WEB
PROJECTION
"init=epsg:4326"
END # PROJECTION
# WEB
# PROJECTION
# WEB
# PROJECTION
OUTPUTFORMAT
NAME "mvt"
DRIVER "MVT"
MIMETYPE "application/x-protobuf"
IMAGEMODE RGB
EXTENSION "mvt"
END # OUTPUTFORMAT
# OUTPUTFORMAT
# OUTPUTFORMAT
LEGEND
IMAGECOLOR 235 235 235
KEYSIZE 20 10
KEYSPACING 10 10
LABEL
TYPE TRUETYPE
ANTIALIAS TRUE
FONT "arial"
SIZE 10
COLOR 114 114 114
END # LABEL
END # LEGEND
# LEGEND
# LEGEND
################
#### LAYERS ####
################
LAYER
NAME "cemetery_area"
TYPE POLYGON # METADATA
STATUS ON
GROUP "INFRASTRUCTURE_ELEMENTS"
CONNECTIONTYPE POSTGIS
CONNECTION "gis_conversion"
DATA "geom FROM (SELECT id,contract_id,layer_name,subtype_code,source_data_object,active_flag,logical_delete_flag,geom FROM maptimus_omnilume.maptimus_stage WHERE layer_name = 'gis_cemetery_area' AND active_flag = 't' AND logical_delete_flag != 't') AS subquery USING UNIQUE id USING SRID=4326"
MAXSCALEDENOM 100000
PROCESSING "CLOSE_CONNECTION=DEFER"
METADATA
"wms_title" "Cemetery"
"wms_srs" "EPSG:4326"
"gml_include_items" "all"
"gml_featureid" "id"
"wms_enable_request" "*"
"wms_extent" "-126.166992 23.644524 -66.005859 49.525208"
END # METADATA
# METADATA
# METADATA
CLASS
STYLE
COLOR 249 253 191
OUTLINECOLOR 190 190 190
WIDTH 2.0
END # STYLE
END # CLASS
END # LAYER
# LAYER
7.1c. Using the header X-API-KEY with the value from step 7.1a, and the body from step 7.1b, send a message using the following URL:
```url
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.1.0&request=PutMapFile&project=tests&map=edited-map-contents&username=DB0400&newprojectname=tests2
**7.1d.** After sending a message, the response should look like this:
```json
{
"response": "success",
"message": "Multiple edits were made to mapfile"
}
```
---
## 8. Test the MFS ValidateMap request to get a mapfile validation output.
[MAP-176](https://dycominc.atlassian.net/browse/MAP-176)
**8a.** Create a token using `list_map_files` as the resource:
```json
{
"appkey": "insert-your-appkey-here",
"resource": "list_map_files"
}
8b. Add the following mapfile contents to the raw body of the request:
MAP
NAME "sample"
LAYER
NAME "test"
STATUS DEFAULT
DATA "SELECT GEOM FROM TABLE"
TYPE LINE
END
END
8c. Using the header X-API-KEY with the value from step 8a, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=MFS&version=1.1.0&request=ValidateMap
8d. After sending a message, the response should look like this:
{
"response": "success",
"validation_errors": []
}
9. Test the MFS GetFile request to get a mapfile output.
MAP-176
9a. Create a token using get_file as the resource:
{
"appkey": "insert-your-appkey-here",
"resource": "get_file"
}
9b. Using the header X-API-KEY with the value from step 9a, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.1.0&request=GetFile&project=shared&file=shared.sym
9c. After sending a message, the response should look like this:
SYMBOLSET
SYMBOL
NAME "interstate"
TYPE pixmap
IMAGE "interstate.png"
END
SYMBOL
NAME 'tie'
TYPE vector
POINTS
0 0
0 2
END
ANCHORPOINT 0 0.5
END
SYMBOL
NAME "dot"
TYPE ellipse
FILLED true
POINTS
1 1
END
END
END
10. Test the MFS PutFile request to upload a file to the server.
MAP-176
10a. Create a token using put_file as the resource:
{
"appkey": "insert-your-appkey-here",
"resource": "put_file"
}
10b. Add the following file to key's value body of the request:
Key is file and test_fpa.png is the Value
10c. Using the header X-API-KEY with the value from step 10a, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.2.0&request=PutFile&project=tests
10d. After sending a message, the response should look like this:
json
{
"response": "success",
"message": "test_fpa.png was created"
}
11. Test the MFS DeleteFile request to delete a file on the server.
MAP-176
11a. Create a token using delete_file as the resource:
{
"appkey": "insert-your-appkey-here",
"resource": "delete_file"
}
11b. Add the following file to key's value body of the request:
Key is file and test_fpa.png is the Value
11c. Using the header X-API-KEY with the value from step 11a, send a message using the following URL:
https://maptimus.certusview.com/api/v2/mapfile?service=mfs&version=1.2.0&request=DeleteFile&project=tests&file=test_fpa.png
11d. After sending a message, the response should look like this:
json
{
"response": "success",
"message": "file deleted"
}