Search in sources :

Example 1 with Cache

use of org.xwiki.cache.Cache 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");
}
Also used : NamedColorThemeReference(org.xwiki.lesscss.internal.colortheme.NamedColorThemeReference) CacheManager(org.xwiki.cache.CacheManager) FSSkinReference(org.xwiki.lesscss.internal.skin.FSSkinReference) CacheFactory(org.xwiki.cache.CacheFactory) CacheConfiguration(org.xwiki.cache.config.CacheConfiguration) Cache(org.xwiki.cache.Cache) LESSSkinFileResourceReference(org.xwiki.lesscss.internal.resources.LESSSkinFileResourceReference) Before(org.junit.Before)

Example 2 with Cache

use of org.xwiki.cache.Cache 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);
}
Also used : CacheManager(org.xwiki.cache.CacheManager) DefaultParameterizedType(org.xwiki.component.util.DefaultParameterizedType) CacheFactory(org.xwiki.cache.CacheFactory) CacheConfiguration(org.xwiki.cache.config.CacheConfiguration) Cache(org.xwiki.cache.Cache) IconSet(org.xwiki.icon.IconSet) Before(org.junit.Before)

Example 3 with Cache

use of org.xwiki.cache.Cache in project xwiki-platform by xwiki.

the class XWikiCacheStoreTest method before.

@Before
public void before() throws Exception {
    this.oldcore.getMocker().registerMockComponent(RemoteObservationManagerContext.class);
    this.oldcore.getMocker().registerMockComponent(ObservationManager.class);
    CacheManager cacheManager = this.oldcore.getMocker().registerMockComponent(CacheManager.class);
    cache = mock(Cache.class);
    when(cacheManager.<XWikiDocument>createNewCache(isCacheConfiguration("xwiki.store.pagecache"))).thenReturn(cache);
    existCache = mock(Cache.class);
    when(cacheManager.<Boolean>createNewCache(isCacheConfiguration("xwiki.store.pageexistcache"))).thenReturn(existCache);
}
Also used : XWikiDocument(com.xpn.xwiki.doc.XWikiDocument) CacheManager(org.xwiki.cache.CacheManager) Cache(org.xwiki.cache.Cache) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)3 Cache (org.xwiki.cache.Cache)3 CacheManager (org.xwiki.cache.CacheManager)3 CacheFactory (org.xwiki.cache.CacheFactory)2 CacheConfiguration (org.xwiki.cache.config.CacheConfiguration)2 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)1 DefaultParameterizedType (org.xwiki.component.util.DefaultParameterizedType)1 IconSet (org.xwiki.icon.IconSet)1 NamedColorThemeReference (org.xwiki.lesscss.internal.colortheme.NamedColorThemeReference)1 LESSSkinFileResourceReference (org.xwiki.lesscss.internal.resources.LESSSkinFileResourceReference)1 FSSkinReference (org.xwiki.lesscss.internal.skin.FSSkinReference)1