kopia lustrzana https://github.com/JOSM/MapWithAI
Update error prone and fix bugs found
Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head v0.2.3
rodzic
dd52534c53
commit
ee210efda8
|
@ -18,7 +18,11 @@
|
|||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
|
||||
<classpathentry kind="lib" path="/JOSM/test/lib/awaitility-3.1.5.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/JOSM-utilsplugin2"/>
|
||||
<classpathentry kind="lib" path="/JOSM/test/lib/awaitility-4.0.1.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="https://www.javadoc.io/doc/org.awaitility/awaitility/latest/index.html"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="build/classes/java/main"/>
|
||||
</classpath>
|
||||
|
|
|
@ -12,7 +12,7 @@ plugins {
|
|||
id "maven-publish"
|
||||
id "pmd"
|
||||
id "com.github.ben-manes.versions" version "0.27.0"
|
||||
id "com.github.spotbugs" version "2.0.1"
|
||||
id "com.github.spotbugs" version "3.0.0"
|
||||
id "org.openstreetmap.josm" version "0.6.5"
|
||||
id "net.ltgt.errorprone" version "1.1.1"
|
||||
//id 'de.aaschmid.cpd' version '2.0'
|
||||
|
@ -45,7 +45,7 @@ def gitlabRepositoryName = "JOSM_MapWithAI"
|
|||
|
||||
def versions = [
|
||||
awaitility: "4.0.1",
|
||||
errorprone: "2.3.3",
|
||||
errorprone: "2.3.4",
|
||||
jacoco: "0.8.5",
|
||||
jmockit: "1.46",
|
||||
junit: "5.5.2",
|
||||
|
|
|
@ -87,7 +87,7 @@ public final class MapWithAIPlugin extends Plugin implements Destroyable {
|
|||
destroyables = new ArrayList<>();
|
||||
destroyables.add(new MapWithAIUploadHook(info));
|
||||
mapFrameInitialized(null, MainApplication.getMap());
|
||||
MainApplication.worker.submit(() -> UpdateProd.doProd(info.mainversion));
|
||||
MainApplication.worker.execute(() -> UpdateProd.doProd(info.mainversion));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.openstreetmap.josm.tools.OpenBrowser;
|
|||
*
|
||||
* @author Taylor Smock
|
||||
*/
|
||||
public class UpdateProd {
|
||||
public final class UpdateProd {
|
||||
private UpdateProd() {
|
||||
// Hide constructor
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@ import java.io.ByteArrayInputStream;
|
|||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.awaitility.Durations;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
@ -72,8 +72,8 @@ public class MapWithAIPluginTest {
|
|||
Config.getPref().putBoolean(MapWithAIPlugin.PAINTSTYLE_PREEXISTS, existed);
|
||||
plugin.destroy();
|
||||
Assert.assertEquals(dataMenuSize, dataMenu.getMenuComponentCount());
|
||||
Awaitility.await().atMost(5, TimeUnit.SECONDS)
|
||||
.until(() -> existed == MapWithAIDataUtils.checkIfMapWithAIPaintStyleExists());
|
||||
Awaitility.await().atMost(Durations.FIVE_SECONDS)
|
||||
.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());
|
||||
|
|
|
@ -9,9 +9,8 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.awaitility.Durations;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
@ -53,7 +52,7 @@ public class MapWithAIActionTest {
|
|||
|
||||
MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "temporary", null));
|
||||
action.actionPerformed(null);
|
||||
Awaitility.await().timeout(8, TimeUnit.SECONDS)
|
||||
Awaitility.await().atMost(Durations.TEN_SECONDS)
|
||||
.until(() -> 1 == MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).size());
|
||||
assertEquals(1, MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).size());
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@ package org.openstreetmap.josm.plugins.mapwithai.backend;
|
|||
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.awaitility.Durations;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
@ -36,7 +35,7 @@ public class MapWithAIAvailabilityTest {
|
|||
Territories.initialize();
|
||||
instance = MapWithAIAvailability.getInstance();
|
||||
LatLon temp = new LatLon(40, -100);
|
||||
await().atMost(10, TimeUnit.SECONDS).until(() -> Territories.isIso3166Code("US", temp));
|
||||
await().atMost(Durations.TEN_SECONDS).until(() -> Territories.isIso3166Code("US", temp));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -9,12 +9,12 @@ import java.awt.Component;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.awaitility.Durations;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
@ -76,7 +76,7 @@ public class MapWithAILayerTest {
|
|||
UndoRedoHandler.getInstance().add(command);
|
||||
Assert.assertNotNull(layer.getChangesetSourceTag());
|
||||
Assert.assertFalse(layer.getChangesetSourceTag().trim().isEmpty());
|
||||
Assert.assertEquals(layer.getChangesetSourceTag(), MapWithAIPlugin.NAME);
|
||||
Assert.assertEquals(MapWithAIPlugin.NAME, layer.getChangesetSourceTag());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -144,13 +144,13 @@ public class MapWithAILayerTest {
|
|||
osm.unlock();
|
||||
|
||||
MapWithAIDataUtils.getMapWithAIData(mapWithAILayer);
|
||||
await().atMost(10, TimeUnit.SECONDS).until(() -> !mapWithAILayer.getDataSet().getDataSourceBounds().isEmpty());
|
||||
await().atMost(Durations.TEN_SECONDS).until(() -> !mapWithAILayer.getDataSet().getDataSourceBounds().isEmpty());
|
||||
Assert.assertFalse(mapWithAILayer.getDataSet().getDataSourceBounds().isEmpty());
|
||||
Assert.assertEquals(1, mapWithAILayer.getDataSet().getDataSourceBounds().parallelStream().distinct().count());
|
||||
|
||||
osm.getDataSet().addDataSource(new DataSource(new Bounds(-0.001, -0.001, 0, 0), "random test"));
|
||||
MapWithAIDataUtils.getMapWithAIData(mapWithAILayer);
|
||||
await().atMost(10, TimeUnit.SECONDS).until(
|
||||
await().atMost(Durations.TEN_SECONDS).until(
|
||||
() -> mapWithAILayer.getDataSet().getDataSourceBounds().parallelStream().distinct().count() == 2);
|
||||
Assert.assertEquals(2, mapWithAILayer.getDataSet().getDataSourceBounds().parallelStream().distinct().count());
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.awaitility.Durations;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
@ -139,7 +139,7 @@ public class MapWithAIRemoteControlTest {
|
|||
newHandler("http://127.0.0.1:8111/mapwithai?bbox={bbox}".replace("{bbox}", temp.toStringCSV(","))).handle();
|
||||
assertFalse(MainApplication.getLayerManager().getLayersOfType(MapWithAILayer.class).isEmpty());
|
||||
|
||||
await().atMost(10, TimeUnit.SECONDS)
|
||||
await().atMost(Durations.TEN_SECONDS)
|
||||
.until(() -> !MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().isEmpty());
|
||||
|
||||
final BBox added = MapWithAIDataUtils.getLayer(false).getDataSet().getDataSourceBounds().iterator().next().toBBox();
|
||||
|
|
Ładowanie…
Reference in New Issue