Changeset 9902 in josm


Ignore:
Timestamp:
2016-02-29T21:25:53+01:00 (9 years ago)
Author:
wiktorn
Message:

Final fix for #12573 - WMTS getCapabilities parser error.

Unit tests for case in #12573 and some edge case. Fix for edge case.

Closes: #12573

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r9889 r9902  
    388388                        if (moveReaderToTag(reader, new QName[] {new QName(OWS_NS_URL, "Identifier")})) {
    389389                            layer.style = reader.getElementText();
     390                            tagStack.push(reader.getName()); // keep tagStack in sync
    390391                        }
    391                         tagStack.push(reader.getName()); // keep tagStack in sync
    392392                    } else if (new QName(WMTS_NS_URL, "TileMatrixSetLink").equals(reader.getName())) {
    393393                        layer.tileMatrixSetLinks.add(praseTileMatrixSetLink(reader));
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java

    r9820 r9902  
    3333    private ImageryInfo testImagery12168 = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12168-WMTSCapabilities.xml");
    3434    private ImageryInfo testLotsOfLayers = getImagery(TestUtils.getTestDataRoot() + "wmts/getCapabilities-lots-of-layers.xml");
     35    private ImageryInfo testDuplicateTags = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12573-wmts-identifier.xml");
     36    private ImageryInfo testMissingStyleIdentifer = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12573-wmts-missing-style-identifier.xml");
    3537
    3638    /**
     
    243245    }
    244246
     247    @Test
     248    public void testPraserForDuplicateTags() throws Exception {
     249        Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));
     250        WMTSTileSource testSource = new WMTSTileSource(testDuplicateTags);
     251        testSource.initProjection(Main.getProjection());
     252        assertEquals(
     253                "http://tile.informatievlaanderen.be/ws/raadpleegdiensten/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=grb_bsk&"
     254                        + "STYLE=&FORMAT=image/png&tileMatrixSet=GoogleMapsVL&tileMatrix=1&tileRow=1&tileCol=1",
     255                testSource.getTileUrl(1, 1, 1)
     256                );
     257    }
     258
     259    @Test
     260    public void testPraserForMissingStyleIdentifier() throws Exception {
     261        Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));
     262        WMTSTileSource testSource = new WMTSTileSource(testMissingStyleIdentifer);
     263        testSource.initProjection(Main.getProjection());
     264    }
     265
    245266    private void verifyTile(LatLon expected, WMTSTileSource source, int x, int y, int z) {
    246267        LatLon ll = new LatLon(source.tileXYToLatLon(x, y, z));
Note: See TracChangeset for help on using the changeset viewer.