use of org.xwiki.context.Execution in project xwiki-platform by xwiki.
the class WikiUIExtensionRendererTest method setUp.
@Before
public void setUp() throws Exception {
execution = cm.registerMockComponent(Execution.class);
ExecutionContext executionContext = mock(ExecutionContext.class);
renderingContext = mock(MutableRenderingContext.class);
cm.registerComponent(RenderingContext.class, renderingContext);
cm.registerMockComponent(Transformation.class, "macro");
contentParser = cm.registerMockComponent(ContentParser.class);
when(execution.getContext()).thenReturn(executionContext);
xdom = mock(XDOM.class);
}
use of org.xwiki.context.Execution in project xwiki-platform by xwiki.
the class DomainWikiReferenceExtractorTest method setUpConfiguration.
private void setUpConfiguration(WikiNotFoundBehavior wikiNotFoundBehavior) throws Exception {
// Simulate a configured Execution Context
Execution execution = mocker.getInstance(Execution.class);
when(execution.getContext()).thenReturn(new ExecutionContext());
StandardURLConfiguration urlConfiguration = mocker.getInstance(StandardURLConfiguration.class);
when(urlConfiguration.getWikiNotFoundBehavior()).thenReturn(wikiNotFoundBehavior);
}
use of org.xwiki.context.Execution in project xwiki-platform by xwiki.
the class FilesystemExportContextProviderTest method getWhenExportContextAlreadyInEC.
@Test
public void getWhenExportContextAlreadyInEC() throws Exception {
ExecutionContext ec = new ExecutionContext();
FilesystemExportContext fec = new FilesystemExportContext();
ec.setProperty("filesystemExportContext", fec);
Execution execution = this.mocker.getInstance(Execution.class);
when(execution.getContext()).thenReturn(ec);
FilesystemExportContext newfec = this.mocker.getComponentUnderTest().get();
assertSame(newfec, ec.getProperty("filesystemExportContext"));
assertSame(newfec, fec);
}
use of org.xwiki.context.Execution in project xwiki-platform by xwiki.
the class FilesystemExportContextProviderTest method getWhenExportContextNotInEC.
@Test
public void getWhenExportContextNotInEC() throws Exception {
ExecutionContext ec = new ExecutionContext();
Execution execution = this.mocker.getInstance(Execution.class);
when(execution.getContext()).thenReturn(ec);
FilesystemExportContext fec = this.mocker.getComponentUnderTest().get();
assertSame(fec, ec.getProperty("filesystemExportContext"));
}
use of org.xwiki.context.Execution in project xwiki-platform by xwiki.
the class ExtensionHistoryScriptServiceTest method configure.
@Before
public void configure() throws Exception {
Provider<XWikiContext> xcontextProvider = this.mocker.getInstance(XWikiContext.TYPE_PROVIDER);
when(xcontextProvider.get()).thenReturn(this.xcontext);
Execution execution = this.mocker.getInstance(Execution.class);
when(execution.getContext()).thenReturn(this.executionContext);
this.jobExecutor = this.mocker.getInstance(JobExecutor.class);
this.authorization = this.mocker.getInstance(ContextualAuthorizationManager.class);
this.documentAccessBridge = this.mocker.getInstance(DocumentAccessBridge.class);
}
Aggregations