Fix some issues when tests were run together

Signed-off-by: Taylor Smock <taylor.smock@kaart.com>
pull/1/head
Taylor Smock 2020-06-30 15:44:14 -06:00
rodzic 11adb96777
commit 6f3aef98c3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
1 zmienionych plików z 17 dodań i 5 usunięć

Wyświetl plik

@ -55,7 +55,6 @@ public class MapWithAITestRules extends JOSMTestRules {
public MapWithAITestRules() {
super();
super.assertionsInEDT();
}
/**
@ -113,10 +112,16 @@ public class MapWithAITestRules extends JOSMTestRules {
.extensions(new WireMockUrlTransformer()).dynamicPort());
wireMock.start();
MapWithAIDataUtils.setPaintStyleUrl(replaceUrl(wireMock, MapWithAIDataUtils.getPaintStyleUrl()));
currentReleaseUrl = DataAvailability.getReleaseUrl();
// Avoid cases where tests could write the wiremock url to some fields.
if (currentReleaseUrl == null) {
currentReleaseUrl = DataAvailability.getReleaseUrl();
}
DataAvailability.setReleaseUrl(replaceUrl(wireMock, DataAvailability.getReleaseUrl()));
Config.getPref().put("osm-server.url", wireMock.baseUrl());
sourceSites = MapWithAILayerInfo.getImageryLayersSites();
// Avoid cases where tests could write the wiremock url to some fields.
if (sourceSites == null) {
sourceSites = MapWithAILayerInfo.getImageryLayersSites();
}
MapWithAILayerInfo.setImageryLayersSites(sourceSites.stream().map(t -> replaceUrl(wireMock, t))
.filter(Objects::nonNull).collect(Collectors.toList()));
MapWithAIConflationCategory.setConflationJsonLocation(
@ -158,9 +163,16 @@ public class MapWithAITestRules extends JOSMTestRules {
List<LoggedRequest> requests = wireMock.findUnmatchedRequests().getRequests();
requests.forEach(r -> Logging.error(r.getAbsoluteUrl()));
assertTrue(requests.isEmpty());
DataAvailability.setReleaseUrl(currentReleaseUrl);
Config.getPref().put("osm-server.url", null);
MapWithAILayerInfo.setImageryLayersSites(sourceSites);
// Avoid cases where tests could write the wiremock url to some fields.
if (currentReleaseUrl != null) {
DataAvailability.setReleaseUrl(currentReleaseUrl);
currentReleaseUrl = null;
}
if (sourceSites != null) {
MapWithAILayerInfo.setImageryLayersSites(sourceSites);
sourceSites = null;
}
MapWithAIConflationCategory.resetConflationJsonLocation();
resetMapWithAILayerInfo();
}