Ignore:
Timestamp:
2014-08-07T02:09:00+02:00 (10 years ago)
Author:
donvip
Message:

[josm_opendata] enhancements to MapInfo .mif file reading + bugfixes + improved unit tests + add mapinfo documentation because of previous dead link

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  
    1818import org.openstreetmap.josm.data.osm.DataSet;
    1919import org.openstreetmap.josm.data.osm.Node;
    20 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     20import org.openstreetmap.josm.data.osm.Relation;
     21import org.openstreetmap.josm.data.osm.Way;
    2122import org.openstreetmap.josm.tools.CheckParameterUtil;
    2223
     
    2627     * Non-regression generic test.
    2728     */
    28     public static void testGeneric(DataSet ds) {
     29    public static void testGeneric(String context, DataSet ds) {
    2930        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        }
    3246    }
    3347   
     
    3650     */
    3751    public static void testTicket10214(DataSet ds) {
    38         testGeneric(ds);
     52        testGeneric("#10214", ds);
    3953        boolean found = false;
    4054        for (Node n : ds.getNodes()) {
  • applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReaderTest.java

    r30568 r30573  
    4040    public void testReadZipFiles() throws IOException, XMLStreamException, FactoryConfigurationError, JAXBException {
    4141        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)) {
    4545                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());
    4849                }
    4950            }
  • applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/KmlReaderTest.java

    r30563 r30573  
    4949        File file = new File(TestUtils.getRegressionDataFile(7714, "doc.kml"));
    5050        try (InputStream is = new FileInputStream(file)) {
    51             NonRegFunctionalTests.testGeneric(KmlReader.parseDataSet(is, null));
     51            NonRegFunctionalTests.testGeneric("#7714", KmlReader.parseDataSet(is, null));
    5252        }
    5353    }
  • applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifReaderTest.java

    r30568 r30573  
    3434        File file = new File(TestUtils.getRegressionDataFile(9592, "bg.mif"));
    3535        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));
    3737        }
    3838    }
  • applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReaderTest.java

    r30563 r30573  
    4949        File file = new File(TestUtils.getRegressionDataFile(8309, "new_ti_declarada.shp"));
    5050        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));
    5252        }
    5353    }
  • applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvReaderTest.java

    r30563 r30573  
    7777        File file = new File(TestUtils.getRegressionDataFile(8805, "XXX.csv"));
    7878        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));
    8080        }
    8181    }
Note: See TracChangeset for help on using the changeset viewer.