Changeset 30573 in osm for applications/editors/josm/plugins/opendata/test
- Timestamp:
- 2014-08-07T02:09:00+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/NonRegFunctionalTests.java
r30568 r30573 18 18 import org.openstreetmap.josm.data.osm.DataSet; 19 19 import org.openstreetmap.josm.data.osm.Node; 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 import org.openstreetmap.josm.data.osm.Relation; 21 import org.openstreetmap.josm.data.osm.Way; 21 22 import org.openstreetmap.josm.tools.CheckParameterUtil; 22 23 … … 26 27 * Non-regression generic test. 27 28 */ 28 public static void testGeneric(DataSet ds) { 29 public static void testGeneric(String context, DataSet ds) { 29 30 CheckParameterUtil.ensureParameterNotNull(ds, "ds"); 30 Collection<OsmPrimitive> prims = ds.allPrimitives(); 31 assertFalse(prims.isEmpty()); 31 // Every dataset should at least contain a node 32 Collection<Node> nodes = ds.getNodes(); 33 assertFalse("No nodes in dataset for "+context, nodes.isEmpty()); 34 // Nodes should all have coordinates 35 for (Node n : nodes) { 36 assertTrue("Node without coordinate found for "+context, n.getCoor() != null); 37 } 38 // and no empty ways 39 for (Way w : ds.getWays()) { 40 assertTrue("Empty way found for "+context, w.getNodesCount() > 0); 41 } 42 // neither empty relations 43 for (Relation r : ds.getRelations()) { 44 assertTrue("Empty relation found for "+context, r.getMembersCount() > 0); 45 } 32 46 } 33 47 … … 36 50 */ 37 51 public static void testTicket10214(DataSet ds) { 38 testGeneric(ds); 52 testGeneric("#10214", ds); 39 53 boolean found = false; 40 54 for (Node n : ds.getNodes()) { -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReaderTest.java
r30568 r30573 40 40 public void testReadZipFiles() throws IOException, XMLStreamException, FactoryConfigurationError, JAXBException { 41 41 for (Path p : NonRegFunctionalTests.listDataFiles("zip")) { 42 File file = p.toFile(); 43 Main.info("Testing reading file "+file.getPath()); 44 try (InputStream is = new FileInputStream(file)) { 42 File zipfile = p.toFile(); 43 Main.info("Testing reading file "+zipfile.getPath()); 44 try (InputStream is = new FileInputStream(zipfile)) { 45 45 for (Entry<File, DataSet> entry : ZipReader.parseDataSets(is, null, null, false).entrySet()) { 46 Main.info("Checking dataset for entry "+entry.getKey().getName()); 47 NonRegFunctionalTests.testGeneric(entry.getValue()); 46 String name = entry.getKey().getName(); 47 Main.info("Checking dataset for entry "+name); 48 NonRegFunctionalTests.testGeneric(zipfile.getName()+"/"+name, entry.getValue()); 48 49 } 49 50 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/KmlReaderTest.java
r30563 r30573 49 49 File file = new File(TestUtils.getRegressionDataFile(7714, "doc.kml")); 50 50 try (InputStream is = new FileInputStream(file)) { 51 NonRegFunctionalTests.testGeneric(KmlReader.parseDataSet(is, null)); 51 NonRegFunctionalTests.testGeneric("#7714", KmlReader.parseDataSet(is, null)); 52 52 } 53 53 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifReaderTest.java
r30568 r30573 34 34 File file = new File(TestUtils.getRegressionDataFile(9592, "bg.mif")); 35 35 try (InputStream is = new FileInputStream(file)) { 36 NonRegFunctionalTests.testGeneric(MifReader.parseDataSet(is, file, null, null)); 36 NonRegFunctionalTests.testGeneric("#9592", MifReader.parseDataSet(is, file, null, null)); 37 37 } 38 38 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReaderTest.java
r30563 r30573 49 49 File file = new File(TestUtils.getRegressionDataFile(8309, "new_ti_declarada.shp")); 50 50 try (InputStream is = new FileInputStream(file)) { 51 NonRegFunctionalTests.testGeneric(ShpReader.parseDataSet(is, file, null, null)); 51 NonRegFunctionalTests.testGeneric("#8309", ShpReader.parseDataSet(is, file, null, null)); 52 52 } 53 53 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvReaderTest.java
r30563 r30573 77 77 File file = new File(TestUtils.getRegressionDataFile(8805, "XXX.csv")); 78 78 try (InputStream is = new FileInputStream(file)) { 79 NonRegFunctionalTests.testGeneric(CsvReader.parseDataSet(is, newHandler("EPSG:4326"), null)); 79 NonRegFunctionalTests.testGeneric("#8805", CsvReader.parseDataSet(is, newHandler("EPSG:4326"), null)); 80 80 } 81 81 }
Note:
See TracChangeset
for help on using the changeset viewer.