use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class ShortURLConstructorTest method getConstructor.
private URLConstructor getConstructor(String prefix) throws WikiException {
if (prefix != null)
props.setProperty(ShortURLConstructor.PROP_PREFIX, prefix);
testEngine = new TestEngine(props);
URLConstructor constr = new ShortURLConstructor();
constr.initialize(testEngine, props);
return constr;
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class AuthenticationManagerTest method setUp.
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
m_engine = new TestEngine(props);
m_auth = m_engine.getAuthenticationManager();
m_groupMgr = m_engine.getGroupManager();
m_session = WikiSessionTest.adminSession(m_engine);
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class MarkdownRendererTest method setUp.
@Before
public void setUp() throws Exception {
CacheManager.getInstance().removeAllCaches();
props.setProperty("jspwiki.translatorReader.matchEnglishPlurals", "true");
props.setProperty("jspwiki.fileSystemProvider.pageDir", "./target/md-pageDir");
props.setProperty("jspwiki.renderingManager.markupParser", MarkdownParser.class.getName());
props.setProperty("jspwiki.renderingManager.renderer", MarkdownRenderer.class.getName());
testEngine = new TestEngine(props);
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class AuthorizationManagerTest method testUserPolicy.
@Test
public void testUserPolicy() throws Exception {
Properties props = TestEngine.getTestProperties();
// Make sure we are using the default security policy file jspwiki.policy
props.put(AuthorizationManager.POLICY, "jspwiki-testUserPolicy.policy");
// Initialize the test engine
m_engine = new TestEngine(props);
m_auth = m_engine.getAuthorizationManager();
m_groupMgr = m_engine.getGroupManager();
m_session = WikiSessionTest.adminSession(m_engine);
WikiSession s = WikiSessionTest.anonymousSession(m_engine);
Assert.assertFalse("Anonymous view", m_auth.checkStaticPermission(s, PagePermission.VIEW));
Assert.assertFalse("Anonymous edit", m_auth.checkStaticPermission(s, PagePermission.EDIT));
Assert.assertFalse("Anonymous comment", m_auth.checkStaticPermission(s, PagePermission.COMMENT));
Assert.assertFalse("Anonymous modify", m_auth.checkStaticPermission(s, PagePermission.MODIFY));
Assert.assertFalse("Anonymous upload", m_auth.checkStaticPermission(s, PagePermission.UPLOAD));
Assert.assertFalse("Anonymous rename", m_auth.checkStaticPermission(s, PagePermission.RENAME));
Assert.assertFalse("Anonymous delete", m_auth.checkStaticPermission(s, PagePermission.DELETE));
Assert.assertFalse("Anonymous prefs", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PREFERENCES));
Assert.assertFalse("Anonymous profile", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PROFILE));
Assert.assertFalse("Anonymous pages", m_auth.checkStaticPermission(s, WikiPermission.CREATE_PAGES));
Assert.assertFalse("Anonymous groups", m_auth.checkStaticPermission(s, WikiPermission.CREATE_GROUPS));
s = WikiSessionTest.assertedSession(m_engine, "Jack Sparrow");
Assert.assertFalse("Asserted view", m_auth.checkStaticPermission(s, PagePermission.VIEW));
Assert.assertFalse("Asserted edit", m_auth.checkStaticPermission(s, PagePermission.EDIT));
Assert.assertFalse("Asserted comment", m_auth.checkStaticPermission(s, PagePermission.COMMENT));
Assert.assertFalse("Asserted modify", m_auth.checkStaticPermission(s, PagePermission.MODIFY));
Assert.assertFalse("Asserted upload", m_auth.checkStaticPermission(s, PagePermission.UPLOAD));
Assert.assertFalse("Asserted rename", m_auth.checkStaticPermission(s, PagePermission.RENAME));
Assert.assertFalse("Asserted delete", m_auth.checkStaticPermission(s, PagePermission.DELETE));
Assert.assertFalse("Asserted prefs", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PREFERENCES));
Assert.assertFalse("Asserted profile", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PROFILE));
Assert.assertFalse("Asserted pages", m_auth.checkStaticPermission(s, WikiPermission.CREATE_PAGES));
Assert.assertFalse("Asserted groups", m_auth.checkStaticPermission(s, WikiPermission.CREATE_GROUPS));
s = WikiSessionTest.authenticatedSession(m_engine, Users.BOB, Users.BOB_PASS);
Assert.assertTrue("Bob view", m_auth.checkStaticPermission(s, PagePermission.VIEW));
Assert.assertTrue("Bob edit", m_auth.checkStaticPermission(s, PagePermission.EDIT));
Assert.assertTrue("Bob comment", m_auth.checkStaticPermission(s, PagePermission.COMMENT));
Assert.assertTrue("Bob modify", m_auth.checkStaticPermission(s, PagePermission.MODIFY));
Assert.assertTrue("Bob upload", m_auth.checkStaticPermission(s, PagePermission.UPLOAD));
Assert.assertFalse("Bob rename", m_auth.checkStaticPermission(s, PagePermission.RENAME));
Assert.assertTrue("Bob delete", m_auth.checkStaticPermission(s, PagePermission.DELETE));
Assert.assertFalse("Bob prefs", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PREFERENCES));
Assert.assertFalse("Bob profile", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PROFILE));
Assert.assertFalse("Bob pages", m_auth.checkStaticPermission(s, WikiPermission.CREATE_PAGES));
Assert.assertFalse("Bob groups", m_auth.checkStaticPermission(s, WikiPermission.CREATE_GROUPS));
s = WikiSessionTest.authenticatedSession(m_engine, Users.JANNE, Users.JANNE_PASS);
Assert.assertTrue("Janne view", m_auth.checkStaticPermission(s, PagePermission.VIEW));
Assert.assertTrue("Janne edit", m_auth.checkStaticPermission(s, PagePermission.EDIT));
Assert.assertTrue("Janne comment", m_auth.checkStaticPermission(s, PagePermission.COMMENT));
Assert.assertTrue("Janne modify", m_auth.checkStaticPermission(s, PagePermission.MODIFY));
Assert.assertTrue("Janne upload", m_auth.checkStaticPermission(s, PagePermission.UPLOAD));
Assert.assertFalse("Janne rename", m_auth.checkStaticPermission(s, PagePermission.RENAME));
Assert.assertTrue("Janne delete", m_auth.checkStaticPermission(s, PagePermission.DELETE));
Assert.assertFalse("Janne prefs", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PREFERENCES));
Assert.assertFalse("Janne profile", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PROFILE));
Assert.assertFalse("Janne pages", m_auth.checkStaticPermission(s, WikiPermission.CREATE_PAGES));
Assert.assertFalse("Janne groups", m_auth.checkStaticPermission(s, WikiPermission.CREATE_GROUPS));
s = WikiSessionTest.adminSession(m_engine);
Assert.assertTrue("Admin view", m_auth.checkStaticPermission(s, PagePermission.VIEW));
Assert.assertFalse("Admin edit", m_auth.checkStaticPermission(s, PagePermission.EDIT));
Assert.assertFalse("Admin comment", m_auth.checkStaticPermission(s, PagePermission.COMMENT));
Assert.assertFalse("Admin modify", m_auth.checkStaticPermission(s, PagePermission.MODIFY));
Assert.assertFalse("Admin upload", m_auth.checkStaticPermission(s, PagePermission.UPLOAD));
Assert.assertFalse("Admin rename", m_auth.checkStaticPermission(s, PagePermission.RENAME));
Assert.assertFalse("Admin delete", m_auth.checkStaticPermission(s, PagePermission.DELETE));
Assert.assertFalse("Admin prefs", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PREFERENCES));
Assert.assertFalse("Admin profile", m_auth.checkStaticPermission(s, WikiPermission.EDIT_PROFILE));
Assert.assertFalse("Admin pages", m_auth.checkStaticPermission(s, WikiPermission.CREATE_PAGES));
Assert.assertFalse("Admin groups", m_auth.checkStaticPermission(s, WikiPermission.CREATE_GROUPS));
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class AuthorizationManagerTest method setUp.
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
// Make sure we are using the default security policy file jspwiki.policy
props.put(AuthorizationManager.POLICY, AuthorizationManager.DEFAULT_POLICY);
// Initialize the test engine
m_engine = new TestEngine(props);
m_auth = m_engine.getAuthorizationManager();
m_groupMgr = m_engine.getGroupManager();
m_session = WikiSessionTest.adminSession(m_engine);
}
Aggregations