Changeset 10652 in josm for trunk/test/unit/org
- Timestamp:
- 2016-07-26T22:06:52+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCacheManagerTest.java
r10559 r10652 2 2 package org.openstreetmap.josm.data.cache; 3 3 4 import static org.junit.Assert.assertEquals; 5 6 import java.io.File; 7 import java.io.FileOutputStream; 4 8 import java.io.IOException; 5 9 import java.util.logging.Logger; 6 10 11 import org.apache.commons.jcs.access.CacheAccess; 12 import org.apache.commons.jcs.auxiliary.disk.block.BlockDiskCacheAttributes; 7 13 import org.junit.BeforeClass; 8 14 import org.junit.Test; … … 31 37 Logger.getLogger("org.apache.commons.jcs").warning("{switch:0}"); 32 38 } 39 40 @Test 41 public void testUseBigDiskFile() throws IOException { 42 if (JCSCacheManager.USE_BLOCK_CACHE.get()) { 43 // test only when using block cache 44 File cacheFile = new File("foobar/testUseBigDiskFile_BLOCK_v2.data"); 45 if (!cacheFile.exists()) { 46 cacheFile.createNewFile(); 47 } 48 try (FileOutputStream fileOutputStream = new FileOutputStream(cacheFile, false)) { 49 fileOutputStream.getChannel().truncate(0); 50 fileOutputStream.write(new byte[1024*1024*10]); // create 10MB empty file 51 } 52 53 CacheAccess<Object, Object> cache = JCSCacheManager.getCache("testUseBigDiskFile", 1, 100, "foobar"); 54 assertEquals("BlockDiskCache use file size to calculate its size", 10*1024, 55 ((BlockDiskCacheAttributes)cache.getCacheControl().getAuxCaches()[0].getAuxiliaryCacheAttributes()).getMaxKeySize()); 56 } 57 } 58 33 59 }
Note:
See TracChangeset
for help on using the changeset viewer.