Ignore:
Timestamp:
2020-05-15T20:17:24+02:00 (16 months ago)
Author:
simon04
Message:

fix #19193 - WMSImagery: fix parsing of version 1.3.0 capabilities

For the constant CAPABILITIES_ROOT_130, the namespaceURI and localPart were interchanged.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java

    r14411 r16412  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertNull;
    56import static org.junit.Assert.assertTrue;
    67
     
    8485    @Test
    8586    public void testTicket16248() throws IOException, WMSGetCapabilitiesException {
    86         tileServer.stubFor(
    87                 WireMock.get(WireMock.anyUrl())
    88                 .willReturn(WireMock.aResponse().withBody(
    89                         Files.readAllBytes(Paths.get(TestUtils.getRegressionDataFile(16248, "capabilities.xml")))
    90                         ))
    91                 );
     87        byte[] capabilities = Files.readAllBytes(Paths.get(TestUtils.getRegressionDataFile(16248, "capabilities.xml")));
     88        tileServer.stubFor(WireMock.get(WireMock.anyUrl()).willReturn(WireMock.aResponse().withBody(capabilities)));
    9289        WMSImagery wms = new WMSImagery(tileServer.url("any"));
    9390        assertEquals("http://wms.hgis.cartomatic.pl/topo/3857/m25k?", wms.buildRootUrl());
    9491        assertEquals("wms.hgis.cartomatic.pl", wms.getLayers().get(0).getName());
    95         assertEquals("http://wms.hgis.cartomatic.pl/topo/3857/m25k?FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&"
    96                 + "LAYERS=wms.hgis.cartomatic.pl&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}",
     92        assertEquals("http://wms.hgis.cartomatic.pl/topo/3857/m25k?FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.3.0&SERVICE=WMS&REQUEST=GetMap&"
     93                + "LAYERS=wms.hgis.cartomatic.pl&STYLES=&CRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}",
     94                wms.buildGetMapUrl(wms.getLayers(), (List<String>) null, true));
     95    }
     96
     97    /**
     98     * Non-regression test for bug #19193.
     99     * @throws IOException if any I/O error occurs
     100     * @throws WMSGetCapabilitiesException never
     101     */
     102    @Test
     103    public void testTicket19193() throws IOException, WMSGetCapabilitiesException {
     104        byte[] capabilities = Files.readAllBytes(Paths.get(TestUtils.getRegressionDataFile(19193, "capabilities.xml")));
     105        tileServer.stubFor(WireMock.get(WireMock.anyUrl()).willReturn(WireMock.aResponse().withBody(capabilities)));
     106        WMSImagery wms = new WMSImagery(tileServer.url("any"));
     107        assertEquals("https://inspire.brandenburg.de/services/gn_alkis_wms?", wms.buildRootUrl());
     108        assertEquals(1, wms.getLayers().size());
     109        assertNull(wms.getLayers().get(0).getName());
     110        assertEquals("INSPIRE GN ALKIS BB", wms.getLayers().get(0).getTitle());
     111        assertEquals("https://inspire.brandenburg.de/services/gn_alkis_wms?FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.3.0&"
     112                + "SERVICE=WMS&REQUEST=GetMap&LAYERS=null&STYLES=&CRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}",
    97113                wms.buildGetMapUrl(wms.getLayers(), (List<String>) null, true));
    98114    }
Note: See TracChangeset for help on using the changeset viewer.