Changeset 9489 in josm for trunk/test/unit/org
- Timestamp:
- 2016-01-16T16:41:44+01:00 (9 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/TestUtils.java
r9246 r9489 4 4 import static org.junit.Assert.fail; 5 5 6 import java.io.File; 7 import java.io.IOException; 8 import java.io.InputStream; 6 9 import java.util.Arrays; 7 10 import java.util.Comparator; 11 12 import org.openstreetmap.josm.io.Compression; 8 13 9 14 /** … … 46 51 public static String getRegressionDataFile(int ticketid, String filename) { 47 52 return getRegressionDataDir(ticketid) + '/' + filename; 53 } 54 55 /** 56 * Gets input stream to given file in test data directory for given ticket id. 57 * @param ticketid Ticket numeric identifier 58 * @param filename File name 59 * @return path to given file in test data directory for given ticket id 60 * @throws IOException if any I/O error occurs 61 */ 62 public static InputStream getRegressionDataStream(int ticketid, String filename) throws IOException { 63 return Compression.getUncompressedFileInputStream(new File(getRegressionDataDir(ticketid) + '/' + filename)); 48 64 } 49 65 -
trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java
r9225 r9489 4 4 import static org.junit.Assert.assertEquals; 5 5 6 import java.io.FileInputStream;7 6 import java.io.IOException; 8 7 import java.io.InputStream; … … 10 9 import java.util.List; 11 10 import java.util.Set; 12 13 import nl.jqno.equalsverifier.EqualsVerifier;14 11 15 12 import org.junit.BeforeClass; … … 23 20 import org.openstreetmap.josm.io.IllegalDataException; 24 21 import org.openstreetmap.josm.io.OsmReader; 22 23 import nl.jqno.equalsverifier.EqualsVerifier; 25 24 26 25 /** … … 44 43 @Test 45 44 public void testTicket11957() throws IOException, IllegalDataException { 46 try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(11957, "data.osm"))) {45 try (InputStream is = TestUtils.getRegressionDataStream(11957, "data.osm")) { 47 46 DataSet ds = OsmReader.parseDataSet(is, null); 48 47 NodeGraph graph = NodeGraph.createNearlyUndirectedGraphFromNodeWays(ds.getWays()); -
trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java
r8930 r9489 4 4 import static org.junit.Assert.assertEquals; 5 5 6 import java.io.FileInputStream;7 6 import java.io.IOException; 8 7 import java.io.InputStream; … … 39 38 @Test 40 39 public void testTicket10511() throws IOException, IllegalDataException { 41 try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(10511, "10511_mini.osm"))) {40 try (InputStream is = TestUtils.getRegressionDataStream(10511, "10511_mini.osm")) { 42 41 DataSet ds = OsmReader.parseDataSet(is, null); 43 42 Main.map.mapView.addLayer(new OsmDataLayer(ds, null, null)); … … 54 53 @Test 55 54 public void testTicket11992() throws IOException, IllegalDataException { 56 try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(11992, "shapes.osm"))) {55 try (InputStream is = TestUtils.getRegressionDataStream(11992, "shapes.osm")) { 57 56 DataSet ds = OsmReader.parseDataSet(is, null); 58 57 assertEquals(10, ds.getWays().size()); -
trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java
r8984 r9489 5 5 import static org.junit.Assert.assertTrue; 6 6 7 import java.io.FileInputStream;8 7 import java.io.FileNotFoundException; 9 8 import java.io.IOException; … … 42 41 @Test 43 42 public void testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException { 44 try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(12038, "data.osm"))) {43 try (InputStream is = TestUtils.getRegressionDataStream(12038, "data.osm")) { 45 44 DataSet ds = OsmReader.parseDataSet(is, null); 46 45 Main.map.mapView.addLayer(new OsmDataLayer(ds, null, null)); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java
r9095 r9489 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.TestUtils; 16 17 import org.openstreetmap.josm.data.Bounds; 17 18 import org.openstreetmap.josm.data.coor.LatLon; … … 24 25 25 26 private ImageryInfo testImageryTMS = new ImageryInfo("test imagery", "http://localhost", "tms", null, null); 26 private ImageryInfo testImageryPSEUDO_MERCATOR = getImagery( "test/data/wmts/getcapabilities-pseudo-mercator.xml");27 private ImageryInfo testImageryTOPO_PL = getImagery( "test/data/wmts/getcapabilities-TOPO.xml");28 private ImageryInfo testImageryORTO_PL = getImagery( "test/data/wmts/getcapabilities-ORTO.xml");29 private ImageryInfo testImageryWIEN = getImagery( "test/data/wmts/getCapabilities-wien.xml");30 private ImageryInfo testImageryWALLONIE = getImagery( "test/data/wmts/WMTSCapabilities-Wallonie.xml");31 private ImageryInfo testImageryOntario = getImagery( "test/data/wmts/WMTSCapabilities-Ontario.xml");32 private ImageryInfo testImagery12168 = getImagery( "test/data/wmts/bug12168-WMTSCapabilities.xml");33 private ImageryInfo testLotsOfLayers = getImagery( "test/data/wmts/getCapabilities-lots-of-layers.xml");27 private ImageryInfo testImageryPSEUDO_MERCATOR = getImagery(TestUtils.getTestDataRoot() + "wmts/getcapabilities-pseudo-mercator.xml"); 28 private ImageryInfo testImageryTOPO_PL = getImagery(TestUtils.getTestDataRoot() + "wmts/getcapabilities-TOPO.xml"); 29 private ImageryInfo testImageryORTO_PL = getImagery(TestUtils.getTestDataRoot() + "wmts/getcapabilities-ORTO.xml"); 30 private ImageryInfo testImageryWIEN = getImagery(TestUtils.getTestDataRoot() + "wmts/getCapabilities-wien.xml"); 31 private ImageryInfo testImageryWALLONIE = getImagery(TestUtils.getTestDataRoot() + "wmts/WMTSCapabilities-Wallonie.xml"); 32 private ImageryInfo testImageryOntario = getImagery(TestUtils.getTestDataRoot() + "wmts/WMTSCapabilities-Ontario.xml"); 33 private ImageryInfo testImagery12168 = getImagery(TestUtils.getTestDataRoot() + "wmts/bug12168-WMTSCapabilities.xml"); 34 private ImageryInfo testLotsOfLayers = getImagery(TestUtils.getTestDataRoot() + "wmts/getCapabilities-lots-of-layers.xml"); 34 35 35 36 /** -
trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java
r9480 r9489 4 4 import static org.junit.Assert.assertNull; 5 5 6 import java.io.FileInputStream;7 6 import java.io.InputStream; 8 7 … … 13 12 import org.openstreetmap.josm.JOSMFixture; 14 13 import org.openstreetmap.josm.TestUtils; 15 import org.openstreetmap.josm.io.Compression;16 14 import org.openstreetmap.josm.io.OsmReader; 17 15 … … 41 39 @Test 42 40 public void testTicket12376() throws Exception { 43 try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(12376, "multipolygon_hang.osm.bz2"))) { 44 DataSet ds = OsmReader.parseDataSet(Compression.BZIP2.getUncompressedInputStream(is), null); 45 for (Relation r : ds.getRelations()) { 41 try (InputStream is = TestUtils.getRegressionDataStream(12376, "multipolygon_hang.osm.bz2")) { 42 for (Relation r : OsmReader.parseDataSet(is, null).getRelations()) { 46 43 assertNull(new MultipolygonBuilder().makeFromWays(r.getMemberPrimitives(Way.class))); 47 44 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java
r9214 r9489 13 13 import org.openstreetmap.josm.data.projection.Projections; 14 14 15 /** 16 * Unit tests of the {@code OsmPrimitive} class. 17 */ 15 18 public class OsmPrimitiveTest { 16 19 -
trunk/test/unit/org/openstreetmap/josm/data/osm/WaySegmentTest.java
r9214 r9489 10 10 import org.openstreetmap.josm.data.coor.LatLon; 11 11 12 /** 13 * Unit tests of the {@code WaySegment} class. 14 */ 12 15 public class WaySegmentTest { 13 16 17 /** 18 * Setup test. 19 */ 14 20 @Before 15 public void setUp() throws Exception{21 public void setUp() { 16 22 JOSMFixture.createUnitTestFixture().init(); 17 23 } -
trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java
r9475 r9489 5 5 import static org.junit.Assert.assertSame; 6 6 7 import java.io.FileInputStream;8 7 import java.io.IOException; 9 8 import java.io.InputStream; … … 24 23 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader; 25 24 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 26 import org.openstreetmap.josm.io.Compression;27 25 import org.openstreetmap.josm.io.IllegalDataException; 28 26 import org.openstreetmap.josm.io.OsmReader; … … 55 53 Comparator<Relation> comparator = DefaultNameFormatter.getInstance().getRelationComparator(); 56 54 57 try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(9632, "data.osm.zip"))) {58 DataSet ds = OsmReader.parseDataSet( Compression.ZIP.getUncompressedInputStream(is), null);55 try (InputStream is = TestUtils.getRegressionDataStream(9632, "data.osm.zip")) { 56 DataSet ds = OsmReader.parseDataSet(is, null); 59 57 60 58 // Test with 3 known primitives causing the problem. Correct order is p1, p3, p2 with this preset
Note:
See TracChangeset
for help on using the changeset viewer.