Search in sources :

Example 1 with TestEngine

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

the class DecisionQueueTest method setUp.

@Before
public void setUp() throws Exception {
    Properties props = TestEngine.getTestProperties();
    m_engine = new TestEngine(props);
    m_queue = m_engine.getWorkflowManager().getDecisionQueue();
    adminSession = m_engine.adminSession();
    janneSession = m_engine.janneSession();
    w = new Workflow("workflow.key", new WikiPrincipal("Owner1"));
    w.setWorkflowManager(m_engine.getWorkflowManager());
    d1 = new SimpleDecision(w, "decision1.key", new GroupPrincipal("Admin"));
    d2 = new SimpleDecision(w, "decision2.key", new WikiPrincipal("Owner2"));
    d3 = new SimpleDecision(w, "decision3.key", janneSession.getUserPrincipal());
    m_queue.add(d1);
    m_queue.add(d2);
    m_queue.add(d3);
}
Also used : WikiPrincipal(org.apache.wiki.auth.WikiPrincipal) GroupPrincipal(org.apache.wiki.auth.GroupPrincipal) TestEngine(org.apache.wiki.TestEngine) Properties(java.util.Properties) Before(org.junit.Before)

Example 2 with TestEngine

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

the class OutcomeTest method testMessage.

@Test
public void testMessage() throws Exception {
    Properties props = TestEngine.getTestProperties();
    WikiEngine engine = new TestEngine(props);
    InternationalizationManager i18n = engine.getInternationalizationManager();
    String core = "templates.default";
    Locale rootLocale = Locale.ROOT;
    Outcome o;
    o = Outcome.DECISION_APPROVE;
    Assert.assertEquals("Approve", i18n.get(core, rootLocale, o.getMessageKey()));
    o = Outcome.DECISION_DENY;
    Assert.assertEquals("Deny", i18n.get(core, rootLocale, o.getMessageKey()));
    o = Outcome.DECISION_HOLD;
    Assert.assertEquals("Hold", i18n.get(core, rootLocale, o.getMessageKey()));
    o = Outcome.DECISION_REASSIGN;
    Assert.assertEquals("Reassign", i18n.get(core, rootLocale, o.getMessageKey()));
}
Also used : Locale(java.util.Locale) InternationalizationManager(org.apache.wiki.i18n.InternationalizationManager) TestEngine(org.apache.wiki.TestEngine) Properties(java.util.Properties) WikiEngine(org.apache.wiki.WikiEngine) Test(org.junit.Test)

Example 3 with TestEngine

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

the class WorkflowManagerTest method setUp.

@Before
public void setUp() throws Exception {
    Properties props = TestEngine.getTestProperties();
    m_engine = new TestEngine(props);
    wm = m_engine.getWorkflowManager();
    // Create a workflow with 3 steps, with a Decision in the middle
    w = new Workflow("workflow.key", new WikiPrincipal("Owner1"));
    w.setWorkflowManager(m_engine.getWorkflowManager());
    Step startTask = new TaskTest.NormalTask(w);
    Step endTask = new TaskTest.NormalTask(w);
    Decision decision = new SimpleDecision(w, "decision.editWikiApproval", new WikiPrincipal("Actor1"));
    startTask.addSuccessor(Outcome.STEP_COMPLETE, decision);
    decision.addSuccessor(Outcome.DECISION_APPROVE, endTask);
    w.setFirstStep(startTask);
    // Add a message argument to the workflow with the page name
    w.addMessageArgument("MyPage");
}
Also used : WikiPrincipal(org.apache.wiki.auth.WikiPrincipal) TestEngine(org.apache.wiki.TestEngine) Properties(java.util.Properties) Before(org.junit.Before)

Example 4 with TestEngine

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

the class MailUtilTest method setUp.

@Before
public void setUp() throws Exception {
    PropertyConfigurator.configure(m_props);
    TestEngine testEngine = new TestEngine(m_props);
    m_context = new WikiContext(testEngine, new WikiPage(testEngine, PAGE_NAME));
}
Also used : WikiContext(org.apache.wiki.WikiContext) WikiPage(org.apache.wiki.WikiPage) TestEngine(org.apache.wiki.TestEngine) Before(org.junit.Before)

Example 5 with TestEngine

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

the class DefaultURLConstructorTest method getConstructor.

private URLConstructor getConstructor(String prefix) throws WikiException {
    if (prefix != null)
        props.setProperty(ShortViewURLConstructor.PROP_PREFIX, prefix);
    testEngine = new TestEngine(props);
    URLConstructor constr = new DefaultURLConstructor();
    constr.initialize(testEngine, props);
    return constr;
}
Also used : TestEngine(org.apache.wiki.TestEngine)

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