use of org.xwiki.cache.CacheFactory in project xwiki-platform by xwiki.
the class DefaultLESSResourcesCacheTest method setUp.
@Before
public void setUp() throws Exception {
cacheManager = mocker.getInstance(CacheManager.class);
cache = mock(Cache.class);
CacheFactory cacheFactory = mock(CacheFactory.class);
when(cacheManager.getCacheFactory()).thenReturn(cacheFactory);
CacheConfiguration configuration = new CacheConfiguration("lesscss.skinfiles.cache");
when(cacheFactory.<String>newCache(eq(configuration))).thenReturn(cache);
cacheKeyFactory = mocker.getInstance(CacheKeyFactory.class);
LESSSkinFileResourceReference lessSkinFileResourceReference = new LESSSkinFileResourceReference("lessResource", null, null);
when(cacheKeyFactory.getCacheKey(eq(lessSkinFileResourceReference), eq(new FSSkinReference("skin")), eq(new NamedColorThemeReference("colorTheme")), eq(true))).thenReturn("12_lessResource_4_skin_10_colorTheme");
}
use of org.xwiki.cache.CacheFactory in project xwiki-platform by xwiki.
the class DefaultIconSetCacheTest method setUp.
@Before
public void setUp() throws Exception {
cacheManager = mocker.getInstance(CacheManager.class);
entityReferenceSerializer = mocker.getInstance(new DefaultParameterizedType(null, EntityReferenceSerializer.class, String.class));
cache = mock(Cache.class);
CacheFactory cacheFactory = mock(CacheFactory.class);
when(cacheManager.getCacheFactory()).thenReturn(cacheFactory);
CacheConfiguration configuration = new CacheConfiguration("iconset");
when(cacheFactory.<IconSet>newCache(eq(configuration))).thenReturn(cache);
}
use of org.xwiki.cache.CacheFactory in project xwiki-platform by xwiki.
the class DefaultColorThemeCache method initialize.
@Override
public void initialize() throws InitializationException {
try {
// Create the cache
CacheConfiguration configuration = new CacheConfiguration(LESS_COLOR_THEMES_CACHE_ID);
CacheFactory cacheFactory = cacheManager.getCacheFactory();
super.cache = cacheFactory.newCache(configuration);
// The Color Theme only depends on colors which do not depend on the XWikiContext. So we don't handle the
// XWikiContext in this cache.
super.isContextHandled = false;
} catch (ComponentLookupException | CacheException e) {
throw new InitializationException(String.format("Failed to initialize LESS color themes cache [%s].", LESS_COLOR_THEMES_CACHE_ID), e);
}
}
use of org.xwiki.cache.CacheFactory in project xwiki-platform by xwiki.
the class DefaultLESSResourcesCache method initialize.
@Override
public void initialize() throws InitializationException {
try {
CacheConfiguration configuration = new CacheConfiguration(LESS_FILES_CACHE_ID);
CacheFactory cacheFactory = cacheManager.getCacheFactory();
this.cache = cacheFactory.newCache(configuration);
} catch (ComponentLookupException | CacheException e) {
throw new InitializationException(String.format("Failed to initialize LESS skin files cache [%s].", LESS_FILES_CACHE_ID), e);
}
}
use of org.xwiki.cache.CacheFactory in project xwiki-platform by xwiki.
the class DefaultIconSetCache method initialize.
@Override
public void initialize() throws InitializationException {
try {
CacheConfiguration configuration = new CacheConfiguration(ICON_SET_CACHE_ID);
CacheFactory cacheFactory = cacheManager.getCacheFactory();
this.cache = cacheFactory.newCache(configuration);
} catch (ComponentLookupException | CacheException e) {
throw new InitializationException("Failed to initialize the IconSet Cache.", e);
}
}
Aggregations