Changeset 32984 in osm for applications/editors


Ignore:
Timestamp:
2016-09-11T14:14:51+02:00 (8 years ago)
Author:
nokutu
Message:

Fixed CacheTest

Location:
applications/editors/josm/plugins/mapillary
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/build.gradle

    r32693 r32984  
    4545   * If not, choose the next higher number that is available, or the gradle build will break.
    4646   */
    47   compile(':josm:10583')
     47  compile(':josm:10966')
    4848  // For plugins it's irrelevant, which version is specified, always the latest version is used.
    4949  requiredPlugin (name: 'apache-commons'){changing=true}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java

    r32979 r32984  
    66import java.util.HashMap;
    77
     8import org.apache.commons.jcs.access.CacheAccess;
    89import org.openstreetmap.josm.Main;
    910import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
     
    4445   */
    4546  public MapillaryCache(String key, Type type) {
    46     super(MapillaryPlugin.getCache(), 50000, 50000, new HashMap<>());
     47    this(MapillaryPlugin.getCache(), key, type);
     48  }
     49
     50  protected MapillaryCache(CacheAccess<String, BufferedImageCacheEntry> cache, String key, Type type) {
     51    super(cache, 50000, 50000, new HashMap<>());
    4752    String k = null;
    4853    URL u = null;
  • applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCacheTest.java

    r32923 r32984  
    99import java.io.IOException;
    1010
     11import org.apache.commons.jcs.access.CacheAccess;
    1112import org.junit.Before;
    1213import org.junit.Test;
    1314import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
    1416import org.openstreetmap.josm.data.cache.JCSCacheManager;
    1517import org.openstreetmap.josm.plugins.mapillary.AbstractTest;
     
    1820
    1921public class MapillaryCacheTest extends AbstractTest {
    20 
    21   @Before
    22   public void setUp() throws IOException {
    23     MapillaryPlugin.cache = JCSCacheManager.getCache("mapillary", 10, 10000,
    24            new File(Main.pref.getPluginsDirectory(), "mapillary").getPath() + "/cache/");
    25   }
    2622 
    2723  @Test
    28   public void test() {
    29     MapillaryCache cache = new MapillaryCache("00000", Type.FULL_IMAGE);
     24  public void test() throws IOException {
     25    CacheAccess<String, BufferedImageCacheEntry> cacheAccess = JCSCacheManager.getCache("mapillary", 10, 10000,
     26      new File(Main.pref.getPluginsDirectory(), "mapillary").getPath() + "/cache/");
     27
     28    MapillaryCache cache = new MapillaryCache(cacheAccess, "00000", Type.FULL_IMAGE);
    3029    assertNotEquals(null, cache.getUrl());
    3130    assertNotEquals(null, cache.getCacheKey());
     
    3332    assertFalse(cache.isObjectLoadable());
    3433
    35     cache = new MapillaryCache("00000", Type.THUMBNAIL);
     34    cache = new MapillaryCache(cacheAccess, "00000", Type.THUMBNAIL);
    3635    assertNotEquals(null, cache.getCacheKey());
    3736    assertNotEquals(null, cache.getUrl());
    3837
    39     cache = new MapillaryCache(null, null);
     38    cache = new MapillaryCache(cacheAccess, null, null);
    4039    assertEquals(null, cache.getCacheKey());
    4140    assertEquals(null, cache.getUrl());
Note: See TracChangeset for help on using the changeset viewer.