You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by aj...@apache.org on 2009/10/14 05:28:34 UTC
svn commit: r825002 - in /incubator/jspwiki/trunk:
src/WebContent/WEB-INF/lib/ src/java/org/apache/wiki/
src/java/org/apache/wiki/api/ src/java/org/apache/wiki/content/
src/java/org/apache/wiki/content/jcr/ src/java/org/apache/wiki/parser/
src/java/org...
Author: ajaquith
Date: Wed Oct 14 03:28:33 2009
New Revision: 825002
URL: http://svn.apache.org/viewvc?rev=825002&view=rev
Log:
Additional unit test fixes. Pass rate is now over 97% when LDAP test harness running. Checked in Priha 0.5.2.
Added:
incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.5.3.jar (with props)
Removed:
incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.3.2.jar
incubator/jspwiki/trunk/tests/java/org/apache/wiki/filters/SpamFilterTest.java
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/api/WikiPage.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ReferenceManager.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/MarkupParser.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/InsertPage.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PageViewPlugin.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/RecentChangesPlugin.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiEngineTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/PageRenamerTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/filters/AllTests.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/MarkupParserTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PageViewPluginTest.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/UndefinedPagesPluginTest.java
incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/FileBasedActionResolverTest.java
Added: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.5.3.jar
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.5.3.jar?rev=825002&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/jspwiki/trunk/src/WebContent/WEB-INF/lib/priha-0.5.3.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Wed Oct 14 03:28:33 2009
@@ -77,7 +77,7 @@
* <p>
* If the build identifier is empty, it is not added.
*/
- public static final String BUILD = "163";
+ public static final String BUILD = "164";
/**
* This is the generic version string you should use
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java Wed Oct 14 03:28:33 2009
@@ -1238,7 +1238,8 @@
/**
* Returns true, if the requested page (or an alias) exists with the
- * requested version.
+ * requested version. A page "exists" if it has been
+ * previously saved to disk.
*
* @param page Page name
* @param version Page version
@@ -1259,7 +1260,8 @@
/**
* Returns true, if the requested page (or an alias) exists, with the
- * specified version in the WikiPage.
+ * specified version in the WikiPage. A page "exists" if it has been
+ * previously saved to disk.
*
* @param page A WikiPage object describing the name and version.
* @return true, if the page (or alias, or attachment) exists.
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/api/WikiPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/api/WikiPage.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/api/WikiPage.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/api/WikiPage.java Wed Oct 14 03:28:33 2009
@@ -111,6 +111,8 @@
/**
* Returns the date when this page was last modified.
+ * If the page has never been modified (because it has never
+ * been saved, for example), this method returns {@code null}.
*
* @return The last modification date
*/
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java Wed Oct 14 03:28:33 2009
@@ -455,7 +455,7 @@
nd.setProperty( JCRWikiPage.ATTR_CREATED, Calendar.getInstance() );
}
- if( nd.isNew() )
+ if( isNew( nd ) )
{
// New node, so nothing to check in
nd.getParent().save();
@@ -634,17 +634,37 @@
}
/**
- * Returns true, if this Node is the root node of a space.
+ * Returns {@code true} if this Node is the root node of a space.
*
* @param nd Node to check
* @return true, if this is a root node of a space.
*/
- private boolean isSpaceRoot(Node nd) throws RepositoryException
+ private boolean isSpaceRoot( Node nd ) throws RepositoryException
{
return nd != null && nd.getPath().startsWith( "/"+JCR_PAGES_NODE ) && nd.getDepth() == 2;
}
/**
+ * Returns {@code true} if the JCR node contains the attribute
+ * {@link JCRWikiPage#ATTR_CREATED}; {@code false} otherwise.
+ * @param nd the node to check
+ * @return whether the node has been previously saved
+ */
+ private boolean isNew( Node nd )
+ {
+ try
+ {
+ return !nd.hasProperty( JCRWikiPage.ATTR_CREATED );
+ }
+ catch( RepositoryException e )
+ {
+ log.error( "Could not obtain attribute " + JCRWikiPage.ATTR_CREATED + " from node " + nd.toString() );
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ /**
* Returns the WikiEngine to which this PageManager belongs to.
*
* @return The WikiEngine object.
@@ -890,16 +910,14 @@
}
// Node "exists" only if it's been saved already.
- return !node.isNew();
+ return !isNew( node );
}
/**
* Returns <code>true</code> if a given page exists for a specific version.
* For the page to "exist" the page must have been previously added
- * (for example, by {@link #addPage(WikiPath, String)}), although it need not
- * have been saved. This is unlike the {@link WikiEngine} version of
- * <code>pageExists</code>, which requires the page to be saved before it
- * is considered to exist.
+ * (for example, by {@link #addPage(WikiPath, String)}), and it must
+ * have been previously saved.
*
* @param wikiPath the {@link WikiPath} to check for
* @param version The version to check
@@ -927,14 +945,14 @@
if ( version == WikiProvider.LATEST_VERSION )
{
- return !node.isNew();
+ return !isNew( node );
}
String v = Integer.toString( version );
if ( node.hasNode( WIKI_VERSIONS ) )
{
Node versions = node.getNode( WIKI_VERSIONS );
- return versions.hasNode( v ) && !versions.getNode( v ).isNew();
+ return versions.hasNode( v ) && !isNew( versions.getNode( v ) );
}
}
catch ( PathNotFoundException e )
@@ -1353,10 +1371,14 @@
try
{
page = engine.getPage( toPage );
+ if ( engine.pageExists( fromPage.toString() ) )
+ {
+ throw new InternalWikiException( "Rename failed: fromPage " + fromPage + " still exists after move!" );
+ }
}
catch ( PageNotFoundException e )
{
- throw new InternalWikiException( "Rename seems to have failed for some strange reason - please check logs!" );
+ throw new InternalWikiException( "Rename failed: toPage " + toPage + " not found after move!" );
}
page.setAttribute( WikiPage.CHANGENOTE, fromPage.toString() + " ==> " + toPage.toString() );
page.setAuthor( context.getCurrentUser().getName() );
@@ -1468,7 +1490,7 @@
Node nd = session.getRootNode().addNode( jcrPath );
nd.addMixin( "mix:referenceable" );
- nd.setProperty( JCRWikiPage.CONTENTTYPE, contentType );
+ nd.setProperty( JCRWikiPage.CONTENT_TYPE, contentType );
JCRWikiPage page = new JCRWikiPage(m_engine, path, nd);
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ReferenceManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ReferenceManager.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ReferenceManager.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ReferenceManager.java Wed Oct 14 03:28:33 2009
@@ -967,9 +967,9 @@
/**
* Removes a String value from a given JCR node and
* {@link javax.jcr.Property}. The property is assumed to return an array
- * of {@link javax.jcr.Value} objects. The node is created if it does not
- * exist. Modifications to the underlying JCR node are saved by the
- * current JCR {@link Session}.
+ * of {@link javax.jcr.Value} objects. The node is <em>not</em> created if it does not
+ * exist because by definition the property is already removed! Modifications to the
+ * underlying JCR node are saved by the current JCR {@link Session}.
*
* @param jcrNode the JCR path to the node
* @param property the property to add to
@@ -994,10 +994,8 @@
}
catch( PathNotFoundException e )
{
- if( !s.itemExists( jcrNode ) )
- {
- node = cm.createJCRNode( jcrNode );
- }
+ // If parent node doesn't exist, it's (by definition) already removed
+ return;
}
// Retrieve the property; remove all instances of value
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/jcr/JCRWikiPage.java Wed Oct 14 03:28:33 2009
@@ -55,7 +55,8 @@
{
private static final long serialVersionUID = 1L;
- private static final String LASTMODIFIED = "wiki:lastModified";
+ /** The name of the attribute that stores the last-modified timestamp. */
+ private static final String LAST_MODIFIED = "wiki:lastModified";
private static final String AUTHOR = "wiki:author";
@@ -70,7 +71,7 @@
public static final String ATTR_CREATED = "wiki:created";
/** The name of the contentType attribute */
- public static final String CONTENTTYPE = "wiki:contentType";
+ public static final String CONTENT_TYPE = "wiki:contentType";
/** The ISO8601:2000 dateformat */
public static final String DATEFORMAT_ISO8601_2000 = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
@@ -288,9 +289,9 @@
{
try
{
- if ( getJCRNode().hasProperty( LASTMODIFIED ) )
+ if ( getJCRNode().hasProperty( LAST_MODIFIED ) )
{
- return getJCRNode().getProperty( LASTMODIFIED ).getDate().getTime();
+ return getJCRNode().getProperty( LAST_MODIFIED ).getDate().getTime();
}
}
catch( RepositoryException e )
@@ -302,7 +303,7 @@
public void setLastModified( Date date )
{
- setAttribute( LASTMODIFIED, date );
+ setAttribute( LAST_MODIFIED, date );
}
/**
@@ -544,7 +545,7 @@
*/
public String getContentType()
{
- return (String)getAttribute( CONTENTTYPE );
+ return (String)getAttribute( CONTENT_TYPE );
}
public List<WikiPath> getReferrers() throws ProviderException
@@ -578,7 +579,7 @@
public void setContentType( String contentType )
{
- setAttribute( CONTENTTYPE, contentType );
+ setAttribute( CONTENT_TYPE, contentType );
}
/**
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/JSPWikiMarkupParser.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/JSPWikiMarkupParser.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/JSPWikiMarkupParser.java Wed Oct 14 03:28:33 2009
@@ -1662,6 +1662,11 @@
linkref = linkref.substring( 0, hashMark );
linkref = MarkupParser.cleanLink( linkref );
+ if ( linkExists( linkref ) == null )
+ {
+ String legacyLinkref = MarkupParser.wikifyLink( linkref );
+ linkref = linkExists( legacyLinkref ) != null ? legacyLinkref : linkref;
+ }
callMutatorChain( m_localLinkMutatorChain, linkref );
@@ -1681,6 +1686,11 @@
{
// It's an internal Wiki link
linkref = MarkupParser.cleanLink( linkref );
+ if ( linkExists( linkref ) == null )
+ {
+ String legacyLinkref = MarkupParser.wikifyLink( linkref );
+ linkref = linkExists( legacyLinkref ) != null ? legacyLinkref : linkref;
+ }
callMutatorChain( m_localLinkMutatorChain, linkref );
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/MarkupParser.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/MarkupParser.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/MarkupParser.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/parser/MarkupParser.java Wed Oct 14 03:28:33 2009
@@ -309,6 +309,12 @@
continue;
wasSpace = true;
+
+ // Make sure we capitalize the next letter for old-style wiki links
+ if ( LEGACY_CHARS_ALLOWED.equals( allowedChars ) )
+ {
+ isWord = true;
+ }
}
else
{
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/InsertPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/InsertPage.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/InsertPage.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/InsertPage.java Wed Oct 14 03:28:33 2009
@@ -102,6 +102,11 @@
try
{
WikiPath pageName = engine.getFinalPageName( context.getPage().getPath().resolve( includedPage ) );
+ if ( pageName == null )
+ {
+ String includedPageNoSpaces = includedPage.replace( " ", "" ); //Trim any spaces in the name
+ pageName = engine.getFinalPageName( context.getPage().getPath().resolve( includedPageNoSpaces ) );
+ }
if( pageName != null )
{
page = engine.getPage( pageName );
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PageViewPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PageViewPlugin.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PageViewPlugin.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PageViewPlugin.java Wed Oct 14 03:28:33 2009
@@ -108,7 +108,7 @@
private static final String STR_GLOBSTAR = "*";
/** Constant for file storage. */
- private static final String COUNTER_PAGE = "PageCount.txt";
+ protected static final String COUNTER_PAGE = "PageCount.txt";
/** Constant for storage interval in seconds. */
private static final int STORAGE_INTERVAL = 60;
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/RecentChangesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/RecentChangesPlugin.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/RecentChangesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/RecentChangesPlugin.java Wed Oct 14 03:28:33 2009
@@ -126,97 +126,94 @@
try
{
Date lastmod = pageref.getLastModified();
-
- if( lastmod == null || lastmod.before( sincedate.getTime() ) )
- {
- break;
- }
-
- if( !isSameDay( lastmod, olddate ) )
+ if( lastmod != null && lastmod.after( sincedate.getTime() ) )
{
+ if( !isSameDay( lastmod, olddate ) )
+ {
+ tr row = new tr();
+ td col = new td();
+
+ col.setColSpan(tablewidth).setClass("date");
+ col.addElement( new b().addElement(fmt.format(lastmod)) );
+
+ rt.addElement(row);
+ row.addElement(col);
+ olddate = lastmod;
+ }
+
+ String link = context.getURL( pageref.isAttachment() ? WikiContext.ATTACH : WikiContext.VIEW,
+ pageref.getName() ) ;
+
+ a linkel = new a(link,engine.beautifyTitle(pageref.getPath()));
+
tr row = new tr();
- td col = new td();
- col.setColSpan(tablewidth).setClass("date");
- col.addElement( new b().addElement(fmt.format(lastmod)) );
-
- rt.addElement(row);
- row.addElement(col);
- olddate = lastmod;
- }
+ td col = new td().setWidth("30%").addElement(linkel);
- String link = context.getURL( pageref.isAttachment() ? WikiContext.ATTACH : WikiContext.VIEW,
- pageref.getName() ) ;
-
- a linkel = new a(link,engine.beautifyTitle(pageref.getPath()));
-
- tr row = new tr();
-
- td col = new td().setWidth("30%").addElement(linkel);
-
- //
- // Add the direct link to the attachment info.
- //
- if( pageref.isAttachment() )
- {
- linkel = new a().setHref(context.getURL(WikiContext.INFO,pageref.getName()));
- linkel.setClass("infolink");
- linkel.addElement( new img().setSrc(context.getURL(WikiContext.NONE, "images/attachment_small.png")));
-
- col.addElement( linkel );
- }
+ //
+ // Add the direct link to the attachment info.
+ //
+ if( pageref.isAttachment() )
+ {
+ linkel = new a().setHref(context.getURL(WikiContext.INFO,pageref.getName()));
+ linkel.setClass("infolink");
+ linkel.addElement( new img().setSrc(context.getURL(WikiContext.NONE, "images/attachment_small.png")));
-
- row.addElement(col);
- rt.addElement(row);
-
- if( pageref.isAttachment() )
- {
- row.addElement( new td(tfmt.format(lastmod)).setClass("lastchange") );
- }
- else
- {
- td infocol = (td) new td().setClass("lastchange");
- infocol.addElement( new a(context.getURL(WikiContext.DIFF, pageref.getName(), "r1=-1"),tfmt.format(lastmod)) );
- row.addElement(infocol);
- }
+ col.addElement( linkel );
+ }
- //
- // Display author information.
- //
+
+ row.addElement(col);
+ rt.addElement(row);
+
+ if( pageref.isAttachment() )
+ {
+ row.addElement( new td(tfmt.format(lastmod)).setClass("lastchange") );
+ }
+ else
+ {
+ td infocol = (td) new td().setClass("lastchange");
+ infocol.addElement( new a(context.getURL(WikiContext.DIFF, pageref.getName(), "r1=-1"),tfmt.format(lastmod)) );
+ row.addElement(infocol);
+ }
- if( showAuthor )
- {
- String author = pageref.getAuthor();
+ //
+ // Display author information.
+ //
- td authorinfo = new td();
- authorinfo.setClass("author");
-
- if( author != null )
+ if( showAuthor )
{
- if( engine.pageExists(author) )
+ String author = pageref.getAuthor();
+
+ td authorinfo = new td();
+ authorinfo.setClass("author");
+
+ if( author != null )
{
- authorinfo.addElement( new a(context.getURL(WikiContext.VIEW, author),author) );
+ if( engine.pageExists(author) )
+ {
+ authorinfo.addElement( new a(context.getURL(WikiContext.VIEW, author),author) );
+ }
+ else
+ {
+ authorinfo.addElement(author);
+ }
}
else
{
- authorinfo.addElement(author);
+ authorinfo.addElement( context.getBundle(InternationalizationManager.CORE_BUNDLE).getString( "common.unknownauthor" ) );
}
+
+ row.addElement( authorinfo );
}
- else
+
+ // Change note
+ if( showChangenote )
{
- authorinfo.addElement( context.getBundle(InternationalizationManager.CORE_BUNDLE).getString( "common.unknownauthor" ) );
+ String changenote = (String)pageref.getAttribute(WikiPage.CHANGENOTE);
+
+ row.addElement( new td(changenote != null ? TextUtil.replaceEntities(changenote) : "").setClass("changenote") );
}
-
- row.addElement( authorinfo );
- }
-
- // Change note
- if( showChangenote )
- {
- String changenote = (String)pageref.getAttribute(WikiPage.CHANGENOTE);
-
- row.addElement( new td(changenote != null ? TextUtil.replaceEntities(changenote) : "").setClass("changenote") );
}
}
catch( ProviderException e )
@@ -225,7 +222,6 @@
throw new PluginException( "Could not determine whether WikiPage " + pageref.getName() + " is an attachment.", e );
}
-
// Revert note
/*
if( context.hasAdminPermissions() )
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=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java Wed Oct 14 03:28:33 2009
@@ -26,6 +26,7 @@
import java.util.Map;
import java.util.Properties;
+import javax.jcr.RepositoryException;
import javax.security.auth.login.LoginException;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
@@ -208,6 +209,10 @@
catch( IOException e ) {} // Fine
}
+ /**
+ * Empties the page directory and re-initializes the references database.
+ * @throws ProviderException
+ */
public void emptyRepository() throws ProviderException
{
Collection<WikiPage> pages = getContentManager().getAllPages( null );
@@ -216,6 +221,14 @@
{
getContentManager().deletePage( p );
}
+ try
+ {
+ getReferenceManager().rebuild();
+ }
+ catch( RepositoryException e )
+ {
+ throw new ProviderException( "Could not rebuild reference database.", e );
+ }
}
public static final InputStream findTestProperties()
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiEngineTest.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiEngineTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiEngineTest.java Wed Oct 14 03:28:33 2009
@@ -820,8 +820,8 @@
m_engine.deletePage( NAME1 );
WikiPage page = m_engine.createPage( WikiPath.valueOf( NAME1 ) );
- assertEquals( "Page does not exist",
- true,
+ assertEquals( "Page was saved to disk, but should not have been.",
+ false,
m_engine.pageExists( page ) );
}
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=825002&r1=825001&r2=825002&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 Wed Oct 14 03:28:33 2009
@@ -23,6 +23,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Properties;
+import java.util.Set;
import junit.framework.Test;
import junit.framework.TestCase;
@@ -72,8 +73,8 @@
public void testSimpleRename()
throws Exception
{
- // Count the numberof existing references
- int refCount = m_engine.getReferenceManager().findCreated().size();
+ // Count the number of existing references
+ int pageCount = m_engine.getPageCount();
m_engine.saveText("TestPage", "the big lazy dog thing" );
@@ -96,11 +97,11 @@
// Refmgr
- Collection<String> refs = m_engine.getReferenceManager().findCreated();
+ Set<String> pages = m_engine.getReferenceManager().findCreated();
- assertTrue( "FooTest does not exist", refs.contains("Main:FooTest") );
- assertFalse( "TestPage exists", refs.contains("Main:TestPage") );
- assertEquals( "wrong list size", refCount+1, refs.size() );
+ assertTrue( "FooTest does not exist", pages.contains( "Main:FooTest" ) );
+ assertFalse( "TestPage exists", pages.contains( "Main:TestPage" ) );
+ assertEquals( "wrong list size", pageCount+1, pages.size() );
}
public void testReferrerChange()
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/filters/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/filters/AllTests.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/filters/AllTests.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/filters/AllTests.java Wed Oct 14 03:28:33 2009
@@ -33,10 +33,7 @@
public static Test suite()
{
TestSuite suite = new TestSuite("PageFilter tests");
-
suite.addTest( FilterManagerTest.suite() );
- suite.addTest( SpamFilterTest.suite() );
-
return suite;
}
}
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/MarkupParserTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/MarkupParserTest.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/MarkupParserTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/parser/MarkupParserTest.java Wed Oct 14 03:28:33 2009
@@ -59,6 +59,16 @@
assertEquals( "Clean (link)", MarkupParser.cleanLink("Clean (link)") );
}
+ public void testCleanLinkWithSpaces()
+ {
+ assertEquals( "Hyperlink too", MarkupParser.cleanLink("hyperlink too") );
+ }
+
+ public void testWikifyLinkWithSpaces()
+ {
+ assertEquals( "HyperlinkToo", MarkupParser.wikifyLink("hyperlink too") );
+ }
+
public static Test suite()
{
TestSuite suite = new TestSuite(MarkupParserTest.class);
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PageViewPluginTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PageViewPluginTest.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PageViewPluginTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/PageViewPluginTest.java Wed Oct 14 03:28:33 2009
@@ -20,11 +20,12 @@
*/
package org.apache.wiki.plugin;
+import java.io.File;
import java.util.Properties;
+import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import junit.framework.Test;
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
@@ -34,34 +35,41 @@
public class PageViewPluginTest extends TestCase
{
- Properties props = new Properties();
-
- TestEngine testEngine;
-
- WikiContext context;
-
- PluginManager manager;
+ private TestEngine m_engine;
public void setUp() throws Exception
{
+ Properties props = new Properties();
props.load( TestEngine.findTestProperties() );
- testEngine = new TestEngine( props );
+ m_engine = new TestEngine( props );
+
+ // Clean page counters
+ File file = new File ( m_engine.getWorkDir(), PageViewPlugin.COUNTER_PAGE );
+ if ( file.exists() )
+ {
+ file.delete();
+ }
- // create pages that should be counted
- testEngine.saveText( "TestPage01", "this is test page 01 [{PageViewPlugin}]" );
- testEngine.saveText( "TestPage02", "this is test page 02 [{PageViewPlugin}]" );
+ // Create pages that should be counted
+ m_engine.deletePage( "PageViewPluginTest01" );
+ m_engine.deletePage( "PageViewPluginTest02" );
+ m_engine.deletePage( "PageViewPluginTest03" );
+ m_engine.deletePage( "PageViewPluginTest04" );
+ m_engine.deletePage( "PageViews" );
+ m_engine.saveText( "PageViewPluginTest01", "this is test page 01 [{PageViewPlugin}]" );
+ m_engine.saveText( "PageViewPluginTest02", "this is test page 02 [{PageViewPlugin}]" );
- manager = new PluginManager( testEngine, props );
+ new PluginManager( m_engine, props );
}
public void tearDown()
{
try
{
- testEngine.deletePage( "TestPage01" );
- testEngine.deletePage( "TestPage02" );
- testEngine.deletePage( "PageViews" );
+ m_engine.deletePage( "PageViewPluginTest01" );
+ m_engine.deletePage( "PageViewPluginTest02" );
+ m_engine.deletePage( "PageViews" );
}
catch( ProviderException e )
{
@@ -72,86 +80,86 @@
public void testShowCountsBasic() throws Exception
{
- WikiPage page1 = testEngine.getPage( "TestPage01" );
- WikiContext context1 = testEngine.getWikiContextFactory().newViewContext( page1 );
- WikiPage page2 = testEngine.getPage( "TestPage02" );
- WikiContext context2 = testEngine.getWikiContextFactory().newViewContext( page2 );
+ WikiPage page1 = m_engine.getPage( "PageViewPluginTest01" );
+ WikiContext context1 = m_engine.getWikiContextFactory().newViewContext( page1 );
+ WikiPage page2 = m_engine.getPage( "PageViewPluginTest02" );
+ WikiContext context2 = m_engine.getWikiContextFactory().newViewContext( page2 );
// generate counts:
- testEngine.getHTML( context1, page1 );
- testEngine.getHTML( context2, page2 );
- testEngine.getHTML( context2, page2 );
+ m_engine.getHTML( context1, page1 );
+ m_engine.getHTML( context2, page2 );
+ m_engine.getHTML( context2, page2 );
// mind the double \n in the following string:
String pageViewPageContent = "[{PageViewPlugin show='list''\n\n* {1} ({2} views)\n}]";
- testEngine.saveText( "PageViews", pageViewPageContent );
+ m_engine.saveText( "PageViews", pageViewPageContent );
- WikiPage pageviews = testEngine.getPage( "PageViews" );
- WikiContext contextPV = testEngine.getWikiContextFactory().newViewContext( pageviews );
+ WikiPage pageviews = m_engine.getPage( "PageViews" );
+ WikiContext contextPV = m_engine.getWikiContextFactory().newViewContext( pageviews );
- String result = testEngine.getHTML( contextPV, pageviews );
+ String result = m_engine.getHTML( contextPV, pageviews );
// System.out.println( result );
- assertTrue( result.contains( "TestPage01</a> (2 views)" ) );
+ assertTrue( result.contains( "PageViewPluginTest01</a> (2 views)" ) );
- assertTrue( result.contains( "TestPage02</a> (3 views)" ) );
+ assertTrue( result.contains( "PageViewPluginTest02</a> (3 views)" ) );
}
public void testShowCountsExclude() throws Exception
{
- testEngine.saveText( "TestPageExcluded", "this is test page that should be excluded [{PageViewPlugin}]" );
+ m_engine.saveText( "TestPageExcluded", "this is test page that should be excluded [{PageViewPlugin}]" );
- WikiPage page1 = testEngine.getPage( "TestPage01" );
- WikiContext context1 = testEngine.getWikiContextFactory().newViewContext( page1 );
- WikiPage page2 = testEngine.getPage( "TestPage02" );
- WikiContext context2 = testEngine.getWikiContextFactory().newViewContext( page2 );
+ WikiPage page1 = m_engine.getPage( "PageViewPluginTest01" );
+ WikiContext context1 = m_engine.getWikiContextFactory().newViewContext( page1 );
+ WikiPage page2 = m_engine.getPage( "PageViewPluginTest02" );
+ WikiContext context2 = m_engine.getWikiContextFactory().newViewContext( page2 );
// generate counts:
- testEngine.getHTML( context1, page1 );
- testEngine.getHTML( context2, page2 );
+ m_engine.getHTML( context1, page1 );
+ m_engine.getHTML( context2, page2 );
// mind the double \n in the following string:
String pageViewPageContent = "[{PageViewPlugin show='list' exclude='TestPageExcl*' '\n\n* {1} ({2} views)\n}]";
- testEngine.saveText( "PageViews", pageViewPageContent );
+ m_engine.saveText( "PageViews", pageViewPageContent );
- WikiPage pageviews = testEngine.getPage( "PageViews" );
- WikiContext contextPV = testEngine.getWikiContextFactory().newViewContext( pageviews );
+ WikiPage pageviews = m_engine.getPage( "PageViews" );
+ WikiContext contextPV = m_engine.getWikiContextFactory().newViewContext( pageviews );
- String result = testEngine.getHTML( contextPV, pageviews );
+ String result = m_engine.getHTML( contextPV, pageviews );
// System.out.println( result );
- assertTrue( result.contains( "TestPage01" ) );
+ assertTrue( result.contains( "PageViewPluginTest01" ) );
// this page should not have been shown:
assertFalse( result.contains( "TestPageExcluded" ) );
- testEngine.deletePage( "TestPageExcluded" );
+ m_engine.deletePage( "TestPageExcluded" );
}
public void testShowCountsSorted() throws Exception
{
- WikiPage page1 = testEngine.getPage( "TestPage01" );
- WikiContext context1 = testEngine.getWikiContextFactory().newViewContext( page1 );
- WikiPage page2 = testEngine.getPage( "TestPage02" );
- WikiContext context2 = testEngine.getWikiContextFactory().newViewContext( page2 );
+ WikiPage page1 = m_engine.getPage( "PageViewPluginTest01" );
+ WikiContext context1 = m_engine.getWikiContextFactory().newViewContext( page1 );
+ WikiPage page2 = m_engine.getPage( "PageViewPluginTest02" );
+ WikiContext context2 = m_engine.getWikiContextFactory().newViewContext( page2 );
// generate counts:
- testEngine.getHTML( context1, page1 );
- testEngine.getHTML( context2, page2 );
- testEngine.getHTML( context2, page2 );
+ m_engine.getHTML( context1, page1 );
+ m_engine.getHTML( context2, page2 );
+ m_engine.getHTML( context2, page2 );
// mind the double \n in the following string:
String pageViewPageContent = "[{PageViewPlugin show='list' sort=count '\n\n* {1} ({2} views)\n}]";
- testEngine.saveText( "PageViews", pageViewPageContent );
+ m_engine.saveText( "PageViews", pageViewPageContent );
- WikiPage pageviews = testEngine.getPage( "PageViews" );
- WikiContext contextPV = testEngine.getWikiContextFactory().newViewContext( pageviews );
+ WikiPage pageviews = m_engine.getPage( "PageViews" );
+ WikiContext contextPV = m_engine.getWikiContextFactory().newViewContext( pageviews );
- String result = testEngine.getHTML( contextPV, pageviews );
+ String result = m_engine.getHTML( contextPV, pageviews );
// System.out.println( result );
- int start1 = result.indexOf( "TestPage01" );
- int start2 = result.indexOf( "TestPage02" );
+ int start1 = result.indexOf( "PageViewPluginTest01" );
+ int start2 = result.indexOf( "PageViewPluginTest02" );
// page2 should be showed before page1
assertTrue( start2 < start1 );
@@ -160,41 +168,41 @@
public void testShowCountEntries() throws Exception
{
// create pages that should be counted
- testEngine.saveText( "TestPage03", "this is test page 03 [{PageViewPlugin}]" );
- testEngine.saveText( "TestPage04", "this is test page 04 [{PageViewPlugin}]" );
+ m_engine.saveText( "PageViewPluginTest03", "this is test page 03 [{PageViewPlugin}]" );
+ m_engine.saveText( "PageViewPluginTest04", "this is test page 04 [{PageViewPlugin}]" );
- WikiPage page1 = testEngine.getPage( "TestPage01" );
- WikiContext context1 = testEngine.getWikiContextFactory().newViewContext( page1 );
- WikiPage page2 = testEngine.getPage( "TestPage02" );
- WikiContext context2 = testEngine.getWikiContextFactory().newViewContext( page2 );
- WikiPage page3 = testEngine.getPage( "TestPage03" );
- WikiContext context3 = testEngine.getWikiContextFactory().newViewContext( page3 );
- WikiPage page4 = testEngine.getPage( "TestPage04" );
- WikiContext context4 = testEngine.getWikiContextFactory().newViewContext( page4 );
+ WikiPage page1 = m_engine.getPage( "PageViewPluginTest01" );
+ WikiContext context1 = m_engine.getWikiContextFactory().newViewContext( page1 );
+ WikiPage page2 = m_engine.getPage( "PageViewPluginTest02" );
+ WikiContext context2 = m_engine.getWikiContextFactory().newViewContext( page2 );
+ WikiPage page3 = m_engine.getPage( "PageViewPluginTest03" );
+ WikiContext context3 = m_engine.getWikiContextFactory().newViewContext( page3 );
+ WikiPage page4 = m_engine.getPage( "PageViewPluginTest04" );
+ WikiContext context4 = m_engine.getWikiContextFactory().newViewContext( page4 );
// generate counts:
- testEngine.getHTML( context1, page1 );
- testEngine.getHTML( context2, page2 );
- testEngine.getHTML( context2, page2 );
- testEngine.getHTML( context3, page3 );
- testEngine.getHTML( context4, page4 );
+ m_engine.getHTML( context1, page1 );
+ m_engine.getHTML( context2, page2 );
+ m_engine.getHTML( context2, page2 );
+ m_engine.getHTML( context3, page3 );
+ m_engine.getHTML( context4, page4 );
// mind the double \n in the following string:
String pageViewPageContent = "[{PageViewPlugin show='list' entries=3'\n\n* {1} ({2} views)\n}]";
- testEngine.saveText( "PageViews", pageViewPageContent );
+ m_engine.saveText( "PageViews", pageViewPageContent );
- WikiPage pageviews = testEngine.getPage( "PageViews" );
- WikiContext contextPV = testEngine.getWikiContextFactory().newViewContext( pageviews );
+ WikiPage pageviews = m_engine.getPage( "PageViews" );
+ WikiContext contextPV = m_engine.getWikiContextFactory().newViewContext( pageviews );
- String result = testEngine.getHTML( contextPV, pageviews );
+ String result = m_engine.getHTML( contextPV, pageviews );
// System.out.println( result );
- assertTrue( result.contains( "TestPage03" ) );
+ assertTrue( result.contains( "PageViewPluginTest03" ) );
- assertFalse( result.contains( "TestPage04" ) );
+ assertFalse( result.contains( "PageViewPluginTest04" ) );
- testEngine.deletePage( "TestPage03" );
- testEngine.deletePage( "TestPage04" );
+ m_engine.deletePage( "PageViewPluginTest03" );
+ m_engine.deletePage( "PageViewPluginTest04" );
}
public static Test suite()
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=825002&r1=825001&r2=825002&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 Wed Oct 14 03:28:33 2009
@@ -47,11 +47,10 @@
m_engine = new TestEngine( m_props );
- 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" );
+ m_engine.saveText( "RecentChangesPlugin01", "Some Text for testing 01" );
+ m_engine.saveText( "RecentChangesPlugin02", "Some Text for testing 02" );
+ m_engine.saveText( "RecentChangesPlugin03", "Some Text for testing 03" );
-// context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage( "TestPage01" ) );
m_pluginmanager = new PluginManager( m_engine, m_props );
}
@@ -70,16 +69,16 @@
*/
public void testSimple() throws Exception
{
- m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "TestPage01" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "RecentChangesPlugin01" ) );
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
assertTrue(res.contains( "<table cellpadding='4' class='recentchanges'>"));
- assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage01'>TestPage01</a>" ));
- assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage02'>TestPage02</a>" ));
- assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage03'>TestPage03</a>" ));
+ assertTrue(res.contains( "<a href='/Wiki.jsp?page=RecentChangesPlugin01'>RecentChangesPlugin01</a>" ));
+ assertTrue(res.contains( "<a href='/Wiki.jsp?page=RecentChangesPlugin02'>RecentChangesPlugin02</a>" ));
+ assertTrue(res.contains( "<a href='/Wiki.jsp?page=RecentChangesPlugin03'>RecentChangesPlugin03</a>" ));
}
@@ -90,15 +89,15 @@
*/
public void testParmInclude() throws Exception
{
- m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "TestPage02" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "RecentChangesPlugin02" ) );
String res = m_pluginmanager.execute( m_context,
- "{INSERT org.apache.wiki.plugin.RecentChangesPlugin include='TestPage02*'}" );
+ "{INSERT org.apache.wiki.plugin.RecentChangesPlugin include='RecentChangesPlugin02*'}" );
assertTrue(res.contains( "<table cellpadding='4' class='recentchanges'>"));
- assertFalse(res.contains( "<a href='/Wiki.jsp?page=TestPage01'>TestPage01</a>" ));
- assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage02'>TestPage02</a>" ));
- assertFalse(res.contains( "<a href='/Wiki.jsp?page=TestPage03'>TestPage03</a>" ));
+ assertFalse(res.contains( "<a href='/Wiki.jsp?page=RecentChangesPlugin01'>RecentChangesPlugin01</a>" ));
+ assertTrue(res.contains( "<a href='/Wiki.jsp?page=RecentChangesPlugin02'>RecentChangesPlugin02</a>" ));
+ assertFalse(res.contains( "<a href='/Wiki.jsp?page=RecentChangesPlugin03'>RecentChangesPlugin03</a>" ));
}
@@ -109,14 +108,14 @@
*/
public void testParmExclude() throws Exception
{
- m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "TestPage03" ) );
+ m_context = m_engine.getWikiContextFactory().newViewContext( null, null, m_engine.getPage( "RecentChangesPlugin03" ) );
- String res = m_pluginmanager.execute( m_context, "{INSERT RecentChangesPlugin exclude='TestPage03*'}" );
+ String res = m_pluginmanager.execute( m_context, "{INSERT RecentChangesPlugin exclude='RecentChangesPlugin03*'}" );
assertTrue(res.contains( "<table cellpadding='4' class='recentchanges'>"));
- assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage01'>TestPage01</a>" ));
- assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage02'>TestPage02</a>" ));
- assertFalse(res.contains( "<a href='/Wiki.jsp?page=TestPage03'>TestPage03</a>" ));
+ assertTrue(res.contains( "<a href='/Wiki.jsp?page=RecentChangesPlugin01'>RecentChangesPlugin01</a>" ));
+ assertTrue(res.contains( "<a href='/Wiki.jsp?page=RecentChangesPlugin02'>RecentChangesPlugin02</a>" ));
+ assertFalse(res.contains( "<a href='/Wiki.jsp?page=RecentChangesPlugin03'>RecentChangesPlugin03</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=825002&r1=825001&r2=825002&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 Wed Oct 14 03:28:33 2009
@@ -58,17 +58,13 @@
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" ) );
m_manager = new PluginManager( m_engine, m_props );
}
public void tearDown() throws Exception
{
m_engine.emptyRepository();
-
TestEngine.emptyWorkDir();
-
m_engine.shutdown();
}
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=825002&r1=825001&r2=825002&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 Wed Oct 14 03:28:33 2009
@@ -29,6 +29,7 @@
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
+import org.apache.wiki.WikiEngine;
import org.apache.wiki.api.PluginException;
import org.apache.wiki.plugin.PluginManager;
@@ -49,13 +50,14 @@
throws Exception
{
m_props.load( TestEngine.findTestProperties() );
+ m_props.setProperty( WikiEngine.PROP_BEAUTIFYTITLE, "false" );
m_engine = new TestEngine(m_props);
- m_engine.saveText( "TestPage", "Reference to [Foobar]." );
- m_engine.saveText( "Foobar", "Reference to [Foobar 2], [Foobars]" );
+ m_engine.saveText( "UndefinedPagesPluginTest", "Reference to [UndefinedRef]." );
+ m_engine.saveText( "UndefinedRef", "Reference to [UndefinedRef2], [UndefinedRefs]" );
- m_context = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "TestPage") );
+ m_context = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "UndefinedPagesPluginTest") );
m_manager = new PluginManager( m_engine, m_props );
}
@@ -79,12 +81,12 @@
public void testSimpleUndefined()
throws Exception
{
- WikiContext context2 = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "Foobar") );
+ WikiContext context2 = m_engine.getWikiContextFactory().newViewContext( m_engine.getPage( "UndefinedRef") );
String res = m_manager.execute( context2,
"{INSERT org.apache.wiki.plugin.UndefinedPagesPlugin");
- String exp = "[Foobar 2]\\\\";
+ String exp = "[UndefinedRef2]\\\\";
assertEquals( wikitize(exp), res );
}
Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/FileBasedActionResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/FileBasedActionResolverTest.java?rev=825002&r1=825001&r2=825002&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/FileBasedActionResolverTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/ui/stripes/FileBasedActionResolverTest.java Wed Oct 14 03:28:33 2009
@@ -22,15 +22,19 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import net.sourceforge.stripes.controller.DispatcherServlet;
+import net.sourceforge.stripes.controller.DynamicMappingFilter;
import net.sourceforge.stripes.controller.StripesFilter;
import net.sourceforge.stripes.mock.MockRoundtrip;
import net.sourceforge.stripes.mock.MockServletContext;
+import org.apache.wiki.WikiEngine;
+import org.apache.wiki.action.InstallActionBean;
import org.apache.wiki.action.ViewActionBean;
@@ -54,6 +58,12 @@
// Set the configured servlet context
m_servletContext = servletContext;
+
+ // Set the admin password and base URL so that the Installer interceptor doesnt't trip
+ WikiEngine engine = WikiEngine.getInstance( servletContext, null );
+ Properties props = engine.getWikiProperties();
+ props.setProperty( InstallActionBean.PROP_ADMIN_PASSWORD_HASH, "foobar" );
+ props.setProperty( WikiEngine.PROP_BASEURL, "http://127.0.0.1" );
}
protected void tearDown() throws Exception