You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ja...@apache.org on 2009/05/17 14:37:24 UTC
svn commit: r775638 - in
/incubator/jspwiki/trunk/tests/java/org/apache/wiki: ./ attachment/
content/ parser/ plugin/ render/ search/ xmlrpc/
Author: jalkanen
Date: Sun May 17 12:37:23 2009
New Revision: 775638
URL: http://svn.apache.org/viewvc?rev=775638&view=rev
Log:
Removed old FileSystemProvider dependency from TestEngine (which was causing test failures).
Minor refactorings to make some tests conform to coding guidelines.
Modified:
incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/attachment/AttachmentManagerTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/PageRenamerTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/CounterPluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/DenouncePluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/GroupsTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/IndexPluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InsertPageTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InterWikiLinksPluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PluginIndexPluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/RecentChangesPluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferredPagesPluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferringPagesPluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/TableOfContentsTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/UndefinedPagesPluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/render/WysiwygEditingRendererTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/search/SearchManagerTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/xmlrpc/RPCHandlerTest.java
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java Sun May 17 12:37:23 2009
@@ -274,37 +274,6 @@
}
/**
- * Removes a page, but not any auxiliary information. Works only
- * with FileSystemProvider.
- */
- public static void deleteTestPage( String name )
- {
- Properties properties = new Properties();
-
- try
- {
- properties.load( findTestProperties() );
- String files = properties.getProperty( AbstractFileProvider.PROP_PAGEDIR );
-
- File f = new File( files, mangleName(name)+".txt" );
-
- f.delete();
-
- // Remove the property file, too
- f = new File( files, mangleName(name)+".properties" );
-
- if( f.exists() )
- f.delete();
-
- deleteAttachments( name );
- }
- catch( Exception e )
- {
- log.error("Couldn't delete "+name, e );
- }
- }
-
- /**
* Deletes all attachments related to the given page.
*/
public static void deleteAttachments( String page )
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/attachment/AttachmentManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/attachment/AttachmentManagerTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/attachment/AttachmentManagerTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/attachment/AttachmentManagerTest.java Sun May 17 12:37:23 2009
@@ -77,16 +77,10 @@
return tmpFile;
}
- public void tearDown()
+ public void tearDown() throws Exception
{
- TestEngine.deleteTestPage( NAME1 );
- TestEngine.deleteTestPage( NAMEU );
-
- TestEngine.deleteAttachments(NAME1);
- TestEngine.deleteAttachments(NAMEU);
-
TestEngine.emptyWorkDir();
-
+ m_engine.emptyRepository();
m_engine.shutdown();
}
/*
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/PageRenamerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/PageRenamerTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/PageRenamerTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/PageRenamerTest.java Sun May 17 12:37:23 2009
@@ -52,32 +52,15 @@
props.setProperty( WikiEngine.PROP_MATCHPLURALS, "true" );
TestEngine.emptyWorkDir();
- m_engine = new TestEngine(props);
+ m_engine = new TestEngine(props);
+
+ m_engine.emptyRepository();
}
protected void tearDown() throws Exception
{
super.tearDown();
-
- TestEngine.deleteTestPage("TestPage");
- TestEngine.deleteTestPage("TestPage2");
- TestEngine.deleteTestPage("FooTest");
- TestEngine.deleteTestPage("Test");
- TestEngine.deleteTestPage("CdauthNew");
- TestEngine.deleteTestPage("Cdauth");
- TestEngine.deleteTestPage("TestPageReferring");
- TestEngine.deleteTestPage("TestPageReferredNew");
- TestEngine.deleteTestPage("Main");
- TestEngine.deleteTestPage("Main8887");
- TestEngine.deleteTestPage("TestPage1234");
- TestEngine.deleteTestPage("TestPageReferred");
- TestEngine.deleteTestPage("RenameTest");
- TestEngine.deleteTestPage("Link one");
- TestEngine.deleteTestPage("Link uno");
- TestEngine.deleteTestPage("Link two");
-
- TestEngine.emptyWorkDir();
-
+
m_engine.shutdown();
}
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java Sun May 17 12:37:23 2009
@@ -35,6 +35,7 @@
import org.apache.wiki.api.WikiException;
import org.apache.wiki.api.WikiPage;
import org.apache.wiki.content.WikiPath;
+import org.apache.wiki.providers.ProviderException;
import org.apache.wiki.render.XHTMLRenderer;
import org.apache.wiki.util.TextUtil;
@@ -80,14 +81,13 @@
created.addElement( name );
}
- private void deleteCreatedPages()
+ private void deleteCreatedPages() throws ProviderException
{
for( Iterator<String> i = created.iterator(); i.hasNext(); )
{
String name = i.next();
- TestEngine.deleteTestPage(name);
- TestEngine.deleteAttachments(name);
+ testEngine.deletePage(name);
}
created.clear();
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/CounterPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/CounterPluginTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/CounterPluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/CounterPluginTest.java Sun May 17 12:37:23 2009
@@ -39,8 +39,8 @@
public class CounterPluginTest extends TestCase
{
- Properties props = new Properties();
- TestEngine testEngine;
+ Properties m_props = new Properties();
+ TestEngine m_testEngine;
public CounterPluginTest( String s )
{
@@ -50,20 +50,20 @@
public void setUp()
throws Exception
{
- props.load( TestEngine.findTestProperties() );
+ m_props.load( TestEngine.findTestProperties() );
- testEngine = new TestEngine(props);
+ m_testEngine = new TestEngine(m_props);
}
public void tearDown()
{
- testEngine.shutdown();
+ m_testEngine.shutdown();
}
private String translate( String src ) throws Exception
{
- testEngine.deletePage( "TestPage" );
- WikiContext context = testEngine.getWikiContextFactory().newViewContext( testEngine.createPage( "TestPage" ) );
+ m_testEngine.deletePage( "TestPage" );
+ WikiContext context = m_testEngine.getWikiContextFactory().newViewContext( m_testEngine.createPage( "TestPage" ) );
MarkupParser p = new JSPWikiMarkupParser( context, new StringReader(src) );
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/DenouncePluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/DenouncePluginTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/DenouncePluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/DenouncePluginTest.java Sun May 17 12:37:23 2009
@@ -34,109 +34,120 @@
import junit.framework.TestSuite;
import net.sourceforge.stripes.mock.MockHttpServletRequest;
+public class DenouncePluginTest extends TestCase
+{
+ private Properties m_props = new Properties();
+ private TestEngine m_engine;
+ private WikiContext m_context;
+ private PluginManager m_pluginmanager;
+ private Properties m_denounceProps;
+ private static final String PLUGINCMDLINE = "[{Denounce link='http://www.mobileasses.com' text='peoples asses'}]";
-public class DenouncePluginTest extends TestCase {
- Properties props = new Properties();
- TestEngine engine;
- WikiContext context;
- PluginManager manager;
- Properties denounceProps;
- private final String pluginCmdLine = "[{Denounce link='http://www.mobileasses.com' text='peoples asses'}]";
-
- public DenouncePluginTest(String s) {
+ public DenouncePluginTest(String s)
+ {
super(s);
}
public void setUp()
- throws Exception {
- props.load(TestEngine.findTestProperties());
-
- engine = new TestEngine(props);
- try {
-
-
+ throws Exception
+ {
+ m_props.load(TestEngine.findTestProperties());
+
+ m_engine = new TestEngine(m_props);
+ try
+ {
ClassLoader loader = Denounce.class.getClassLoader();
InputStream in = loader.getResourceAsStream("DenouncePlugin.properties");
- if (in == null) {
+ if (in == null)
+ {
throw new IOException("No property file found! (Check the installation, it should be there.)");
}
- denounceProps = new Properties();
- denounceProps.load(in);
- } catch (IOException e) {
+ m_denounceProps = new Properties();
+ m_denounceProps.load(in);
+ }
+ catch (IOException e)
+ {
fail("failed to load DenouncePlugin.properties");
}
-
-
}
- private void setupHTTPRequest(String header) {
- MockHttpServletRequest request = engine.newHttpRequest();
+ private void setupHTTPRequest(String header)
+ {
+ MockHttpServletRequest request = m_engine.newHttpRequest();
if (header != null)
request.addHeader("User-Agent", header);
//if(host != null)
request.getParameterMap().put("page", new String[]{"TestPage"});
- context = engine.getWikiContextFactory().newViewContext( request, null, null );
- manager = new PluginManager(engine, props);
+ m_context = m_engine.getWikiContextFactory().newViewContext( request, null, null );
+ m_pluginmanager = new PluginManager(m_engine, m_props);
}
- public void tearDown() {
- TestEngine.deleteTestPage("TestPage");
- TestEngine.deleteTestPage("Foobar");
+ public void tearDown() throws Exception
+ {
TestEngine.emptyWorkDir();
- engine.shutdown();
+ m_engine.emptyRepository();
+ m_engine.shutdown();
}
- public void testSLURPBot() throws Exception {
+ public void testSLURPBot() throws Exception
+ {
setupHTTPRequest("Slurp/2.1");
- String res = manager.execute(context, pluginCmdLine);
+ String res = m_pluginmanager.execute(m_context, PLUGINCMDLINE);
assertEquals(getDenounceText(), res);
//
setupHTTPRequest("ETSlurp/");
- res = manager.execute(context, pluginCmdLine);
+ res = m_pluginmanager.execute(m_context, PLUGINCMDLINE);
assertEquals(getDenounceText(), res);
setupHTTPRequest("Slurp");
- res = manager.execute(context, pluginCmdLine);
+ res = m_pluginmanager.execute(m_context, PLUGINCMDLINE);
assertFalse(getDenounceText().equalsIgnoreCase(res));
}
- public void testGoogleBotWithWrongCase() throws Exception {
+
+ public void testGoogleBotWithWrongCase() throws Exception
+ {
setupHTTPRequest("gOOglebot/2.1");
- String res = manager.execute(context, pluginCmdLine);
+ String res = m_pluginmanager.execute(m_context, PLUGINCMDLINE);
assertFalse(getDenounceText().equalsIgnoreCase(res));
- }
- public void testGoogleBot() throws Exception {
+ }
+
+ public void testGoogleBot() throws Exception
+ {
setupHTTPRequest("Googlebot/2.1");
- String res = manager.execute(context, pluginCmdLine);
+ String res = m_pluginmanager.execute(m_context, PLUGINCMDLINE);
assertEquals(getDenounceText(), res);
//
setupHTTPRequest("ETSGooglebot/2.1");
- res = manager.execute(context, pluginCmdLine);
+ res = m_pluginmanager.execute(m_context, PLUGINCMDLINE);
assertEquals(getDenounceText(), res);
setupHTTPRequest("ETSGooglebot");
- res = manager.execute(context, pluginCmdLine);
+ res = m_pluginmanager.execute(m_context, PLUGINCMDLINE);
assertEquals(getDenounceText(), res);
}
- public void testPlugin() throws Exception {
+ public void testPlugin() throws Exception
+ {
setupHTTPRequest(null);
- String res = manager.execute(context, pluginCmdLine);
+ String res = m_pluginmanager.execute(m_context, PLUGINCMDLINE);
assertEquals("<a href=\"http://www.mobileasses.com\">peoples asses</a>", res);
}
- private String getDenounceText() {
- return denounceProps.getProperty("denounce.denouncetext");
+ private String getDenounceText()
+ {
+ return m_denounceProps.getProperty("denounce.denouncetext");
}
- public static Test suite() {
+ public static Test suite()
+ {
return new TestSuite(DenouncePluginTest.class);
}
}
\ No newline at end of file
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/GroupsTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/GroupsTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/GroupsTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/GroupsTest.java Sun May 17 12:37:23 2009
@@ -32,8 +32,8 @@
public class GroupsTest extends TestCase
{
- Properties props = new Properties();
- TestEngine testEngine;
+ Properties m_props = new Properties();
+ TestEngine m_testEngine;
public GroupsTest( String s )
{
@@ -43,25 +43,25 @@
public void setUp()
throws Exception
{
- props.load( TestEngine.findTestProperties() );
+ m_props.load( TestEngine.findTestProperties() );
- testEngine = new TestEngine(props);
+ m_testEngine = new TestEngine(m_props);
}
public void tearDown() throws Exception
{
super.tearDown();
- testEngine.deletePage( "Test" );
+ m_testEngine.deletePage( "Test" );
}
public void testTag() throws Exception
{
String src="[{Groups}]";
- testEngine.saveText( "Test", src );
+ m_testEngine.saveText( "Test", src );
- String res = testEngine.getHTML( "Test" );
+ String res = m_testEngine.getHTML( "Test" );
assertEquals( "<a href=\"/Group.jsp?group=Admin\">Admin</a>, "
+ "<a href=\"/Group.jsp?group=Art\">Art</a>, "
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/IndexPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/IndexPluginTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/IndexPluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/IndexPluginTest.java Sun May 17 12:37:23 2009
@@ -58,9 +58,9 @@
m_manager = new PluginManager( m_engine, m_props );
}
- public void tearDown()
+ public void tearDown() throws Exception
{
- TestEngine.deleteTestPage( "TestPage" );
+ m_engine.emptyRepository();
TestEngine.emptyWorkDir();
m_engine.shutdown();
}
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InsertPageTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InsertPageTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InsertPageTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InsertPageTest.java Sun May 17 12:37:23 2009
@@ -31,36 +31,32 @@
public class InsertPageTest extends TestCase
{
- protected TestEngine testEngine;
- protected Properties props = new Properties();
+ protected TestEngine m_testEngine;
+ protected Properties m_props = new Properties();
protected void setUp() throws Exception
{
- props.load( TestEngine.findTestProperties() );
+ m_props.load( TestEngine.findTestProperties() );
- testEngine = new TestEngine(props);
+ m_testEngine = new TestEngine(m_props);
}
protected void tearDown() throws Exception
{
- TestEngine.deleteTestPage( "ThisPage" );
- TestEngine.deleteTestPage( "ThisPage2" );
- TestEngine.deleteTestPage( "Test_Page" );
- TestEngine.deleteTestPage( "TestPage" );
- TestEngine.deleteTestPage( "Test Page" );
+ m_testEngine.emptyRepository();
- testEngine.shutdown();
+ m_testEngine.shutdown();
}
public void testRecursive() throws Exception
{
String src = "[{InsertPage page='ThisPage'}] [{ALLOW view Anonymous}]";
- testEngine.saveText("ThisPage",src);
+ m_testEngine.saveText("ThisPage",src);
// Just check that it contains a proper error message; don't bother do HTML
// checking.
- String res = testEngine.getHTML("ThisPage");
+ String res = m_testEngine.getHTML("ThisPage");
assertTrue( res.indexOf("Circular reference") != -1 );
}
@@ -69,12 +65,12 @@
String src = "[{InsertPage page='ThisPage2'}]";
String src2 = "[{InsertPage page='ThisPage'}]";
- testEngine.saveText("ThisPage",src);
- testEngine.saveText("ThisPage2",src2);
+ m_testEngine.saveText("ThisPage",src);
+ m_testEngine.saveText("ThisPage2",src2);
// Just check that it contains a proper error message; don't bother do HTML
// checking.
- assertTrue( testEngine.getHTML("ThisPage").indexOf("Circular reference") != -1 );
+ assertTrue( m_testEngine.getHTML("ThisPage").indexOf("Circular reference") != -1 );
}
public void testMultiInvocation() throws Exception
@@ -82,12 +78,12 @@
String src = "[{InsertPage page='ThisPage2'}] [{InsertPage page='ThisPage2'}]";
String src2 = "foo[{ALLOW view Anonymous}]";
- testEngine.saveText("ThisPage",src);
- testEngine.saveText("ThisPage2",src2);
+ m_testEngine.saveText("ThisPage",src);
+ m_testEngine.saveText("ThisPage2",src2);
- assertTrue( "got circ ref", testEngine.getHTML("ThisPage").indexOf("Circular reference") == -1 );
+ assertTrue( "got circ ref", m_testEngine.getHTML("ThisPage").indexOf("Circular reference") == -1 );
- assertEquals( "found != 2", "<div style=\"\">foo\n</div> <div style=\"\">foo\n</div>\n", testEngine.getHTML("ThisPage") );
+ assertEquals( "found != 2", "<div style=\"\">foo\n</div> <div style=\"\">foo\n</div>\n", m_testEngine.getHTML("ThisPage") );
}
@@ -96,12 +92,12 @@
String src = "[{InsertPage page='Test_Page'}]";
String src2 = "foo[{ALLOW view Anonymous}]";
- testEngine.saveText("ThisPage",src);
- testEngine.saveText("Test_Page",src2);
+ m_testEngine.saveText("ThisPage",src);
+ m_testEngine.saveText("Test_Page",src2);
- assertTrue( "got circ ref", testEngine.getHTML("ThisPage").indexOf("Circular reference") == -1 );
+ assertTrue( "got circ ref", m_testEngine.getHTML("ThisPage").indexOf("Circular reference") == -1 );
- assertEquals( "found != 1", "<div style=\"\">foo\n</div>\n", testEngine.getHTML("ThisPage") );
+ assertEquals( "found != 1", "<div style=\"\">foo\n</div>\n", m_testEngine.getHTML("ThisPage") );
}
@@ -111,10 +107,10 @@
*/
public void testWithBlanks1() throws Exception
{
- testEngine.saveText( "ThisPage", "[{InsertPage page='Test Page'}]" );
- testEngine.saveText( "Test Page", "foo[{ALLOW view Anonymous}]" );
+ m_testEngine.saveText( "ThisPage", "[{InsertPage page='Test Page'}]" );
+ m_testEngine.saveText( "Test Page", "foo[{ALLOW view Anonymous}]" );
- assertEquals( "found != 1", "<div style=\"\">foo\n</div>\n", testEngine.getHTML( "ThisPage" ) );
+ assertEquals( "found != 1", "<div style=\"\">foo\n</div>\n", m_testEngine.getHTML( "ThisPage" ) );
}
/**
@@ -124,10 +120,10 @@
*/
public void testWithBlanks2() throws Exception
{
- testEngine.saveText( "ThisPage", "[{InsertPage page='Test Page'}]" );
- testEngine.saveText( "TestPage", "foo[{ALLOW view Anonymous}]" );
+ m_testEngine.saveText( "ThisPage", "[{InsertPage page='Test Page'}]" );
+ m_testEngine.saveText( "TestPage", "foo[{ALLOW view Anonymous}]" );
- assertEquals( "found != 1", "<div style=\"\">foo\n</div>\n", testEngine.getHTML( "ThisPage" ) );
+ assertEquals( "found != 1", "<div style=\"\">foo\n</div>\n", m_testEngine.getHTML( "ThisPage" ) );
}
public static Test suite()
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InterWikiLinksPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InterWikiLinksPluginTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InterWikiLinksPluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/InterWikiLinksPluginTest.java Sun May 17 12:37:23 2009
@@ -34,28 +34,28 @@
public class InterWikiLinksPluginTest extends TestCase
{
- private Properties props = new Properties();
+ private Properties m_props = new Properties();
- private TestEngine engine;
+ private TestEngine m_engine;
- private WikiContext context;
+ private WikiContext m_context;
- private PluginManager manager;
+ private PluginManager m_manager;
private Collection<String> m_links = null;
public void setUp() throws Exception
{
- props.load( TestEngine.findTestProperties() );
+ m_props.load( TestEngine.findTestProperties() );
- engine = new TestEngine( props );
+ m_engine = new TestEngine( m_props );
- manager = new PluginManager( engine, props );
+ m_manager = new PluginManager( m_engine, m_props );
- engine.deletePage( "TestPage" );
- context = engine.getWikiContextFactory().newViewContext( engine.createPage( "TestPage" ) );
+ m_engine.deletePage( "TestPage" );
+ m_context = m_engine.getWikiContextFactory().newViewContext( m_engine.createPage( "TestPage" ) );
- m_links = engine.getAllInterWikiLinks();
+ m_links = m_engine.getAllInterWikiLinks();
}
@@ -63,7 +63,7 @@
{
TestEngine.emptyWorkDir();
- engine.shutdown();
+ m_engine.shutdown();
}
public static Test suite()
@@ -78,7 +78,7 @@
*/
public void testLinkCollection() throws PluginException
{
- String result = manager.execute( context, "{InterWikiLinksPlugin}" );
+ String result = m_manager.execute( m_context, "{InterWikiLinksPlugin}" );
boolean allLinksFound = true;
for( String link : m_links )
@@ -100,7 +100,7 @@
public void testTableFormat() throws PluginException
{
String title = "DirtyHarryWikiLinks";
- String result = manager.execute( context, "{InterWikiLinksPlugin type=TABLE,tabletitle=" + title + "}" );
+ String result = m_manager.execute( m_context, "{InterWikiLinksPlugin type=TABLE,tabletitle=" + title + "}" );
assertTrue( "no table found", result.contains( "<table>" ) );
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PluginIndexPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PluginIndexPluginTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PluginIndexPluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PluginIndexPluginTest.java Sun May 17 12:37:23 2009
@@ -37,13 +37,13 @@
public class PluginIndexPluginTest extends TestCase
{
- Properties props = new Properties();
+ Properties m_props = new Properties();
- TestEngine engine;
+ TestEngine m_engine;
- WikiContext context;
+ WikiContext m_context;
- PluginManager manager;
+ PluginManager m_manager;
Collection<WikiPluginInfo> m_requiredPlugins;
@@ -57,24 +57,24 @@
public void setUp() throws Exception
{
- props.load( TestEngine.findTestProperties() );
+ m_props.load( TestEngine.findTestProperties() );
- engine = new TestEngine( props );
+ m_engine = new TestEngine( m_props );
- manager = new PluginManager( engine, props );
+ m_manager = new PluginManager( m_engine, m_props );
- engine.saveText( "TestPage", "This is a test." );
+ m_engine.saveText( "TestPage", "This is a test." );
- context = engine.getWikiContextFactory().newViewContext( engine.getPage( "TestPage" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "TestPage" ) );
- m_requiredPlugins = context.getEngine().getPluginManager().modules();
+ m_requiredPlugins = m_context.getEngine().getPluginManager().modules();
}
public void tearDown()
{
TestEngine.emptyWorkDir();
- engine.shutdown();
+ m_engine.shutdown();
}
public static Test suite()
@@ -89,7 +89,7 @@
*/
public void testCorePluginsPresent() throws PluginException
{
- String result = manager.execute( context, "{PluginIndexPlugin details=false}" );
+ String result = m_manager.execute( m_context, "{PluginIndexPlugin details=false}" );
// test for the presence of each core plugin (this list can be expanded
// as new plugins are added)
@@ -108,7 +108,7 @@
*/
public void testDetails() throws PluginException
{
- String result = manager.execute( context, "{PluginIndexPlugin details=true}" );
+ String result = m_manager.execute( m_context, "{PluginIndexPlugin details=true}" );
// check for the presence of all required columns:
for( int i = 0; i < REQUIRED_COLUMNS.length; i++ )
@@ -125,7 +125,7 @@
*/
public void testNumberOfRows() throws PluginException
{
- String result = manager.execute( context, "{PluginIndexPlugin details=true}" );
+ String result = m_manager.execute( m_context, "{PluginIndexPlugin details=true}" );
String row = "<tr";
String[] pieces = result.split( row );
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/RecentChangesPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/RecentChangesPluginTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/RecentChangesPluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/RecentChangesPluginTest.java Sun May 17 12:37:23 2009
@@ -23,50 +23,44 @@
import java.util.Properties;
-import org.apache.wiki.TestEngine;
-import org.apache.wiki.WikiContext;
-import org.apache.wiki.log.Logger;
-import org.apache.wiki.log.LoggerFactory;
-import org.apache.wiki.plugin.PluginManager;
-
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.apache.wiki.TestEngine;
+import org.apache.wiki.WikiContext;
+
public class RecentChangesPluginTest extends TestCase
{
- Properties props = new Properties();
+ Properties m_props = new Properties();
- TestEngine engine;
+ TestEngine m_engine;
- WikiContext context;
+ WikiContext m_context;
- PluginManager manager;
+ PluginManager m_pluginmanager;
public void setUp() throws Exception
{
- props.load( TestEngine.findTestProperties() );
+ m_props.load( TestEngine.findTestProperties() );
- engine = new TestEngine( props );
+ m_engine = new TestEngine( m_props );
- engine.saveText( "TestPage01", "Some Text for testing 01" );
- engine.saveText( "TestPage02", "Some Text for testing 02" );
- engine.saveText( "TestPage03", "Some Text for testing 03" );
+ m_engine.saveText( "TestPage01", "Some Text for testing 01" );
+ m_engine.saveText( "TestPage02", "Some Text for testing 02" );
+ m_engine.saveText( "TestPage03", "Some Text for testing 03" );
// context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage( "TestPage01" ) );
- manager = new PluginManager( engine, props );
+ m_pluginmanager = new PluginManager( m_engine, m_props );
}
- public void tearDown()
+ public void tearDown() throws Exception
{
- TestEngine.deleteTestPage( "TestPage01" );
- TestEngine.deleteTestPage( "TestPage02" );
- TestEngine.deleteTestPage( "TestPage03" );
-
+ m_engine.emptyRepository();
TestEngine.emptyWorkDir();
- engine.shutdown();
+ m_engine.shutdown();
}
/**
@@ -76,9 +70,9 @@
*/
public void testSimple() throws Exception
{
- context = engine.getWikiContextFactory().newViewContext( null, null, engine.getPage( "TestPage01" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "TestPage01" ) );
- String res = manager.execute( context, "{INSERT org.apache.wiki.plugin.RecentChangesPlugin}" );
+ String res = m_pluginmanager.execute( m_context, "{INSERT org.apache.wiki.plugin.RecentChangesPlugin}" );
// we don't want to compare the complete html returned, but check if certain Strings are present and other
// Strings are not present
@@ -96,9 +90,9 @@
*/
public void testParmInclude() throws Exception
{
- context = engine.getWikiContextFactory().newViewContext( null, null, engine.getPage( "TestPage02" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "TestPage02" ) );
- String res = manager.execute( context,
+ String res = m_pluginmanager.execute( m_context,
"{INSERT org.apache.wiki.plugin.RecentChangesPlugin include='TestPage02*'}" );
assertTrue(res.contains( "<table cellpadding='4' class='recentchanges'>"));
@@ -115,9 +109,9 @@
*/
public void testParmExclude() throws Exception
{
- context = engine.getWikiContextFactory().newViewContext( null, null, engine.getPage( "TestPage03" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "TestPage03" ) );
- String res = manager.execute( context, "{INSERT RecentChangesPlugin exclude='TestPage03*'}" );
+ String res = m_pluginmanager.execute( m_context, "{INSERT RecentChangesPlugin exclude='TestPage03*'}" );
assertTrue(res.contains( "<table cellpadding='4' class='recentchanges'>"));
assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage01'>TestPage01</a>" ));
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferredPagesPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferredPagesPluginTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferredPagesPluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferredPagesPluginTest.java Sun May 17 12:37:23 2009
@@ -34,13 +34,13 @@
public class ReferredPagesPluginTest extends TestCase
{
- Properties props = new Properties();
+ Properties m_props = new Properties();
- TestEngine engine;
+ TestEngine m_engine;
- WikiContext context;
+ WikiContext m_context;
- PluginManager manager;
+ PluginManager m_manager;
public ReferredPagesPluginTest( String s )
{
@@ -49,31 +49,27 @@
public void setUp() throws Exception
{
- props.load( TestEngine.findTestProperties() );
+ m_props.load( TestEngine.findTestProperties() );
- engine = new TestEngine( props );
+ m_engine = new TestEngine( m_props );
- engine.saveText( "SomeBodyPointsToMe", "Somebody points to this page" );
- engine.saveText( "IPointToSomeoneElse", "Reference to [SomeBodyPointsToMe]." );
- engine.saveText( "IPointToSomeoneElseToo", "Reference to [SomeBodyPointsToMe]." );
- engine.saveText( "SomeBodyPointsToMeToo", "Somebody points to this page too" );
- engine.saveText( "IPointToTwoPages", "Reference to [SomeBodyPointsToMe] and [SomeBodyPointsToMeToo]." );
+ m_engine.saveText( "SomeBodyPointsToMe", "Somebody points to this page" );
+ m_engine.saveText( "IPointToSomeoneElse", "Reference to [SomeBodyPointsToMe]." );
+ m_engine.saveText( "IPointToSomeoneElseToo", "Reference to [SomeBodyPointsToMe]." );
+ m_engine.saveText( "SomeBodyPointsToMeToo", "Somebody points to this page too" );
+ m_engine.saveText( "IPointToTwoPages", "Reference to [SomeBodyPointsToMe] and [SomeBodyPointsToMeToo]." );
// context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage( "IPointToSomeoneElse" ) );
- manager = new PluginManager( engine, props );
+ m_manager = new PluginManager( m_engine, m_props );
}
- public void tearDown()
+ public void tearDown() throws Exception
{
- TestEngine.deleteTestPage( "SomeBodyPointsToMe" );
- TestEngine.deleteTestPage( "IPointToSomeoneElse" );
- TestEngine.deleteTestPage( "IPointToSomeoneElseToo" );
- TestEngine.deleteTestPage( "SomeBodyPointsToMeToo");
- TestEngine.deleteTestPage( "IPointToTwoPages" );
+ m_engine.emptyRepository();
TestEngine.emptyWorkDir();
- engine.shutdown();
+ m_engine.shutdown();
}
/**
@@ -83,9 +79,9 @@
*/
public void testReferredPage() throws Exception
{
- context = engine.getWikiContextFactory().newViewContext( null, null, engine.getPage( "IPointToSomeoneElse" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "IPointToSomeoneElse" ) );
- String res = manager.execute( context, "{INSERT org.apache.wiki.plugin.ReferredPagesPlugin}" );
+ String res = m_manager.execute( m_context, "{INSERT org.apache.wiki.plugin.ReferredPagesPlugin}" );
assertEquals(
"<div class=\"ReferredPagesPlugin\">\n<a class=\"wikipage\" href=\"/Wiki.jsp?page=IPointToSomeoneElse\" title=\"ReferredPagesPlugin: depth[1] include[.*] exclude[^$] format[compact]\">IPointToSomeoneElse</a>\n<ul>\n<li><a class=\"wikipage\" href=\"/Wiki.jsp?page=SomeBodyPointsToMe\">SomeBodyPointsToMe</a></li>\n</ul>\n</div>\n",
@@ -100,9 +96,9 @@
*/
public void testReferredPageParmPage() throws Exception
{
- context = engine.getWikiContextFactory().newViewContext( null, null, engine.getPage( "IPointToSomeoneElse" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "IPointToSomeoneElse" ) );
- String res = manager.execute( context, "{INSERT org.apache.wiki.plugin.ReferredPagesPlugin page=IPointToSomeoneElseToo}" );
+ String res = m_manager.execute( m_context, "{INSERT org.apache.wiki.plugin.ReferredPagesPlugin page=IPointToSomeoneElseToo}" );
assertEquals(
"<div class=\"ReferredPagesPlugin\">\n<a class=\"wikipage\" href=\"/Wiki.jsp?page=IPointToSomeoneElseToo\" title=\"ReferredPagesPlugin: depth[1] include[.*] exclude[^$] format[compact]\">IPointToSomeoneElseToo</a>\n<ul>\n<li><a class=\"wikipage\" href=\"/Wiki.jsp?page=SomeBodyPointsToMe\">SomeBodyPointsToMe</a></li>\n</ul>\n</div>\n",
@@ -116,14 +112,14 @@
*/
public void testReferredPageParmInclude() throws Exception
{
- context = engine.getWikiContextFactory().newViewContext( null, null, engine.getPage( "IPointToTwoPages" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "IPointToTwoPages" ) );
String expected = "<div class=\"ReferredPagesPlugin\">\n<a class=\"wikipage\" href=\"/Wiki.jsp?page=IPointToTwoPages\" title=\"ReferredPagesPlugin: depth[1] include[Main:SomeBodyPointsToMe.*] exclude[^$] format[compact]\">IPointToTwoPages</a>\n<ul>\n<li><a class=\"wikipage\" href=\"/Wiki.jsp?page=SomeBodyPointsToMe\">SomeBodyPointsToMe</a></li>\n<li><a class=\"wikipage\" href=\"/Wiki.jsp?page=SomeBodyPointsToMeToo\">SomeBodyPointsToMeToo</a></li>\n</ul>\n</div>\n";
- String res = manager.execute( context,
+ String res = m_manager.execute( m_context,
"{INSERT org.apache.wiki.plugin.ReferredPagesPlugin include='SomeBodyPointsToMe*'}" );
assertEquals( expected, res );
- res = manager.execute( context,
+ res = m_manager.execute( m_context,
"{INSERT org.apache.wiki.plugin.ReferredPagesPlugin include='Main:SomeBodyPointsToMe*'}" );
assertEquals( expected, res );
}
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferringPagesPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferringPagesPluginTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferringPagesPluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferringPagesPluginTest.java Sun May 17 12:37:23 2009
@@ -36,10 +36,10 @@
public class ReferringPagesPluginTest extends TestCase
{
- Properties props = new Properties();
- TestEngine engine;
- WikiContext context;
- PluginManager manager;
+ Properties m_props = new Properties();
+ TestEngine m_engine;
+ WikiContext m_context;
+ PluginManager m_manager;
public ReferringPagesPluginTest( String s )
{
@@ -49,36 +49,28 @@
public void setUp()
throws Exception
{
- props.load( TestEngine.findTestProperties() );
+ m_props.load( TestEngine.findTestProperties() );
- props.setProperty( "jspwiki.breakTitleWithSpaces", "false" );
- engine = new TestEngine(props);
+ m_props.setProperty( "jspwiki.breakTitleWithSpaces", "false" );
+ m_engine = new TestEngine(m_props);
- engine.saveText( "TestPage", "Reference to [Foobar]." );
- engine.saveText( "Foobar", "Reference to [TestPage]." );
- engine.saveText( "Foobar2", "Reference to [TestPage]." );
- engine.saveText( "Foobar3", "Reference to [TestPage]." );
- engine.saveText( "Foobar4", "Reference to [TestPage]." );
- engine.saveText( "Foobar5", "Reference to [TestPage]." );
- engine.saveText( "Foobar6", "Reference to [TestPage]." );
- engine.saveText( "Foobar7", "Reference to [TestPage]." );
+ m_engine.saveText( "TestPage", "Reference to [Foobar]." );
+ m_engine.saveText( "Foobar", "Reference to [TestPage]." );
+ m_engine.saveText( "Foobar2", "Reference to [TestPage]." );
+ m_engine.saveText( "Foobar3", "Reference to [TestPage]." );
+ m_engine.saveText( "Foobar4", "Reference to [TestPage]." );
+ m_engine.saveText( "Foobar5", "Reference to [TestPage]." );
+ m_engine.saveText( "Foobar6", "Reference to [TestPage]." );
+ m_engine.saveText( "Foobar7", "Reference to [TestPage]." );
- context = engine.getWikiContextFactory().newViewContext( engine.getPage( "TestPage" ) );
- manager = new PluginManager( engine, props );
+ m_context = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "TestPage" ) );
+ m_manager = new PluginManager( m_engine, m_props );
}
public void tearDown() throws Exception
{
- TestEngine.deleteTestPage( "TestPage" );
- TestEngine.deleteTestPage( "Foobar" );
- TestEngine.deleteTestPage( "Foobar2" );
- TestEngine.deleteTestPage( "Foobar3" );
- TestEngine.deleteTestPage( "Foobar4" );
- TestEngine.deleteTestPage( "Foobar5" );
- TestEngine.deleteTestPage( "Foobar6" );
- TestEngine.deleteTestPage( "Foobar7" );
- engine.emptyRepository();
- engine.shutdown();
+ m_engine.emptyRepository();
+ m_engine.shutdown();
}
private String mkLink( String page )
@@ -94,9 +86,9 @@
public void testSingleReferral()
throws Exception
{
- WikiContext context2 = engine.getWikiContextFactory().newViewContext( engine.getPage( "Foobar" ) );
+ WikiContext context2 = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "Foobar" ) );
- String res = manager.execute( context2,
+ String res = m_manager.execute( context2,
"{INSERT org.apache.wiki.plugin.ReferringPagesPlugin WHERE max=5}");
assertEquals( mkLink( "TestPage" )+"<br />",
@@ -106,7 +98,7 @@
public void testMaxReferences()
throws Exception
{
- String res = manager.execute( context,
+ String res = m_manager.execute( m_context,
"{INSERT org.apache.wiki.plugin.ReferringPagesPlugin WHERE max=5}");
int count = 0;
@@ -135,9 +127,9 @@
public void testReferenceWidth()
throws Exception
{
- WikiContext context2 = engine.getWikiContextFactory().newViewContext( engine.getPage( "Foobar" ) );
+ WikiContext context2 = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "Foobar" ) );
- String res = manager.execute( context2,
+ String res = m_manager.execute( context2,
"{INSERT org.apache.wiki.plugin.ReferringPagesPlugin WHERE maxwidth=5}");
assertEquals( mkFullLink( "TestP...", "TestPage" )+"<br />",
@@ -147,7 +139,7 @@
public void testInclude()
throws Exception
{
- String res = manager.execute( context,
+ String res = m_manager.execute( m_context,
"{ReferringPagesPlugin include='*7'}" );
assertTrue( "7", res.indexOf("Foobar7") != -1 );
@@ -161,7 +153,7 @@
public void testExclude()
throws Exception
{
- String res = manager.execute( context,
+ String res = m_manager.execute( m_context,
"{ReferringPagesPlugin exclude='*'}");
assertEquals( "...nobody",
@@ -171,7 +163,7 @@
public void testExclude2()
throws Exception
{
- String res = manager.execute( context,
+ String res = m_manager.execute( m_context,
"{ReferringPagesPlugin exclude='*7'}");
assertTrue( res.indexOf("Foobar7") == -1 );
@@ -180,7 +172,7 @@
public void testExclude3()
throws Exception
{
- String res = manager.execute( context,
+ String res = m_manager.execute( m_context,
"{ReferringPagesPlugin exclude='*7,*5,*4'}");
assertTrue( "7", res.indexOf("Foobar7") == -1 );
@@ -194,13 +186,13 @@
public void testCount() throws Exception
{
String result = null;
- result = manager.execute(context, "{ReferringPagesPlugin show=count}");
+ result = m_manager.execute(m_context, "{ReferringPagesPlugin show=count}");
assertEquals("7",result);
- result = manager.execute(context, "{ReferringPagesPlugin,exclude='*7',show=count}");
+ result = m_manager.execute(m_context, "{ReferringPagesPlugin,exclude='*7',show=count}");
assertEquals("6",result);
- result = manager.execute(context, "{ReferringPagesPlugin,exclude='*7',show=count,showLastModified=true}");
+ result = m_manager.execute(m_context, "{ReferringPagesPlugin,exclude='*7',show=count,showLastModified=true}");
String numberResult=result.substring(0,result.indexOf(" "));
assertEquals("6",numberResult);
@@ -214,7 +206,7 @@
String exceptionString = null;
try
{
- result = manager.execute(context, "{ReferringPagesPlugin,showLastModified=true}");
+ result = m_manager.execute(m_context, "{ReferringPagesPlugin,showLastModified=true}");
}
catch (PluginException pe)
{
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/TableOfContentsTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/TableOfContentsTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/TableOfContentsTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/TableOfContentsTest.java Sun May 17 12:37:23 2009
@@ -38,7 +38,7 @@
*/
public class TableOfContentsTest extends TestCase
{
- TestEngine testEngine;
+ TestEngine m_testEngine;
/*
* @see TestCase#setUp()
@@ -51,7 +51,7 @@
props.load(TestEngine.findTestProperties());
- testEngine = new TestEngine( props );
+ m_testEngine = new TestEngine( props );
}
/*
@@ -61,9 +61,9 @@
{
super.tearDown();
- testEngine.deletePage( "Test" );
+ m_testEngine.deletePage( "Test" );
- testEngine.shutdown();
+ m_testEngine.shutdown();
}
public void testHeadingVariables()
@@ -71,9 +71,9 @@
{
String src="[{SET foo=bar}]\n\n[{TableOfContents}]\n\n!!!Heading [{$foo}]";
- testEngine.saveText( "Test", src );
+ m_testEngine.saveText( "Test", src );
- String res = testEngine.getHTML( "Test" );
+ String res = m_testEngine.getHTML( "Test" );
// FIXME: The <p> should not be here.
assertEquals( "<p><div class=\"toc\">\n<div class=\"collapsebox\">\n"+
@@ -90,9 +90,9 @@
{
String src="[{SET foo=bar}]\n\n[{INSERT TableOfContents WHERE numbered=true,start=3}]\n\n!!!Heading [{$foo}]\n\n!!Subheading\n\n!Subsubheading";
- testEngine.saveText( "Test", src );
+ m_testEngine.saveText( "Test", src );
- String res = testEngine.getHTML( "Test" );
+ String res = m_testEngine.getHTML( "Test" );
// FIXME: The <p> should not be here.
String expecting = "<p><div class=\"toc\">\n<div class=\"collapsebox\">\n"+
@@ -115,9 +115,9 @@
{
String src="[{SET foo=bar}]\n\n[{INSERT TableOfContents WHERE numbered=true,start=3}]\n\n!!!Heading [{$foo}]\n\n!!Subheading\n\n!Subsubheading\n\n!Subsubheading2\n\n!!Subheading2\n\n!Subsubheading3\n\n!!!Heading\n\n!!Subheading3";
- testEngine.saveText( "Test", src );
+ m_testEngine.saveText( "Test", src );
- String res = testEngine.getHTML( "Test" );
+ String res = m_testEngine.getHTML( "Test" );
// FIXME: The <p> should not be here.
String expecting = "<p><div class=\"toc\">\n<div class=\"collapsebox\">\n"+
@@ -150,9 +150,9 @@
{
String src="[{SET foo=bar}]\n\n[{INSERT TableOfContents WHERE numbered=true,start=3}]\n\n!!Subheading0\n\n!!!Heading [{$foo}]\n\n!!Subheading\n\n!Subsubheading\n\n!Subsubheading2\n\n!!Subheading2\n\n!Subsubheading3\n\n!!!Heading\n\n!!Subheading3";
- testEngine.saveText( "Test", src );
+ m_testEngine.saveText( "Test", src );
- String res = testEngine.getHTML( "Test" );
+ String res = m_testEngine.getHTML( "Test" );
// FIXME: The <p> should not be here.
String expecting = "<p><div class=\"toc\">\n<div class=\"collapsebox\">\n"+
@@ -187,9 +187,9 @@
{
String src="[{SET foo=bar}]\n\n[{INSERT TableOfContents WHERE numbered=true,start=3,prefix=FooBar-}]\n\n!!!Heading [{$foo}]\n\n!!Subheading\n\n!Subsubheading";
- testEngine.saveText( "Test", src );
+ m_testEngine.saveText( "Test", src );
- String res = testEngine.getHTML( "Test" );
+ String res = m_testEngine.getHTML( "Test" );
// FIXME: The <p> should not be here.
String expecting = "<p><div class=\"toc\">\n<div class=\"collapsebox\">\n"+
@@ -217,9 +217,9 @@
{
String src = "!!![{TableOfContents}]";
- testEngine.saveText( "Test", src );
+ m_testEngine.saveText( "Test", src );
- String res = testEngine.getHTML( "Test" );
+ String res = m_testEngine.getHTML( "Test" );
assertTrue( res.indexOf("Table of Contents") != -1 );
}
@@ -229,9 +229,9 @@
{
String src = "[{TableOfContents}]\n\n!<i>test</i>";
- testEngine.saveText( "Test", src );
+ m_testEngine.saveText( "Test", src );
- String res = testEngine.getHTML( "Test" );
+ String res = m_testEngine.getHTML( "Test" );
assertTrue( "<i>", res.indexOf("<i>") == -1 ); // Check that there is no HTML left
assertTrue( "</i>", res.indexOf("</i>") == -1 ); // Check that there is no HTML left
@@ -242,9 +242,9 @@
{
String src = "[{TableOfContents}]\n\n!Test\n\n!Test\n\n";
- testEngine.saveText( "Test", src );
+ m_testEngine.saveText( "Test", src );
- String res = testEngine.getHTML( "Test" );
+ String res = m_testEngine.getHTML( "Test" );
assertTrue( "Final HTML 1", res.indexOf( "id=\"section-Test-Test\"" ) != -1 );
assertTrue( "Final HTML 2", res.indexOf( "id=\"section-Test-Test-2\"" ) != -1 );
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/UndefinedPagesPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/UndefinedPagesPluginTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/UndefinedPagesPluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/UndefinedPagesPluginTest.java Sun May 17 12:37:23 2009
@@ -35,10 +35,10 @@
public class UndefinedPagesPluginTest extends TestCase
{
- Properties props = new Properties();
- TestEngine engine;
- WikiContext context;
- PluginManager manager;
+ Properties m_props = new Properties();
+ TestEngine m_engine;
+ WikiContext m_context;
+ PluginManager m_manager;
public UndefinedPagesPluginTest( String s )
{
@@ -48,28 +48,27 @@
public void setUp()
throws Exception
{
- props.load( TestEngine.findTestProperties() );
+ m_props.load( TestEngine.findTestProperties() );
- engine = new TestEngine(props);
+ m_engine = new TestEngine(m_props);
- engine.saveText( "TestPage", "Reference to [Foobar]." );
- engine.saveText( "Foobar", "Reference to [Foobar 2], [Foobars]" );
+ m_engine.saveText( "TestPage", "Reference to [Foobar]." );
+ m_engine.saveText( "Foobar", "Reference to [Foobar 2], [Foobars]" );
- context = engine.getWikiContextFactory().newViewContext( engine.getPage( "TestPage") );
- manager = new PluginManager( engine, props );
+ m_context = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "TestPage") );
+ m_manager = new PluginManager( m_engine, m_props );
}
- public void tearDown()
+ public void tearDown() throws Exception
{
- TestEngine.deleteTestPage( "TestPage" );
- TestEngine.deleteTestPage( "Foobar" );
+ m_engine.emptyRepository();
TestEngine.emptyWorkDir();
- engine.shutdown();
+ m_engine.shutdown();
}
private String wikitize( String s )
{
- return engine.textToHTML( context, s );
+ return m_engine.textToHTML( m_context, s );
}
/**
@@ -80,9 +79,9 @@
public void testSimpleUndefined()
throws Exception
{
- WikiContext context2 = engine.getWikiContextFactory().newViewContext( engine.getPage( "Foobar") );
+ WikiContext context2 = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "Foobar") );
- String res = manager.execute( context2,
+ String res = m_manager.execute( context2,
"{INSERT org.apache.wiki.plugin.UndefinedPagesPlugin");
String exp = "[Foobar 2]\\\\";
@@ -93,7 +92,7 @@
public void testCount() throws Exception
{
String result = null;
- result = manager.execute(context, "{UndefinedPagesPlugin show=count}");
+ result = m_manager.execute(m_context, "{UndefinedPagesPlugin show=count}");
assertEquals("1", result);
// test if the proper exception is thrown:
@@ -101,7 +100,7 @@
String exceptionString = null;
try
{
- result = manager.execute(context, "{UndefinedPagesPlugin,show=count,showLastModified=true}");
+ result = m_manager.execute(m_context, "{UndefinedPagesPlugin,show=count,showLastModified=true}");
}
catch (PluginException pe)
{
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/render/WysiwygEditingRendererTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/render/WysiwygEditingRendererTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/render/WysiwygEditingRendererTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/render/WysiwygEditingRendererTest.java Sun May 17 12:37:23 2009
@@ -50,10 +50,9 @@
m_testEngine.saveText( "This Pagename Has Spaces", "This Pagename Has Spaces" );
}
- public void tearDown()
+ public void tearDown() throws Exception
{
- TestEngine.deleteTestPage( "WysiwygEditingRendererTest" );
- TestEngine.deleteTestPage( "This Pagename Has Spaces" );
+ m_testEngine.emptyRepository();
m_testEngine.shutdown();
}
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/search/SearchManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/search/SearchManagerTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/search/SearchManagerTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/search/SearchManagerTest.java Sun May 17 12:37:23 2009
@@ -65,7 +65,7 @@
{
super.tearDown();
- TestEngine.deleteTestPage("TestPage");
+ m_engine.emptyRepository();
m_engine.shutdown();
}
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/xmlrpc/RPCHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/xmlrpc/RPCHandlerTest.java?rev=775638&r1=775637&r2=775638&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/xmlrpc/RPCHandlerTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/xmlrpc/RPCHandlerTest.java Sun May 17 12:37:23 2009
@@ -58,8 +58,7 @@
public void tearDown() throws Exception
{
- TestEngine.deleteTestPage( NAME1 );
- TestEngine.deleteAttachments( NAME1 );
+ m_engine.emptyRepository();
TestEngine.emptyWorkDir();
m_engine.shutdown();
}