Search in sources :

Example 56 with WikiPage

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"));
}
Also used : WikiPage(org.apache.wiki.WikiPage) Test(org.junit.Test)

Example 57 with WikiPage

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);
}
Also used : WikiPage(org.apache.wiki.WikiPage) TestEngine(org.apache.wiki.TestEngine) Test(org.junit.Test)

Example 58 with WikiPage

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. &lt;b&gt;danger&lt;/b&gt;", res);
    Assert.assertEquals("<b>danger</b>", p.getAttribute("name"));
}
Also used : WikiPage(org.apache.wiki.WikiPage) Test(org.junit.Test)

Example 59 with WikiPage

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);
}
Also used : WikiContext(org.apache.wiki.WikiContext) WikiPage(org.apache.wiki.WikiPage) TestEngine(org.apache.wiki.TestEngine) Before(org.junit.Before)

Example 60 with WikiPage

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);
}
Also used : WikiContext(org.apache.wiki.WikiContext) WikiPage(org.apache.wiki.WikiPage) Test(org.junit.Test)

Aggregations

WikiPage (org.apache.wiki.WikiPage)186 Test (org.junit.Test)77 WikiContext (org.apache.wiki.WikiContext)63 WikiEngine (org.apache.wiki.WikiEngine)29 Attachment (org.apache.wiki.attachment.Attachment)26 ProviderException (org.apache.wiki.api.exceptions.ProviderException)22 Date (java.util.Date)17 File (java.io.File)16 Collection (java.util.Collection)16 TestEngine (org.apache.wiki.TestEngine)15 Iterator (java.util.Iterator)13 StringReader (java.io.StringReader)9 Hashtable (java.util.Hashtable)9 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)8 Calendar (java.util.Calendar)8 Vector (java.util.Vector)8 StringWriter (java.io.StringWriter)7 InternalWikiException (org.apache.wiki.InternalWikiException)7 PagePermission (org.apache.wiki.auth.permissions.PagePermission)7