Changeset 14499 in josm for trunk/test


Ignore:
Timestamp:
2018-12-03T00:26:23+01:00 (6 years ago)
Author:
Don-vip
Message:

see #16073 - initialize tile source

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java

    r14497 r14499  
    1616import org.junit.Rule;
    1717import org.junit.Test;
     18import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource;
     19import org.openstreetmap.gui.jmapviewer.tilesources.BingAerialTileSource;
     20import org.openstreetmap.gui.jmapviewer.tilesources.ScanexTileSource;
     21import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource;
    1822import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1923import org.openstreetmap.josm.data.imagery.ImageryLayerInfo;
     24import org.openstreetmap.josm.data.imagery.TemplatedWMSTileSource;
     25import org.openstreetmap.josm.data.imagery.WMSEndpointTileSource;
     26import org.openstreetmap.josm.data.imagery.WMTSTileSource;
     27import org.openstreetmap.josm.data.imagery.WMTSTileSource.WMTSGetCapabilitiesException;
     28import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    2029import org.openstreetmap.josm.testutils.JOSMTestRules;
    2130import org.openstreetmap.josm.tools.HttpClient;
     
    3544    @Rule
    3645    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    37     public JOSMTestRules test = new JOSMTestRules().https().timeout(10000*60);
     46    public JOSMTestRules test = new JOSMTestRules().https().projection().projectionNadGrids().timeout(10000*60);
    3847
    3948    private final Map<String, Map<ImageryInfo, List<String>>> errors = Collections.synchronizedMap(new TreeMap<>());
     
    8089        checkUrl(info, info.getTermsOfUseURL());
    8190
     91        try {
     92            getTileSource(info);
     93        } catch (IOException | WMTSGetCapabilitiesException | IllegalArgumentException e) {
     94            addError(info, e.toString());
     95        }
     96
    8297        for (ImageryInfo mirror : info.getMirrors()) {
    8398            checkEntry(mirror);
     99        }
     100    }
     101
     102    private static AbstractTileSource getTileSource(ImageryInfo info) throws IOException, WMTSGetCapabilitiesException {
     103        switch (info.getImageryType()) {
     104            case BING:
     105                return new BingAerialTileSource();
     106            case SCANEX:
     107                return new ScanexTileSource(info);
     108            case TMS:
     109                return new TemplatedTMSTileSource(info);
     110            case WMS:
     111                return new TemplatedWMSTileSource(info, ProjectionRegistry.getProjection());
     112            case WMS_ENDPOINT:
     113                return new WMSEndpointTileSource(info, ProjectionRegistry.getProjection());
     114            case WMTS:
     115                return new WMTSTileSource(info);
     116            default:
     117                throw new UnsupportedOperationException(info.toString());
    84118        }
    85119    }
Note: See TracChangeset for help on using the changeset viewer.