use of org.xwiki.cache.CacheManager 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);
}
use of org.xwiki.cache.CacheManager in project xwiki-platform by xwiki.
the class AbstractTestDocumentConfigurationSource method before.
@Before
public void before() throws Exception {
this.mockCache = mock(Cache.class);
this.mockConverter = this.componentManager.getInstance(ConverterManager.class);
when(this.mockConverter.convert(any(Type.class), anyObject())).then(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
return invocation.getArguments()[1];
}
});
CacheManager cacheManager = this.componentManager.getInstance(CacheManager.class);
when(cacheManager.createNewCache(any(CacheConfiguration.class))).thenReturn(this.mockCache);
WikiDescriptorManager wikiManager = this.componentManager.getInstance(WikiDescriptorManager.class);
when(wikiManager.getCurrentWikiId()).thenReturn(CURRENT_WIKI);
DocumentReferenceResolver<EntityReference> mockCurrentEntityResolver = this.componentManager.registerMockComponent(DocumentReferenceResolver.TYPE_REFERENCE, "current");
when(mockCurrentEntityResolver.resolve(eq(getClassReference()), any(DocumentReference.class))).thenReturn(new DocumentReference(getClassReference(), new WikiReference(CURRENT_WIKI)));
}
Aggregations