use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class XMLUserDatabaseTest method setUp.
/**
*/
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
props.put(XMLUserDatabase.PROP_USERDATABASE, "target/test-classes/userdatabase.xml");
WikiEngine engine = new TestEngine(props);
m_db = new XMLUserDatabase();
m_db.initialize(engine, props);
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class TableOfContentsTest method setUp.
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
testEngine = new TestEngine(props);
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class UndefinedPagesPluginTest method setUp.
@Before
public void setUp() throws Exception {
CacheManager.getInstance().removeAllCaches();
testEngine = new TestEngine(props);
testEngine.saveText("TestPage", "Reference to [Foobar].");
testEngine.saveText("Foobar", "Reference to [Foobar 2], [Foobars]");
context = new WikiContext(testEngine, new WikiPage(testEngine, "TestPage"));
manager = new DefaultPluginManager(testEngine, props);
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class CachingProviderTest method testInitialization.
/**
* Checks that at startup we call the provider once, and once only.
*/
@Test
public void testInitialization() throws Exception {
Properties props = TestEngine.getTestProperties();
props.setProperty("jspwiki.usePageCache", "true");
props.setProperty("jspwiki.pageProvider", "org.apache.wiki.providers.CounterProvider");
props.setProperty("jspwiki.cachingProvider.capacity", "100");
TestEngine engine = new TestEngine(props);
CounterProvider p = (CounterProvider) ((CachingProvider) engine.getPageManager().getProvider()).getRealProvider();
Assert.assertEquals("init", 1, p.m_initCalls);
Assert.assertEquals("getAllPages", 1, p.m_getAllPagesCalls);
Assert.assertEquals("pageExists", 0, p.m_pageExistsCalls);
Assert.assertEquals("getPageText", 4, p.m_getPageTextCalls);
engine.getPage("Foo");
Assert.assertEquals("pageExists2", 0, p.m_pageExistsCalls);
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class CachingProviderTest method testSneakyAdd.
@Test
public void testSneakyAdd() throws Exception {
Properties props = TestEngine.getTestProperties();
props.setProperty("jspwiki.cachingProvider.cacheCheckInterval", "2");
TestEngine engine = new TestEngine(props);
String dir = props.getProperty(FileSystemProvider.PROP_PAGEDIR);
File f = new File(dir, "Testi.txt");
String content = "[fuufaa]";
PrintWriter out = new PrintWriter(new FileWriter(f));
FileUtil.copyContents(new StringReader(content), out);
out.close();
// Make sure we wait long enough
Thread.sleep(4000L);
WikiPage p = engine.getPage("Testi");
Assert.assertNotNull("page did not exist?", p);
String text = engine.getText("Testi");
Assert.assertEquals("text", "[fuufaa]", text);
// TODO: ReferenceManager check as well
}
Aggregations