use of org.xwiki.wiki.descriptor.WikiDescriptorManager in project xwiki-platform by xwiki.
the class WebJarsScriptServiceTest method computeJavaScriptURLWithSuffixAndNoParameters.
@Test
public void computeJavaScriptURLWithSuffixAndNoParameters() throws Exception {
WikiDescriptorManager wikiDescriptorManager = this.mocker.getInstance(WikiDescriptorManager.class);
when(wikiDescriptorManager.getCurrentWikiId()).thenReturn("math");
WebJarsResourceReference resourceReference = new WebJarsResourceReference("wiki:math", Arrays.asList("angular", "angular.js"));
resourceReference.addParameter("r", "1");
when(this.serializer.serialize(resourceReference)).thenReturn(new ExtendedURL(Arrays.asList("xwiki", "angular", "angular.js"), resourceReference.getParameters()));
assertEquals("/xwiki/angular/angular.js?r=1", this.mocker.getComponentUnderTest().url("angular", "angular.js"));
}
use of org.xwiki.wiki.descriptor.WikiDescriptorManager in project xwiki-platform by xwiki.
the class DefaultNotificationEmailUserPreferenceManagerTest method setUp.
@Before
public void setUp() throws Exception {
documentAccessBridge = mocker.getInstance(DocumentAccessBridge.class);
referenceResolver = mocker.getInstance(DocumentReferenceResolver.TYPE_STRING);
wikiDescriptorManager = mocker.getInstance(WikiDescriptorManager.class);
when(wikiDescriptorManager.getMainWikiId()).thenReturn("mainWiki");
currentUser = new DocumentReference("someWiki", "XWiki", "User");
when(documentAccessBridge.getCurrentUserReference()).thenReturn(currentUser);
}
use of org.xwiki.wiki.descriptor.WikiDescriptorManager in project xwiki-platform by xwiki.
the class SolrReferenceResolverTest method registerComponents.
@BeforeComponent
public void registerComponents() throws Exception {
this.mocker.registerMockComponent(XWikiContext.TYPE_PROVIDER);
this.mocker.registerMockComponent(QueryManager.class);
WikiDescriptorManager wikiDescriptorManager = this.mocker.registerMockComponent(WikiDescriptorManager.class);
when(wikiDescriptorManager.getAllIds()).thenReturn(Arrays.asList(wikiReference1.getName(), wikiReference2.getName()));
}
use of org.xwiki.wiki.descriptor.WikiDescriptorManager in project xwiki-platform by xwiki.
the class WikiTemplateMigrationTest method setUp.
@Before
public void setUp() throws Exception {
wikiDescriptorManager = mocker.getInstance(WikiDescriptorManager.class);
queryManager = mocker.getInstance(QueryManager.class);
// documentReferenceResolver = mocker.getInstance(DocumentReferenceResolver.TYPE_STRING, "current");
documentReferenceResolver = mocker.getInstance(new DefaultParameterizedType(null, DocumentReferenceResolver.class, String.class));
execution = mock(Execution.class);
mocker.registerComponent(Execution.class, execution);
xcontext = mock(XWikiContext.class);
xwiki = mock(XWiki.class);
ExecutionContext executionContext = mock(ExecutionContext.class);
when(execution.getContext()).thenReturn(executionContext);
when(executionContext.getProperty("xwikicontext")).thenReturn(xcontext);
when(xcontext.getWiki()).thenReturn(xwiki);
when(wikiDescriptorManager.getMainWikiId()).thenReturn("mainWiki");
query = mock(Query.class);
when(queryManager.createQuery(any(), eq(Query.XWQL))).thenReturn(query);
}
use of org.xwiki.wiki.descriptor.WikiDescriptorManager in project xwiki-platform by xwiki.
the class WorkspaceMigrationTest method setUp.
@Before
public void setUp() throws Exception {
wikiDescriptorManager = mocker.getInstance(WikiDescriptorManager.class);
documentRestorerFromAttachedXAR = mocker.getInstance(DocumentRestorerFromAttachedXAR.class);
execution = mock(Execution.class);
mocker.registerComponent(Execution.class, execution);
xcontext = mock(XWikiContext.class);
xwiki = mock(XWiki.class);
ExecutionContext executionContext = mock(ExecutionContext.class);
when(execution.getContext()).thenReturn(executionContext);
when(executionContext.getProperty("xwikicontext")).thenReturn(xcontext);
when(xcontext.getWiki()).thenReturn(xwiki);
when(wikiDescriptorManager.getMainWikiId()).thenReturn("mainWiki");
}
Aggregations