use of org.apache.wiki.WikiPage in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testSet4.
@Test
public void testSet4() throws Exception {
String src = "Foobar.[{SET name='Janne Jalkanen'}][{SET too='{$name}'}]";
WikiPage p = new WikiPage(testEngine, PAGE_NAME);
String res = translate(p, src);
Assert.assertEquals("Page text", "Foobar.", res);
Assert.assertEquals("Janne Jalkanen", p.getAttribute("name"));
Assert.assertEquals("Janne Jalkanen", p.getAttribute("too"));
}
use of org.apache.wiki.WikiPage in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testHTMLWhenAllowed.
@Test
public void testHTMLWhenAllowed() throws Exception {
String src = "<p>";
props.setProperty("jspwiki.translatorReader.allowHTML", "true");
testEngine = new TestEngine(props);
WikiPage page = new WikiPage(testEngine, PAGE_NAME);
String out = translate(testEngine, page, src);
Assert.assertEquals("<p>", out);
}
use of org.apache.wiki.WikiPage in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testSetHTML.
@Test
public void testSetHTML() throws Exception {
String src = "Foobar.[{SET name='<b>danger</b>'}] [{$name}]";
WikiPage p = new WikiPage(testEngine, PAGE_NAME);
String res = translate(p, src);
Assert.assertEquals("Page text", "Foobar. <b>danger</b>", res);
Assert.assertEquals("<b>danger</b>", p.getAttribute("name"));
}
use of org.apache.wiki.WikiPage in project jspwiki by apache.
the class DefaultPluginManagerTest method setUp.
@Before
public void setUp() throws Exception {
engine = new TestEngine(props);
context = new WikiContext(engine, new WikiPage(engine, "Testpage"));
manager = new DefaultPluginManager(engine, props);
}
use of org.apache.wiki.WikiPage in project jspwiki by apache.
the class UndefinedPagesPluginTest method testSimpleUndefined.
/**
* Tests that only correct undefined links are found.
* We also check against plural forms here, which should not
* be listed as non-existent.
*/
@Test
public void testSimpleUndefined() throws Exception {
WikiContext context2 = new WikiContext(testEngine, new WikiPage(testEngine, "Foobar"));
String res = manager.execute(context2, "{INSERT org.apache.wiki.plugin.UndefinedPagesPlugin");
String exp = "[Foobar 2]\\\\";
Assert.assertEquals(wikitize(exp), res);
}
Aggregations