use of org.xwiki.url.filesystem.FilesystemExportContext 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.url.filesystem.FilesystemExportContext 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.url.filesystem.FilesystemExportContext in project xwiki-platform by xwiki.
the class FilesystemExportContextTest method getSetDocParentLevels.
@Test
public void getSetDocParentLevels() {
FilesystemExportContext context = new FilesystemExportContext();
context.setDocParentLevels(5);
assertEquals(5, context.getDocParentLevel());
}
use of org.xwiki.url.filesystem.FilesystemExportContext in project xwiki-platform by xwiki.
the class ExportURLFactoryTest method setUp.
@Before
public void setUp() throws Exception {
this.urlFactory = new ExportURLFactory();
this.tmpDir = this.tmpDirRule.newFolder("xwikitests");
new File(this.tmpDir, "attachment").mkdir();
Provider<FilesystemExportContext> exportContextProvider = this.oldcoreRule.getMocker().getInstance(new DefaultParameterizedType(null, Provider.class, FilesystemExportContext.class));
this.exportContext = exportContextProvider.get();
doReturn("/xwiki").when(this.oldcoreRule.getSpyXWiki()).getWebAppPath(any(XWikiContext.class));
XWikiContext context = this.oldcoreRule.getXWikiContext();
XWikiRequest request = mock(XWikiRequest.class);
context.setRequest(request);
context.setURL(new URL("http://www.xwiki.org/"));
this.urlFactory.init(null, this.tmpDir, this.exportContext, context);
}
Aggregations