@Test public void testMaxSizeEviction() { for (int i = 0; i < 20; i++) { service.addDownloadResource(new MockDownloadResource("" + i)); } assertTrue(cache.getCacheSize() <= 10); cache.clearCache(); }
public String addDownloadResource(DownloadResource resource) { String id = Integer.toString(resource.hashCode()); if (resource.getDownloadType() != null) { id = resource.getDownloadType() + ":/" + id; } downloadResources_.put(id, resource); return id; }
DownloadService { public String addDownloadResource(DownloadResource resource) { String id = Integer.toString(resource.hashCode()); if (resource.getDownloadType() != null) { id = resource.getDownloadType() + ":/" + id; } downloadResources_.put(id, resource); return id; } }
DownloadService { public String addDownloadResource(DownloadResource resource) { String id = Integer.toString(resource.hashCode()); if (resource.getDownloadType() != null) { id = resource.getDownloadType() + ":/" + id; } downloadResources_.put(id, resource); return id; } DownloadService(PortalContainerInfo pinfo, InitParams params); }
DownloadService { public String addDownloadResource(DownloadResource resource) { String id = Integer.toString(resource.hashCode()); if (resource.getDownloadType() != null) { id = resource.getDownloadType() + ":/" + id; } downloadResources_.put(id, resource); return id; } DownloadService(PortalContainerInfo pinfo, InitParams params); void addDefaultDownloadResource(DownloadResource resource); String addDownloadResource(DownloadResource resource); DownloadResource getDownloadResource(String id); String getDownloadLink(String id); ExoCache<String, DownloadResource> getCache(); }
DownloadService { public String addDownloadResource(DownloadResource resource) { String id = Integer.toString(resource.hashCode()); if (resource.getDownloadType() != null) { id = resource.getDownloadType() + ":/" + id; } downloadResources_.put(id, resource); return id; } DownloadService(PortalContainerInfo pinfo, InitParams params); void addDefaultDownloadResource(DownloadResource resource); String addDownloadResource(DownloadResource resource); DownloadResource getDownloadResource(String id); String getDownloadLink(String id); ExoCache<String, DownloadResource> getCache(); static final String DOWNLOAD_HANDLER_PATH; }