Changeset 18021 in josm


Ignore:
Timestamp:
2021-07-14T20:52:02+02:00 (5 months ago)
Author:
Don-vip
Message:

see #8472 - don't load image from Wikimedia Commons for real in unit test. Breaks our CI in case of network/load issues, see https://github.com/openstreetmap/josm/runs/3069693523

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r17925 r18021  
    130130import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
    131131import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    132 import org.openstreetmap.josm.gui.layer.geoimage.WikimediaCommonsLoader;
     132import org.openstreetmap.josm.gui.layer.geoimage.WikimediaCommonsLoader.WikimediaCommonsLoadImagesAction;
    133133import org.openstreetmap.josm.gui.mappaint.MapPaintMenu;
    134134import org.openstreetmap.josm.gui.preferences.imagery.ImageryPreference;
     
    749749        add(fileMenu, searchNotes);
    750750        add(fileMenu, downloadNotesInView);
    751         add(fileMenu, new WikimediaCommonsLoader.Action());
     751        add(fileMenu, new WikimediaCommonsLoadImagesAction());
    752752        add(fileMenu, downloadReferrers);
    753753        add(fileMenu, update);
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/WikimediaCommonsLoader.java

    r17880 r18021  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.layer.geoimage;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
     5
     6import java.awt.event.ActionEvent;
     7import java.io.IOException;
     8import java.util.ArrayList;
     9import java.util.List;
     10
     11import javax.xml.parsers.ParserConfigurationException;
     12import javax.xml.xpath.XPathExpressionException;
    313
    414import org.openstreetmap.josm.actions.JosmAction;
     
    1020import org.openstreetmap.josm.tools.Mediawiki;
    1121import org.xml.sax.SAXException;
    12 
    13 import javax.xml.parsers.ParserConfigurationException;
    14 import javax.xml.xpath.XPathExpressionException;
    15 import java.awt.event.ActionEvent;
    16 import java.io.IOException;
    17 import java.util.ArrayList;
    18 import java.util.List;
    19 
    20 import static org.openstreetmap.josm.tools.I18n.tr;
    2122
    2223/**
     
    5960    }
    6061
    61     public static class Action extends JosmAction {
    62         public Action() {
     62    /**
     63     * Load images from Wikimedia Commons
     64     * @since 18021
     65     */
     66    public static class WikimediaCommonsLoadImagesAction extends JosmAction {
     67        /**
     68         * Constructs a new {@code WikimediaCommonsLoadImagesAction}
     69         */
     70        public WikimediaCommonsLoadImagesAction() {
    6371            super(tr("Load images from Wikimedia Commons"), "wikimedia_commons", null, null, false);
    6472        }
     
    7583        }
    7684    }
    77 
    7885}
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/WikimediaCommonsLoaderTest.java

    r17883 r18021  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.layer.geoimage;
    3 
    4 import com.github.tomakehurst.wiremock.WireMockServer;
    5 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    6 import org.junit.jupiter.api.Test;
    7 import org.junit.jupiter.api.extension.RegisterExtension;
    8 import org.openstreetmap.josm.data.Bounds;
    9 import org.openstreetmap.josm.testutils.JOSMTestRules;
    10 
    11 import java.net.URL;
    12 import java.util.List;
    133
    144import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
     
    177import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
    188import static org.junit.jupiter.api.Assertions.assertEquals;
     9
     10import java.net.URL;
     11import java.util.List;
     12
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
     15import org.openstreetmap.josm.data.Bounds;
     16import org.openstreetmap.josm.testutils.JOSMTestRules;
     17
     18import com.github.tomakehurst.wiremock.WireMockServer;
     19
     20import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1921
    2022/**
     
    5153        assertEquals(new URL("https://upload.wikimedia.org/wikipedia/commons/e/e8/ISS053-E-105875_-_View_of_Earth.jpg"),
    5254                image.getImageUrl());
    53         image.read(null); // load the image from commons.wikimedia.org
    5455    }
    5556
Note: See TracChangeset for help on using the changeset viewer.