use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class GroupManagerTest method setUp.
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
m_engine = new TestEngine(props);
m_groupMgr = m_engine.getGroupManager();
m_session = WikiSessionTest.adminSession(m_engine);
// Flush any pre-existing groups (left over from previous Assert.failures, perhaps)
try {
m_groupMgr.removeGroup("Test");
m_groupMgr.removeGroup("Test2");
m_groupMgr.removeGroup("Test3");
} catch (NoSuchPrincipalException e) {
// It's not a problem if we can't find the principals...
}
m_groupMgr.addWikiEventListener(m_trap);
m_trap.clearEvents();
// Add 3 test groups
Group group;
group = m_groupMgr.parseGroup("Test", "Alice \n Bob \n Charlie", true);
m_groupMgr.setGroup(m_session, group);
group = m_groupMgr.parseGroup("Test2", "Bob", true);
m_groupMgr.setGroup(m_session, group);
group = m_groupMgr.parseGroup("Test3", "Fred Flintstone", true);
m_groupMgr.setGroup(m_session, group);
// We should see 3 events: 1 for each group add
Assert.assertEquals(3, m_trap.events().length);
m_trap.clearEvents();
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class UserManagerTest method setUpWithWorkflow.
/**
* Call this setup program to use the save-profile workflow.
*/
protected void setUpWithWorkflow() throws Exception {
Properties props = TestEngine.getTestProperties();
// Turn on user profile saves by the Admin group
props.put("jspwiki.approver." + UserManager.SAVE_APPROVER, "Admin");
// Make sure we are using the XML user database
props.put(XMLUserDatabase.PROP_USERDATABASE, "target/test-classes/userdatabase.xml");
m_engine = new TestEngine(props);
m_mgr = m_engine.getUserManager();
m_db = m_mgr.getUserDatabase();
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class JSPWikiMarkupParserTest method translate_nofollow.
private String translate_nofollow(String src) throws IOException, NoRequiredPropertyException, ServletException, WikiException {
props = TestEngine.getTestProperties();
props.setProperty("jspwiki.translatorReader.useRelNofollow", "true");
TestEngine testEngine2 = new TestEngine(props);
WikiContext context = new WikiContext(testEngine2, new WikiPage(testEngine2, PAGE_NAME));
JSPWikiMarkupParser r = new JSPWikiMarkupParser(context, new BufferedReader(new StringReader(src)));
XHTMLRenderer conv = new XHTMLRenderer(context, r.parse());
return conv.getString();
}
use of org.apache.wiki.TestEngine 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);
}
use of org.apache.wiki.TestEngine 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);
}
Aggregations