Search in sources :

Example 61 with TestEngine

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

the class AnonymousLoginModuleTest method setUp.

/**
 */
@Before
public void setUp() throws Exception {
    Properties props = TestEngine.getTestProperties();
    props.put(XMLUserDatabase.PROP_USERDATABASE, "target/test-classes/userdatabase.xml");
    m_engine = new TestEngine(props);
    m_db = new XMLUserDatabase();
    m_subject = new Subject();
    try {
        m_db.initialize(m_engine, props);
    } catch (NoRequiredPropertyException e) {
        System.err.println(e.getMessage());
        Assert.assertTrue(false);
    }
}
Also used : TestEngine(org.apache.wiki.TestEngine) XMLUserDatabase(org.apache.wiki.auth.user.XMLUserDatabase) Properties(java.util.Properties) NoRequiredPropertyException(org.apache.wiki.api.exceptions.NoRequiredPropertyException) Subject(javax.security.auth.Subject) Before(org.junit.Before)

Example 62 with TestEngine

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

the class UserDatabaseLoginModuleTest method setUp.

/**
 */
@Before
public void setUp() throws Exception {
    Properties props = TestEngine.getTestProperties();
    props.put(XMLUserDatabase.PROP_USERDATABASE, "target/test-classes/userdatabase.xml");
    m_engine = new TestEngine(props);
    m_db = new XMLUserDatabase();
    m_subject = new Subject();
    try {
        m_db.initialize(m_engine, props);
    } catch (NoRequiredPropertyException e) {
        System.err.println(e.getMessage());
        Assert.assertTrue(false);
    }
}
Also used : TestEngine(org.apache.wiki.TestEngine) XMLUserDatabase(org.apache.wiki.auth.user.XMLUserDatabase) Properties(java.util.Properties) NoRequiredPropertyException(org.apache.wiki.api.exceptions.NoRequiredPropertyException) Subject(javax.security.auth.Subject) Before(org.junit.Before)

Example 63 with TestEngine

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

the class WebContainerLoginModuleTest method setUp.

@Before
public void setUp() throws Exception {
    Properties props = TestEngine.getTestProperties();
    props.put(XMLUserDatabase.PROP_USERDATABASE, "target/test-classes/userdatabase.xml");
    m_engine = new TestEngine(props);
    m_db = new XMLUserDatabase();
    m_subject = new Subject();
    try {
        m_db.initialize(m_engine, props);
    } catch (NoRequiredPropertyException e) {
        System.err.println(e.getMessage());
        Assert.assertTrue(false);
    }
}
Also used : TestEngine(org.apache.wiki.TestEngine) XMLUserDatabase(org.apache.wiki.auth.user.XMLUserDatabase) Properties(java.util.Properties) NoRequiredPropertyException(org.apache.wiki.api.exceptions.NoRequiredPropertyException) Subject(javax.security.auth.Subject) Before(org.junit.Before)

Example 64 with TestEngine

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

the class JSPWikiMarkupParserTest method testAttachmentLink3.

/**
 * Are attachments parsed correctly also when using gappy text?
 */
@Test
public void testAttachmentLink3() 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 = "[Test page/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 65 with TestEngine

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

the class JSPWikiMarkupParserTest method testHTMLWhenAllowedPre.

@Test
public void testHTMLWhenAllowedPre() throws Exception {
    String src = "{{{ <br /> }}}";
    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("<pre> &lt;br /&gt; </pre>", out);
}
Also used : WikiPage(org.apache.wiki.WikiPage) TestEngine(org.apache.wiki.TestEngine) Test(org.junit.Test)

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