Changeset 36064 in osm for applications/editors/josm/plugins/opendata
- Timestamp:
- 2023-03-21T14:49:10+01:00 (21 months ago)
- Location:
- applications/editors/josm/plugins/opendata
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/modules/fr.toulouse/test/unit/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseModuleTest.java
r35269 r36064 2 2 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse; 3 3 4 import static org.junit.Assert.assertEquals;5 import static org.junit.Assert.assertFalse;6 4 7 import org.junit.Rule; 8 import org.junit.Test; 9 import org.openstreetmap.josm.testutils.JOSMTestRules; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 8 import org.junit.jupiter.api.Test; 9 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 10 10 11 11 /** 12 12 * Unit tests of {@link ToulouseModule} class. 13 13 */ 14 public class ToulouseModuleTest { 15 16 /** 17 * Setup test. 18 */ 19 @Rule 20 public JOSMTestRules rules = new JOSMTestRules().preferences(); 21 14 @BasicPreferences 15 class ToulouseModuleTest { 22 16 @Test 23 publicvoid testHandlersConstruction() {17 void testHandlersConstruction() { 24 18 ToulouseModule module = new ToulouseModule(null); 25 19 assertFalse(module.getHandlers().isEmpty()); -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/test/unit/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseModuleTestIT.java
r35272 r36064 2 2 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse; 3 3 4 import static org.junit.Assert.assertTrue; 4 5 import static org.junit.jupiter.api.Assertions.assertTrue; 5 6 6 7 import java.io.IOException; … … 8 9 import java.util.TreeMap; 9 10 10 import org.junit. Rule;11 import org.junit. Test;11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.Timeout; 12 13 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 13 import org.openstreetmap.josm.testutils. JOSMTestRules;14 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 14 15 import org.openstreetmap.josm.tools.HttpClient; 15 16 … … 17 18 * Integration tests of {@link ToulouseModule} class. 18 19 */ 19 public class ToulouseModuleTestIT { 20 21 /** 22 * Setup test. 23 */ 24 @Rule 25 public JOSMTestRules rules = new JOSMTestRules().preferences().timeout(30_000); 26 20 @BasicPreferences 21 @Timeout(30) 22 class ToulouseModuleTestIT { 27 23 @Test 28 publicvoid testUrlValidity() throws IOException {24 void testUrlValidity() throws IOException { 29 25 Map<String, Integer> errors = new TreeMap<>(); 30 26 for (AbstractDataSetHandler handler : new ToulouseModule(null).getNewlyInstanciatedHandlers()) { … … 34 30 } 35 31 } 36 assertTrue(errors. toString(), errors.isEmpty());32 assertTrue(errors.isEmpty(), errors.toString()); 37 33 } 38 34 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReaderTest.java
r35899 r36064 3 3 4 4 import java.io.File; 5 import java.io.FileInputStream;6 5 import java.io.InputStream; 6 import java.nio.file.Files; 7 7 import java.nio.file.Path; 8 8 import java.util.Map.Entry; 9 import java.util.concurrent.TimeUnit; 9 10 10 11 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api. extension.RegisterExtension;12 import org.junit.jupiter.api.Timeout; 12 13 import org.openstreetmap.josm.data.osm.DataSet; 13 14 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 14 import org.openstreetmap.josm.testutils.JOSMTestRules;15 15 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 16 import org.openstreetmap.josm.testutils.annotations.Projection; 16 17 import org.openstreetmap.josm.tools.Logging; 17 18 … … 20 21 */ 21 22 @BasicPreferences 23 @Projection 24 @Timeout(value = 10, unit = TimeUnit.MINUTES) 22 25 class ZipReaderTest { 23 24 /**25 * Setup test.26 */27 @RegisterExtension28 public JOSMTestRules rules = new JOSMTestRules().projection().noTimeout();29 30 26 /** 31 27 * Test for various zip files reading … … 37 33 File zipfile = p.toFile(); 38 34 Logging.info("Testing reading file "+zipfile.getPath()); 39 try (InputStream is = new FileInputStream(zipfile)) {35 try (InputStream is = Files.newInputStream(zipfile.toPath())) { 40 36 for (Entry<File, DataSet> entry : ZipReader.parseDataSets(is, null, null, false).entrySet()) { 41 37 String name = entry.getKey().getName(); -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/datasets/DataSetUpdaterTest.java
r35899 r36064 2 2 package org.openstreetmap.josm.plugins.opendata.core.io.datasets; 3 3 4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 4 7 import java.io.File; 5 import java.io.FileInputStream;6 8 import java.io.InputStream; 9 import java.nio.file.Files; 10 import java.util.concurrent.TimeUnit; 7 11 import java.util.function.Predicate; 8 12 9 13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.Timeout; 10 15 import org.junit.jupiter.api.extension.RegisterExtension; 11 16 import org.openstreetmap.josm.TestUtils; … … 17 22 import org.openstreetmap.josm.testutils.JOSMTestRules; 18 23 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 19 20 import static org.junit.jupiter.api.Assertions.assertFalse; 21 import static org.junit.jupiter.api.Assertions.assertTrue; 24 import org.openstreetmap.josm.testutils.annotations.Projection; 22 25 23 26 /** … … 25 28 */ 26 29 @BasicPreferences 30 @Projection 31 @Timeout(value = 1, unit = TimeUnit.MINUTES) 27 32 class DataSetUpdaterTest { 28 33 … … 31 36 */ 32 37 @RegisterExtension 33 JOSMTestRules rules = new JOSMTestRules(). projection().devAPI().timeout(60000);38 JOSMTestRules rules = new JOSMTestRules().devAPI(); 34 39 35 40 /** … … 40 45 void testTicket11166() throws Exception { 41 46 File file = new File(TestUtils.getRegressionDataFile(11166, "raba760dissJosm.zip")); 42 try (InputStream is = new FileInputStream(file)) {47 try (InputStream is = Files.newInputStream(file.toPath())) { 43 48 Predicate<? super Way> p = w -> w.getNodesCount() >= 0.9 * OsmApi.getOsmApi().getCapabilities().getMaxWayNodes(); 44 49 DataSet ds = ZipReader.parseDataSet(is, null, null, false); -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GmlReaderTest.java
r35899 r36064 6 6 7 7 import java.io.File; 8 import java.io.FileInputStream;9 8 import java.io.InputStream; 9 import java.nio.file.Files; 10 import java.util.concurrent.TimeUnit; 10 11 11 12 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api. extension.RegisterExtension;13 import org.junit.jupiter.api.Timeout; 13 14 import org.openstreetmap.josm.TestUtils; 14 15 import org.openstreetmap.josm.data.osm.Node; 15 import org.openstreetmap.josm.testutils.JOSMTestRules;16 16 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 17 import org.openstreetmap.josm.testutils.annotations.Projection; 17 18 18 19 /** … … 20 21 */ 21 22 @BasicPreferences 23 @Projection 24 @Timeout(value = 1, unit = TimeUnit.MINUTES) 22 25 class GmlReaderTest { 23 24 /**25 * Setup test.26 */27 @RegisterExtension28 JOSMTestRules rules = new JOSMTestRules().projection().timeout(60000);29 30 26 /** 31 27 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/11624">#11624</a> … … 35 31 void testTicket11624() throws Exception { 36 32 File file = new File(TestUtils.getRegressionDataFile(11624, "temp3.gml")); 37 try (InputStream is = new FileInputStream(file)) {33 try (InputStream is = Files.newInputStream(file.toPath())) { 38 34 for (Node n : GmlReader.parseDataSet(is, null, null).getNodes()) { 39 35 assertNotNull(n.getCoor(), n.toString()); -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/KmlReaderTest.java
r35910 r36064 8 8 9 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension;11 10 import org.openstreetmap.josm.TestUtils; 12 11 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 13 import org.openstreetmap.josm.testutils.JOSMTestRules;14 12 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 13 import org.openstreetmap.josm.testutils.annotations.Projection; 15 14 16 15 /** … … 18 17 */ 19 18 @BasicPreferences 19 @Projection 20 20 class KmlReaderTest { 21 22 /**23 * Setup test.24 */25 @RegisterExtension26 JOSMTestRules rules = new JOSMTestRules().projection();27 28 21 /** 29 22 * Unit test of {@link KmlReader#COLOR_PATTERN} -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifReaderTest.java
r35899 r36064 8 8 9 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension;11 10 import org.openstreetmap.josm.TestUtils; 12 11 import org.openstreetmap.josm.data.osm.DataSet; … … 14 13 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 15 14 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 16 import org.openstreetmap.josm.testutils.JOSMTestRules;17 15 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 16 import org.openstreetmap.josm.testutils.annotations.Projection; 18 17 19 18 /** … … 21 20 */ 22 21 @BasicPreferences 22 @Projection 23 23 class MifReaderTest { 24 25 /**26 * Setup test.27 */28 @RegisterExtension29 JOSMTestRules rules = new JOSMTestRules().projection();30 31 24 private static AbstractDataSetHandler newHandler(final String epsgCode) { 32 25 AbstractDataSetHandler handler = new AbstractDataSetHandler() { -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReaderTest.java
r35899 r36064 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.opendata.core.io.geographic; 3 4 import java.io.File;5 import java.io.FileInputStream;6 import java.io.InputStream;7 import java.util.Collection;8 import java.util.Objects;9 10 import org.junit.jupiter.api.Disabled;11 import org.junit.jupiter.api.Test;12 import org.junit.jupiter.api.extension.RegisterExtension;13 import org.openstreetmap.josm.TestUtils;14 import org.openstreetmap.josm.data.coor.LatLon;15 import org.openstreetmap.josm.data.osm.Node;16 import org.openstreetmap.josm.data.osm.Way;17 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests;18 import org.openstreetmap.josm.testutils.JOSMTestRules;19 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;20 3 21 4 import static org.junit.jupiter.api.Assertions.assertEquals; … … 25 8 import static org.junit.jupiter.api.Assertions.assertTrue; 26 9 10 import java.io.File; 11 import java.io.FileInputStream; 12 import java.io.InputStream; 13 import java.nio.file.Files; 14 import java.util.Collection; 15 import java.util.Objects; 16 import java.util.concurrent.TimeUnit; 17 18 import org.junit.jupiter.api.Disabled; 19 import org.junit.jupiter.api.Test; 20 import org.junit.jupiter.api.Timeout; 21 import org.openstreetmap.josm.TestUtils; 22 import org.openstreetmap.josm.data.coor.LatLon; 23 import org.openstreetmap.josm.data.osm.Node; 24 import org.openstreetmap.josm.data.osm.Way; 25 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 26 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 27 import org.openstreetmap.josm.testutils.annotations.Projection; 28 27 29 /** 28 30 * Unit tests of {@link ShpReader} class. 29 31 */ 30 32 @BasicPreferences 33 @Projection 34 @Timeout(value = 1, unit = TimeUnit.MINUTES) 31 35 class ShpReaderTest { 32 33 /**34 * Setup test.35 */36 @RegisterExtension37 JOSMTestRules rules = new JOSMTestRules().projection().timeout(60000);38 39 36 /** 40 37 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/12714">#12714</a> … … 44 41 void testTicket12714() throws Exception { 45 42 File file = new File(TestUtils.getRegressionDataFile(12714, "linhas.shp")); 46 try (InputStream is = new FileInputStream(file)) {43 try (InputStream is = Files.newInputStream(file.toPath())) { 47 44 for (Node n : ShpReader.parseDataSet(is, file, null, null).getNodes()) { 48 45 assertNotNull(n.getCoor(), n.toString()); -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/TabReaderTest.java
r35899 r36064 3 3 4 4 import java.io.File; 5 import java.io.FileInputStream;6 5 import java.io.InputStream; 6 import java.nio.file.Files; 7 import java.util.concurrent.TimeUnit; 7 8 8 9 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api. extension.RegisterExtension;10 import org.junit.jupiter.api.Timeout; 10 11 import org.openstreetmap.josm.TestUtils; 11 12 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 12 import org.openstreetmap.josm.testutils.JOSMTestRules;13 13 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 14 import org.openstreetmap.josm.testutils.annotations.Projection; 14 15 15 16 /** … … 17 18 */ 18 19 @BasicPreferences 20 @Projection 21 @Timeout(value = 1, unit = TimeUnit.MINUTES) 19 22 class TabReaderTest { 20 21 /**22 * Setup test.23 */24 @RegisterExtension25 JOSMTestRules rules = new JOSMTestRules().projection().timeout(60000);26 27 23 /** 28 24 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/15159">#15159</a> … … 32 28 void testTicket15159() throws Exception { 33 29 File file = new File(TestUtils.getRegressionDataFile(15159, "Sanisette.tab")); 34 try (InputStream is = new FileInputStream(file)) {30 try (InputStream is = Files.newInputStream(file.toPath())) { 35 31 NonRegFunctionalTests.testGeneric("#15159", TabReader.parseDataSet(is, file, null, null)); 36 32 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvReaderTest.java
r35899 r36064 5 5 6 6 import org.junit.jupiter.api.Test; 7 import org.junit.jupiter.api.extension.RegisterExtension;8 7 import org.openstreetmap.josm.TestUtils; 9 8 import org.openstreetmap.josm.data.coor.EastNorth; … … 13 12 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 14 13 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 15 import org.openstreetmap.josm.testutils.JOSMTestRules;16 14 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 15 import org.openstreetmap.josm.testutils.annotations.Projection; 17 16 18 17 /** … … 20 19 */ 21 20 @BasicPreferences 21 @Projection 22 22 class CsvReaderTest { 23 24 /**25 * Setup test.26 */27 @RegisterExtension28 JOSMTestRules rules = new JOSMTestRules().projection();29 30 23 private static AbstractDataSetHandler newHandler(final String epsgCode) { 31 24 AbstractDataSetHandler handler = new AbstractDataSetHandler() { -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsReaderTest.java
r35899 r36064 5 5 6 6 import org.junit.jupiter.api.Test; 7 import org.junit.jupiter.api.extension.RegisterExtension;8 7 import org.openstreetmap.josm.TestUtils; 9 8 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 10 import org.openstreetmap.josm.testutils.JOSMTestRules;11 9 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 10 import org.openstreetmap.josm.testutils.annotations.Projection; 12 11 13 12 /** … … 15 14 */ 16 15 @BasicPreferences 16 @Projection 17 17 class OdsReaderTest { 18 19 /**20 * Setup test.21 */22 @RegisterExtension23 JOSMTestRules rules = new JOSMTestRules().projection();24 18 25 19 /** -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/tabular/XlsReaderTest.java
r35899 r36064 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.opendata.core.io.tabular; 3 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 3 6 4 7 import java.io.InputStream; 5 8 6 9 import org.junit.jupiter.api.Test; 7 import org.junit.jupiter.api.extension.RegisterExtension;8 10 import org.openstreetmap.josm.TestUtils; 9 11 import org.openstreetmap.josm.data.coor.EastNorth; … … 14 16 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 15 17 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 16 import org.openstreetmap.josm.testutils.JOSMTestRules;17 18 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 18 19 import static org.junit.jupiter.api.Assertions.assertEquals; 20 import static org.junit.jupiter.api.Assertions.assertNotNull; 19 import org.openstreetmap.josm.testutils.annotations.Projection; 21 20 22 21 /** … … 24 23 */ 25 24 @BasicPreferences 25 @Projection 26 26 class XlsReaderTest { 27 28 /**29 * Setup test.30 */31 @RegisterExtension32 public JOSMTestRules rules = new JOSMTestRules().projection();33 34 27 private static AbstractDataSetHandler newHandler(final String epsgCode) { 35 28 AbstractDataSetHandler handler = new AbstractDataSetHandler() {
Note:
See TracChangeset
for help on using the changeset viewer.