Search in sources :

Example 1 with ScriptServiceManager

use of org.xwiki.script.service.ScriptServiceManager in project xwiki-platform by xwiki.

the class WikiManagerScriptServiceTest method setUp.

@Before
public void setUp() throws Exception {
    wikiManager = mocker.getInstance(WikiManager.class);
    wikiDescriptorManager = mocker.getInstance(WikiDescriptorManager.class);
    authorizationManager = mocker.getInstance(AuthorizationManager.class);
    scriptServiceManager = mocker.getInstance(ScriptServiceManager.class);
    entityReferenceSerializer = mocker.getInstance(new DefaultParameterizedType(null, EntityReferenceSerializer.class, String.class));
    standardURLConfiguration = mocker.getInstance(StandardURLConfiguration.class);
    wikiConfiguration = mocker.getInstance(WikiConfiguration.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(wikiDescriptorManager.getMainWikiId()).thenReturn("mainWiki");
    when(entityReferenceSerializer.serialize(currentUserRef)).thenReturn("mainWiki:XWiki.User");
    wikiDescriptorDocumentHelper = mocker.getInstance(WikiDescriptorDocumentHelper.class);
}
Also used : WikiDescriptorManager(org.xwiki.wiki.descriptor.WikiDescriptorManager) WikiConfiguration(org.xwiki.wiki.configuration.WikiConfiguration) ScriptServiceManager(org.xwiki.script.service.ScriptServiceManager) XWikiContext(com.xpn.xwiki.XWikiContext) WikiDescriptorDocumentHelper(org.xwiki.wiki.internal.descriptor.document.WikiDescriptorDocumentHelper) WikiManager(org.xwiki.wiki.manager.WikiManager) XWikiDocument(com.xpn.xwiki.doc.XWikiDocument) Execution(org.xwiki.context.Execution) ExecutionContext(org.xwiki.context.ExecutionContext) AuthorizationManager(org.xwiki.security.authorization.AuthorizationManager) DefaultParameterizedType(org.xwiki.component.util.DefaultParameterizedType) StandardURLConfiguration(org.xwiki.url.internal.standard.StandardURLConfiguration) DocumentReference(org.xwiki.model.reference.DocumentReference) 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 ScriptServiceManager (org.xwiki.script.service.ScriptServiceManager)1 AuthorizationManager (org.xwiki.security.authorization.AuthorizationManager)1 StandardURLConfiguration (org.xwiki.url.internal.standard.StandardURLConfiguration)1 WikiConfiguration (org.xwiki.wiki.configuration.WikiConfiguration)1 WikiDescriptorManager (org.xwiki.wiki.descriptor.WikiDescriptorManager)1 WikiDescriptorDocumentHelper (org.xwiki.wiki.internal.descriptor.document.WikiDescriptorDocumentHelper)1 WikiManager (org.xwiki.wiki.manager.WikiManager)1