Changeset 30568 in osm for applications/editors/josm/plugins/opendata/test/unit/org
- Timestamp:
- 2014-08-06T19:33:57+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/NonRegFunctionalTests.java
r30563 r30568 6 6 import static org.junit.Assert.assertTrue; 7 7 8 import java.io.IOException; 9 import java.nio.file.DirectoryIteratorException; 10 import java.nio.file.DirectoryStream; 11 import java.nio.file.Files; 12 import java.nio.file.Path; 13 import java.nio.file.Paths; 14 import java.util.ArrayList; 8 15 import java.util.Collection; 9 16 17 import org.openstreetmap.josm.TestUtils; 10 18 import org.openstreetmap.josm.data.osm.DataSet; 11 19 import org.openstreetmap.josm.data.osm.Node; … … 40 48 assertTrue(found); 41 49 } 50 51 /** 52 * Lists all datasets files matching given extension. 53 * @param ext file extension to search for 54 * @returns List of all datasets files matching given extension 55 * @throws IOException in case of I/O error 56 */ 57 public static Collection<Path> listDataFiles(String ext) throws IOException { 58 Collection<Path> result = new ArrayList<>(); 59 addTree(Paths.get(TestUtils.getTestDataRoot()+"datasets"), result, ext.toLowerCase()); 60 return result; 61 } 62 63 static void addTree(Path directory, Collection<Path> all, String ext) throws IOException { 64 try (DirectoryStream<Path> ds = Files.newDirectoryStream(directory)) { 65 for (Path child : ds) { 66 if (Files.isDirectory(child)) { 67 addTree(child, all, ext); 68 } else if (child.toString().toLowerCase().endsWith(ext)) { 69 all.add(child); 70 } 71 } 72 } catch (DirectoryIteratorException ex) { 73 // I/O error encounted during the iteration, the cause is an IOException 74 throw ex.getCause(); 75 } 76 } 42 77 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifReaderTest.java
r30550 r30568 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.opendata.core.io.geographic; 3 4 import static org.junit.Assert.assertFalse;5 3 6 4 import java.io.File; … … 13 11 import org.openstreetmap.josm.JOSMFixture; 14 12 import org.openstreetmap.josm.TestUtils; 15 import org.openstreetmap.josm. data.osm.DataSet;13 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 16 14 17 15 /** … … 36 34 File file = new File(TestUtils.getRegressionDataFile(9592, "bg.mif")); 37 35 try (InputStream is = new FileInputStream(file)) { 38 DataSet ds = MifReader.parseDataSet(is, file, null, null); 39 assertFalse(ds.allPrimitives().isEmpty()); 36 NonRegFunctionalTests.testGeneric(MifReader.parseDataSet(is, file, null, null)); 40 37 } 41 38 }
Note:
See TracChangeset
for help on using the changeset viewer.