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);
}
Aggregations