1 19 import java.util.Map ; 20 import javax.util.jcache.Cache; 21 import javax.util.jcache.CacheAccessFactory; 22 import javax.util.jcache.CacheAttributes; 23 import junit.framework.TestCase; 24 25 public class Bug974609_2 extends TestCase { 26 37 final public void testSetDiskSize() throws Exception { 38 CacheAttributes ca = CacheAttributes.getDefaultCacheAttributes(); 39 ca.setDiskPath(System.getProperty("java.io.tmpdir")); 40 ca.setDiskCacheSize(1); 41 ca.setMaxObjects(1); 42 ca.setLocal(); 43 CacheAccessFactory factory = CacheAccessFactory.getInstance(); 44 Cache cache = factory.getCache(); 45 cache.close(); 46 cache.init(ca); 47 Map map = factory.getMapAccess(); 48 map.put("one", new byte[1024*1024]); 49 map.put("two", new byte[1024*900]); 50 try { 51 map.put("three", new byte[1024*900]); 52 fail("Should throw CacheException, but did not."); 53 }catch(IllegalArgumentException e) { 54 } 56 } 57 } 58 | Popular Tags |