use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class FileSystemProviderTest method setUp.
@Before
public void setUp() throws Exception {
m_pagedir = "./target/jspwiki.test.pages";
props.setProperty(PageManager.PROP_PAGEPROVIDER, "FileSystemProvider");
props.setProperty(FileSystemProvider.PROP_PAGEDIR, m_pagedir);
Properties props2 = new Properties();
PropertyConfigurator.configure(props2);
m_engine = new TestEngine(props);
m_provider = new FileSystemProvider();
m_provider.initialize(m_engine, props);
props.setProperty(WikiEngine.PROP_ENCODING, "UTF-8");
m_providerUTF8 = new FileSystemProvider();
m_providerUTF8.initialize(m_engine, props);
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class VersioningFileProviderTest method testMigrationMultiChangesNoCache.
/*
* A variation of testMigrationMultiChangesHistory when caching
* is disabled.
*/
@Test
public void testMigrationMultiChangesNoCache() throws Exception {
// discard the default engine, and get another with different properties
// note: the originating properties file is unchanged.
String cacheState = PROPS.getProperty(PageManager.PROP_USECACHE);
Assert.assertEquals("should cache", "true", cacheState);
cacheState = "false";
PROPS.setProperty(PageManager.PROP_USECACHE, cacheState);
engine = new TestEngine(PROPS);
// the new TestEngine will have assigned a new page directory
files = PROPS.getProperty(AbstractFileProvider.PROP_PAGEDIR);
// we cannot switch PageProviders within a single test, so the
// initial FileSystemProvider wiki page must be faked.
final String fakeWikiPage = "foobar";
injectFile(NAME1 + AbstractFileProvider.FILE_EXT, fakeWikiPage);
// also create an associated properties file with some history
injectFile(NAME1 + FileSystemProvider.PROP_EXT, FAKE_HISTORY);
// next update the wiki page to create a version number 2
// with a different user name
final String text2 = "diddo\r\n";
engine.saveTextAsJanne(NAME1, text2);
// finally update the wiki page to create a version number 3
final String text3 = "whateverNext\r\n";
engine.saveText(NAME1, text3);
// confirm the right number of versions have been recorded
Collection versionHistory = engine.getVersionHistory(NAME1);
Assert.assertEquals("number of versions", 3, versionHistory.size());
// fetch the latest version of the page
String result = engine.getText(NAME1);
Assert.assertEquals("latest should be newest version", text3, result);
String result2 = engine.getText(NAME1, 3);
Assert.assertEquals("fetch new by version did not work", text3, result2);
// confirm the original page was archived
String result3 = engine.getText(NAME1, 1);
Assert.assertEquals("fetch original by version Assert.failed", fakeWikiPage, result3);
// confirm the first update was archived
String result4 = engine.getText(NAME1, 2);
Assert.assertEquals("fetch original by version Assert.failed", text2, result4);
WikiPage pageNew = engine.getPage(NAME1);
Assert.assertEquals("newest version", 3, pageNew.getVersion());
Assert.assertEquals("newest author", "Guest", pageNew.getAuthor());
WikiPage pageMiddle = engine.getPage(NAME1, 2);
Assert.assertEquals("middle version", 2, pageMiddle.getVersion());
Assert.assertEquals("middle author", Users.JANNE, pageMiddle.getAuthor());
WikiPage pageOld = engine.getPage(NAME1, 1);
Assert.assertEquals("old version", 1, pageOld.getVersion());
Assert.assertEquals("old author", OLD_AUTHOR, pageOld.getAuthor());
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class VersioningFileProviderTest method setUp.
@Before
public void setUp() throws Exception {
// make sure that the reference manager cache is cleaned first
TestEngine.emptyWorkDir(null);
engine = new TestEngine(PROPS);
files = PROPS.getProperty(AbstractFileProvider.PROP_PAGEDIR);
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class ApprovalWorkflowTest method setUp.
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
// Explicitly turn on Admin approvals for page saves and our sample approval workflow
props.put("jspwiki.approver.workflow.saveWikiPage", "Admin");
props.put("jspwiki.approver.workflow.approvalWorkflow", Users.JANNE);
// Start the wiki engine
m_engine = new TestEngine(props);
m_wm = m_engine.getWorkflowManager();
m_dq = m_wm.getDecisionQueue();
m_builder = WorkflowBuilder.getBuilder(m_engine);
}
use of org.apache.wiki.TestEngine in project jspwiki by apache.
the class CreoleRendererTest method setUp.
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
m_testEngine = new TestEngine(props);
}
Aggregations