kopia lustrzana https://github.com/JOSM/MapWithAI
Use JOSM territories annotation
Signed-off-by: Taylor Smock <tsmock@meta.com>pull/34/head
rodzic
ada0741bc7
commit
a2372c6e49
|
@ -15,10 +15,10 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType;
|
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.spi.preferences.MapWithAIConfig;
|
import org.openstreetmap.josm.plugins.mapwithai.spi.preferences.MapWithAIConfig;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration test for {@link MapWithAISourceReader}
|
* Integration test for {@link MapWithAISourceReader}
|
||||||
|
|
|
@ -19,10 +19,10 @@ import org.openstreetmap.josm.gui.MainApplication;
|
||||||
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for {@link DownloadListener}
|
* Test class for {@link DownloadListener}
|
||||||
|
|
|
@ -18,11 +18,11 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInf
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@ import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
import org.openstreetmap.josm.tools.Geometry;
|
import org.openstreetmap.josm.tools.Geometry;
|
||||||
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.openstreetmap.josm.tools.Territories;
|
||||||
@MapWithAISources
|
@MapWithAISources
|
||||||
@NoExceptions
|
@NoExceptions
|
||||||
@Projection
|
@Projection
|
||||||
@org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories
|
@org.openstreetmap.josm.testutils.annotations.Territories
|
||||||
@Timeout(10)
|
@Timeout(10)
|
||||||
class MapWithAIActionTest {
|
class MapWithAIActionTest {
|
||||||
private MapWithAIAction action;
|
private MapWithAIAction action;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.openstreetmap.josm.tools.Territories;
|
||||||
*/
|
*/
|
||||||
@MapWithAISources
|
@MapWithAISources
|
||||||
@Projection
|
@Projection
|
||||||
@org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories
|
@org.openstreetmap.josm.testutils.annotations.Territories
|
||||||
@Wiremock
|
@Wiremock
|
||||||
class MapWithAIAvailabilityTest {
|
class MapWithAIAvailabilityTest {
|
||||||
private DataAvailability instance;
|
private DataAvailability instance;
|
||||||
|
|
|
@ -34,12 +34,12 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Main;
|
import org.openstreetmap.josm.testutils.annotations.Main;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
import org.openstreetmap.josm.tools.Logging;
|
import org.openstreetmap.josm.tools.Logging;
|
||||||
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
|
|
@ -48,7 +48,6 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.tools.MapPaintUtils;
|
import org.openstreetmap.josm.plugins.mapwithai.tools.MapPaintUtils;
|
||||||
import org.openstreetmap.josm.spi.preferences.Config;
|
import org.openstreetmap.josm.spi.preferences.Config;
|
||||||
|
@ -56,6 +55,7 @@ import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Main;
|
import org.openstreetmap.josm.testutils.annotations.Main;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,13 @@ import org.openstreetmap.josm.plugins.mapwithai.commands.DuplicateCommand;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MissingConnectionTagsMocker;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.MissingConnectionTagsMocker;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.LoggingHandler;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.LoggingHandler;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.spi.preferences.Config;
|
import org.openstreetmap.josm.spi.preferences.Config;
|
||||||
import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
|
import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Main;
|
import org.openstreetmap.josm.testutils.annotations.Main;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
import org.openstreetmap.josm.testutils.mockers.WindowMocker;
|
import org.openstreetmap.josm.testutils.mockers.WindowMocker;
|
||||||
import org.openstreetmap.josm.tools.Logging;
|
import org.openstreetmap.josm.tools.Logging;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ import mockit.MockUp;
|
||||||
@BasicPreferences
|
@BasicPreferences
|
||||||
@Main
|
@Main
|
||||||
@Projection
|
@Projection
|
||||||
@org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories(Territories.Initialize.ALL)
|
@Territories(Territories.Initialize.ALL)
|
||||||
@Wiremock
|
@Wiremock
|
||||||
class MapWithAIMoveActionTest {
|
class MapWithAIMoveActionTest {
|
||||||
private MapWithAIMoveAction moveAction;
|
private MapWithAIMoveAction moveAction;
|
||||||
|
|
|
@ -20,11 +20,11 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo;
|
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Main;
|
import org.openstreetmap.josm.testutils.annotations.Main;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
import org.openstreetmap.josm.testutils.annotations.ThreadSync;
|
import org.openstreetmap.josm.testutils.annotations.ThreadSync;
|
||||||
import org.openstreetmap.josm.tools.Utils;
|
import org.openstreetmap.josm.tools.Utils;
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,11 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo;
|
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Main;
|
import org.openstreetmap.josm.testutils.annotations.Main;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for {@link MapWithAIUploadHook}
|
* Test class for {@link MapWithAIUploadHook}
|
||||||
|
|
|
@ -21,11 +21,11 @@ import org.openstreetmap.josm.gui.MainApplication;
|
||||||
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.actions.AddMapWithAILayerAction;
|
import org.openstreetmap.josm.plugins.mapwithai.actions.AddMapWithAILayerAction;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Main;
|
import org.openstreetmap.josm.testutils.annotations.Main;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
import org.openstreetmap.josm.tools.Logging;
|
import org.openstreetmap.josm.tools.Logging;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,10 +13,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.openstreetmap.josm.data.Bounds;
|
import org.openstreetmap.josm.data.Bounds;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAIDataUtilsTest;
|
import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAIDataUtilsTest;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
|
|
||||||
@BasicPreferences
|
@BasicPreferences
|
||||||
@Projection
|
@Projection
|
||||||
|
|
|
@ -14,10 +14,10 @@ import org.openstreetmap.josm.gui.widgets.JosmTextArea;
|
||||||
import org.openstreetmap.josm.gui.widgets.JosmTextField;
|
import org.openstreetmap.josm.gui.widgets.JosmTextField;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||||
import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
|
import org.openstreetmap.josm.testutils.annotations.AssertionsInEDT;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
import org.openstreetmap.josm.testutils.mockers.WindowMocker;
|
import org.openstreetmap.josm.testutils.mockers.WindowMocker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,9 +14,9 @@ import java.util.List;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Territories;
|
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.lang.annotation.Target;
|
||||||
|
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo;
|
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An annotation to use {@link MapWithAILayerInfo}
|
* An annotation to use {@link MapWithAILayerInfo}
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
// License: GPL. For details, see LICENSE file.
|
|
||||||
package org.openstreetmap.josm.plugins.mapwithai.testutils.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.extension.AfterAllCallback;
|
|
||||||
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.JOSMTestRules;
|
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
|
||||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use boundaries dataset in this test. FIXME: Use the JOSM version
|
|
||||||
*
|
|
||||||
* @see JOSMTestRules#territories()
|
|
||||||
* @author Taylor Smock
|
|
||||||
* @since xxx
|
|
||||||
*/
|
|
||||||
@Documented
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@BasicPreferences // Needed for nodes
|
|
||||||
@Projection // Needed for getEastNorth
|
|
||||||
@ExtendWith(Territories.TerritoriesExtension.class)
|
|
||||||
public @interface Territories {
|
|
||||||
/**
|
|
||||||
* Initialization states. Please note that the highest initialization state
|
|
||||||
* holds.
|
|
||||||
*
|
|
||||||
* @author Taylor Smock
|
|
||||||
*/
|
|
||||||
enum Initialize {
|
|
||||||
/** Don't initialize */
|
|
||||||
NONE,
|
|
||||||
/** Initialize only internal data */
|
|
||||||
INTERNAL,
|
|
||||||
/** Initialize internal and external data */
|
|
||||||
ALL
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The way to initialize Territories
|
|
||||||
*
|
|
||||||
* @return The value to use
|
|
||||||
*/
|
|
||||||
Initialize value() default Initialize.INTERNAL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize boundaries prior to use
|
|
||||||
*
|
|
||||||
* @author Taylor Smock
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class TerritoriesExtension implements BeforeAllCallback, AfterAllCallback {
|
|
||||||
private static Initialize last = Initialize.NONE;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterAll(ExtensionContext context) throws Exception {
|
|
||||||
synchronized (TerritoriesExtension.class) {
|
|
||||||
// TODO
|
|
||||||
// org.openstreetmap.josm.tools.Territories.uninitialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void beforeAll(ExtensionContext context) throws Exception {
|
|
||||||
Optional<Territories> annotation = AnnotationSupport.findAnnotation(context.getElement(),
|
|
||||||
Territories.class);
|
|
||||||
if (annotation.isPresent()) {
|
|
||||||
Initialize current = annotation.get().value();
|
|
||||||
if (current.ordinal() <= last.ordinal()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
last = current;
|
|
||||||
// Avoid potential race conditions if tests are parallelized
|
|
||||||
synchronized (TerritoriesExtension.class) {
|
|
||||||
if (current == Initialize.INTERNAL) {
|
|
||||||
org.openstreetmap.josm.tools.Territories.initializeInternalData();
|
|
||||||
} else if (current == Initialize.ALL) {
|
|
||||||
org.openstreetmap.josm.tools.Territories.initialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -25,6 +25,7 @@ import org.openstreetmap.josm.testutils.annotations.AnnotationUtils;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||||
import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
|
import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
|
||||||
import org.openstreetmap.josm.testutils.annotations.HTTP;
|
import org.openstreetmap.josm.testutils.annotations.HTTP;
|
||||||
|
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||||
|
|
||||||
import com.github.tomakehurst.wiremock.WireMockServer;
|
import com.github.tomakehurst.wiremock.WireMockServer;
|
||||||
import com.github.tomakehurst.wiremock.client.WireMock;
|
import com.github.tomakehurst.wiremock.client.WireMock;
|
||||||
|
|
Ładowanie…
Reference in New Issue