Add overture data sources

Signed-off-by: Taylor Smock <tsmock@meta.com>
pull/50/head
Taylor Smock 2024-10-31 12:07:05 -06:00
rodzic 629e34f413
commit 87274baa62
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 3D4E7B422350E843
12 zmienionych plików z 231 dodań i 60 usunięć

Wyświetl plik

@ -74,6 +74,7 @@ import org.openstreetmap.josm.spi.preferences.Config;
import org.openstreetmap.josm.tools.HttpClient;
import org.openstreetmap.josm.tools.JosmRuntimeException;
import org.openstreetmap.josm.tools.Logging;
import org.openstreetmap.josm.tools.Utils;
import jakarta.json.Json;
import jakarta.json.JsonValue;
@ -368,30 +369,33 @@ public class BoundingBoxMapWithAIDownloader extends BoundingBoxDownloader {
}
final var ds = new DataSet();
final var primitiveMap = new HashMap<PrimitiveId, OsmPrimitive>(tile.getData().getAllPrimitives().size());
for (VectorPrimitive p : tile.getData().getAllPrimitives()) {
final OsmPrimitive osmPrimitive;
if (p instanceof VectorNode node) {
osmPrimitive = new Node(node.getCoor());
osmPrimitive.putAll(node.getKeys());
} else if (p instanceof VectorWay way) {
final var tWay = new Way();
for (VectorNode node : way.getNodes()) {
tWay.addNode((Node) primitiveMap.get(node));
for (Class<? extends VectorPrimitive> clazz : Arrays.asList(VectorNode.class, VectorWay.class,
VectorRelation.class)) {
for (VectorPrimitive p : Utils.filteredCollection(tile.getData().getAllPrimitives(), clazz)) {
final OsmPrimitive osmPrimitive;
if (p instanceof VectorNode node) {
osmPrimitive = new Node(node.getCoor());
osmPrimitive.putAll(node.getKeys());
} else if (p instanceof VectorWay way) {
final var tWay = new Way();
for (VectorNode node : way.getNodes()) {
tWay.addNode((Node) primitiveMap.get(node));
}
tWay.putAll(way.getKeys());
osmPrimitive = tWay;
} else if (p instanceof VectorRelation vectorRelation) {
final var tRelation = new Relation();
for (VectorRelationMember member : vectorRelation.getMembers()) {
tRelation.addMember(new RelationMember(member.getRole(), primitiveMap.get(member.getMember())));
}
tRelation.putAll(vectorRelation.getKeys());
osmPrimitive = tRelation;
} else {
throw new IllegalDataException("Unknown vector data type: " + p);
}
tWay.putAll(way.getKeys());
osmPrimitive = tWay;
} else if (p instanceof VectorRelation vectorRelation) {
final var tRelation = new Relation();
for (VectorRelationMember member : vectorRelation.getMembers()) {
tRelation.addMember(new RelationMember(member.getRole(), primitiveMap.get(member.getMember())));
}
tRelation.putAll(vectorRelation.getKeys());
osmPrimitive = tRelation;
} else {
throw new IllegalDataException("Unknown vector data type: " + p);
ds.addPrimitive(osmPrimitive);
primitiveMap.put(p, osmPrimitive);
}
ds.addPrimitive(osmPrimitive);
primitiveMap.put(p, osmPrimitive);
}
return ds;
}

Wyświetl plik

@ -38,7 +38,6 @@ import org.openstreetmap.josm.gui.progress.ProgressMonitor;
import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor;
import org.openstreetmap.josm.gui.util.GuiHelper;
import org.openstreetmap.josm.io.IllegalDataException;
import org.openstreetmap.josm.io.OsmApiException;
import org.openstreetmap.josm.io.OsmTransferException;
import org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin;
import org.openstreetmap.josm.plugins.mapwithai.commands.MapWithAIAddCommand;

Wyświetl plik

@ -41,6 +41,7 @@ import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAIDataUtils;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo.MapWithAIPreferenceEntry;
import org.openstreetmap.josm.plugins.mapwithai.io.mapwithai.ESRISourceReader;
import org.openstreetmap.josm.plugins.mapwithai.io.mapwithai.MapWithAISourceReader;
import org.openstreetmap.josm.plugins.mapwithai.io.mapwithai.OvertureSourceReader;
import org.openstreetmap.josm.plugins.mapwithai.spi.preferences.MapWithAIConfig;
import org.openstreetmap.josm.spi.preferences.Config;
import org.openstreetmap.josm.tools.ListenerList;
@ -333,6 +334,7 @@ public class MapWithAILayerInfo {
// This is called here to "pre-cache" the layer information, to avoid blocking
// the EDT
this.updateEsriLayers(result);
this.updateOvertureLayers(result);
newLayers.addAll(result);
} catch (IOException ex) {
loadError = true;
@ -364,6 +366,24 @@ public class MapWithAILayerInfo {
layers.addAll(esriInfo);
}
/**
* Update the overture layers
* @param layers The layers to iterate through and modify
* @throws IOException If something happens while parsing overture layers
*/
private void updateOvertureLayers(@Nonnull final Collection<MapWithAIInfo> layers) throws IOException {
final var overtureLayers = new ArrayList<MapWithAIInfo>(4);
for (var layer : layers) {
if (MapWithAIType.OVERTURE == layer.getSourceType()) {
try (var reader = new OvertureSourceReader(layer)) {
reader.parse().ifPresent(overtureLayers::addAll);
}
}
}
layers.removeIf(layer -> MapWithAIType.OVERTURE == layer.getSourceType());
layers.addAll(overtureLayers);
}
protected void finish() {
defaultLayers.clear();
synchronized (allDefaultLayers) {

Wyświetl plik

@ -12,7 +12,7 @@ import jakarta.annotation.Nonnull;
*/
public enum MapWithAIType implements ISourceType<MapWithAIType> {
FACEBOOK("facebook"), THIRD_PARTY("thirdParty"), ESRI("esri"), ESRI_FEATURE_SERVER(
"esriFeatureServer"), MAPBOX_VECTOR_TILE("mvt"), PMTILES("pmtiles");
"esriFeatureServer"), MAPBOX_VECTOR_TILE("mvt"), PMTILES("pmtiles"), OVERTURE("overture");
private final String typeString;

Wyświetl plik

@ -51,6 +51,7 @@ class MapWithAIDefaultLayerTableModel extends DefaultTableModel {
columnDataRetrieval.add(info -> Optional.ofNullable(info.getTermsOfUseURL()).orElse(""));
columnDataRetrieval.add(i -> MapWithAILayerInfo.getInstance().getLayers().contains(i));
MapWithAILayerInfo.getInstance().addFinishListener(() -> GuiHelper.runInEDT(this::fireTableDataChanged));
MapWithAILayerInfo.SHOW_PREVIEW.addWeakListener(l -> GuiHelper.runInEDT(this::fireTableDataChanged));
}
/**
@ -60,10 +61,11 @@ class MapWithAIDefaultLayerTableModel extends DefaultTableModel {
* @return The imagery info at the given row number
*/
public static MapWithAIInfo getRow(int row) {
if (row == 0 && MapWithAILayerInfo.getInstance().getAllDefaultLayers().isEmpty()) {
final var layers = MapWithAILayerInfo.getInstance().getAllDefaultLayers();
if (row == 0 && layers.isEmpty()) {
return new MapWithAIInfo(tr("Loading"), "");
}
return MapWithAILayerInfo.getInstance().getAllDefaultLayers().get(row);
return layers.get(row);
}
@Override

Wyświetl plik

@ -6,6 +6,7 @@ import java.util.Optional;
import org.openstreetmap.josm.io.CachedFile;
import org.openstreetmap.josm.tools.HttpClient;
import org.openstreetmap.josm.tools.Logging;
import org.openstreetmap.josm.tools.Utils;
import jakarta.json.Json;
@ -13,6 +14,7 @@ import jakarta.json.JsonObject;
import jakarta.json.JsonReader;
import jakarta.json.JsonStructure;
import jakarta.json.JsonValue;
import jakarta.json.stream.JsonParsingException;
/**
* Read sources for MapWithAI
@ -49,8 +51,10 @@ public abstract class CommonSourceReader<T> implements AutoCloseable {
final var jsonObject = struct.asJsonObject();
return Optional.ofNullable(this.parseJson(jsonObject));
}
return Optional.empty();
} catch (JsonParsingException jsonParsingException) {
Logging.error(jsonParsingException);
}
return Optional.empty();
}
/**

Wyświetl plik

@ -0,0 +1,140 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapwithai.io.mapwithai;
import java.io.Closeable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.imagery.ImageryInfo;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAICategory;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType;
import org.openstreetmap.josm.plugins.pmtiles.lib.PMTiles;
import org.openstreetmap.josm.tools.Logging;
import jakarta.annotation.Nullable;
import jakarta.json.JsonArray;
import jakarta.json.JsonObject;
import jakarta.json.JsonString;
import jakarta.json.JsonValue;
/**
* Read data from overture sources
*/
public class OvertureSourceReader extends CommonSourceReader<List<MapWithAIInfo>> implements Closeable {
private final MapWithAIInfo source;
public OvertureSourceReader(MapWithAIInfo source) {
super(source.getUrl());
this.source = source;
}
@Override
public List<MapWithAIInfo> parseJson(JsonObject jsonObject) {
if (jsonObject.containsKey("releases")) {
final var info = new ArrayList<MapWithAIInfo>(6 * 4);
final var releases = jsonObject.get("releases");
final var baseUri = URI.create(this.source.getUrl()).resolve("./"); // safe since we created an URI from the source to get to this point
if (releases instanceof JsonArray rArray) {
for (JsonValue value : rArray) {
if (value instanceof JsonObject release && release.containsKey("release_id")
&& release.containsKey("files")) {
final var id = release.get("release_id");
final var files = release.get("files");
if (id instanceof JsonString sId && files instanceof JsonArray fArray) {
final String releaseId = sId.getString();
for (JsonValue file : fArray) {
final var newInfo = parseFile(baseUri, releaseId, file);
if (newInfo != null) {
info.add(newInfo);
}
}
}
}
}
}
info.trimToSize();
return info;
}
return Collections.emptyList();
}
/**
* Parse the individual file from the files array
* @param baseUri The base URI (if the href is relative)
* @param releaseId The release id to differentiate it from other releases with the same theme
* @param file The file object
* @return The info, if it was parsed. Otherwise {@code null}.
*/
@Nullable
private MapWithAIInfo parseFile(URI baseUri, String releaseId, JsonValue file) {
if (file instanceof JsonObject fObj && fObj.containsKey("theme") && fObj.containsKey("href")) {
final JsonValue vTheme = fObj.get("theme");
final JsonValue vHref = fObj.get("href");
try {
if (vTheme instanceof JsonString sTheme && vHref instanceof JsonString href) {
final var theme = sTheme.getString();
final URI uri;
if (href.getString().startsWith("./") || href.getString().startsWith("../")) {
uri = baseUri.resolve(href.getString());
} else {
uri = new URI(href.getString());
}
return buildSource(uri, releaseId, theme);
}
} catch (URISyntaxException uriSyntaxException) {
Logging.debug(uriSyntaxException);
}
}
return null;
}
private MapWithAIInfo buildSource(URI uri, String releaseId, String theme) {
final var info = new MapWithAIInfo(this.source);
info.setUrl(uri.toString());
info.setName(this.source.getName() + ": " + theme + " - " + releaseId);
if ("addresses".equals(theme)) {
info.setCategory(MapWithAICategory.ADDRESS);
} else if ("buildings".equals(theme)) {
info.setCategory(MapWithAICategory.BUILDING);
} else {
info.setCategory(MapWithAICategory.OTHER);
}
// Addresses and places are "interesting". Only removing "transportation" since that currently causes crashes.
if ("transportation".equals(theme)) {
return null;
}
final var categories = EnumSet.of(this.source.getCategory(),
this.source.getAdditionalCategories().toArray(MapWithAICategory[]::new));
categories.removeIf(MapWithAICategory.OTHER::equals);
info.setAdditionalCategories(new ArrayList<>(categories));
info.setId(info.getName());
if (uri.getPath().endsWith(".pmtiles")) {
info.setSourceType(MapWithAIType.PMTILES);
// Set additional information
try {
final var header = PMTiles.readHeader(uri);
final var metadata = PMTiles.readMetadata(header);
final var bounds = new Bounds(header.minLatitude(), header.minLongitude(), header.maxLatitude(),
header.maxLongitude());
info.setBounds(new ImageryInfo.ImageryBounds(bounds.encodeAsString(","), ","));
if (metadata.containsKey("name") && metadata.get("name")instanceof JsonString name) {
info.setName(name.getString() + " - " + releaseId);
}
if (metadata.containsKey("description")
&& metadata.get("description")instanceof JsonString description) {
info.setDescription(description.getString());
}
} catch (IOException ioException) {
Logging.error(ioException);
}
}
return info;
}
}

Wyświetl plik

@ -41,13 +41,11 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType;
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
import org.openstreetmap.josm.testutils.annotations.Projection;
import org.openstreetmap.josm.testutils.annotations.ThreadSync;
import org.openstreetmap.josm.tools.ImageProvider;
import org.openstreetmap.josm.tools.Logging;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.matching.AnythingPattern;
import com.github.tomakehurst.wiremock.matching.EqualToPattern;
@ -89,8 +87,9 @@ class AddMapWithAILayerActionTest {
parameterMap.put("outfields", new EqualToPattern("*"));
parameterMap.put("result_type", new EqualToPattern("road_building_vector_xml"));
parameterMap.put("resultOffset", anythingPattern);
wireMockRuntimeInfo.getWireMock().register(
WireMock.get(new UrlPathPattern(new EqualToPattern("/query"), false)).withQueryParams(parameterMap)
wireMockRuntimeInfo.getWireMock()
.register(WireMock.get(new UrlPathPattern(new EqualToPattern("/query"), false))
.withQueryParams(parameterMap)
.willReturn(WireMock.aResponse()
.withBody(Json.createObjectBuilder().add("type", "FeatureCollection")
.add("features", Json.createArrayBuilder().build()).build().toString()))
@ -148,7 +147,8 @@ class AddMapWithAILayerActionTest {
final BufferedImage bi = assertInstanceOf(BufferedImage.class, blankImage.getImage());
ImageIO.write(bi, "png", byteArrayOutputStream);
byte[] originalImage = byteArrayOutputStream.toByteArray();
wireMockRuntimeInfo.getWireMock().register(WireMock.get("/icon").willReturn(WireMock.aResponse().withBody(originalImage)));
wireMockRuntimeInfo.getWireMock()
.register(WireMock.get("/icon").willReturn(WireMock.aResponse().withBody(originalImage)));
final MapWithAIInfo remoteInfo = new MapWithAIInfo(info);
remoteInfo.setIcon(wireMockRuntimeInfo.getHttpBaseUrl() + "/icon");
final AddMapWithAILayerAction action = new AddMapWithAILayerAction(remoteInfo);

Wyświetl plik

@ -95,16 +95,22 @@ class BoundingBoxMapWithAIDownloaderTest {
StubMapping noConflation = wireMockRuntimeInfo.getWireMock()
.register(WireMock.get("/no-conflation").willReturn(WireMock.badRequest()));
StubMapping resultOffset = wireMockRuntimeInfo.getWireMock().register(
WireMock.get(WireMock.urlPathEqualTo("/conflation")).withQueryParam("bbox", new AnythingPattern())
StubMapping resultOffset = wireMockRuntimeInfo.getWireMock()
.register(WireMock.get(WireMock.urlPathEqualTo("/conflation"))
.withQueryParam("bbox", new AnythingPattern())
.withQueryParam("resultOffset", new EqualToPattern("0")).willReturn(WireMock.badRequest()));
StubMapping noResultOffset = wireMockRuntimeInfo.getWireMock().register(WireMock.get(WireMock.urlPathEqualTo("/conflation"))
.withQueryParam("bbox", new AnythingPattern()).withQueryParam("resultOffset", AbsentPattern.ABSENT)
.willReturn(WireMock.aResponse().withBody(TEST_DATA)));
StubMapping noResultOffset = wireMockRuntimeInfo.getWireMock()
.register(WireMock.get(WireMock.urlPathEqualTo("/conflation"))
.withQueryParam("bbox", new AnythingPattern())
.withQueryParam("resultOffset", AbsentPattern.ABSENT)
.willReturn(WireMock.aResponse().withBody(TEST_DATA)));
assertDoesNotThrow(() -> boundingBoxMapWithAIDownloader.parseOsm(NullProgressMonitor.INSTANCE));
wireMockRuntimeInfo.getWireMock().verifyThat(0, RequestPatternBuilder.forCustomMatcher(noConflation.getRequest()));
wireMockRuntimeInfo.getWireMock().verifyThat(0, RequestPatternBuilder.forCustomMatcher(resultOffset.getRequest()));
wireMockRuntimeInfo.getWireMock().verifyThat(1, RequestPatternBuilder.forCustomMatcher(noResultOffset.getRequest()));
wireMockRuntimeInfo.getWireMock().verifyThat(0,
RequestPatternBuilder.forCustomMatcher(noConflation.getRequest()));
wireMockRuntimeInfo.getWireMock().verifyThat(0,
RequestPatternBuilder.forCustomMatcher(resultOffset.getRequest()));
wireMockRuntimeInfo.getWireMock().verifyThat(1,
RequestPatternBuilder.forCustomMatcher(noResultOffset.getRequest()));
}
}

Wyświetl plik

@ -26,10 +26,8 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIConflati
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
import org.openstreetmap.josm.testutils.annotations.HTTP;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.stubbing.StubMapping;
@ -104,8 +102,8 @@ class DataConflationSenderTest {
@Test
void testWorkingUrlTimeout(WireMockRuntimeInfo wireMockRuntimeInfo) {
MapWithAIConflationCategoryMock.url = wireMockRuntimeInfo.getHttpBaseUrl() + "/conflate";
final StubMapping stubMapping = wireMockRuntimeInfo.getWireMock().register(WireMock.post("/conflate")
.willReturn(WireMock.aResponse().withBody(
final StubMapping stubMapping = wireMockRuntimeInfo.getWireMock()
.register(WireMock.post("/conflate").willReturn(WireMock.aResponse().withBody(
"<?xml version='1.0' encoding='UTF-8'?><osm version='0.6' generator='DataConflationSenderTest#testWorkingUrl'><node id='1' version='1' visible='true' lat='89.0' lon='0.1' /></osm>")
.withFixedDelay(500)));
new MapWithAIConflationCategoryMock();
@ -134,7 +132,8 @@ class DataConflationSenderTest {
@MethodSource
void testNonWorkingUrl(final ResponseDefinitionBuilder response, final WireMockRuntimeInfo wireMockRuntimeInfo) {
MapWithAIConflationCategoryMock.url = wireMockRuntimeInfo.getHttpBaseUrl() + "/conflate";
final StubMapping stubMapping = wireMockRuntimeInfo.getWireMock().register(WireMock.post("/conflate").willReturn(response));
final StubMapping stubMapping = wireMockRuntimeInfo.getWireMock()
.register(WireMock.post("/conflate").willReturn(response));
new MapWithAIConflationCategoryMock();
final DataSet external = new DataSet(new Node(LatLon.NORTH_POLE));

Wyświetl plik

@ -10,7 +10,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
import org.awaitility.Awaitility;
@ -22,12 +21,9 @@ import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType;
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
import org.openstreetmap.josm.testutils.annotations.Projection;
import org.openstreetmap.josm.tools.JosmRuntimeException;
import com.github.tomakehurst.wiremock.WireMockServer;
@Projection
@Wiremock
class ESRISourceReaderTest {

Wyświetl plik

@ -22,8 +22,6 @@ import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ParameterContext;
import org.junit.jupiter.api.extension.ParameterResolutionException;
import org.junit.platform.commons.support.AnnotationSupport;
import org.openstreetmap.josm.plugins.mapwithai.backend.DataAvailability;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIConflationCategory;
@ -75,8 +73,7 @@ public @interface Wiremock {
*/
public static WireMockRuntimeInfo getWiremock(ExtensionContext context) {
return context.getStore(ExtensionContext.Namespace.create(BasicWiremock.WireMockExtension.class))
.get(BasicWiremock.WireMockExtension.class, BasicWiremock.WireMockExtension.class)
.getRuntimeInfo();
.get(BasicWiremock.WireMockExtension.class, BasicWiremock.WireMockExtension.class).getRuntimeInfo();
}
}
@ -113,7 +110,8 @@ public @interface Wiremock {
}
class TestMapWithAIUrls extends WiremockExtension implements IMapWithAIUrls, BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback {
class TestMapWithAIUrls extends WiremockExtension
implements IMapWithAIUrls, BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback {
ExtensionContext context;
private static boolean conflationServerInitialized;
@ -137,17 +135,20 @@ public @interface Wiremock {
@Override
public String getConflationServerJson() {
conflationServerInitialized = true;
return replaceUrl(getWiremock(this.context).getHttpBaseUrl(), MapWithAIUrls.getInstance().getConflationServerJson());
return replaceUrl(getWiremock(this.context).getHttpBaseUrl(),
MapWithAIUrls.getInstance().getConflationServerJson());
}
@Override
public String getMapWithAISourcesJson() {
return replaceUrl(getWiremock(this.context).getHttpBaseUrl(), MapWithAIUrls.getInstance().getMapWithAISourcesJson());
return replaceUrl(getWiremock(this.context).getHttpBaseUrl(),
MapWithAIUrls.getInstance().getMapWithAISourcesJson());
}
@Override
public String getMapWithAIPaintStyle() {
return replaceUrl(getWiremock(this.context).getHttpBaseUrl(), MapWithAIUrls.getInstance().getMapWithAIPaintStyle());
return replaceUrl(getWiremock(this.context).getHttpBaseUrl(),
MapWithAIUrls.getInstance().getMapWithAIPaintStyle());
}
@Override
@ -174,9 +175,9 @@ public @interface Wiremock {
}
final WireMock wireMockServer = getWiremock(context).getWireMock();
if (wireMockServer.allStubMappings().getMappings().stream().filter(mapping -> mapping.getRequest().getUrl() != null)
.noneMatch(mapping -> mapping.getRequest().getUrl()
.equals("/MapWithAI/json/conflation_servers.json"))) {
if (wireMockServer.allStubMappings().getMappings().stream()
.filter(mapping -> mapping.getRequest().getUrl() != null).noneMatch(mapping -> mapping.getRequest()
.getUrl().equals("/MapWithAI/json/conflation_servers.json"))) {
wireMockServer.register(WireMock.get("/MapWithAI/json/conflation_servers.json")
.willReturn(WireMock.aResponse().withBody("{}")).atPriority(-5));
}