Changeset 18892 in josm for trunk/test/unit
- Timestamp:
- 2023-10-31T21:27:34+01:00 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTileTest.java
r18853 r18892 9 9 import java.util.stream.Stream; 10 10 11 import org.apache.commons.jcs3.access.behavior.ICacheAccess; 11 12 import org.awaitility.Awaitility; 12 13 import org.awaitility.Durations; 14 import org.junit.jupiter.api.AfterAll; 15 import org.junit.jupiter.api.BeforeAll; 13 16 import org.junit.jupiter.api.BeforeEach; 14 17 import org.junit.jupiter.params.ParameterizedTest; … … 18 21 import org.openstreetmap.gui.jmapviewer.interfaces.TileJob; 19 22 import org.openstreetmap.josm.TestUtils; 23 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry; 20 24 import org.openstreetmap.josm.data.cache.JCSCacheManager; 21 25 import org.openstreetmap.josm.data.imagery.ImageryInfo; … … 26 30 */ 27 31 class MVTTileTest { 32 private static ICacheAccess<String, BufferedImageCacheEntry> cache; 28 33 private MapboxVectorTileSource tileSource; 29 34 private MapboxVectorCachedTileLoader loader; 35 36 @BeforeAll 37 static void classSetup() { 38 cache = JCSCacheManager.getCache("testMapillaryCache"); 39 } 40 41 @AfterAll 42 static void classTearDown() { 43 cache.clear(); 44 cache = null; 45 } 46 30 47 @BeforeEach 31 48 void setup() { 49 cache.clear(); 32 50 tileSource = new MapboxVectorTileSource(new ImageryInfo("Test Mapillary", "file:/" + TestUtils.getTestDataRoot() 33 51 + "pbf/mapillary/{z}/{x}/{y}.mvt")); 34 loader = new MapboxVectorCachedTileLoader(null, 35 JCSCacheManager.getCache("testMapillaryCache"), new TileJobOptions(1, 1, Collections 36 .emptyMap(), 3600)); 52 final TileJobOptions options = new TileJobOptions(1, 1, Collections.emptyMap(), 3600); 53 loader = new MapboxVectorCachedTileLoader(null, cache, options); 37 54 } 38 55 … … 58 75 59 76 TileJob job = loader.createTileLoaderJob(tile); 60 job.submit(); 77 // Ensure that we are not getting a cached tile 78 job.submit(true); 61 79 Awaitility.await().atMost(Durations.ONE_SECOND).until(tile::isLoaded); 62 80 if (isLoaded) { 63 Awaitility.await().atMost(Durations.ONE_SECOND).until(() -> tile.get Layers() != null && tile.getLayers().size() > 1);81 Awaitility.await().atMost(Durations.ONE_SECOND).until(() -> tile.getImage() == MVTTile.CLEAR_LOADED); 64 82 assertEquals(2, tile.getLayers().size()); 65 83 assertEquals(4096, tile.getExtent());
Note:
See TracChangeset
for help on using the changeset viewer.