kopia lustrzana https://github.com/JOSM/MapWithAI
rodzic
3a7e383700
commit
a14502d1d2
|
@ -30,8 +30,7 @@ public final class UpdateProd {
|
||||||
public static boolean doProd(int nextMinVersion) {
|
public static boolean doProd(int nextMinVersion) {
|
||||||
if (nextMinVersion > Version.getInstance().getVersion()) {
|
if (nextMinVersion > Version.getInstance().getVersion()) {
|
||||||
int doUpdate = ConditionalOptionPaneUtil.showOptionDialog(
|
int doUpdate = ConditionalOptionPaneUtil.showOptionDialog(
|
||||||
MapWithAIPlugin.NAME.concat(".ignore_next_version"),
|
MapWithAIPlugin.NAME.concat(".ignore_next_version"), MainApplication.getMainFrame(),
|
||||||
MainApplication.getMainFrame(),
|
|
||||||
tr("Please update JOSM -- {0} {1} is the last {0} version to support JOSM {2}",
|
tr("Please update JOSM -- {0} {1} is the last {0} version to support JOSM {2}",
|
||||||
MapWithAIPlugin.NAME, MapWithAIPlugin.getVersionInfo(),
|
MapWithAIPlugin.NAME, MapWithAIPlugin.getVersionInfo(),
|
||||||
Integer.toString(Version.getInstance().getVersion())),
|
Integer.toString(Version.getInstance().getVersion())),
|
||||||
|
|
|
@ -34,11 +34,9 @@ public class BoundingBoxMapWithAIDownloader extends BoundingBoxDownloader {
|
||||||
@Override
|
@Override
|
||||||
protected DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException {
|
protected DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException {
|
||||||
DataSet ds = OsmReaderCustom.parseDataSet(source, progressMonitor, true);
|
DataSet ds = OsmReaderCustom.parseDataSet(source, progressMonitor, true);
|
||||||
GetDataRunnable.addMapWithAISourceTag(ds,
|
GetDataRunnable.addMapWithAISourceTag(ds, MapWithAIPreferenceHelper.getMapWithAIUrl().stream()
|
||||||
MapWithAIPreferenceHelper.getMapWithAIUrl().stream()
|
|
||||||
.filter(map -> map.getOrDefault("url", "no-url").equals(url))
|
.filter(map -> map.getOrDefault("url", "no-url").equals(url))
|
||||||
.map(map -> map.getOrDefault("source", MapWithAIPlugin.NAME)).findFirst()
|
.map(map -> map.getOrDefault("source", MapWithAIPlugin.NAME)).findFirst().orElse(MapWithAIPlugin.NAME));
|
||||||
.orElse(MapWithAIPlugin.NAME));
|
|
||||||
GetDataRunnable.cleanup(ds, downloadArea);
|
GetDataRunnable.cleanup(ds, downloadArea);
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,8 @@ public final class MapWithAIAvailability {
|
||||||
cachedRapidReleases.setMaxAge(604_800);
|
cachedRapidReleases.setMaxAge(604_800);
|
||||||
parser.next();
|
parser.next();
|
||||||
final Stream<Entry<String, JsonValue>> entries = parser.getObjectStream();
|
final Stream<Entry<String, JsonValue>> entries = parser.getObjectStream();
|
||||||
final Optional<Entry<String, JsonValue>> objects = entries
|
final Optional<Entry<String, JsonValue>> objects = entries.filter(entry -> "objects".equals(entry.getKey()))
|
||||||
.filter(entry -> "objects".equals(entry.getKey())).findFirst();
|
.findFirst();
|
||||||
if (objects.isPresent()) {
|
if (objects.isPresent()) {
|
||||||
final JsonObject value = objects.get().getValue().asJsonObject();
|
final JsonObject value = objects.get().getValue().asJsonObject();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
|
@ -120,8 +120,7 @@ public final class MapWithAIAvailability {
|
||||||
.orElse(Optional.ofNullable(countryLoop.get("ISO3166-2")).orElse(""));
|
.orElse(Optional.ofNullable(countryLoop.get("ISO3166-2")).orElse(""));
|
||||||
if ("".equals(key)) {
|
if ("".equals(key)) {
|
||||||
Logging.error("{0}: {1} does not have a \"ISO3166-1:alpha2\" or \"ISO3166-2\" key. {2}",
|
Logging.error("{0}: {1} does not have a \"ISO3166-1:alpha2\" or \"ISO3166-2\" key. {2}",
|
||||||
MapWithAIPlugin.NAME,
|
MapWithAIPlugin.NAME, countryLoop, countryLoop.getInterestingTags());
|
||||||
countryLoop, countryLoop.getInterestingTags());
|
|
||||||
} else {
|
} else {
|
||||||
Logging.trace("{0}: {1} has a country code of {2}", MapWithAIPlugin.NAME,
|
Logging.trace("{0}: {1} has a country code of {2}", MapWithAIPlugin.NAME,
|
||||||
countryLoop.get("name:en"), key);
|
countryLoop.get("name:en"), key);
|
||||||
|
|
|
@ -87,8 +87,9 @@ public class MapWithAIRemoteControl extends RequestHandler.RawURLParseRequestHan
|
||||||
@Override
|
@Override
|
||||||
protected void handleRequest() throws RequestHandlerErrorException, RequestHandlerBadRequestException {
|
protected void handleRequest() throws RequestHandlerErrorException, RequestHandlerBadRequestException {
|
||||||
if (crop != null && crop.isInWorld()) {
|
if (crop != null && crop.isInWorld()) {
|
||||||
MainApplication.getLayerManager().addLayer(new GpxLayer(
|
MainApplication.getLayerManager()
|
||||||
DetectTaskingManagerUtils.createTaskingManagerGpxData(crop), DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
|
.addLayer(new GpxLayer(DetectTaskingManagerUtils.createTaskingManagerGpxData(crop),
|
||||||
|
DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
|
||||||
}
|
}
|
||||||
|
|
||||||
final MapWithAILayer layer = MapWithAIDataUtils.getLayer(true);
|
final MapWithAILayer layer = MapWithAIDataUtils.getLayer(true);
|
||||||
|
|
|
@ -38,8 +38,7 @@ public class MapWithAIUploadHook implements UploadHook, Destroyable {
|
||||||
if (MapWithAIPreferenceHelper.getMapWithAIUrl().parallelStream().anyMatch(
|
if (MapWithAIPreferenceHelper.getMapWithAIUrl().parallelStream().anyMatch(
|
||||||
map -> !MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API.equalsIgnoreCase(map.get("url")))) {
|
map -> !MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API.equalsIgnoreCase(map.get("url")))) {
|
||||||
sb.append(";url=")
|
sb.append(";url=")
|
||||||
.append(String.join(";url=",
|
.append(String.join(";url=", MapWithAIPreferenceHelper.getMapWithAIUrl().parallelStream()
|
||||||
MapWithAIPreferenceHelper.getMapWithAIUrl().parallelStream()
|
|
||||||
.filter(map -> map.containsKey("url")).map(map -> map.get("url"))
|
.filter(map -> map.containsKey("url")).map(map -> map.get("url"))
|
||||||
.filter(url -> !MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API.equalsIgnoreCase(url))
|
.filter(url -> !MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API.equalsIgnoreCase(url))
|
||||||
.collect(Collectors.toList())));
|
.collect(Collectors.toList())));
|
||||||
|
|
|
@ -14,11 +14,12 @@ import org.openstreetmap.josm.io.OsmReader;
|
||||||
import org.openstreetmap.josm.tools.Logging;
|
import org.openstreetmap.josm.tools.Logging;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parser for the Osm API (XML output). Read from an input stream and construct a dataset out of it.
|
* Parser for the Osm API (XML output). Read from an input stream and construct
|
||||||
|
* a dataset out of it.
|
||||||
*
|
*
|
||||||
* For each xml element, there is a dedicated method.
|
* For each xml element, there is a dedicated method. The XMLStreamReader cursor
|
||||||
* The XMLStreamReader cursor points to the start of the element, when the method is
|
* points to the start of the element, when the method is entered, and it must
|
||||||
* entered, and it must point to the end of the same element, when it is exited.
|
* point to the end of the same element, when it is exited.
|
||||||
*/
|
*/
|
||||||
public class OsmReaderCustom extends OsmReader {
|
public class OsmReaderCustom extends OsmReader {
|
||||||
protected OsmReaderCustom(boolean convertUnknownToTags) {
|
protected OsmReaderCustom(boolean convertUnknownToTags) {
|
||||||
|
@ -51,17 +52,19 @@ public class OsmReaderCustom extends OsmReader {
|
||||||
* Parse the given input source and return the dataset.
|
* Parse the given input source and return the dataset.
|
||||||
*
|
*
|
||||||
* @param source the source input stream. Must not be null.
|
* @param source the source input stream. Must not be null.
|
||||||
* @param progressMonitor the progress monitor. If null, {@link NullProgressMonitor#INSTANCE} is assumed
|
* @param progressMonitor the progress monitor. If null,
|
||||||
* @param convertUnknownToTags true if unknown xml attributes should be kept as tags
|
* {@link NullProgressMonitor#INSTANCE} is assumed
|
||||||
|
* @param convertUnknownToTags true if unknown xml attributes should be kept as
|
||||||
|
* tags
|
||||||
*
|
*
|
||||||
* @return the dataset with the parsed data
|
* @return the dataset with the parsed data
|
||||||
* @throws IllegalDataException if an error was found while parsing the data from the source
|
* @throws IllegalDataException if an error was found while parsing the data
|
||||||
|
* from the source
|
||||||
* @throws IllegalArgumentException if source is null
|
* @throws IllegalArgumentException if source is null
|
||||||
* @since xxx
|
* @since xxx
|
||||||
*/
|
*/
|
||||||
public static DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor,
|
public static DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor,
|
||||||
boolean convertUnknownToTags)
|
boolean convertUnknownToTags) throws IllegalDataException {
|
||||||
throws IllegalDataException {
|
|
||||||
return new OsmReaderCustom(convertUnknownToTags).doParseDataSet(source, progressMonitor);
|
return new OsmReaderCustom(convertUnknownToTags).doParseDataSet(source, progressMonitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.openstreetmap.josm.tools.Pair;
|
||||||
|
|
||||||
public abstract class AbstractConflationCommand extends Command {
|
public abstract class AbstractConflationCommand extends Command {
|
||||||
Collection<OsmPrimitive> possiblyAffectedPrimitives;
|
Collection<OsmPrimitive> possiblyAffectedPrimitives;
|
||||||
|
|
||||||
public AbstractConflationCommand(DataSet data) {
|
public AbstractConflationCommand(DataSet data) {
|
||||||
super(data);
|
super(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,8 @@ public class MapWithAIAddCommand extends Command implements Runnable {
|
||||||
* @param editLayer The OSM layer
|
* @param editLayer The OSM layer
|
||||||
* @param selection The primitives to add from MapWithAI
|
* @param selection The primitives to add from MapWithAI
|
||||||
*/
|
*/
|
||||||
public MapWithAIAddCommand(MapWithAILayer mapWithAILayer, OsmDataLayer editLayer, Collection<OsmPrimitive> selection) {
|
public MapWithAIAddCommand(MapWithAILayer mapWithAILayer, OsmDataLayer editLayer,
|
||||||
|
Collection<OsmPrimitive> selection) {
|
||||||
this(mapWithAILayer.getDataSet(), editLayer.getDataSet(), selection);
|
this(mapWithAILayer.getDataSet(), editLayer.getDataSet(), selection);
|
||||||
lock = mapWithAILayer.getLock();
|
lock = mapWithAILayer.getLock();
|
||||||
}
|
}
|
||||||
|
@ -76,8 +77,8 @@ public class MapWithAIAddCommand extends Command implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mapWithAI.equals(editable)) {
|
if (mapWithAI.equals(editable)) {
|
||||||
Logging.error("{0}: DataSet mapWithAI ({1}) should not be the same as DataSet editable ({2})", MapWithAIPlugin.NAME,
|
Logging.error("{0}: DataSet mapWithAI ({1}) should not be the same as DataSet editable ({2})",
|
||||||
mapWithAI, editable);
|
MapWithAIPlugin.NAME, mapWithAI, editable);
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
@ -91,7 +92,8 @@ public class MapWithAIAddCommand extends Command implements Runnable {
|
||||||
final Command movePrimitivesCommand = new MovePrimitiveDataSetCommand(editable, mapWithAI,
|
final Command movePrimitivesCommand = new MovePrimitiveDataSetCommand(editable, mapWithAI,
|
||||||
primitives);
|
primitives);
|
||||||
final Command createConnectionsCommand = createConnections(editable, allPrimitives);
|
final Command createConnectionsCommand = createConnections(editable, allPrimitives);
|
||||||
command = new SequenceCommand(getDescriptionText(), movePrimitivesCommand, createConnectionsCommand);
|
command = new SequenceCommand(getDescriptionText(), movePrimitivesCommand,
|
||||||
|
createConnectionsCommand);
|
||||||
}
|
}
|
||||||
command.executeCommand();
|
command.executeCommand();
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -41,7 +41,6 @@ import org.openstreetmap.josm.tools.ImageProvider;
|
||||||
|
|
||||||
public class MapWithAIDownloadReader implements DownloadSource<MapWithAIDownloadReader.MapWithAIDownloadData> {
|
public class MapWithAIDownloadReader implements DownloadSource<MapWithAIDownloadReader.MapWithAIDownloadData> {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractDownloadSourcePanel<MapWithAIDownloadData> createPanel(DownloadDialog dialog) {
|
public AbstractDownloadSourcePanel<MapWithAIDownloadData> createPanel(DownloadDialog dialog) {
|
||||||
return new MapWithAIDownloadPanel(this);
|
return new MapWithAIDownloadPanel(this);
|
||||||
|
@ -65,8 +64,7 @@ public class MapWithAIDownloadReader implements DownloadSource<MapWithAIDownload
|
||||||
sb.append(urlInformation.get("url"));
|
sb.append(urlInformation.get("url"));
|
||||||
if (urlInformation.containsKey("parameters")) {
|
if (urlInformation.containsKey("parameters")) {
|
||||||
List<String> parameters = DataUrl.readJsonStringArraySimple(urlInformation.get("parameters"))
|
List<String> parameters = DataUrl.readJsonStringArraySimple(urlInformation.get("parameters"))
|
||||||
.parallelStream()
|
.parallelStream().filter(JsonObject.class::isInstance).map(JsonObject.class::cast)
|
||||||
.filter(JsonObject.class::isInstance).map(JsonObject.class::cast)
|
|
||||||
.filter(map -> map.getBoolean("enabled", false)).filter(map -> map.containsKey("parameter"))
|
.filter(map -> map.getBoolean("enabled", false)).filter(map -> map.containsKey("parameter"))
|
||||||
.map(map -> map.getString("parameter")).collect(Collectors.toList());
|
.map(map -> map.getString("parameter")).collect(Collectors.toList());
|
||||||
if (!parameters.isEmpty()) {
|
if (!parameters.isEmpty()) {
|
||||||
|
|
|
@ -29,11 +29,9 @@ public class UpdateProdTest {
|
||||||
String booleanKey = "message.".concat(MapWithAIPlugin.NAME.concat(".ignore_next_version"));
|
String booleanKey = "message.".concat(MapWithAIPlugin.NAME.concat(".ignore_next_version"));
|
||||||
String intKey = "message.".concat(MapWithAIPlugin.NAME.concat(".ignore_next_version")).concat(".value"); // "message.MapWithAI.ignore_next_version.value";
|
String intKey = "message.".concat(MapWithAIPlugin.NAME.concat(".ignore_next_version")).concat(".value"); // "message.MapWithAI.ignore_next_version.value";
|
||||||
Config.getPref().putBoolean(booleanKey, false);
|
Config.getPref().putBoolean(booleanKey, false);
|
||||||
Config.getPref().putInt(intKey,
|
Config.getPref().putInt(intKey, JOptionPane.YES_OPTION);
|
||||||
JOptionPane.YES_OPTION);
|
|
||||||
assertTrue(UpdateProd.doProd(Integer.MAX_VALUE));
|
assertTrue(UpdateProd.doProd(Integer.MAX_VALUE));
|
||||||
Config.getPref().putInt(intKey,
|
Config.getPref().putInt(intKey, JOptionPane.NO_OPTION);
|
||||||
JOptionPane.NO_OPTION);
|
|
||||||
assertTrue(UpdateProd.doProd(Integer.MAX_VALUE));
|
assertTrue(UpdateProd.doProd(Integer.MAX_VALUE));
|
||||||
assertFalse(UpdateProd.doProd(0));
|
assertFalse(UpdateProd.doProd(0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,8 @@ public class DetectTaskingManagerUtilsTest {
|
||||||
Assert.assertFalse(DetectTaskingManagerUtils.hasTaskingManagerLayer());
|
Assert.assertFalse(DetectTaskingManagerUtils.hasTaskingManagerLayer());
|
||||||
|
|
||||||
final BBox bbox = new BBox(0, 0, 1, 1);
|
final BBox bbox = new BBox(0, 0, 1, 1);
|
||||||
MainApplication.getLayerManager().addLayer(new GpxLayer(DetectTaskingManagerUtils.createTaskingManagerGpxData(bbox),
|
MainApplication.getLayerManager()
|
||||||
|
.addLayer(new GpxLayer(DetectTaskingManagerUtils.createTaskingManagerGpxData(bbox),
|
||||||
DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
|
DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
|
||||||
|
|
||||||
Assert.assertTrue(DetectTaskingManagerUtils.hasTaskingManagerLayer());
|
Assert.assertTrue(DetectTaskingManagerUtils.hasTaskingManagerLayer());
|
||||||
|
|
|
@ -115,8 +115,8 @@ public class GetDataRunnableTest {
|
||||||
@Test
|
@Test
|
||||||
public void testRegressionTicket46() {
|
public void testRegressionTicket46() {
|
||||||
DataSet ds = new DataSet();
|
DataSet ds = new DataSet();
|
||||||
new GetDataRunnable(Arrays.asList(new BBox(-5.7400005, 34.4524384, -5.6686014, 34.5513153)), ds,
|
new GetDataRunnable(Arrays.asList(new BBox(-5.7400005, 34.4524384, -5.6686014, 34.5513153)), ds, null).fork()
|
||||||
null).fork().join();
|
.join();
|
||||||
assertNotNull(ds);
|
assertNotNull(ds);
|
||||||
assertFalse(ds.isEmpty());
|
assertFalse(ds.isEmpty());
|
||||||
assertFalse(ds.allNonDeletedPrimitives().isEmpty());
|
assertFalse(ds.allNonDeletedPrimitives().isEmpty());
|
||||||
|
|
|
@ -31,8 +31,8 @@ public class MapWithAIAvailabilityTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
wireMock.start();
|
wireMock.start();
|
||||||
MapWithAIAvailability.setReleaseUrl(wireMock.baseUrl()
|
MapWithAIAvailability.setReleaseUrl(
|
||||||
+ "/facebookmicrosites/Open-Mapping-At-Facebook/master/data/rapid_releases.geojson");
|
wireMock.baseUrl() + "/facebookmicrosites/Open-Mapping-At-Facebook/master/data/rapid_releases.geojson");
|
||||||
Territories.initialize();
|
Territories.initialize();
|
||||||
instance = MapWithAIAvailability.getInstance();
|
instance = MapWithAIAvailability.getInstance();
|
||||||
LatLon temp = new LatLon(40, -100);
|
LatLon temp = new LatLon(40, -100);
|
||||||
|
|
|
@ -35,8 +35,7 @@ public class MapWithAIMoveActionTest {
|
||||||
moveAction = new MapWithAIMoveAction();
|
moveAction = new MapWithAIMoveAction();
|
||||||
final DataSet osmData = new DataSet();
|
final DataSet osmData = new DataSet();
|
||||||
mapWithAIData = new DataSet();
|
mapWithAIData = new DataSet();
|
||||||
way1 = TestUtils.newWay("highway=residential", new Node(new LatLon(0, 0)),
|
way1 = TestUtils.newWay("highway=residential", new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)));
|
||||||
new Node(new LatLon(0.1, 0.1)));
|
|
||||||
way2 = TestUtils.newWay("highway=residential", new Node(new LatLon(-0.1, -0.1)),
|
way2 = TestUtils.newWay("highway=residential", new Node(new LatLon(-0.1, -0.1)),
|
||||||
new Node(new LatLon(0.1, 0.1)));
|
new Node(new LatLon(0.1, 0.1)));
|
||||||
way1.getNodes().forEach(node -> mapWithAIData.addPrimitive(node));
|
way1.getNodes().forEach(node -> mapWithAIData.addPrimitive(node));
|
||||||
|
@ -45,8 +44,7 @@ public class MapWithAIMoveActionTest {
|
||||||
mapWithAIData.addPrimitive(way1);
|
mapWithAIData.addPrimitive(way1);
|
||||||
|
|
||||||
osmLayer = new OsmDataLayer(osmData, "osm", null);
|
osmLayer = new OsmDataLayer(osmData, "osm", null);
|
||||||
final MapWithAILayer mapWithAILayer = new MapWithAILayer(mapWithAIData, "MapWithAI",
|
final MapWithAILayer mapWithAILayer = new MapWithAILayer(mapWithAIData, "MapWithAI", null);
|
||||||
null);
|
|
||||||
MainApplication.getLayerManager().addLayer(osmLayer);
|
MainApplication.getLayerManager().addLayer(osmLayer);
|
||||||
MainApplication.getLayerManager().addLayer(mapWithAILayer);
|
MainApplication.getLayerManager().addLayer(mapWithAILayer);
|
||||||
MainApplication.getLayerManager().setActiveLayer(mapWithAILayer);
|
MainApplication.getLayerManager().setActiveLayer(mapWithAILayer);
|
||||||
|
|
|
@ -52,10 +52,8 @@ public class MapWithAIRemoteControlTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
wireMock.start();
|
wireMock.start();
|
||||||
MapWithAIPreferenceHelper.setMapWithAIURLs(MapWithAIPreferenceHelper.getMapWithAIURLs().stream()
|
MapWithAIPreferenceHelper.setMapWithAIURLs(MapWithAIPreferenceHelper.getMapWithAIURLs().stream().map(map -> {
|
||||||
.map(map -> {
|
map.put("url", map.getOrDefault("url", MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API)
|
||||||
map.put("url",
|
|
||||||
map.getOrDefault("url", MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API)
|
|
||||||
.replace("https://www.facebook.com", wireMock.baseUrl()));
|
.replace("https://www.facebook.com", wireMock.baseUrl()));
|
||||||
return map;
|
return map;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
|
@ -76,6 +74,7 @@ public class MapWithAIRemoteControlTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit test for bad request - invalid URL.
|
* Unit test for bad request - invalid URL.
|
||||||
|
*
|
||||||
* @throws Exception if any error occurs
|
* @throws Exception if any error occurs
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
@ -134,8 +133,7 @@ public class MapWithAIRemoteControlTest {
|
||||||
|
|
||||||
thrown.expect(RequestHandlerBadRequestException.class);
|
thrown.expect(RequestHandlerBadRequestException.class);
|
||||||
thrown.expectMessage("NumberFormatException (For input string: \"BAD_VALUE\")");
|
thrown.expectMessage("NumberFormatException (For input string: \"BAD_VALUE\")");
|
||||||
newHandler(
|
newHandler("http://127.0.0.1:8111/mapwithai?bbox=" + getTestBBox().toStringCSV(",") + "&max_obj=BAD_VALUE")
|
||||||
"http://127.0.0.1:8111/mapwithai?bbox=" + getTestBBox().toStringCSV(",") + "&max_obj=BAD_VALUE")
|
|
||||||
.handle();
|
.handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +145,8 @@ public class MapWithAIRemoteControlTest {
|
||||||
|
|
||||||
await().atMost(Durations.TEN_SECONDS)
|
await().atMost(Durations.TEN_SECONDS)
|
||||||
.until(() -> !MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().isEmpty());
|
.until(() -> !MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().isEmpty());
|
||||||
final BBox added = MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().iterator().next().toBBox();
|
final BBox added = MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().iterator().next()
|
||||||
|
.toBBox();
|
||||||
assertTrue(temp.bounds(added));
|
assertTrue(temp.bounds(added));
|
||||||
|
|
||||||
MainApplication.getLayerManager().removeLayer(MapWithAIDataUtils.getLayer(false));
|
MainApplication.getLayerManager().removeLayer(MapWithAIDataUtils.getLayer(false));
|
||||||
|
|
Ładowanie…
Reference in New Issue