/** * Tests that a fetched icon is added to the cache, and that the {@link * GraphicCache#clearCache()} method correctly clears the cache. */ public void testClearCache() { URL u = this.getClass().getResource("test-data/test.png"); Icon icon = image.getIcon(null, ff.literal(u), "image/png", -1); assertTrue(image.imageCache.containsKey(u)); assertNotNull(image.imageCache.get(u)); ((GraphicCache) image).clearCache(); assertTrue(image.imageCache.isEmpty()); } }
public void onReset() { // kill the image caches Iterator<ExternalGraphicFactory> it = DynamicSymbolFactoryFinder.getExternalGraphicFactories(); while (it.hasNext()) { ExternalGraphicFactory egf = it.next(); if (egf instanceof GraphicCache) { ((GraphicCache) egf).clearCache(); } } // reloads the font cache reloadFontCache(); // reset WMS Animator Executor Service resetAnimatorExecutorService(); }