Changeset 6920 in josm for trunk/test


Ignore:
Timestamp:
2014-03-21T17:31:18+01:00 (11 years ago)
Author:
Don-vip
Message:

fix #9778, fix #9806 - access OSM API and JOSM website in HTTPS by default + other HTTPS links where applicable + update CONTRIBUTION

Location:
trunk/test
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/fixtures/JOSMFixture.java

    r6471 r6920  
    1111
    1212import org.openstreetmap.josm.Main;
    13 import org.openstreetmap.josm.data.Preferences;
    1413import org.openstreetmap.josm.data.projection.Projections;
    1514import org.openstreetmap.josm.io.OsmApi;
     
    7372        //
    7473        String url = OsmApi.getOsmApi().getBaseUrl().toLowerCase().trim();
    75         if (url.startsWith("http://www.openstreetmap.org")
    76                 || url.startsWith("http://api.openstreetmap.org")) {
     74        if (url.startsWith("http://www.openstreetmap.org") || url.startsWith("http://api.openstreetmap.org")
     75            || url.startsWith("https://www.openstreetmap.org") || url.startsWith("https://api.openstreetmap.org")) {
    7776            fail(MessageFormat.format("configured server url ''{0}'' seems to be a productive url, aborting.", url));
    7877        }
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r6881 r6920  
    189189        //
    190190        String url = OsmApi.getOsmApi().getBaseUrl().toLowerCase().trim();
    191         if (url.startsWith("http://www.openstreetmap.org")
    192                 || url.startsWith("http://api.openstreetmap.org")) {
     191        if (url.startsWith("http://www.openstreetmap.org") || url.startsWith("http://api.openstreetmap.org")
     192            || url.startsWith("https://www.openstreetmap.org") || url.startsWith("https://api.openstreetmap.org")) {
    193193            fail(MessageFormat.format("configured url ''{0}'' seems to be a productive url, aborting.", url));
    194194        }
    195 
    196195
    197196        String p = System.getProperties().getProperty("useCachedDataset");
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r6881 r6920  
    196196        //
    197197        String url = OsmApi.getOsmApi().getBaseUrl().toLowerCase().trim();
    198         if (url.startsWith("http://www.openstreetmap.org")
    199                 || url.startsWith("http://api.openstreetmap.org")) {
     198        if (url.startsWith("http://www.openstreetmap.org") || url.startsWith("http://api.openstreetmap.org")
     199            || url.startsWith("https://www.openstreetmap.org") || url.startsWith("https://api.openstreetmap.org")) {
    200200            fail(MessageFormat.format("configured url ''{0}'' seems to be a productive url, aborting.", url));
    201201        }
    202 
    203202
    204203        String p = System.getProperties().getProperty("useCachedDataset");
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java

    r6881 r6920  
    4343    public void testCheckOpeningHourSyntax1() throws Exception {
    4444        final String key = "opening_hours";
    45         // frequently used tags according to http://taginfo.openstreetmap.org/keys/opening_hours#values
     45        // frequently used tags according to https://taginfo.openstreetmap.org/keys/opening_hours#values
    4646        assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "24/7"), isEmpty());
    4747        assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Fr 08:30-20:00"), isEmpty());
     
    117117    public void testCheckServiceTimeSyntax1() throws Exception {
    118118        final String key = "service_times";
    119         // frequently used tags according to http://taginfo.openstreetmap.org/keys/service_times#values
     119        // frequently used tags according to https://taginfo.openstreetmap.org/keys/service_times#values
    120120        assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Su 10:00", OpeningHourTest.CheckMode.BOTH), isEmpty());
    121121        assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "automatic", OpeningHourTest.CheckMode.BOTH), not(isEmpty()));
     
    131131    public void testCheckCollectionTimeSyntax1() throws Exception {
    132132        final String key = "collection_times";
    133         // frequently used tags according to http://taginfo.openstreetmap.org/keys/collection_times#values
     133        // frequently used tags according to https://taginfo.openstreetmap.org/keys/collection_times#values
    134134        assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Sa 09:00", OpeningHourTest.CheckMode.BOTH), isEmpty());
    135135        assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "fixme", OpeningHourTest.CheckMode.BOTH), not(isEmpty()));
  • trunk/test/unit/org/openstreetmap/josm/tools/OsmUrlToBoundsTest.java

    r6483 r6920  
    1414     */
    1515    private static final ParseTestItem[] parseTestData = {
    16         new ParseTestItem("http://www.openstreetmap.org", null),
    17         new ParseTestItem("http://www.openstreetmap.org/?bbox=-0.489,51.28,0.236,51.686", new Bounds(51.28, -0.489, 51.686, 0.236)),
    18         new ParseTestItem("http://www.openstreetmap.org/?minlon=-0.489&minlat=51.28&maxlon=0.236&maxlat=51.686", new Bounds(51.28, -0.489, 51.686, 0.236)),
    19         new ParseTestItem("http://www.openstreetmap.org/?maxlat=51.686&maxlon=0.236&minlat=51.28&minlon=-0.489", new Bounds(51.28, -0.489, 51.686, 0.236)),
    20         new ParseTestItem("http://www.openstreetmap.org/?zoom=17&lat=51.71873&lon=8.76164", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17)),
    21         new ParseTestItem("http://www.openstreetmap.org/?lon=8.76164&lat=51.71873&zoom=17&foo", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17)),
    22         new ParseTestItem("http://www.openstreetmap.org/?mlon=8.76164&mlat=51.71873", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 18)),
     16        new ParseTestItem("https://www.openstreetmap.org", null),
     17        new ParseTestItem("https://www.openstreetmap.org/?bbox=-0.489,51.28,0.236,51.686", new Bounds(51.28, -0.489, 51.686, 0.236)),
     18        new ParseTestItem("https://www.openstreetmap.org/?minlon=-0.489&minlat=51.28&maxlon=0.236&maxlat=51.686", new Bounds(51.28, -0.489, 51.686, 0.236)),
     19        new ParseTestItem("https://www.openstreetmap.org/?maxlat=51.686&maxlon=0.236&minlat=51.28&minlon=-0.489", new Bounds(51.28, -0.489, 51.686, 0.236)),
     20        new ParseTestItem("https://www.openstreetmap.org/?zoom=17&lat=51.71873&lon=8.76164", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17)),
     21        new ParseTestItem("https://www.openstreetmap.org/?lon=8.76164&lat=51.71873&zoom=17&foo", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17)),
     22        new ParseTestItem("https://www.openstreetmap.org/?mlon=8.76164&mlat=51.71873", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 18)),
    2323        new ParseTestItem("http://osm.org/go/euulwp", OsmUrlToBounds.positionToBounds(51.48262023925781, -0.29937744140625, 8)),
    24         new ParseTestItem("http://www.openstreetmap.org/#map=17/51.71873/8.76164", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17)),
    25         new ParseTestItem("http://www.openstreetmap.org/#map=17/51.71873/8.76164&layers=CN", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17)),
    26         new ParseTestItem("http%3A%2F%2Fwww.openstreetmap.org%2F%23map%3D16%2F51.71873%2F8.76164", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 16)),
    27         new ParseTestItem("http%3A%2F%2Fwww.openstreetmap.org%2F%23map%3D16%2F51.71873%2F8.76164%26layers%3DCN", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 16)),
    28         new ParseTestItem("http://www.openstreetmap.org/?note=26325#map=18/40.86215/-75.75020", OsmUrlToBounds.positionToBounds(40.86215, -75.75020, 18)),
    29         new ParseTestItem("http://www.openstreetmap.org/?note=26325#map=18/40.86215/-75.75020&layers=N", OsmUrlToBounds.positionToBounds(40.86215, -75.75020, 18)),
    30         new ParseTestItem("http://www.openstreetmap.org/?mlat=51.5&mlon=-0.01#map=10/51.4831/-0.1270", OsmUrlToBounds.positionToBounds(51.4831, -0.1270, 10)),
    31         new ParseTestItem("http://www.openstreetmap.org/?mlat=51.5&mlon=-0.01#map=10/51.4831/-0.3509&layers=T", OsmUrlToBounds.positionToBounds(51.4831, -0.3509, 10)),
    32         new ParseTestItem("http://www.openstreetmap.org/#map", null),
    33         new ParseTestItem("http://www.openstreetmap.org/#map=foo", null),
    34         new ParseTestItem("http://www.openstreetmap.org/#map=fooz/foolat/foolon", null)
     24        new ParseTestItem("https://www.openstreetmap.org/#map=17/51.71873/8.76164", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17)),
     25        new ParseTestItem("https://www.openstreetmap.org/#map=17/51.71873/8.76164&layers=CN", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17)),
     26        new ParseTestItem("https%3A%2F%2Fwww.openstreetmap.org%2F%23map%3D16%2F51.71873%2F8.76164", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 16)),
     27        new ParseTestItem("https%3A%2F%2Fwww.openstreetmap.org%2F%23map%3D16%2F51.71873%2F8.76164%26layers%3DCN", OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 16)),
     28        new ParseTestItem("https://www.openstreetmap.org/?note=26325#map=18/40.86215/-75.75020", OsmUrlToBounds.positionToBounds(40.86215, -75.75020, 18)),
     29        new ParseTestItem("https://www.openstreetmap.org/?note=26325#map=18/40.86215/-75.75020&layers=N", OsmUrlToBounds.positionToBounds(40.86215, -75.75020, 18)),
     30        new ParseTestItem("https://www.openstreetmap.org/?mlat=51.5&mlon=-0.01#map=10/51.4831/-0.1270", OsmUrlToBounds.positionToBounds(51.4831, -0.1270, 10)),
     31        new ParseTestItem("https://www.openstreetmap.org/?mlat=51.5&mlon=-0.01#map=10/51.4831/-0.3509&layers=T", OsmUrlToBounds.positionToBounds(51.4831, -0.3509, 10)),
     32        new ParseTestItem("https://www.openstreetmap.org/#map", null),
     33        new ParseTestItem("https://www.openstreetmap.org/#map=foo", null),
     34        new ParseTestItem("https://www.openstreetmap.org/#map=fooz/foolat/foolon", null)
    3535    };
    3636
     
    3838        public String url;
    3939        public Bounds bounds;
    40        
     40
    4141        public ParseTestItem(String url, Bounds bounds) {
    4242            this.url = url;
  • trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java

    r6661 r6920  
    22package org.openstreetmap.josm.tools;
    33
    4 import org.junit.Assert;
    5 import org.junit.Test;
    6 import org.openstreetmap.josm.Main;
     4import static org.hamcrest.CoreMatchers.is;
     5import static org.junit.Assert.assertThat;
    76
    87import java.io.BufferedReader;
     
    1110import java.util.Locale;
    1211
    13 import static org.hamcrest.CoreMatchers.is;
    14 import static org.junit.Assert.assertThat;
     12import org.junit.Assert;
     13import org.junit.Test;
     14import org.openstreetmap.josm.Main;
    1515
    1616/**
     
    2424    @Test
    2525    public void testStrip() {
    26         final String someWhite = 
     26        final String someWhite =
    2727            "\u00A0"+ // SPACE_SEPARATOR
    2828            "\u2007"+ // LINE_SEPARATOR
     
    7979    public void testOpenUrlGzip() throws Exception {
    8080        Main.initApplicationPreferences();
    81         final BufferedReader x = Utils.openURLReaderAndDecompress(new URL("http://www.openstreetmap.org/trace/1613906/data"), true);
     81        final BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/1613906/data"), true);
    8282        Assert.assertTrue(x.readLine().startsWith("<?xml version="));
    8383        x.close();
     
    8787    public void testOpenUrlBzip() throws Exception {
    8888        Main.initApplicationPreferences();
    89         final BufferedReader x = Utils.openURLReaderAndDecompress(new URL("http://www.openstreetmap.org/trace/785544/data"), true);
     89        final BufferedReader x = Utils.openURLReaderAndDecompress(new URL("https://www.openstreetmap.org/trace/785544/data"), true);
    9090        Assert.assertTrue(x.readLine().startsWith("<?xml version="));
    9191        x.close();
Note: See TracChangeset for help on using the changeset viewer.