@OldcoreTest @PageComponentList public class PageTest extends Object
loadPage(org.xwiki.model.reference.DocumentReference)
or renderPage(org.xwiki.model.reference.DocumentReference)
to load and
render a page located in the classpath.Modifier and Type | Field and Description |
---|---|
protected org.xwiki.test.mockito.MockitoComponentManager |
componentManager
The Component Manager to use for getting Component instances or registering Mock Components in the test,
provided for ease of use (can also be retrieved through
oldcore ). |
protected com.xpn.xwiki.XWikiContext |
context
The configured XWiki Context, provided for ease of use (can also be retrieved through
oldcore ). |
protected com.xpn.xwiki.test.MockitoOldcore |
oldcore |
protected XWikiServletRequestStub |
request
The stubbed request used to simulate a real Servlet Request.
|
protected XWikiServletResponseStub |
response
The stubbed response used to simulate a real Servlet Response.
|
protected com.xpn.xwiki.XWiki |
xwiki
The mocked XWiki instance, provided for ease of use (can also be retrieved through
oldcore ). |
Constructor and Description |
---|
PageTest() |
Modifier and Type | Method and Description |
---|---|
void |
configureComponentsBeforeOldcoreRuleForPageTest(org.xwiki.test.mockito.MockitoComponentManager componentManager)
Set up of Components after the Components declared in
ComponentList have been
handled but before MockitoOldcore.before(Class) has been called (i.e. |
protected com.xpn.xwiki.doc.XWikiDocument |
loadPage(org.xwiki.model.reference.DocumentReference documentReference) |
protected void |
registerVelocityTool(String name,
Object tool)
Adds a tool to the Velocity context.
|
protected org.jsoup.nodes.Document |
renderHTMLPage(org.xwiki.model.reference.DocumentReference reference)
Load the provided document reference, render the loaded document and parse the result using
Jsoup . |
protected org.jsoup.nodes.Document |
renderHTMLPage(com.xpn.xwiki.doc.XWikiDocument document)
Render the provided document and parse the result using
Jsoup . |
protected String |
renderPage(org.xwiki.model.reference.DocumentReference reference) |
protected void |
setOutputSyntax(org.xwiki.rendering.syntax.Syntax syntax)
Sets the Syntax with which the Document to test will be rendered into.
|
void |
setUpComponentsForPageTest(org.xwiki.test.mockito.MockitoComponentManager componentManager)
Set up components before Components declared in
ComponentList are handled. |
@InjectMockitoOldcore protected com.xpn.xwiki.test.MockitoOldcore oldcore
protected XWikiServletRequestStub request
protected XWikiServletResponseStub response
protected com.xpn.xwiki.XWiki xwiki
oldcore
).protected com.xpn.xwiki.XWikiContext context
oldcore
).@InjectComponentManager protected org.xwiki.test.mockito.MockitoComponentManager componentManager
oldcore
).@BeforeComponent public void setUpComponentsForPageTest(org.xwiki.test.mockito.MockitoComponentManager componentManager) throws Exception
ComponentList
are handled.componentManager
- the component manager to use to register mock componentsException
- in case of errors@AfterComponent public void configureComponentsBeforeOldcoreRuleForPageTest(org.xwiki.test.mockito.MockitoComponentManager componentManager) throws Exception
ComponentList
have been
handled but before MockitoOldcore.before(Class)
has been called (i.e. before it has created Mocks
and configured Components).componentManager
- the component managerException
- in case of errorsprotected com.xpn.xwiki.doc.XWikiDocument loadPage(org.xwiki.model.reference.DocumentReference documentReference) throws Exception
documentReference
- the reference of the Document to load from the ClassLoaderException
- in case of errorsprotected String renderPage(org.xwiki.model.reference.DocumentReference reference) throws Exception
reference
- the reference of the Document to load and render (and thus load from the Classloader)Exception
- in case of errorsprotected org.jsoup.nodes.Document renderHTMLPage(org.xwiki.model.reference.DocumentReference reference) throws Exception
Jsoup
.reference
- the reference of the Document to load, render, and parse (and thus load from the
Classloader)Jsoup
Exception
- in case of errorsprotected org.jsoup.nodes.Document renderHTMLPage(com.xpn.xwiki.doc.XWikiDocument document) throws Exception
Jsoup
.document
- the document to render and parseJsoup
Exception
- in case of errorsprotected void setOutputSyntax(org.xwiki.rendering.syntax.Syntax syntax) throws Exception
syntax
- the Syntax to render the Document intoException
- in case of errorsCopyright © 2004–2021 XWiki. All rights reserved.