ResourceCache { public IResource getCache(IResourceUrn urn, IResourceLocale locale, boolean isSecure) { return m_cache.get(new CacheKey(locale, urn, isSecure)); }  IResource getCache(IResourceUrn urn, IResourceLocale locale, boolean isSecure); void putCache(IResourceUrn urn, IResourceLocale locale, boolean isSecure, IResource resource); void putCaches(String namespace, Map<String, List<IResource>> map, boolean isSecure);  }
@Test public void testCacheManager() { ResourceCacheManager cacheManager = ResourceRuntimeContext.ctx().getConfig().getCacheManager(); cacheManager.setCache("key", "value1"); Assert.assertEquals("value1", cacheManager.getCache("key")); IResource resource = ResourceFactory.createResource("/js/sample/sample.js"); cacheManager.putResourceCache(resource.getLocale(), resource, false); IResource actual = cacheManager.getResourceCache(resource.getUrn(), resource.getLocale(), false); Assert.assertEquals(resource, actual); IResource resource1 = ResourceFactory.createResource("/js/sample/sample1.js"); IResource resource2 = ResourceFactory.createResource("/js/sample/sample2.js"); Map<String, List<IResource>> map = new HashMap<String, List<IResource>>(); List<IResource> value = new ArrayList<IResource>(); value.add(resource1); value.add(resource2); map.put(null, value); cacheManager.putResourceCaches("local", map, false); Assert.assertEquals(resource2, cacheManager.getResourceCache().getCache(resource2.getUrn(), null, false)); }