Search in sources :

Example 66 with TestEngine

use of org.apache.wiki.TestEngine in project jspwiki by apache.

the class JSPWikiMarkupParserTest method setUp.

@Before
public void setUp() throws Exception {
    CacheManager.getInstance().removeAllCaches();
    props.setProperty("jspwiki.translatorReader.matchEnglishPlurals", "true");
    testEngine = new TestEngine(props);
}
Also used : TestEngine(org.apache.wiki.TestEngine) Before(org.junit.Before)

Example 67 with TestEngine

use of org.apache.wiki.TestEngine in project jspwiki by apache.

the class JSPWikiMarkupParserTest method testAttachmentLink2.

@Test
public void testAttachmentLink2() throws Exception {
    props.setProperty("jspwiki.encoding", "ISO-8859-1");
    // TODO
    TestEngine testEngine2 = new TestEngine(props);
    testEngine2.saveText("Test", "foo ");
    created.addElement("Test");
    Attachment att = new Attachment(testEngine2, "Test", "TestAtt.txt");
    att.setAuthor("FirstPost");
    testEngine2.getAttachmentManager().storeAttachment(att, testEngine.makeAttachmentFile());
    String src = "This should be an [attachment link|Test/TestAtt.txt]";
    Assert.assertEquals("This should be an <a class=\"attachment\" href=\"/test/attach/Test/TestAtt.txt\">attachment link</a>" + "<a href=\"/test/PageInfo.jsp?page=Test/TestAtt.txt\" class=\"infolink\"><img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>", translate(testEngine2, src));
}
Also used : Attachment(org.apache.wiki.attachment.Attachment) TestEngine(org.apache.wiki.TestEngine) Test(org.junit.Test)

Example 68 with TestEngine

use of org.apache.wiki.TestEngine in project jspwiki by apache.

the class JSPWikiMarkupParserTest method testAttachmentLink4.

@Test
public void testAttachmentLink4() throws Exception {
    TestEngine testEngine2 = new TestEngine(props);
    testEngine2.saveText("TestPage", "foo ");
    created.addElement("TestPage");
    Attachment att = new Attachment(testEngine2, "TestPage", "TestAtt.txt");
    att.setAuthor("FirstPost");
    testEngine2.getAttachmentManager().storeAttachment(att, testEngine.makeAttachmentFile());
    String src = "[" + testEngine2.beautifyTitle("TestPage/TestAtt.txt") + "]";
    Assert.assertEquals("<a class=\"attachment\" href=\"/test/attach/TestPage/TestAtt.txt\">Test Page/TestAtt.txt</a>" + "<a href=\"/test/PageInfo.jsp?page=TestPage/TestAtt.txt\" class=\"infolink\"><img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>", translate(testEngine2, src));
}
Also used : Attachment(org.apache.wiki.attachment.Attachment) TestEngine(org.apache.wiki.TestEngine) Test(org.junit.Test)

Example 69 with TestEngine

use of org.apache.wiki.TestEngine in project jspwiki by apache.

the class PageRenamerTest method setUp.

@Before
public void setUp() throws Exception {
    Properties props = TestEngine.getTestProperties();
    props.setProperty(WikiEngine.PROP_MATCHPLURALS, "true");
    CacheManager.getInstance().removeAllCaches();
    TestEngine.emptyWorkDir();
    m_engine = new TestEngine(props);
}
Also used : TestEngine(org.apache.wiki.TestEngine) Properties(java.util.Properties) Before(org.junit.Before)

Example 70 with TestEngine

use of org.apache.wiki.TestEngine in project jspwiki by apache.

the class UserProfileTest method setUp.

@Before
public void setUp() throws Exception {
    Properties props = TestEngine.getTestProperties();
    PropertyConfigurator.configure(props);
    WikiEngine engine = new TestEngine(props);
    m_db = engine.getUserManager().getUserDatabase();
}
Also used : TestEngine(org.apache.wiki.TestEngine) Properties(java.util.Properties) WikiEngine(org.apache.wiki.WikiEngine) Before(org.junit.Before)

Aggregations

TestEngine (org.apache.wiki.TestEngine)70 Before (org.junit.Before)49 Properties (java.util.Properties)42 WikiPage (org.apache.wiki.WikiPage)15 Test (org.junit.Test)15 WikiContext (org.apache.wiki.WikiContext)11 WikiEngine (org.apache.wiki.WikiEngine)8 File (java.io.File)4 Subject (javax.security.auth.Subject)4 WikiSessionTest (org.apache.wiki.WikiSessionTest)4 NoRequiredPropertyException (org.apache.wiki.api.exceptions.NoRequiredPropertyException)4 XMLUserDatabase (org.apache.wiki.auth.user.XMLUserDatabase)4 Attachment (org.apache.wiki.attachment.Attachment)3 WikiPrincipal (org.apache.wiki.auth.WikiPrincipal)3 StringReader (java.io.StringReader)2 Principal (java.security.Principal)2 WikiSession (org.apache.wiki.WikiSession)2 GroupPrincipal (org.apache.wiki.auth.GroupPrincipal)2 Group (org.apache.wiki.auth.authorize.Group)2 BufferedReader (java.io.BufferedReader)1