Formatting fixes

Signed-off-by: Taylor Smock <taylor.smock@kaart.com>
pull/1/head
Taylor Smock 2019-12-11 16:33:33 -07:00
rodzic 3a7e383700
commit a14502d1d2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
29 zmienionych plików z 90 dodań i 94 usunięć

Wyświetl plik

@ -146,7 +146,7 @@ public final class MapWithAIPlugin extends Plugin implements Destroyable {
}
MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).stream()
.forEach(layer -> MainApplication.getLayerManager().removeLayer(layer));
.forEach(layer -> MainApplication.getLayerManager().removeLayer(layer));
if (!Config.getPref().getBoolean(PAINTSTYLE_PREEXISTS)) {
MapWithAIDataUtils.removeMapWithAIPaintStyles();

Wyświetl plik

@ -52,7 +52,7 @@ public class ReplacementPreferenceTable extends PreferencesTable {
return askAddSetting(gui, p)
? new PrefEntry(tkey.getText(), new StringSetting(tValue.getText()), new StringSetting(null), false)
: null;
: null;
}
private static boolean askAddSetting(JComponent gui, JPanel p) {

Wyświetl plik

@ -30,8 +30,7 @@ public final class UpdateProd {
public static boolean doProd(int nextMinVersion) {
if (nextMinVersion > Version.getInstance().getVersion()) {
int doUpdate = ConditionalOptionPaneUtil.showOptionDialog(
MapWithAIPlugin.NAME.concat(".ignore_next_version"),
MainApplication.getMainFrame(),
MapWithAIPlugin.NAME.concat(".ignore_next_version"), MainApplication.getMainFrame(),
tr("Please update JOSM -- {0} {1} is the last {0} version to support JOSM {2}",
MapWithAIPlugin.NAME, MapWithAIPlugin.getVersionInfo(),
Integer.toString(Version.getInstance().getVersion())),

Wyświetl plik

@ -34,11 +34,9 @@ public class BoundingBoxMapWithAIDownloader extends BoundingBoxDownloader {
@Override
protected DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException {
DataSet ds = OsmReaderCustom.parseDataSet(source, progressMonitor, true);
GetDataRunnable.addMapWithAISourceTag(ds,
MapWithAIPreferenceHelper.getMapWithAIUrl().stream()
.filter(map -> map.getOrDefault("url", "no-url").equals(url))
.map(map -> map.getOrDefault("source", MapWithAIPlugin.NAME)).findFirst()
.orElse(MapWithAIPlugin.NAME));
GetDataRunnable.addMapWithAISourceTag(ds, MapWithAIPreferenceHelper.getMapWithAIUrl().stream()
.filter(map -> map.getOrDefault("url", "no-url").equals(url))
.map(map -> map.getOrDefault("source", MapWithAIPlugin.NAME)).findFirst().orElse(MapWithAIPlugin.NAME));
GetDataRunnable.cleanup(ds, downloadArea);
return ds;
}

Wyświetl plik

@ -75,8 +75,8 @@ public final class MapWithAIAvailability {
cachedRapidReleases.setMaxAge(604_800);
parser.next();
final Stream<Entry<String, JsonValue>> entries = parser.getObjectStream();
final Optional<Entry<String, JsonValue>> objects = entries
.filter(entry -> "objects".equals(entry.getKey())).findFirst();
final Optional<Entry<String, JsonValue>> objects = entries.filter(entry -> "objects".equals(entry.getKey()))
.findFirst();
if (objects.isPresent()) {
final JsonObject value = objects.get().getValue().asJsonObject();
if (value != null) {
@ -120,8 +120,7 @@ public final class MapWithAIAvailability {
.orElse(Optional.ofNullable(countryLoop.get("ISO3166-2")).orElse(""));
if ("".equals(key)) {
Logging.error("{0}: {1} does not have a \"ISO3166-1:alpha2\" or \"ISO3166-2\" key. {2}",
MapWithAIPlugin.NAME,
countryLoop, countryLoop.getInterestingTags());
MapWithAIPlugin.NAME, countryLoop, countryLoop.getInterestingTags());
} else {
Logging.trace("{0}: {1} has a country code of {2}", MapWithAIPlugin.NAME,
countryLoop.get("name:en"), key);

Wyświetl plik

@ -69,7 +69,7 @@ public final class MapWithAIDataUtils {
"https://gitlab.com/smocktaylor/rapid/raw/master/src/resources/styles/standard/rapid.mapcss",
"resource://styles/standard/mapwithai.mapcss");
new ArrayList<>(MapPaintStyles.getStyles().getStyleSources()).parallelStream()
.filter(style -> oldUrls.contains(style.url)).forEach(MapPaintStyles::removeStyle);
.filter(style -> oldUrls.contains(style.url)).forEach(MapPaintStyles::removeStyle);
if (!checkIfMapWithAIPaintStyleExists()) {
final MapCSSStyleSource style = new MapCSSStyleSource(paintStyleResourceUrl, MapWithAIPlugin.NAME,
@ -91,8 +91,8 @@ public final class MapWithAIDataUtils {
*/
public static void removeMapWithAIPaintStyles() {
new ArrayList<>(MapPaintStyles.getStyles().getStyleSources()).parallelStream()
.filter(source -> paintStyleResourceUrl.equals(source.url))
.forEach(style -> SwingUtilities.invokeLater(() -> MapPaintStyles.removeStyle(style)));
.filter(source -> paintStyleResourceUrl.equals(source.url))
.forEach(style -> SwingUtilities.invokeLater(() -> MapPaintStyles.removeStyle(style)));
}
/**
@ -172,15 +172,15 @@ public final class MapWithAIDataUtils {
} else {
final Notification noUrls = MapWithAIPreferenceHelper.getMapWithAIURLs().isEmpty()
? new Notification(tr("There are no defined URLs. To get the defaults, restart JOSM"))
: new Notification(tr("No URLS are enabled"));
noUrls.setDuration(Notification.TIME_DEFAULT);
noUrls.setIcon(JOptionPane.INFORMATION_MESSAGE);
noUrls.setHelpTopic(ht("Plugin/MapWithAI#Preferences"));
if (SwingUtilities.isEventDispatchThread()) {
noUrls.show();
} else {
SwingUtilities.invokeLater(noUrls::show);
}
: new Notification(tr("No URLS are enabled"));
noUrls.setDuration(Notification.TIME_DEFAULT);
noUrls.setIcon(JOptionPane.INFORMATION_MESSAGE);
noUrls.setHelpTopic(ht("Plugin/MapWithAI#Preferences"));
if (SwingUtilities.isEventDispatchThread()) {
noUrls.show();
} else {
SwingUtilities.invokeLater(noUrls::show);
}
}
return dataSet;
}

Wyświetl plik

@ -55,7 +55,7 @@ public final class MapWithAIPreferenceHelper {
return (layer != null) && (layer.getMapWithAIUrl() != null)
? getMapWithAIURLs().parallelStream().filter(map -> layer.getMapWithAIUrl().equals(map.get(URL_STRING)))
.collect(Collectors.toList())
: getMapWithAIURLs().stream()
: getMapWithAIURLs().stream()
.filter(map -> Boolean.valueOf(map.getOrDefault(ENABLED_STRING, Boolean.FALSE.toString())))
.collect(Collectors.toList());
}

Wyświetl plik

@ -87,8 +87,9 @@ public class MapWithAIRemoteControl extends RequestHandler.RawURLParseRequestHan
@Override
protected void handleRequest() throws RequestHandlerErrorException, RequestHandlerBadRequestException {
if (crop != null && crop.isInWorld()) {
MainApplication.getLayerManager().addLayer(new GpxLayer(
DetectTaskingManagerUtils.createTaskingManagerGpxData(crop), DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
MainApplication.getLayerManager()
.addLayer(new GpxLayer(DetectTaskingManagerUtils.createTaskingManagerGpxData(crop),
DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
}
final MapWithAILayer layer = MapWithAIDataUtils.getLayer(true);
@ -120,7 +121,7 @@ public class MapWithAIRemoteControl extends RequestHandler.RawURLParseRequestHan
final String br = "<br />";
final StringBuilder sb = new StringBuilder();
sb.append(tr("Remote Control has been asked to load data from the API.")).append(" (").append(url).append(')')
.append(br).append(tr("{0} will ", MapWithAIPlugin.NAME));
.append(br).append(tr("{0} will ", MapWithAIPlugin.NAME));
if (Boolean.FALSE.equals(switchLayer)) {
sb.append(tr("not "));
}
@ -162,6 +163,6 @@ public class MapWithAIRemoteControl extends RequestHandler.RawURLParseRequestHan
"/mapwithai?url=https://www.facebook.com/maps/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&bbox={bbox}",
"/mapwithai?bbox=-108.4625421,39.0621223,-108.4594728,39.0633059&max_obj=1",
"/mapwithai?bbox=-108.4625421,39.0621223,-108.4594728,39.0633059&switch_layer=false",
"/mapwithai?crop_bbox=-108.4625421,39.0621223,-108.4594728,39.0633059" };
"/mapwithai?crop_bbox=-108.4625421,39.0621223,-108.4594728,39.0633059" };
}
}

Wyświetl plik

@ -38,11 +38,10 @@ public class MapWithAIUploadHook implements UploadHook, Destroyable {
if (MapWithAIPreferenceHelper.getMapWithAIUrl().parallelStream().anyMatch(
map -> !MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API.equalsIgnoreCase(map.get("url")))) {
sb.append(";url=")
.append(String.join(";url=",
MapWithAIPreferenceHelper.getMapWithAIUrl().parallelStream()
.filter(map -> map.containsKey("url")).map(map -> map.get("url"))
.filter(url -> !MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API.equalsIgnoreCase(url))
.collect(Collectors.toList())));
.append(String.join(";url=", MapWithAIPreferenceHelper.getMapWithAIUrl().parallelStream()
.filter(map -> map.containsKey("url")).map(map -> map.get("url"))
.filter(url -> !MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API.equalsIgnoreCase(url))
.collect(Collectors.toList())));
}
tags.put("mapwithai:options", sb.toString());
}

Wyświetl plik

@ -14,11 +14,12 @@ import org.openstreetmap.josm.io.OsmReader;
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.
* The XMLStreamReader cursor points to the start of the element, when the method is
* entered, and it must point to the end of the same element, when it is exited.
* For each xml element, there is a dedicated method. The XMLStreamReader cursor
* points to the start of the element, when the method is entered, and it must
* point to the end of the same element, when it is exited.
*/
public class OsmReaderCustom extends OsmReader {
protected OsmReaderCustom(boolean convertUnknownToTags) {
@ -50,18 +51,20 @@ public class OsmReaderCustom extends OsmReader {
/**
* Parse the given input source and return the dataset.
*
* @param source the source input stream. Must not be null.
* @param progressMonitor the progress monitor. If null, {@link NullProgressMonitor#INSTANCE} is assumed
* @param convertUnknownToTags true if unknown xml attributes should be kept as tags
* @param source the source input stream. Must not be null.
* @param progressMonitor the progress monitor. If null,
* {@link NullProgressMonitor#INSTANCE} is assumed
* @param convertUnknownToTags true if unknown xml attributes should be kept as
* tags
*
* @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
* @since xxx
*/
public static DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor,
boolean convertUnknownToTags)
throws IllegalDataException {
boolean convertUnknownToTags) throws IllegalDataException {
return new OsmReaderCustom(convertUnknownToTags).doParseDataSet(source, progressMonitor);
}
}

Wyświetl plik

@ -27,6 +27,7 @@ import org.openstreetmap.josm.tools.Pair;
public abstract class AbstractConflationCommand extends Command {
Collection<OsmPrimitive> possiblyAffectedPrimitives;
public AbstractConflationCommand(DataSet data) {
super(data);
}

Wyświetl plik

@ -87,7 +87,7 @@ public class ConnectedCommand extends AbstractConflationCommand {
public Command getRealCommand() {
final List<Command> commands = new ArrayList<>();
possiblyAffectedPrimitives.stream().filter(Node.class::isInstance).map(Node.class::cast)
.forEach(node -> commands.addAll(connectedCommand(getAffectedDataSet(), node)));
.forEach(node -> commands.addAll(connectedCommand(getAffectedDataSet(), node)));
Command returnCommand = null;
if (!commands.isEmpty()) {
returnCommand = new SequenceCommand(getDescriptionText(), commands);

Wyświetl plik

@ -47,12 +47,12 @@ public class MergeAddressBuildings extends AbstractConflationCommand {
List<Command> commands = new ArrayList<>();
if (MapWithAIPreferenceHelper.isMergeBuildingAddress()) {
possiblyAffectedPrimitives.stream().filter(Way.class::isInstance).map(Way.class::cast)
.filter(way -> way.hasKey(BUILDING_KEY)).filter(Way::isClosed)
.forEach(way -> commands.addAll(mergeAddressBuilding(getAffectedDataSet(), way)));
.filter(way -> way.hasKey(BUILDING_KEY)).filter(Way::isClosed)
.forEach(way -> commands.addAll(mergeAddressBuilding(getAffectedDataSet(), way)));
possiblyAffectedPrimitives.stream().filter(Relation.class::isInstance).map(Relation.class::cast)
.filter(rel -> rel.hasKey(BUILDING_KEY)).filter(Relation::isMultipolygon)
.forEach(rel -> commands.addAll(mergeAddressBuilding(getAffectedDataSet(), rel)));
.filter(rel -> rel.hasKey(BUILDING_KEY)).filter(Relation::isMultipolygon)
.forEach(rel -> commands.addAll(mergeAddressBuilding(getAffectedDataSet(), rel)));
}
Command returnCommand = null;

Wyświetl plik

@ -81,7 +81,7 @@ public class CreateConnectionsCommand extends Command {
}
final Collection<OsmPrimitive> tPrimitives = new TreeSet<>();
abstractCommand.getInterestedTypes()
.forEach(clazz -> tPrimitives.addAll(Utils.filteredCollection(realPrimitives, clazz)));
.forEach(clazz -> tPrimitives.addAll(Utils.filteredCollection(realPrimitives, clazz)));
final Command actualCommand = abstractCommand.getCommand(tPrimitives.stream()
.filter(prim -> prim.hasKey(abstractCommand.getKey())).collect(Collectors.toList()));

Wyświetl plik

@ -41,7 +41,8 @@ public class MapWithAIAddCommand extends Command implements Runnable {
* @param editLayer The OSM layer
* @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);
lock = mapWithAILayer.getLock();
}
@ -76,8 +77,8 @@ public class MapWithAIAddCommand extends Command implements Runnable {
@Override
public void run() {
if (mapWithAI.equals(editable)) {
Logging.error("{0}: DataSet mapWithAI ({1}) should not be the same as DataSet editable ({2})", MapWithAIPlugin.NAME,
mapWithAI, editable);
Logging.error("{0}: DataSet mapWithAI ({1}) should not be the same as DataSet editable ({2})",
MapWithAIPlugin.NAME, mapWithAI, editable);
throw new IllegalArgumentException();
}
synchronized (this) {
@ -91,7 +92,8 @@ public class MapWithAIAddCommand extends Command implements Runnable {
final Command movePrimitivesCommand = new MovePrimitiveDataSetCommand(editable, mapWithAI,
primitives);
final Command createConnectionsCommand = createConnections(editable, allPrimitives);
command = new SequenceCommand(getDescriptionText(), movePrimitivesCommand, createConnectionsCommand);
command = new SequenceCommand(getDescriptionText(), movePrimitivesCommand,
createConnectionsCommand);
}
command.executeCommand();
} finally {

Wyświetl plik

@ -113,7 +113,7 @@ public class MergeDuplicateWays extends Command {
public static void filterDataSet(DataSet dataSet, List<Command> commands, Bounds bound) {
final List<Way> ways = new ArrayList<>(
(bound == null ? dataSet.getWays() : dataSet.searchWays(bound.toBBox())).parallelStream()
.filter(prim -> !prim.isIncomplete() && !prim.isDeleted()).collect(Collectors.toList()));
.filter(prim -> !prim.isIncomplete() && !prim.isDeleted()).collect(Collectors.toList()));
for (int i = 0; i < ways.size(); i++) {
final Way way1 = ways.get(i);
final Collection<Way> nearbyWays = dataSet.searchWays(way1.getBBox()).parallelStream()

Wyświetl plik

@ -41,7 +41,6 @@ import org.openstreetmap.josm.tools.ImageProvider;
public class MapWithAIDownloadReader implements DownloadSource<MapWithAIDownloadReader.MapWithAIDownloadData> {
@Override
public AbstractDownloadSourcePanel<MapWithAIDownloadData> createPanel(DownloadDialog dialog) {
return new MapWithAIDownloadPanel(this);
@ -65,8 +64,7 @@ public class MapWithAIDownloadReader implements DownloadSource<MapWithAIDownload
sb.append(urlInformation.get("url"));
if (urlInformation.containsKey("parameters")) {
List<String> parameters = DataUrl.readJsonStringArraySimple(urlInformation.get("parameters"))
.parallelStream()
.filter(JsonObject.class::isInstance).map(JsonObject.class::cast)
.parallelStream().filter(JsonObject.class::isInstance).map(JsonObject.class::cast)
.filter(map -> map.getBoolean("enabled", false)).filter(map -> map.containsKey("parameter"))
.map(map -> map.getString("parameter")).collect(Collectors.toList());
if (!parameters.isEmpty()) {

Wyświetl plik

@ -88,10 +88,10 @@ public class MapWithAIPluginTest {
plugin.destroy();
Assert.assertEquals(dataMenuSize, dataMenu.getMenuComponentCount());
Awaitility.await().atMost(Durations.FIVE_SECONDS)
.until(() -> existed == MapWithAIDataUtils.checkIfMapWithAIPaintStyleExists());
.until(() -> existed == MapWithAIDataUtils.checkIfMapWithAIPaintStyleExists());
Assert.assertEquals(Config.getPref().getBoolean(MapWithAIPlugin.PAINTSTYLE_PREEXISTS) ? 1 : 0,
MapPaintStyles.getStyles().getStyleSources().parallelStream()
.filter(source -> source.url != null && source.name.contains("MapWithAI")).count());
.filter(source -> source.url != null && source.name.contains("MapWithAI")).count());
}
for (int i = 0; i < 3; i++) {

Wyświetl plik

@ -29,11 +29,9 @@ public class UpdateProdTest {
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";
Config.getPref().putBoolean(booleanKey, false);
Config.getPref().putInt(intKey,
JOptionPane.YES_OPTION);
Config.getPref().putInt(intKey, JOptionPane.YES_OPTION);
assertTrue(UpdateProd.doProd(Integer.MAX_VALUE));
Config.getPref().putInt(intKey,
JOptionPane.NO_OPTION);
Config.getPref().putInt(intKey, JOptionPane.NO_OPTION);
assertTrue(UpdateProd.doProd(Integer.MAX_VALUE));
assertFalse(UpdateProd.doProd(0));
}

Wyświetl plik

@ -65,8 +65,9 @@ public class DetectTaskingManagerUtilsTest {
Assert.assertFalse(DetectTaskingManagerUtils.hasTaskingManagerLayer());
final BBox bbox = new BBox(0, 0, 1, 1);
MainApplication.getLayerManager().addLayer(new GpxLayer(DetectTaskingManagerUtils.createTaskingManagerGpxData(bbox),
DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
MainApplication.getLayerManager()
.addLayer(new GpxLayer(DetectTaskingManagerUtils.createTaskingManagerGpxData(bbox),
DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
Assert.assertTrue(DetectTaskingManagerUtils.hasTaskingManagerLayer());
Assert.assertTrue(DetectTaskingManagerUtils.getTaskingManagerBBox().bounds(bbox));

Wyświetl plik

@ -115,8 +115,8 @@ public class GetDataRunnableTest {
@Test
public void testRegressionTicket46() {
DataSet ds = new DataSet();
new GetDataRunnable(Arrays.asList(new BBox(-5.7400005, 34.4524384, -5.6686014, 34.5513153)), ds,
null).fork().join();
new GetDataRunnable(Arrays.asList(new BBox(-5.7400005, 34.4524384, -5.6686014, 34.5513153)), ds, null).fork()
.join();
assertNotNull(ds);
assertFalse(ds.isEmpty());
assertFalse(ds.allNonDeletedPrimitives().isEmpty());

Wyświetl plik

@ -53,7 +53,7 @@ public class MapWithAIActionTest {
MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "temporary", null));
action.actionPerformed(null);
Awaitility.await().atMost(Durations.TEN_SECONDS)
.until(() -> 1 == MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).size());
.until(() -> 1 == MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).size());
assertEquals(1, MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).size());
assertSame(MapWithAIDataUtils.getLayer(false), MainApplication.getLayerManager().getActiveLayer());

Wyświetl plik

@ -31,8 +31,8 @@ public class MapWithAIAvailabilityTest {
@Before
public void setUp() {
wireMock.start();
MapWithAIAvailability.setReleaseUrl(wireMock.baseUrl()
+ "/facebookmicrosites/Open-Mapping-At-Facebook/master/data/rapid_releases.geojson");
MapWithAIAvailability.setReleaseUrl(
wireMock.baseUrl() + "/facebookmicrosites/Open-Mapping-At-Facebook/master/data/rapid_releases.geojson");
Territories.initialize();
instance = MapWithAIAvailability.getInstance();
LatLon temp = new LatLon(40, -100);

Wyświetl plik

@ -35,8 +35,7 @@ public class MapWithAIMoveActionTest {
moveAction = new MapWithAIMoveAction();
final DataSet osmData = new DataSet();
mapWithAIData = new DataSet();
way1 = TestUtils.newWay("highway=residential", new Node(new LatLon(0, 0)),
new Node(new LatLon(0.1, 0.1)));
way1 = TestUtils.newWay("highway=residential", new Node(new LatLon(0, 0)), 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)));
way1.getNodes().forEach(node -> mapWithAIData.addPrimitive(node));
@ -45,8 +44,7 @@ public class MapWithAIMoveActionTest {
mapWithAIData.addPrimitive(way1);
osmLayer = new OsmDataLayer(osmData, "osm", null);
final MapWithAILayer mapWithAILayer = new MapWithAILayer(mapWithAIData, "MapWithAI",
null);
final MapWithAILayer mapWithAILayer = new MapWithAILayer(mapWithAIData, "MapWithAI", null);
MainApplication.getLayerManager().addLayer(osmLayer);
MainApplication.getLayerManager().addLayer(mapWithAILayer);
MainApplication.getLayerManager().setActiveLayer(mapWithAILayer);

Wyświetl plik

@ -52,13 +52,11 @@ public class MapWithAIRemoteControlTest {
@Before
public void setUp() {
wireMock.start();
MapWithAIPreferenceHelper.setMapWithAIURLs(MapWithAIPreferenceHelper.getMapWithAIURLs().stream()
.map(map -> {
map.put("url",
map.getOrDefault("url", MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API)
.replace("https://www.facebook.com", wireMock.baseUrl()));
return map;
}).collect(Collectors.toList()));
MapWithAIPreferenceHelper.setMapWithAIURLs(MapWithAIPreferenceHelper.getMapWithAIURLs().stream().map(map -> {
map.put("url", map.getOrDefault("url", MapWithAIPreferenceHelper.DEFAULT_MAPWITHAI_API)
.replace("https://www.facebook.com", wireMock.baseUrl()));
return map;
}).collect(Collectors.toList()));
}
@After
@ -76,6 +74,7 @@ public class MapWithAIRemoteControlTest {
/**
* Unit test for bad request - invalid URL.
*
* @throws Exception if any error occurs
*/
@Test
@ -134,9 +133,8 @@ public class MapWithAIRemoteControlTest {
thrown.expect(RequestHandlerBadRequestException.class);
thrown.expectMessage("NumberFormatException (For input string: \"BAD_VALUE\")");
newHandler(
"http://127.0.0.1:8111/mapwithai?bbox=" + getTestBBox().toStringCSV(",") + "&max_obj=BAD_VALUE")
.handle();
newHandler("http://127.0.0.1:8111/mapwithai?bbox=" + getTestBBox().toStringCSV(",") + "&max_obj=BAD_VALUE")
.handle();
}
@Test
@ -146,8 +144,9 @@ public class MapWithAIRemoteControlTest {
assertFalse(MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
await().atMost(Durations.TEN_SECONDS)
.until(() -> !MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().isEmpty());
final BBox added = MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().iterator().next().toBBox();
.until(() -> !MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().isEmpty());
final BBox added = MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().iterator().next()
.toBBox();
assertTrue(temp.bounds(added));
MainApplication.getLayerManager().removeLayer(MapWithAIDataUtils.getLayer(false));

Wyświetl plik

@ -104,8 +104,8 @@ public class MapWithAIUploadHookTest {
BBox tBBox = new BBox(1, 0, 0, 1);
MainApplication.getLayerManager()
.addLayer(new GpxLayer(DetectTaskingManagerUtils.createTaskingManagerGpxData(tBBox),
DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
.addLayer(new GpxLayer(DetectTaskingManagerUtils.createTaskingManagerGpxData(tBBox),
DetectTaskingManagerUtils.MAPWITHAI_CROP_AREA));
tags.clear();
hook.modifyChangesetTags(tags);

Wyświetl plik

@ -102,8 +102,8 @@ public class MapWithAIAddComandTest {
new Node(new LatLon(0.05, 0.2)));
way2.firstNode().put("conn",
"w".concat(Long.toString(way1.getUniqueId())).concat(",n")
.concat(Long.toString(way1.firstNode().getUniqueId())).concat(",n")
.concat(Long.toString(way1.lastNode().getUniqueId())));
.concat(Long.toString(way1.firstNode().getUniqueId())).concat(",n")
.concat(Long.toString(way1.lastNode().getUniqueId())));
way1.getNodes().forEach(node -> ds1.addPrimitive(node));
way2.getNodes().forEach(node -> ds1.addPrimitive(node));
ds1.addPrimitive(way2);

Wyświetl plik

@ -59,7 +59,7 @@ public class MergeAddressBuildingsTest {
Node address = TestUtils.newNode("addr:street=None addr:housenumber=2");
building.getNodes().forEach(ds::addPrimitive);
MainApplication.getLayerManager()
.addLayer(new OsmDataLayer(ds, "required for ReplaceGeometry in utilsplugin2", null));
.addLayer(new OsmDataLayer(ds, "required for ReplaceGeometry in utilsplugin2", null));
ds.addPrimitive(building);
ds.addPrimitive(address);

Wyświetl plik

@ -79,7 +79,7 @@ public class MapWithAIDownloadReaderTest {
Awaitility.await().atMost(Durations.TEN_SECONDS).until(() -> MapWithAIDataUtils.getLayer(false) != null);
assertNotNull(MapWithAIDataUtils.getLayer(false));
Awaitility.await().atMost(Durations.TEN_SECONDS)
.until(() -> !MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().isEmpty());
.until(() -> !MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().isEmpty());
assertFalse(MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().isEmpty());
assertTrue(settings.getDownloadBounds().get().toBBox().bboxIsFunctionallyEqual(
MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().get(0).toBBox(), 0.0001));