Changeset 17615 in josm for trunk/test/performance
- Timestamp:
- 2021-03-21T13:56:13+01:00 (4 years ago)
- Location:
- trunk/test/performance/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/performance/org/openstreetmap/josm/PerformanceTestUtils.java
r11324 r17615 2 2 package org.openstreetmap.josm; 3 3 4 import java.io.File; 5 import java.io.IOException; 6 import java.io.InputStream; 4 7 import java.util.ArrayList; 5 8 import java.util.Collections; 6 9 10 import org.openstreetmap.josm.data.osm.DataSet; 11 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 12 import org.openstreetmap.josm.io.Compression; 13 import org.openstreetmap.josm.io.IllegalDataException; 14 import org.openstreetmap.josm.io.OsmReader; 7 15 import org.openstreetmap.josm.io.XmlWriter; 8 16 … … 14 22 */ 15 23 public final class PerformanceTestUtils { 24 /** 25 * The Neubrandenburg data file 26 */ 27 public static final String DATA_FILE = "nodist/data/neubrandenburg.osm.bz2"; 16 28 private static final int TIMES_WARMUP = 2; 17 29 private static final int TIMES_RUN = 8; 30 31 /** 32 * Parses and returns the Neubrandenburg dataset 33 * @return the Neubrandenburg dataset 34 * @throws IllegalDataException in case of invalid data 35 * @throws IOException in case of I/O error 36 */ 37 public static DataSet getNeubrandenburgDataSet() throws IOException, IllegalDataException { 38 try (InputStream in = Compression.getUncompressedFileInputStream(new File(DATA_FILE))) { 39 return OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); 40 } 41 } 18 42 19 43 /** -
trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java
r17275 r17615 18 18 import org.junit.jupiter.api.Timeout; 19 19 import org.openstreetmap.josm.JOSMFixture; 20 import org.openstreetmap.josm.PerformanceTestUtils; 20 21 import org.openstreetmap.josm.data.Bounds; 21 22 import org.openstreetmap.josm.data.osm.DataSet; … … 75 76 StyledMapRenderer.PREFERENCE_TEXT_ANTIALIASING.put("gasp"); 76 77 78 dsCity = PerformanceTestUtils.getNeubrandenburgDataSet(); 77 79 try (InputStream fisR = Files.newInputStream(Paths.get("nodist/data/restriction.osm")); 78 80 InputStream fisM = Files.newInputStream(Paths.get("nodist/data/multipolygon.osm")); 79 InputStream fisC = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"));80 81 InputStream fisO = Compression.getUncompressedFileInputStream(new File("nodist/data/overpass-download.osm.bz2"));) { 81 82 dsRestriction = OsmReader.parseDataSet(fisR, NullProgressMonitor.INSTANCE); 82 83 dsMultipolygon = OsmReader.parseDataSet(fisM, NullProgressMonitor.INSTANCE); 83 dsCity = OsmReader.parseDataSet(fisC, NullProgressMonitor.INSTANCE);84 84 dsOverpass = OsmReader.parseDataSet(fisO, NullProgressMonitor.INSTANCE); 85 85 } -
trunk/test/performance/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerPerformanceTest.java
r17588 r17615 6 6 import org.junit.jupiter.api.Test; 7 7 import org.junit.jupiter.api.extension.RegisterExtension; 8 import org.openstreetmap.josm.PerformanceTestUtils; 8 9 import org.openstreetmap.josm.data.osm.DataSet; 9 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;10 import org.openstreetmap.josm.io.Compression;11 import org.openstreetmap.josm.io.OsmReader;12 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 13 14 import java.io.File;15 import java.io.InputStream;16 11 17 12 /** … … 39 34 tagChecker = new MapCSSTagChecker(); 40 35 tagChecker.initialize(); 41 try (InputStream in = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"))) { 42 dsCity = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); 43 } 36 dsCity = PerformanceTestUtils.getNeubrandenburgDataSet(); 44 37 } 45 38 -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java
r17275 r17615 10 10 import java.io.File; 11 11 import java.io.IOException; 12 import java.io.InputStream;13 12 import java.util.ArrayList; 14 13 import java.util.Collections; … … 44 43 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; 45 44 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; 46 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;47 import org.openstreetmap.josm.io.Compression;48 import org.openstreetmap.josm.io.OsmReader;49 45 import org.openstreetmap.josm.testutils.JOSMTestRules; 50 46 … … 169 165 MapPaintStyleLoader.reloadStyles(defaultStyleIdx); 170 166 171 try ( 172 InputStream fisC = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2")); 173 ) { 174 dsCity = OsmReader.parseDataSet(fisC, NullProgressMonitor.INSTANCE); 175 } 167 dsCity = PerformanceTestUtils.getNeubrandenburgDataSet(); 176 168 } 177 169 -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java
r17275 r17615 13 13 import org.junit.jupiter.api.BeforeAll; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 import org.openstreetmap.josm.PerformanceTestUtils; 15 16 import org.openstreetmap.josm.data.Bounds; 16 17 import org.openstreetmap.josm.data.osm.DataSet; … … 20 21 import org.openstreetmap.josm.gui.NavigatableComponent; 21 22 import org.openstreetmap.josm.gui.mappaint.MapRendererPerformanceTest; 22 import org.openstreetmap.josm.io.Compression;23 23 import org.openstreetmap.josm.io.IllegalDataException; 24 import org.openstreetmap.josm.io.OsmReader;25 24 26 25 /** … … 37 36 static final String STYLE_FILE = "resources/styles/standard/elemstyles.mapcss"; 38 37 39 /**40 * The data file to be rendered41 */42 static final String DATA_FILE = "nodist/data/neubrandenburg.osm.bz2";43 38 /* ------------------------ / configuration section ---------------------------- */ 44 39 … … 89 84 90 85 void loadData() throws IllegalDataException, IOException { 91 System.out.print("Loading data file '"+ DATA_FILE+"' ...");92 ds = OsmReader.parseDataSet(Compression.getUncompressedFileInputStream(new File(DATA_FILE)), null);86 System.out.print("Loading data file '"+PerformanceTestUtils.DATA_FILE+"' ..."); 87 ds = PerformanceTestUtils.getNeubrandenburgDataSet(); 93 88 System.out.println("DONE"); 94 89 } … … 116 111 ); 117 112 System.out.println("DONE"); 118 System.out.println("data file : "+ DATA_FILE);113 System.out.println("data file : "+PerformanceTestUtils.DATA_FILE); 119 114 System.out.println("style file: "+STYLE_FILE); 120 115 System.out.println(""); -
trunk/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java
r17275 r17615 30 30 class OsmReaderPerformanceTest { 31 31 private static final int TIMES = 4; 32 private static final String DATA_FILE = "nodist/data/neubrandenburg.osm.bz2";33 32 34 33 /** … … 65 64 is.reset(); 66 65 67 ds = OsmReader.parseDataSet(decompressBeforeRead ? is : Compression.byExtension( DATA_FILE)66 ds = OsmReader.parseDataSet(decompressBeforeRead ? is : Compression.byExtension(PerformanceTestUtils.DATA_FILE) 68 67 .getUncompressedInputStream(is), null); 69 68 } … … 73 72 74 73 private InputStream loadFile(boolean decompressBeforeRead) throws IOException { 75 File file = new File( DATA_FILE);74 File file = new File(PerformanceTestUtils.DATA_FILE); 76 75 try (InputStream is = decompressBeforeRead ? Compression.getUncompressedFileInputStream(file) : new FileInputStream(file)) { 77 76 ByteArrayOutputStream temporary = new ByteArrayOutputStream();
Note:
See TracChangeset
for help on using the changeset viewer.