Changeset 17275 in josm for trunk/test/performance/org/openstreetmap
- Timestamp:
- 2020-10-28T20:41:00+01:00 (4 years ago)
- Location:
- trunk/test/performance/org/openstreetmap/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNotSame;7 import static org.junit. Assert.assertSame;8 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNotSame; 7 import static org.junit.jupiter.api.Assertions.assertSame; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.security.SecureRandom; 11 11 import java.util.ArrayList; 12 12 import java.util.Random; 13 import java.util.concurrent.TimeUnit; 13 14 14 15 import org.apache.commons.lang3.RandomStringUtils; 15 16 import org.junit.Before; 16 import org.junit. Rule;17 import org.junit. Test;18 import org.junit. rules.Timeout;17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.Timeout; 19 import org.junit.jupiter.api.extension.RegisterExtension; 19 20 import org.openstreetmap.josm.PerformanceTestUtils; 20 21 import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; … … 28 29 * @author Michael Zangl 29 30 */ 30 public class KeyValuePerformanceTest { 31 @Timeout(value = 15*60, unit = TimeUnit.SECONDS) 32 class KeyValuePerformanceTest { 31 33 private static final int PUT_RUNS = 10000; 32 34 private static final int GET_RUNS = 100000; … … 38 40 39 41 /** 40 * Global timeout applied to all test methods.41 */42 @Rule43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")44 public Timeout globalTimeout = Timeout.seconds(15*60);45 46 /**47 42 * Prepare the test. 48 43 */ 49 @R ule44 @RegisterExtension 50 45 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 51 46 public JOSMTestRules test = new JOSMTestRules().projection(); … … 56 51 @Test 57 52 @SuppressFBWarnings(value = "DM_STRING_CTOR", justification = "test Strings that are interned and those that are not") 58 publicvoid testMeasureStringEqualsIntern() {53 void testMeasureStringEqualsIntern() { 59 54 String str1Interned = "string1"; 60 55 String str1InternedB = "string1"; … … 134 129 */ 135 130 @Test 136 publicvoid testKeyValuePut() {131 void testKeyValuePut() { 137 132 for (double tagNodeRatio : TAG_NODE_RATIOS) { 138 133 int nodeCount = (int) (PUT_RUNS / tagNodeRatio); … … 158 153 @Test 159 154 @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") 160 publicvoid testKeyValueGet() {155 void testKeyValueGet() { 161 156 for (double tagNodeRatio : TAG_NODE_RATIOS) { 162 157 KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio); … … 179 174 */ 180 175 @Test 181 publicvoid testKeyValueGetKeys() {176 void testKeyValueGetKeys() { 182 177 for (double tagNodeRatio : TAG_NODE_RATIOS) { 183 178 KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio); … … 202 197 @Test 203 198 @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") 204 publicvoid testKeyValueGetKeysGet() {199 void testKeyValueGetKeysGet() { 205 200 for (double tagNodeRatio : TAG_NODE_RATIOS) { 206 201 KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio); -
trunk/test/performance/org/openstreetmap/josm/data/osm/RoundingPerformanceTest.java
r10758 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.data.coor.LatLon; 8 8 import org.openstreetmap.josm.data.coor.LatLonTest; … … 13 13 * Checks that rounding of coordinates is not too slow. 14 14 */ 15 publicclass RoundingPerformanceTest {15 class RoundingPerformanceTest { 16 16 17 17 private static double oldRoundToOsmPrecision(double value) { … … 25 25 @Test 26 26 @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") 27 publicvoid testRounding() {27 void testRounding() { 28 28 final int n = 1000000; 29 29 long start = System.nanoTime(); -
trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java
r16006 r17275 11 11 import java.nio.file.Files; 12 12 import java.nio.file.Paths; 13 import java.util.concurrent.TimeUnit; 13 14 14 15 import javax.imageio.ImageIO; 15 16 16 import org.junit.Rule; 17 import org.junit.Test; 18 import org.junit.rules.Timeout; 17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.Timeout; 19 19 import org.openstreetmap.josm.JOSMFixture; 20 20 import org.openstreetmap.josm.data.Bounds; … … 30 30 * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}. 31 31 */ 32 public abstract class AbstractMapRendererPerformanceTestParent { 32 @Timeout(value = 15*60, unit = TimeUnit.SECONDS) 33 abstract class AbstractMapRendererPerformanceTestParent { 33 34 34 35 private static final int IMG_WIDTH = 1400; … … 45 46 private static DataSet dsOverpass; 46 47 private static DataSet dsCity; 47 48 /**49 * Global timeout applied to all test methods.50 */51 @Rule52 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")53 public Timeout globalTimeout = Timeout.seconds(15*60);54 48 55 49 protected static void load() throws Exception { … … 112 106 113 107 @Test 114 publicvoid testRestriction() throws Exception {108 void testRestriction() throws Exception { 115 109 test(700, dsRestriction, new Bounds(51.12, 14.147472381591795, 51.128, 14.162492752075195)); 116 110 } 117 111 118 112 @Test 119 publicvoid testRestrictionSmall() throws Exception {113 void testRestrictionSmall() throws Exception { 120 114 test(1500, dsRestriction, new Bounds(51.125, 14.147, 51.128, 14.152)); 121 115 } 122 116 123 117 @Test 124 publicvoid testMultipolygon() throws Exception {118 void testMultipolygon() throws Exception { 125 119 test(400, dsMultipolygon, new Bounds(60, -180, 85, -122)); 126 120 } 127 121 128 122 @Test 129 publicvoid testMultipolygonSmall() throws Exception {123 void testMultipolygonSmall() throws Exception { 130 124 test(850, dsMultipolygon, new Bounds(-90, -180, 90, 180)); 131 125 } … … 135 129 * Complex polygon (Lake Ontario) with small download area. 136 130 */ 137 publicvoid testOverpassDownload() throws Exception {131 void testOverpassDownload() throws Exception { 138 132 test(20, dsOverpass, new Bounds(43.4510496, -76.536684, 43.4643202, -76.4954853)); 139 133 } 140 134 141 135 @Test 142 publicvoid testCity() throws Exception {136 void testCity() throws Exception { 143 137 test(50, dsCity, new Bounds(53.51, 13.20, 53.59, 13.34)); 144 138 } 145 139 146 140 @Test 147 publicvoid testCitySmall() throws Exception {141 void testCitySmall() throws Exception { 148 142 test(70, dsCity, new Bounds(52, 11, 55, 14)); 149 143 } 150 144 151 145 @Test 152 publicvoid testCityPart1() throws Exception {146 void testCityPart1() throws Exception { 153 147 test(250, dsCity, new Bounds(53.56, 13.25, 53.57, 13.26)); 154 148 } 155 149 156 150 @Test 157 publicvoid testCityPart2() throws Exception {151 void testCityPart2() throws Exception { 158 152 test(200, dsCity, new Bounds(53.55, 13.29, 53.57, 13.30)); 159 153 } 160 154 161 155 @Test 162 publicvoid testCitySmallPart2() throws Exception {156 void testCitySmallPart2() throws Exception { 163 157 test(200, dsCity, new Bounds(53.56, 13.295, 53.57, 13.30)); 164 158 } -
trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java
r10907 r17275 7 7 import javax.imageio.ImageIO; 8 8 9 import org.junit. AfterClass;10 import org.junit. BeforeClass;9 import org.junit.jupiter.api.AfterAll; 10 import org.junit.jupiter.api.BeforeAll; 11 11 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 12 12 … … 16 16 * Performance test of {@code StyledMapRenderer}. 17 17 */ 18 publicclass StyledMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {18 class StyledMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent { 19 19 20 @Before Class20 @BeforeAll 21 21 public static void load() throws Exception { 22 22 AbstractMapRendererPerformanceTestParent.load(); … … 25 25 } 26 26 27 @After Class27 @AfterAll 28 28 public static void clean() throws Exception { 29 29 AbstractMapRendererPerformanceTestParent.clean(); -
trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRendererPerformanceTest.java
r10907 r17275 2 2 package org.openstreetmap.josm.data.osm.visitor.paint; 3 3 4 import org.junit. AfterClass;5 import org.junit. BeforeClass;4 import org.junit.jupiter.api.AfterAll; 5 import org.junit.jupiter.api.BeforeAll; 6 6 7 7 /** 8 8 * Performance test of {@code WireframeMapRenderer}. 9 9 */ 10 publicclass WireframeMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {10 class WireframeMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent { 11 11 12 @Before Class12 @BeforeAll 13 13 public static void load() throws Exception { 14 14 AbstractMapRendererPerformanceTestParent.load(); 15 15 } 16 16 17 @After Class17 @AfterAll 18 18 public static void clean() throws Exception { 19 19 AbstractMapRendererPerformanceTestParent.clean(); -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java
r16822 r17275 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import static org.junit.jupiter.api.Assertions.assertEquals; 3 5 4 6 import java.awt.Color; … … 20 22 import javax.imageio.ImageIO; 21 23 22 import org.junit.AfterClass;23 24 import org.junit.Assert; 24 import org.junit.BeforeClass; 25 import org.junit.Rule; 26 import org.junit.Test; 25 import org.junit.jupiter.api.AfterAll; 26 import org.junit.jupiter.api.BeforeAll; 27 import org.junit.jupiter.api.Test; 28 import org.junit.jupiter.api.extension.RegisterExtension; 27 29 import org.openstreetmap.josm.JOSMFixture; 28 30 import org.openstreetmap.josm.PerformanceTestUtils; … … 49 51 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 50 52 51 import static org.junit.Assert.assertEquals;52 53 53 /** 54 54 * Performance test of map renderer. … … 87 87 * Setup tests 88 88 */ 89 @R ule89 @RegisterExtension 90 90 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 91 91 public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().preferences().timeout(15 * 60 * 1000); … … 95 95 * @throws Exception if any error occurs 96 96 */ 97 @Before Class97 @BeforeAll 98 98 public static void load() throws Exception { 99 99 JOSMFixture.createPerformanceTestFixture().init(true); … … 179 179 * Cleanup test environment. 180 180 */ 181 @After Class181 @AfterAll 182 182 public static void cleanUp() { 183 183 setFilterStyleActive(false); … … 283 283 */ 284 284 @Test 285 publicvoid testPerformanceGenerate() throws IOException {285 void testPerformanceGenerate() throws IOException { 286 286 setFilterStyleActive(false); 287 287 PerformanceTester test = new PerformanceTester(); … … 322 322 */ 323 323 @Test 324 publicvoid testPerformanceDrawFeatures() throws IOException {324 void testPerformanceDrawFeatures() throws IOException { 325 325 testDrawFeature(null); 326 326 for (Feature f : Feature.values()) { … … 352 352 } 353 353 354 publicstatic class BenchmarkData extends CapturingBenchmark {354 static class BenchmarkData extends CapturingBenchmark { 355 355 356 356 private List<StyleRecord> allStyleElems; -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSConditionPerformanceTest.java
r10837 r17275 4 4 import java.util.EnumSet; 5 5 6 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.PerformanceTestUtils; 8 8 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op; … … 12 12 * @author Michael Zangl 13 13 */ 14 publicclass MapCSSConditionPerformanceTest {14 class MapCSSConditionPerformanceTest { 15 15 /** 16 16 * Test the performance of all OP entries. 17 17 */ 18 18 @Test 19 publicvoid testAllOps() {19 void testAllOps() { 20 20 // The JIT does some really heavy optimisations if it notices that other values are not used. 21 21 // If we want to simulate a real scenario, we need to invoke every op several times to let the compiler -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 5 5 6 6 import java.awt.Graphics2D; … … 10 10 import java.util.Collection; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.BeforeAll; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.data.Bounds; … … 29 29 * 30 30 */ 31 publicclass MapCSSPerformanceTest {31 class MapCSSPerformanceTest { 32 32 33 33 /* ------------------------ configuration section ---------------------------- */ … … 56 56 * Setup test. 57 57 */ 58 @Before Class58 @BeforeAll 59 59 public static void createJOSMFixture() { 60 60 JOSMFixture.createPerformanceTestFixture().init(true); -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import org.junit.BeforeClass; 5 import org.junit.Rule; 6 import org.junit.Test; 7 import org.junit.rules.Timeout; 4 import java.util.concurrent.TimeUnit; 5 6 import org.junit.jupiter.api.BeforeAll; 7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.Timeout; 8 9 import org.openstreetmap.josm.JOSMFixture; 9 10 import org.openstreetmap.josm.PerformanceTestUtils; … … 13 14 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 14 15 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;16 17 16 /** 18 17 * Tests how fast {@link MapCSSStyleSource} finds the right style candidates for one object. 19 18 * @author Michael Zangl 20 19 */ 21 public class MapCSSStyleSourceFilterTest { 20 @Timeout(value = 15*60, unit = TimeUnit.SECONDS) 21 class MapCSSStyleSourceFilterTest { 22 22 23 23 private static final int TEST_RULE_COUNT = 10000; … … 82 82 83 83 /** 84 * Global timeout applied to all test methods.85 */86 @Rule87 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")88 public Timeout globalTimeout = Timeout.seconds(15*60);89 90 /**91 84 * Prepare the test. 92 85 */ 93 @Before Class86 @BeforeAll 94 87 public static void createJOSMFixture() { 95 88 JOSMFixture.createPerformanceTestFixture().init(true); … … 100 93 */ 101 94 @Test 102 publicvoid testKeyValueRules() {95 void testKeyValueRules() { 103 96 KeyValueDataGenerator data = OsmDataGenerator.getKeyValue(); 104 97 data.generateDataSet(); … … 111 104 */ 112 105 @Test 113 publicvoid testKeyOnlyRules() {106 void testKeyOnlyRules() { 114 107 KeyValueDataGenerator data = OsmDataGenerator.getKeyValue(); 115 108 data.generateDataSet(); … … 122 115 */ 123 116 @Test 124 publicvoid testRegularExpressionRules() {117 void testRegularExpressionRules() { 125 118 KeyValueDataGenerator data = OsmDataGenerator.getKeyValue(); 126 119 data.generateDataSet(); … … 133 126 */ 134 127 @Test 135 publicvoid testIsTrueRules() {128 void testIsTrueRules() { 136 129 KeyValueDataGenerator data = OsmDataGenerator.getKeyValue(); 137 130 data.generateDataSet(); -
trunk/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 6 import java.io.ByteArrayInputStream; … … 10 10 import java.io.IOException; 11 11 import java.io.InputStream; 12 import java.util.concurrent.TimeUnit; 12 13 13 import org.junit.BeforeClass; 14 import org.junit.Rule; 15 import org.junit.Test; 16 import org.junit.rules.Timeout; 14 import org.junit.jupiter.api.BeforeAll; 15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.Timeout; 17 17 import org.openstreetmap.josm.JOSMFixture; 18 18 import org.openstreetmap.josm.PerformanceTestUtils; 19 19 import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; 20 20 import org.openstreetmap.josm.data.osm.DataSet; 21 22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;23 21 24 22 /** … … 29 27 * @author Michael Zangl 30 28 */ 31 public class OsmReaderPerformanceTest { 29 @Timeout(value = 15*60, unit = TimeUnit.SECONDS) 30 class OsmReaderPerformanceTest { 32 31 private static final int TIMES = 4; 33 32 private static final String DATA_FILE = "nodist/data/neubrandenburg.osm.bz2"; 34 33 35 34 /** 36 * Global timeout applied to all test methods.37 */38 @Rule39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")40 public Timeout globalTimeout = Timeout.seconds(15*60);41 42 /**43 35 * Prepare the test. 44 36 */ 45 @Before Class37 @BeforeAll 46 38 public static void createJOSMFixture() { 47 39 JOSMFixture.createPerformanceTestFixture().init(true); … … 53 45 */ 54 46 @Test 55 publicvoid testCompressed() throws Exception {47 void testCompressed() throws Exception { 56 48 runTest("compressed (.osm.bz2)", false); 57 49 } … … 62 54 */ 63 55 @Test 64 publicvoid testPlain() throws Exception {56 void testPlain() throws Exception { 65 57 runTest(".osm-file", true); 66 58 }
Note:
See TracChangeset
for help on using the changeset viewer.