use of org.apache.wiki.api.core.Page in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testSet3.
@Test
public void testSet3() throws Exception {
final String src = "Foobar.[{SET name= Janne Jalkanen}]";
final Page p = Wiki.contents().page(testEngine, PAGE_NAME);
final String res = translate(p, src);
Assertions.assertEquals("Foobar.", res, "Page text");
Assertions.assertEquals("Janne Jalkanen", p.getAttribute("name"));
}
use of org.apache.wiki.api.core.Page in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testSet1.
/**
* Metadata tests
*/
@Test
public void testSet1() throws Exception {
final String src = "Foobar.[{SET name=foo}]";
final Page p = Wiki.contents().page(testEngine, PAGE_NAME);
final String res = translate(p, src);
Assertions.assertEquals("Foobar.", res, "Page text");
Assertions.assertEquals("foo", p.getAttribute("name"));
}
use of org.apache.wiki.api.core.Page in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testHTMLWhenAllowed.
@Test
public void testHTMLWhenAllowed() throws Exception {
final String src = "<p>";
testEngine = TestEngine.build(with("jspwiki.translatorReader.allowHTML", "true"));
final Page page = Wiki.contents().page(testEngine, PAGE_NAME);
final String out = translate(testEngine, page, src);
Assertions.assertEquals("<p>", out);
}
use of org.apache.wiki.api.core.Page in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testSetHTML.
@Test
public void testSetHTML() throws Exception {
final String src = "Foobar.[{SET name='<b>danger</b>'}] [{$name}]";
final Page p = Wiki.contents().page(testEngine, PAGE_NAME);
final String res = translate(p, src);
Assertions.assertEquals("Foobar. <b>danger</b>", res, "Page text");
Assertions.assertEquals("<b>danger</b>", p.getAttribute("name"));
}
use of org.apache.wiki.api.core.Page in project jspwiki by apache.
the class IfPluginTest method testIfPluginIPNotAllowed.
/**
* Checks that IP address is granted.
*
* @throws WikiException test Assertions.failing.
*/
@Test
public void testIfPluginIPNotAllowed() throws WikiException {
final String src = "[{IfPlugin ip='!127.0.0.1'\n\nContent NOT visible for 127.0.0.1}]";
final String expected = "\n";
testEngine.saveText("Test", src);
final Page page = testEngine.getManager(PageManager.class).getPage("Test", PageProvider.LATEST_VERSION);
final Context context = getJanneBasedWikiContextFor(page);
final String res = testEngine.getManager(RenderingManager.class).getHTML(context, page);
Assertions.assertEquals(expected, res);
}
Aggregations