Search in sources :

Example 1 with WikiTemplateManager

use of org.xwiki.wiki.template.WikiTemplateManager in project xwiki-platform by xwiki.

the class WikiTemplateManagerScriptTest method setUp.

@Before
public void setUp() throws Exception {
    wikiTemplateManager = mocker.getInstance(WikiTemplateManager.class);
    wikiDescriptorManager = mocker.getInstance(WikiDescriptorManager.class);
    authorizationManager = mocker.getInstance(AuthorizationManager.class);
    entityReferenceSerializer = mocker.getInstance(new DefaultParameterizedType(null, EntityReferenceSerializer.class, String.class));
    xcontextProvider = mocker.registerMockComponent(XWikiContext.TYPE_PROVIDER);
    xcontext = mock(XWikiContext.class);
    when(xcontextProvider.get()).thenReturn(xcontext);
    execution = mocker.getInstance(Execution.class);
    executionContext = new ExecutionContext();
    when(execution.getContext()).thenReturn(executionContext);
    currentUserRef = new DocumentReference("mainWiki", "XWiki", "User");
    when(xcontext.getUserReference()).thenReturn(currentUserRef);
    currentDoc = mock(XWikiDocument.class);
    when(xcontext.getDoc()).thenReturn(currentDoc);
    when(xcontext.getMainXWiki()).thenReturn("mainWiki");
    when(entityReferenceSerializer.serialize(currentUserRef)).thenReturn("mainWiki:XWiki.User");
}
Also used : XWikiDocument(com.xpn.xwiki.doc.XWikiDocument) Execution(org.xwiki.context.Execution) ExecutionContext(org.xwiki.context.ExecutionContext) WikiDescriptorManager(org.xwiki.wiki.descriptor.WikiDescriptorManager) XWikiContext(com.xpn.xwiki.XWikiContext) AuthorizationManager(org.xwiki.security.authorization.AuthorizationManager) DefaultParameterizedType(org.xwiki.component.util.DefaultParameterizedType) DocumentReference(org.xwiki.model.reference.DocumentReference) WikiTemplateManager(org.xwiki.wiki.template.WikiTemplateManager) Before(org.junit.Before)

Aggregations

XWikiContext (com.xpn.xwiki.XWikiContext)1 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)1 Before (org.junit.Before)1 DefaultParameterizedType (org.xwiki.component.util.DefaultParameterizedType)1 Execution (org.xwiki.context.Execution)1 ExecutionContext (org.xwiki.context.ExecutionContext)1 DocumentReference (org.xwiki.model.reference.DocumentReference)1 AuthorizationManager (org.xwiki.security.authorization.AuthorizationManager)1 WikiDescriptorManager (org.xwiki.wiki.descriptor.WikiDescriptorManager)1 WikiTemplateManager (org.xwiki.wiki.template.WikiTemplateManager)1