/** * @param cacheKey the cacheKey to set. */ public void setCacheKey(final String cacheKey) { content.setCacheKey(cacheKey); }
@Test public void testSetCacheKey() throws IOException { final String defaultKey = "DEFAULT KEY"; final String testKey = "TEST KEY"; WContent wContent = new WContent(); Assert.assertNull("CacheKey should be null by default", wContent.getCacheKey()); wContent.setCacheKey(defaultKey); Assert.assertEquals("Incorrect value returned for default cache key", defaultKey, wContent. getCacheKey()); wContent.setLocked(true); setActiveContext(createUIContext()); Assert.assertEquals("Incorrect value returned for default cache key with user context", defaultKey, wContent.getCacheKey()); wContent.setCacheKey(testKey); Assert.assertEquals("Incorrect value returned for cache key with user context", testKey, wContent.getCacheKey()); resetContext(); Assert.assertEquals("Incorrect value returned for default cache key", defaultKey, wContent. getCacheKey()); }
setActiveContext(createUIContext()); wContent.setContentAccess(content); wContent.setCacheKey("abcd{}<>"); // this test needs the URLs to be consistent wContent.handleRequest(request);