Search in sources :

Example 26 with TestEngine

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

the class RSSGeneratorTest method setUp.

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

Example 27 with TestEngine

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

the class SearchManagerTest method setUp.

@Before
public void setUp() throws Exception {
    Properties props = TestEngine.getTestProperties();
    String workDir = props.getProperty("jspwiki.workDir");
    String workRepo = props.getProperty("jspwiki.fileSystemProvider.pageDir");
    props.setProperty(SearchManager.PROP_SEARCHPROVIDER, "LuceneSearchProvider");
    props.setProperty("jspwiki.lucene.initialdelay", "1");
    props.setProperty("jspwiki.workDir", workDir + System.currentTimeMillis());
    props.setProperty("jspwiki.fileSystemProvider.pageDir", workRepo + System.currentTimeMillis());
    CacheManager.getInstance().removeAllCaches();
    m_engine = new TestEngine(props);
    m_mgr = m_engine.getSearchManager();
}
Also used : TestEngine(org.apache.wiki.TestEngine) Properties(java.util.Properties) Before(org.junit.Before)

Example 28 with TestEngine

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

the class ReferringUndefinedPagesPluginTest method setUp.

@Before
public void setUp() throws Exception {
    CacheManager.getInstance().removeAllCaches();
    testEngine = new TestEngine(props);
    testEngine.saveText("TestPage01", "Some Text for testing 01 which refers [NonExistingPageA] ");
    testEngine.saveText("TestPage02", "Some Text for testing 02 which refers [NonExistingPageB] ");
    testEngine.saveText("TestPage03", "Some Text for testing 03 which refers [NonExistingPageC] ");
    context = new WikiContext(testEngine, testEngine.newHttpRequest(), new WikiPage(testEngine, "TestPage"));
    manager = new DefaultPluginManager(testEngine, props);
}
Also used : WikiContext(org.apache.wiki.WikiContext) WikiPage(org.apache.wiki.WikiPage) TestEngine(org.apache.wiki.TestEngine) Before(org.junit.Before)

Example 29 with TestEngine

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

the class ContextualDiffProviderTest method diffTest.

// FIXME: This test Assert.fails; must be enabled again asap.
/*
    @Test
    public void testKnownProblemCases() throws NoRequiredPropertyException, IOException
    {
        //These all Assert.fail...

        //make two consequtive changes
        diffTest(null, "A B C D", "A b c D", "A |^b c^-B C-| D");
        //acually returns ->                 "A |^b^-B-| |^c^-C-| D"

        //collapse adjacent elements...
        diffTest(null, "A B C D", "A BC D", "A |^BC^-B C-| D");
        //acually returns ->                "A |^BC^-B-| |-C -|D"


        //These Assert.failures are all due to how we process the diff results, we need to collapse
        //adjacent edits into one...

    }
     */
private void diffTest(String contextLimit, String oldText, String newText, String expectedDiff) throws IOException, WikiException {
    ContextualDiffProvider diff = new ContextualDiffProvider();
    specializedNotation(diff);
    Properties props = TestEngine.getTestProperties();
    if (null != contextLimit)
        props.put(ContextualDiffProvider.PROP_UNCHANGED_CONTEXT_LIMIT, contextLimit);
    diff.initialize(null, props);
    PropertyConfigurator.configure(props);
    TestEngine engine = new TestEngine(props);
    WikiContext ctx = new WikiContext(engine, new WikiPage(engine, "Dummy"));
    String actualDiff = diff.makeDiffHtml(ctx, oldText, newText);
    Assert.assertEquals(expectedDiff, actualDiff);
}
Also used : WikiContext(org.apache.wiki.WikiContext) WikiPage(org.apache.wiki.WikiPage) TestEngine(org.apache.wiki.TestEngine) Properties(java.util.Properties)

Example 30 with TestEngine

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

the class DefaultFilterManagerTest method setUp.

@Before
public void setUp() throws Exception {
    PropertyConfigurator.configure(props);
    engine = new TestEngine(props);
}
Also used : TestEngine(org.apache.wiki.TestEngine) 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