Changeset 17195 in josm


Ignore:
Timestamp:
2020-10-13T22:31:09+02:00 (8 days ago)
Author:
simon04
Message:

see #15102 - see #16637 - Use WireMockServer.url()

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java

    r14138 r17195  
    8282                        .withStatus(404)));
    8383
    84         new AddImageryLayerAction(new ImageryInfo("localhost", "http://localhost:" + wireMockRule.port() + "/wms?",
     84        new AddImageryLayerAction(new ImageryInfo("localhost", wireMockRule.url("/wms?"),
    8585                "wms_endpoint", null, null)).actionPerformed(null);
    8686        List<WMSLayer> wmsLayers = MainApplication.getLayerManager().getLayersOfType(WMSLayer.class);
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTaskTestParent.java

    r13300 r17195  
    5353     */
    5454    protected final String getRemoteFileUrl() {
    55         return "http://localhost:" + wireMockRule.port() + "/" + getRemoteFile();
     55        return wireMockRule.url(getRemoteFile());
    5656    }
    5757
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DefaultNameFormatterTest.java

    r16952 r17195  
    6363                    .withHeader("Content-Type", "text/xml")
    6464                    .withBodyFile(source)));
    65         TaggingPresets.addTaggingPresets(TaggingPresetReader.readAll("http://localhost:" + wireMockRule.port() + "/" + source, true));
     65        TaggingPresets.addTaggingPresets(TaggingPresetReader.readAll(wireMockRule.url(source), true));
    6666
    6767        Comparator<IRelation<?>> comparator = DefaultNameFormatter.getInstance().getRelationComparator();
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java

    r16161 r17195  
    8888        Config.getPref().put("pluginmanager.lastupdate", "999");
    8989        Config.getPref().putList("pluginmanager.sites",
    90             Collections.singletonList(String.format("http://localhost:%s/plugins", this.pluginServerRule.port()))
     90            Collections.singletonList(this.pluginServerRule.url("/plugins"))
    9191        );
    9292
     
    835835            new PluginServer.RemotePlugin(this.referenceDummyJarNew),
    836836            new PluginServer.RemotePlugin(this.referenceBazJarNew, Collections.singletonMap(
    837                 "6800_Plugin-Url", "6;http://localhost:" + this.pluginServerRule.port() + bazOldServePath
     837                "6800_Plugin-Url", "6;" + this.pluginServerRule.url(bazOldServePath)
    838838            ))
    839839        );
  • trunk/test/unit/org/openstreetmap/josm/io/OverpassDownloadReaderTest.java

    r16358 r17195  
    5555    @Before
    5656    public void setUp() {
    57         NameFinder.NOMINATIM_URL_PROP.put("http://localhost:" + wireMockRule.port() + NOMINATIM_URL_PATH);
     57        NameFinder.NOMINATIM_URL_PROP.put(wireMockRule.url(NOMINATIM_URL_PATH));
    5858    }
    5959
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java

    r17089 r17195  
    6464        Config.getPref().put("pluginmanager.lastupdate", "999");
    6565        Config.getPref().putList("pluginmanager.sites",
    66                 Collections.singletonList(String.format("http://localhost:%s/plugins", this.pluginServerRule.port()))
     66                Collections.singletonList(this.pluginServerRule.url("/plugins"))
    6767        );
    6868
     
    310310            new PluginServer.RemotePlugin(this.referenceBazJarOld),
    311311            new PluginServer.RemotePlugin(this.referenceQuxJarNewer, Collections.singletonMap(
    312                 "7499_Plugin-Url", "346;http://localhost:" + this.pluginServerRule.port() + "/dont/bother.jar"
     312                "7499_Plugin-Url", "346;" + this.pluginServerRule.url("/dont/bother.jar")
    313313            ))
    314314        );
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerMultiVersionTest.java

    r16161 r17195  
    6060        Config.getPref().put("pluginmanager.lastupdate", "999");
    6161        Config.getPref().putList("pluginmanager.sites",
    62                 Collections.singletonList(String.format("http://localhost:%s/plugins", this.pluginServerRule.port()))
     62                Collections.singletonList(this.pluginServerRule.url("/plugins"))
    6363        );
    6464
     
    101101        final String quxNewerServePath = "/qux/newer.jar";
    102102        final Map<String, String> attrOverrides = new HashMap<String, String>() {{
    103             put("7500_Plugin-Url", "432;http://localhost:" + pluginServerRule.port() + quxNewerServePath);
    104             put("7499_Plugin-Url", "346;http://localhost:" + pluginServerRule.port() + "/not/served.jar");
    105             put("6999_Plugin-Url", "345;http://localhost:" + pluginServerRule.port() + "/not/served/eithejar");
     103            put("7500_Plugin-Url", "432;" + pluginServerRule.url(quxNewerServePath));
     104            put("7499_Plugin-Url", "346;" + pluginServerRule.url("/not/served.jar"));
     105            put("6999_Plugin-Url", "345;" + pluginServerRule.url("/not/served/eithejar"));
    106106        }};
    107107        final PluginServer pluginServer = new PluginServer(
     
    167167
    168168        final Map<String, String> attrOverrides = new HashMap<String, String>() {{
    169             put("7500_Plugin-Url", "432;http://localhost:" + pluginServerRule.port() + "/dont.jar");
    170             put("7499_Plugin-Url", "346;http://localhost:" + pluginServerRule.port() + "/even.jar");
    171             put("6999_Plugin-Url", "345;http://localhost:" + pluginServerRule.port() + "/bother.jar");
     169            put("7500_Plugin-Url", "432;" + pluginServerRule.url("/dont.jar"));
     170            put("7499_Plugin-Url", "346;" + pluginServerRule.url("/even.jar"));
     171            put("6999_Plugin-Url", "345;" + pluginServerRule.url("/bother.jar"));
    172172        }};
    173173        final PluginServer pluginServer = new PluginServer(
  • trunk/test/unit/org/openstreetmap/josm/testutils/PluginServer.java

    r16161 r17195  
    139139        }
    140140
    141         public String getPluginURL(Integer port) {
     141        public String getPluginURL(WireMockServer wireMockServer) {
    142142            if (this.pluginURL != null) {
    143143                return this.pluginURL;
    144             } else if (port != null && this.getJarPathBeneathFilesDir() != null) {
    145                 return String.format("http://localhost:%s%s", port, this.getPluginURLPath());
     144            } else if (wireMockServer != null && this.getJarPathBeneathFilesDir() != null) {
     145                return wireMockServer.url(this.getPluginURLPath());
    146146            }
    147147            return "http://example.com" + this.getPluginURLPath();
     
    157157        }
    158158
    159         public String getRemotePluginsListSection(Integer port) {
     159        public String getRemotePluginsListSection(WireMockServer wireMockServer) {
    160160            return String.format(
    161161                "%s.jar;%s\n%s",
    162162                this.getName(),
    163                 this.getPluginURL(port),
     163                this.getPluginURL(wireMockServer),
    164164                this.getRemotePluginsListManifestSection()
    165165            );
     
    199199                WireMock.aResponse().withStatus(200).withHeader("Content-Type", "text/plain").withBody(
    200200                    this.pluginList.stream().map(
    201                         remotePlugin -> remotePlugin.getRemotePluginsListSection(wireMockServer.port())
     201                        remotePlugin -> remotePlugin.getRemotePluginsListSection(wireMockServer)
    202202                    ).collect(Collectors.joining())
    203203                )
  • trunk/test/unit/org/openstreetmap/josm/testutils/TileSourceRule.java

    r14201 r17195  
    243243                    // to the mock server seems to prompt it to start earlier (though this request itself is not
    244244                    // expected to succeed). see https://github.com/tomakehurst/wiremock/issues/97
    245                     (new java.net.URL(String.format("http://localhost:%d/_poke", TileSourceRule.this.port()))).getContent();
     245                    new java.net.URL(TileSourceRule.this.url("/_poke")).getContent();
    246246                } catch (IOException e) {
    247247                    Logging.trace(e);
  • trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportSenderTest.java

    r17189 r17195  
    7878        List<URI> calledURIs = OpenBrowserMocker.getCalledURIs();
    7979        assertEquals(1, calledURIs.size());
    80         assertEquals(wireMockRule.baseUrl() + "/josmticket?pdata_stored=6bccff5c0417217bfbbe5fff", calledURIs.get(0).toString());
     80        assertEquals(wireMockRule.url("/josmticket?pdata_stored=6bccff5c0417217bfbbe5fff"), calledURIs.get(0).toString());
    8181    }
    8282}
Note: See TracChangeset for help on using the changeset viewer.