-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#10487: Custom Tile Grids settings for WMS service are not retained w…
…hen adding a Background layer from Catalog (#10490)
- Loading branch information
1 parent
d2bee6c
commit 574bafc
Showing
5 changed files
with
277 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
/* | ||
* Copyright 2014, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import expect from 'expect'; | ||
|
||
import { addBackgroundProperties, SET_BACKGROUND_MODAL_PARAMS } from '../../actions/backgroundselector'; | ||
import { testEpic } from './epicTestUtils'; | ||
import backgroundEpics from '../backgroundselector'; | ||
import MockAdapter from 'axios-mock-adapter'; | ||
import axios from '../../libs/ajax'; | ||
let mockAxios; | ||
|
||
describe('addBackgroundPropertiesEpic Epics', () => { | ||
beforeEach((done) => { | ||
mockAxios = new MockAdapter(axios); | ||
setTimeout(done); | ||
}); | ||
afterEach((done) => { | ||
mockAxios.restore(); | ||
setTimeout(done); | ||
}); | ||
const capabilitiesWMSXmlResponse = `<?xml version="1.0" encoding="UTF-8"?> | ||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0"> | ||
<Contents> | ||
<Layer> | ||
<Title/> | ||
<Abstract/> | ||
<!--Limited list of EPSG projections:--> | ||
<BoundingBox CRS="CRS:84" minx="-124.73142200000001" miny="-43.648056" maxx="148.47914100000003" maxy="49.371735"/> | ||
<Layer queryable="1" opaque="0"> | ||
<Name>states_test</Name> | ||
<Title>states_test</Title> | ||
<Abstract>states_test</Abstract> | ||
<KeywordList> | ||
<Keyword>features</Keyword> | ||
<Keyword>states</Keyword> | ||
</KeywordList> | ||
<CRS>EPSG:4326</CRS> | ||
<CRS>CRS:84</CRS> | ||
<EX_GeographicBoundingBox> | ||
<westBoundLongitude>-124.73142200000001</westBoundLongitude> | ||
<eastBoundLongitude>-66.969849</eastBoundLongitude> | ||
<southBoundLatitude>24.955967</southBoundLatitude> | ||
<northBoundLatitude>49.371735</northBoundLatitude> | ||
</EX_GeographicBoundingBox> | ||
<BoundingBox CRS="CRS:84" minx="-124.73142200000001" miny="24.955967" maxx="-66.969849" maxy="49.371735"/> | ||
<BoundingBox CRS="EPSG:4326" minx="24.955967" miny="-124.73142200000001" maxx="49.371735" maxy="-66.969849"/> | ||
<Style> | ||
<Name>polygon</Name> | ||
<Title>A boring default style</Title> | ||
<Abstract>A sample style that just prints out a transparent red interior with a red outline</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://gs-stable.geo-solutions.it/geoserver/topp/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=states_test"/> | ||
</LegendURL> | ||
</Style> | ||
<Format>image/png</Format> | ||
<Format>image/jpeg</Format> | ||
<Format>image/png8</Format> | ||
</Layer> | ||
</Layer> | ||
</Contents> | ||
</Capabilities>`; | ||
|
||
const capabilitiesWMTSXmlResponse = `<?xml version="1.0" encoding="UTF-8"?><WMS_Capabilities version="1.3.0" updateSequence="5167" xmlns="http://www.opengis.net/wms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wms http://gs-stable.geo-solutions.it/geoserver/schemas/wms/1.3.0/capabilities_1_3_0.xsd"> | ||
<Capability> | ||
<Layer> | ||
<Title/> | ||
<Abstract/> | ||
<!--Limited list of EPSG projections:--> | ||
<BoundingBox CRS="CRS:84" minx="-124.73142200000001" miny="-43.648056" maxx="148.47914100000003" maxy="49.371735"/> | ||
<Layer queryable="1" opaque="0"> | ||
<Name>states_test</Name> | ||
<Title>states_test</Title> | ||
<Abstract>states_test</Abstract> | ||
<KeywordList> | ||
<Keyword>features</Keyword> | ||
<Keyword>states</Keyword> | ||
</KeywordList> | ||
<CRS>EPSG:4326</CRS> | ||
<CRS>CRS:84</CRS> | ||
<EX_GeographicBoundingBox> | ||
<westBoundLongitude>-124.73142200000001</westBoundLongitude> | ||
<eastBoundLongitude>-66.969849</eastBoundLongitude> | ||
<southBoundLatitude>24.955967</southBoundLatitude> | ||
<northBoundLatitude>49.371735</northBoundLatitude> | ||
</EX_GeographicBoundingBox> | ||
<BoundingBox CRS="CRS:84" minx="-124.73142200000001" miny="24.955967" maxx="-66.969849" maxy="49.371735"/> | ||
<BoundingBox CRS="EPSG:4326" minx="24.955967" miny="-124.73142200000001" maxx="49.371735" maxy="-66.969849"/> | ||
<Style> | ||
<Name>polygon</Name> | ||
<Title>A boring default style</Title> | ||
<Abstract>A sample style that just prints out a transparent red interior with a red outline</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://gs-stable.geo-solutions.it/geoserver/topp/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=states_test"/> | ||
</LegendURL> | ||
</Style> | ||
</Layer> | ||
</Layer> | ||
</Capability> | ||
</WMS_Capabilities>`; | ||
it('test add normal background layer', (done) => { | ||
mockAxios.onGet().reply(200, capabilitiesWMSXmlResponse); | ||
let addBackgroundPropAction = addBackgroundProperties({ | ||
layer: { | ||
id: "layer01", allowedSRS: { | ||
"EPSG:3857": true, | ||
"EPSG:900913": true, | ||
"EPSG:4326": true | ||
}, | ||
title: "states_test", | ||
type: 'wms', | ||
name: "states_test", | ||
url: ['/geoserver/wms'], | ||
group: "background" | ||
}, | ||
editing: false | ||
}); | ||
|
||
testEpic(backgroundEpics.addBackgroundPropertiesEpic, 2, [addBackgroundPropAction], (res) => { | ||
const action1 = res[0]; | ||
const action2 = res[1]; | ||
expect(action1).toExist(); | ||
expect(action1.type).toEqual(SET_BACKGROUND_MODAL_PARAMS); | ||
expect(action1.modalParams.loading).toEqual(true); | ||
expect(action2).toExist(); | ||
expect(action2.type).toEqual(SET_BACKGROUND_MODAL_PARAMS); | ||
expect(action2.modalParams.loading).toEqual(false); | ||
expect(action2.modalParams.capabilities).toExist(); | ||
done(); | ||
}, {}); | ||
|
||
}); | ||
it('test add wms as a background layer without enabling remote custom tile grid', (done) => { | ||
mockAxios.onGet().reply(200, capabilitiesWMSXmlResponse); | ||
let addBackgroundPropAction = addBackgroundProperties({ | ||
layer: { | ||
id: "layer01", allowedSRS: { | ||
"EPSG:3857": true, | ||
"EPSG:900913": true, | ||
"EPSG:4326": true | ||
}, | ||
title: "states_test", | ||
type: 'wms', | ||
name: "states_test", | ||
url: '/geoserver/wms', | ||
group: "background" | ||
}, | ||
editing: false | ||
}); | ||
|
||
testEpic(backgroundEpics.addBackgroundPropertiesEpic, 2, [addBackgroundPropAction], (res) => { | ||
const action1 = res[0]; | ||
const action2 = res[1]; | ||
expect(action1).toExist(); | ||
expect(action1.type).toEqual(SET_BACKGROUND_MODAL_PARAMS); | ||
expect(action1.modalParams.loading).toEqual(true); | ||
expect(action2).toExist(); | ||
expect(action2.type).toEqual(SET_BACKGROUND_MODAL_PARAMS); | ||
expect(action2.modalParams.loading).toEqual(false); | ||
expect(action2.modalParams.capabilities).toExist(); | ||
done(); | ||
}, {}); | ||
}); | ||
it('test add wms as a background layer with enabling remote custom tile grid', (done) => { | ||
mockAxios.onGet().replyOnce(200, capabilitiesWMSXmlResponse); | ||
mockAxios.onGet().replyOnce(200, capabilitiesWMTSXmlResponse); | ||
let addBackgroundPropAction = addBackgroundProperties({ | ||
layer: { | ||
id: "layer01", allowedSRS: { | ||
"EPSG:3857": true, | ||
"EPSG:900913": true, | ||
"EPSG:4326": true | ||
}, | ||
title: "states_test", | ||
type: 'wms', | ||
name: "states_test", | ||
url: '/geoserver/wms', | ||
group: "background", | ||
remoteTileGrids: true | ||
}, | ||
editing: false | ||
}); | ||
|
||
testEpic(backgroundEpics.addBackgroundPropertiesEpic, 2, [addBackgroundPropAction], (res) => { | ||
const action1 = res[0]; | ||
const action2 = res[1]; | ||
expect(action1).toExist(); | ||
expect(action1.type).toEqual(SET_BACKGROUND_MODAL_PARAMS); | ||
expect(action1.modalParams.loading).toEqual(true); | ||
expect(action2).toExist(); | ||
expect(action2.type).toEqual(SET_BACKGROUND_MODAL_PARAMS); | ||
expect(action2.modalParams.loading).toEqual(false); | ||
expect(action2.modalParams.capabilities).toExist(); | ||
expect(action2.modalParams.layer.tiled).toEqual(true); | ||
expect(action2.modalParams.layer.tileGridStrategy).toEqual('custom'); | ||
done(); | ||
}, {}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters