Skip to content

Commit

Permalink
Spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Jun 17, 2024
1 parent b72c118 commit 1044cea
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary;

import java.util.stream.Stream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public class MapObjectLayerAction extends JosmAction {

public MapObjectLayerAction() {
super(
I18n.tr(ACTION_NAME), MapillaryPlugin.LOGO.setSize(ImageSizes.DEFAULT), I18n.tr(DESCRIPTION),
Shortcut.registerShortcut("mapillary:trafficSignLayer", ACTION_NAME, KeyEvent.CHAR_UNDEFINED, Shortcut.NONE),
I18n.tr(ACTION_NAME), MapillaryPlugin.LOGO.setSize(ImageSizes.DEFAULT), I18n.tr(DESCRIPTION), Shortcut
.registerShortcut("mapillary:trafficSignLayer", ACTION_NAME, KeyEvent.CHAR_UNDEFINED, Shortcut.NONE),
false, "mapillary:trafficSignLayer", true);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.actions;

import static org.openstreetmap.josm.tools.I18n.marktr;
import static org.openstreetmap.josm.tools.I18n.tr;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.layer.Layer;
Expand All @@ -11,12 +17,6 @@
import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
import org.openstreetmap.josm.tools.Shortcut;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import static org.openstreetmap.josm.tools.I18n.marktr;
import static org.openstreetmap.josm.tools.I18n.tr;

/**
* An action to create a layer for Mapillary point objects (not traffic signs)
*/
Expand All @@ -27,8 +27,8 @@ public class MapPointObjectLayerAction extends JosmAction {
"Displays the layer displaying the map point objects detected by Mapillary");

public MapPointObjectLayerAction() {
super(tr(ACTION_NAME), MapillaryPlugin.LOGO.setSize(ImageSizes.DEFAULT), tr(TOOLTIP),
Shortcut.registerShortcut("mapillary:pointFeaturesLayer", tr(ACTION_NAME), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE),
super(tr(ACTION_NAME), MapillaryPlugin.LOGO.setSize(ImageSizes.DEFAULT), tr(TOOLTIP), Shortcut
.registerShortcut("mapillary:pointFeaturesLayer", tr(ACTION_NAME), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE),
false, "mapillary:pointFeaturesLayer", true);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.command;

import static org.openstreetmap.josm.tools.I18n.tr;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.command;

import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.data.mapillary;

import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.data.mapillary;

import org.openstreetmap.josm.data.osm.event.IDataSelectionListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public final class MapillaryFilterDialog extends ToggleDialog
private static final String[] TIME_LIST = { tr("Years"), tr("Months"), tr("Days") };

private static final long[] TIME_FACTOR = new long[] { 31_536_000_000L, // = 365 * 24 * 60 * 60 * 1000 = number of
// ms in a year
// ms in a year
2_592_000_000L, // = 30 * 24 * 60 * 60 * 1000 = number of ms in a month
86_400_000 // = 24 * 60 * 60 * 1000 = number of ms in a day
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.gui.layer;

import java.awt.Color;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.gui.widget;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.io.download;

import org.openstreetmap.gui.jmapviewer.Tile;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.io.download;

import org.openstreetmap.gui.jmapviewer.Tile;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.spi.preferences;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.utils;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.utils;

import org.openstreetmap.josm.plugins.mapillary.cache.Caches;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.command;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.data.mapillary;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.gui.imageinfo;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class MapillaryDownloader implements AfterEachCallback {
@Override
public void afterEach(ExtensionContext context) {
AtomicBoolean done = new AtomicBoolean();
new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillaryNodesDownloader(nodes -> done.set(true), 1).execute();
new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillaryNodesDownloader(nodes -> done.set(true),
1).execute();
Awaitility.await().atMost(Durations.FIVE_SECONDS).untilTrue(done);
done.set(false);
new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillarySequenceDownloader("", chunks -> done.set(true)).execute();
new org.openstreetmap.josm.plugins.mapillary.gui.workers.MapillarySequenceDownloader("",
chunks -> done.set(true)).execute();
Awaitility.await().atMost(Durations.FIVE_SECONDS).untilTrue(done);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.testutils.annotations;

import static org.junit.jupiter.api.Assertions.fail;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.testutils.annotations;

import java.lang.annotation.Documented;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@

import javax.imageio.ImageIO;

import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.platform.commons.support.AnnotationSupport;
import org.openstreetmap.josm.TestUtils;
import org.openstreetmap.josm.plugins.mapillary.spi.preferences.IMapillaryUrls;
import org.openstreetmap.josm.plugins.mapillary.spi.preferences.MapillaryConfig;
import org.openstreetmap.josm.plugins.mapillary.spi.preferences.MapillaryUrls;
import org.openstreetmap.josm.tools.Utils;

import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.common.TextFile;
Expand All @@ -64,6 +52,17 @@
import jakarta.json.JsonReader;
import jakarta.json.JsonString;
import jakarta.json.JsonValue;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.platform.commons.support.AnnotationSupport;
import org.openstreetmap.josm.TestUtils;
import org.openstreetmap.josm.plugins.mapillary.spi.preferences.IMapillaryUrls;
import org.openstreetmap.josm.plugins.mapillary.spi.preferences.MapillaryConfig;
import org.openstreetmap.josm.plugins.mapillary.spi.preferences.MapillaryUrls;
import org.openstreetmap.josm.tools.Utils;

/**
* Mock Mapillary API calls
Expand Down Expand Up @@ -226,13 +225,10 @@ public Response transform(Response response, ServeEvent serveEvent) {
if (request.queryParameter("image_ids").isPresent()) {
// Not implemented currently since I don't know if I need to split on `,` or `%2C`
final List<String> imageIds = request.queryParameter("image_ids").values().stream()
.map(str -> str.split(",", -1)).flatMap(Stream::of).filter(Objects::nonNull)
.toList();
final List<TextFile> imageText = imageIds.stream()
.map(image -> Path.of(TestUtils.getTestDataRoot(), "__files", "api", "v4", "responses", "graph", image + ".json"))
.map(Path::toUri)
.map(TextFile::new)
.toList();
.map(str -> str.split(",", -1)).flatMap(Stream::of).filter(Objects::nonNull).toList();
final List<TextFile> imageText = imageIds.stream().map(image -> Path.of(TestUtils.getTestDataRoot(),
"__files", "api", "v4", "responses", "graph", image + ".json")).map(Path::toUri)
.map(TextFile::new).toList();
// We need to get the actual bytes prior to returning, so we need to read the files.
final String body = imageText.stream().map(TextFile::readContentsAsString)
.collect(Collectors.joining(",", "{\"data\":[", "]}"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.testutils.annotations;

import java.security.Permission;
Expand Down

0 comments on commit 1044cea

Please sign in to comment.