You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by me...@apache.org on 2009/02/09 18:59:46 UTC

svn commit: r742661 - in /incubator/jspwiki/trunk: ./ .settings/ src/java/org/apache/wiki/plugin/ tests/java/org/apache/wiki/plugin/

Author: metskem
Date: Mon Feb  9 17:59:45 2009
New Revision: 742661

URL: http://svn.apache.org/viewvc?rev=742661&view=rev
Log:
3.0.0-svn-65 JSPWIKI-496 RecentChanges plugin should filter pages.
        The IndexPlugin, RecentChangesPlugin and ReferredPagesPlugin have been refactored, they are now all subclasses of AbstractFilteredPlugin,
        the new name for AbstractReferralPlugin.
        You should now use Glob expressions instead Regexps for all plugins.
        * Added a new JUnit test for RecentChangesPlugin
        * Changed the build.xml (removed the copy of etc/dtd, which was deleted earlier)
	* added etc/i18n to the classpath and changed project setting "Allow output folders
        as source folders", this makes it possible to run individual JUnit tests again.
        Also profanity.properties and denounce.properties can now be found again during 
        JUnit tests (saves a lot of stacktraces in stdout)

Added:
    incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractFilteredPlugin.java
      - copied, changed from r741452, incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractReferralPlugin.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/RecentChangesPluginTest.java
Removed:
    incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractReferralPlugin.java
Modified:
    incubator/jspwiki/trunk/.classpath
    incubator/jspwiki/trunk/.settings/org.eclipse.wst.common.component
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/ReleaseNotes
    incubator/jspwiki/trunk/build.xml
    incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/IndexPlugin.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PluginIndexPlugin.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/RecentChangesPlugin.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferredPagesPlugin.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferringPagesPlugin.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UndefinedPagesPlugin.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UnusedPagesPlugin.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/AllTests.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/ReferredPagesPluginTest.java

Modified: incubator/jspwiki/trunk/.classpath
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/.classpath?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/.classpath (original)
+++ incubator/jspwiki/trunk/.classpath Mon Feb  9 17:59:45 2009
@@ -9,7 +9,9 @@
 	<classpathentry kind="lib" path="tests/lib/jetty-plus-5.1.14.jar"/>
 	<classpathentry kind="lib" path="tests/lib/jetty-jmx-5.1.14.jar"/>
 	<classpathentry kind="lib" path="tests/lib/selenium-server-1.0-beta1.jar"/>
-	<classpathentry kind="lib" path="tests/lib/hsqldb.jar"/>
 	<classpathentry kind="lib" path="tests/etc"/>
+	<classpathentry kind="lib" path="tests/build"/>
+	<classpathentry kind="lib" path="tests/lib/hsqldb.jar"/>
+	<classpathentry kind="lib" path="etc/i18n"/>
 	<classpathentry kind="output" path="build/classes"/>
 </classpath>

Modified: incubator/jspwiki/trunk/.settings/org.eclipse.wst.common.component
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/.settings/org.eclipse.wst.common.component?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/.settings/org.eclipse.wst.common.component (original)
+++ incubator/jspwiki/trunk/.settings/org.eclipse.wst.common.component Mon Feb  9 17:59:45 2009
@@ -2,7 +2,6 @@
 <project-modules id="moduleCoreId" project-version="1.5.0">
 <wb-module deploy-name="JSPWiki">
 <wb-resource deploy-path="/" source-path="/src/WebContent"/>
-<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/java"/>
 <wb-resource deploy-path="/WEB-INF/classes" source-path="/java"/>
 <wb-resource deploy-path="/WEB-INF/classes" source-path="/tests/java"/>
 <property name="java-output-path"/>

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Mon Feb  9 17:59:45 2009
@@ -1,3 +1,25 @@
+2009-02-09  Harry Metske <me...@apache.org>
+
+        * 3.0.0-svn-65
+        
+        * JSPWIKI-496 RecentChanges plugin should filter pages.
+        The IndexPlugin, RecentChangesPlugin and ReferredPagesPlugin have been
+        refactored, they are now all subclasses of AbstractFilteredPlugin.
+        The AbstractFilteredPlugin is the new name for the old AbstractReferralPlugin.
+        As a result, you should now use Glob expressions instead of
+        Regular expressions for all plugins (ReferredPages and IndexPlugin were previously
+        using Regular Expressions, if you use the include/exclude parameters for those
+        plugins, you should convert them to Glob expressions.)
+        
+        * Added a new JUnit test for RecentChangesPlugin
+        
+        * Changed the build.xml (removed the copy of etc/dtd, which was deleted earlier)
+        
+        * added etc/i18n to the classpath and changed project setting "Allow output folders
+        as source folders", this makes it possible to run individual JUnit tests again.
+        Also profanity.properties and denounce.properties can now be found again during 
+        JUnit tests (saves a lot of stacktraces in stdout)
+
 2009-02-06  Harry Metske <me...@apache.org>
 
         * 3.0.0-svn-64

Modified: incubator/jspwiki/trunk/ReleaseNotes
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ReleaseNotes?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ReleaseNotes (original)
+++ incubator/jspwiki/trunk/ReleaseNotes Mon Feb  9 17:59:45 2009
@@ -29,6 +29,9 @@
 	
 	The IndexPlugin has a new parameter (showAttachments=true/false), use false if you don't
 	want attachments to show up on the PageIndex page.
+	
+	The IndexPlugin, RecentChangesPlugin and ReferredPagesPlugin are now subclasses of AbstractFilteredPlugin
+	and therefore inheret the parameters exclude and include, so you can now use these filters. 
 
 The full log of any issues fixed can be found at:
 

Modified: incubator/jspwiki/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/build.xml?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/build.xml (original)
+++ incubator/jspwiki/trunk/build.xml Mon Feb  9 17:59:45 2009
@@ -684,11 +684,7 @@
       <copy file="${webtests.build}/web.xml.container"
           tofile="${tests}/etc/WEB-INF/web.xml" overwrite="true" />
 
-      <!-- Copy the DTDs and jspwiki.properties to the test WEB-INF -->
-      <mkdir dir="${tests}/etc/WEB-INF/dtd" />
-      <copy toDir="${tests}/etc/WEB-INF/dtd">
-        <fileset dir="${basedir}/etc/dtd/" />
-      </copy>
+      <!-- Copy jspwiki.properties to the test WEB-INF -->
       <copy file="${code.web}/WEB-INF/jspwiki.properties"
           tofile="${tests}/etc/WEB-INF/jspwiki.properties" overwrite="true" />
   </target>

Copied: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractFilteredPlugin.java (from r741452, incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractReferralPlugin.java)
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractFilteredPlugin.java?p2=incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractFilteredPlugin.java&p1=incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractReferralPlugin.java&r1=741452&r2=742661&rev=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractReferralPlugin.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/AbstractFilteredPlugin.java Mon Feb  9 17:59:45 2009
@@ -59,10 +59,10 @@
  *  </ul>
  *  
  */
-public abstract class AbstractReferralPlugin
+public abstract class AbstractFilteredPlugin
     implements WikiPlugin
 {
-    private static Logger log = LoggerFactory.getLogger( AbstractReferralPlugin.class );
+    private static Logger log = LoggerFactory.getLogger( AbstractFilteredPlugin.class );
 
     /** Magic value for rendering all items. */
     public static final int    ALL_ITEMS              = -1;
@@ -97,6 +97,9 @@
     /** Parameter name for showing the last modification count.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_LASTMODIFIED     = "showLastModified";
 
+    /** The parameter name for setting the showAttachment.  Value is <tt>{@value}</tt>. */
+    public static final String PARAM_SHOW_ATTACHMENTS = "showAttachments";
+
     protected           int      m_maxwidth = Integer.MAX_VALUE;
     protected           String   m_before = ""; // null not blank
     protected           String   m_separator = ""; // null not blank
@@ -104,6 +107,7 @@
 
     protected           Pattern[] m_exclude;
     protected           Pattern[]  m_include;
+    protected           boolean m_showAttachments = true;
     
     protected           String m_show = "pages";
     protected           boolean m_lastModified=false;
@@ -127,6 +131,12 @@
         m_maxwidth = TextUtil.parseIntParameter( (String)params.get( PARAM_MAXWIDTH ), Integer.MAX_VALUE );
         if( m_maxwidth < 0 ) m_maxwidth = 0;
 
+        String showAttachmentsString = (String) params.get( PARAM_SHOW_ATTACHMENTS );
+        if( "false".equals( showAttachmentsString ) )
+        {
+            m_showAttachments = false;
+        }
+
         String s = (String) params.get( PARAM_SEPARATOR );
 
         if( s != null )
@@ -236,11 +246,20 @@
      */
     protected Collection filterCollection( Collection c )
     {
-        ArrayList<String> result = new ArrayList<String>();
+        ArrayList<Object> result = new ArrayList<Object>();
 
         for( Iterator i = c.iterator(); i.hasNext(); )
         {
-            String pageName = (String) i.next();
+            String pageName = null;
+            Object objectje = i.next();
+            if( objectje instanceof WikiPage )
+            {
+                pageName = ((WikiPage) objectje).getName();
+            }
+            else
+            {
+                pageName = (String) objectje;
+            }
 
             //
             //  If include parameter exists, then by default we include only those
@@ -278,7 +297,21 @@
 
             if( includeThis )
             {
-                result.add( pageName );
+                // show the page if it's not an attachment, or it's and
+                // attachment and show_attachment=true
+                boolean isAttachment = pageName.contains( "/" );
+                if( !isAttachment || (isAttachment && m_showAttachments) )
+                {
+                    if( objectje instanceof WikiPage )
+                    {
+                        result.add( objectje );
+                    }
+                    else
+                    {
+                        result.add( pageName );
+                    }
+                }
+                
                 //
                 //  if we want to show the last modified date of the most recently changed page, we keep a "high watermark" here:
                 WikiPage page = null;

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/IndexPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/IndexPlugin.java?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/IndexPlugin.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/IndexPlugin.java Mon Feb  9 17:59:45 2009
@@ -21,8 +21,6 @@
 package org.apache.wiki.plugin;
 
 import java.util.*;
-import java.util.regex.Pattern;
-
 import org.apache.ecs.Element;
 import org.apache.ecs.xhtml.div;
 import org.apache.ecs.xhtml.span;
@@ -38,33 +36,18 @@
  *  <br>The default is to include all pages.
  *  <p>
  *  This is a complete rewrite of the old IndexPlugin under an Apache license.
- *  <p>Parameters (From AbstractReferralPlugin) : </p>
- *  <ul>
- *    <li><b>include</b> - A regexp pattern for marking which pages should be included.</li>
- *    <li><b>exclude</b> - A regexp pattern for marking which pages should be excluded.</li>
- *    <li><b>showAttachments</b> - Indicates if attachments should also be shown, the default is true.</li>
- *  </ul>
+ *  <p>Parameters (From AbstractFilteredPlugin) : </p>
  */
-public class IndexPlugin  extends AbstractReferralPlugin implements WikiPlugin
+public class IndexPlugin  extends AbstractFilteredPlugin implements WikiPlugin
 {
     private static Logger log = LoggerFactory.getLogger( IndexPlugin.class );
     
-    /** The parameter name for setting the showAttachment.  Value is <tt>{@value}</tt>. */
-    public static final String PARAM_SHOW_ATTACHMENTS = "showAttachments";
-    
     /**
      *  {@inheritDoc}
      */
     public String execute( WikiContext context, Map params ) throws PluginException
     {
-        String include = (String)params.get( PARAM_INCLUDE );
-        String exclude = (String)params.get( PARAM_EXCLUDE );
-        String showAttachmentsString = (String) params.get( PARAM_SHOW_ATTACHMENTS );
-        boolean showAttachments = true;
-        if( "false".equals( showAttachmentsString ) )
-        {
-            showAttachments = false;
-        }
+        super.initialize( context, params );
         
         List<String> pages;
         div masterDiv = new div();
@@ -76,7 +59,7 @@
         indexDiv.setClass( "header" );
         try
         {
-            pages = listPages( context, include, exclude, showAttachments );
+            pages = listPages( context );
             Collections.sort( pages );
             
             char initialChar = ' ';
@@ -134,45 +117,26 @@
     }
 
     /**
-     *  Grabs a list of all pages and filters them according to the include/exclude patterns.
-     *  
+     * Grabs a list of all pages and filters them according to the
+     * include/exclude patterns and showAttachments parameter.
+     * 
      * @param context
-     * @param include
-     * @param exclude
-     * @return A list containing page names which matched the filters.
+     * @return A list containing page names
      * @throws ProviderException
      */
-    private List<String> listPages( WikiContext context, String include, String exclude, boolean showAttachments )
-        throws ProviderException
+    private List<String> listPages( WikiContext context ) throws ProviderException
     {
-        Pattern includePtrn = include != null ? Pattern.compile( include ) : Pattern.compile(".*");
-        Pattern excludePtrn = exclude != null ? Pattern.compile( exclude ) : Pattern.compile("\\p{Cntrl}"); // There are no control characters in page names
-        
+
         ArrayList<String> result = new ArrayList<String>();
-        
+
         Collection pages = context.getEngine().getReferenceManager().findCreated();
-        
+
+        pages = super.filterCollection( pages );
+
         for( Iterator i = pages.iterator(); i.hasNext(); )
         {
-            String pageName = (String) i.next();
-
-            if( excludePtrn.matcher( pageName ).matches() ) continue;
-            if( includePtrn.matcher( pageName ).matches() )
-            {
-                if( showAttachments )
-                {
-                    result.add( pageName );
-                }
-                else
-                {
-                    if( !pageName.contains( "/" ) )
-                    {
-                        result.add( pageName );
-                    }
-                }
-            }
+            result.add( (String) i.next() );
         }
-        
         return result;
     }
 

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PluginIndexPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PluginIndexPlugin.java?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PluginIndexPlugin.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/PluginIndexPlugin.java Mon Feb  9 17:59:45 2009
@@ -46,7 +46,7 @@
  * @author Harry Metske
  */
 @ModuleData( author = "Harry Metske", minVersion = "3.0", maxVersion = "1000000", minAPIVersion = "2.8" )
-public class PluginIndexPlugin extends AbstractReferralPlugin implements WikiPlugin
+public class PluginIndexPlugin extends AbstractFilteredPlugin implements WikiPlugin
 {
     /** Parameter name for the details parameter. Value is <tt>{@value}</tt>. */
     public static final String PARAM_DETAILS = "details";

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=742661&r1=742660&r2=742661&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 Mon Feb  9 17:59:45 2009
@@ -50,7 +50,7 @@
  *  </ul>
  *  
  */
-public class RecentChangesPlugin
+public class RecentChangesPlugin extends AbstractFilteredPlugin
     implements WikiPlugin
 {
     /** Parameter name for the separator format.  Value is <tt>{@value}</tt>. */
@@ -81,8 +81,7 @@
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
-        int      since    = TextUtil.parseIntParameter( (String) params.get("since"),
-                                                        DEFAULT_DAYS );
+        int since = TextUtil.parseIntParameter( (String) params.get( "since" ), DEFAULT_DAYS );
         int      spacing  = 4;
         boolean  showAuthor = true;
         boolean  showChangenote = true;
@@ -109,6 +108,8 @@
         // FIXME: Should really have a since date on the getRecentChanges
         // method.
         Collection   changes = engine.getRecentChanges();
+        super.initialize( context, params );
+        changes = super.filterCollection( changes );
 
         if( changes != null )
         {

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferredPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferredPagesPlugin.java?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferredPagesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferredPagesPlugin.java Mon Feb  9 17:59:45 2009
@@ -21,8 +21,6 @@
 package org.apache.wiki.plugin;
 
 import java.util.*;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
 
 import org.apache.wiki.*;
 import org.apache.wiki.api.PluginException;
@@ -47,15 +45,13 @@
  *
  *  @author Dirk Frederickx
  */
-public class ReferredPagesPlugin implements WikiPlugin
+public class ReferredPagesPlugin extends AbstractFilteredPlugin implements WikiPlugin
 {
     private static Logger log = LoggerFactory.getLogger( ReferredPagesPlugin.class );
     private WikiEngine     m_engine;
     private int            m_depth;
     private HashSet<String> m_exists  = new HashSet<String>();
     private StringBuilder   m_result  = new StringBuilder(1024);
-    private Pattern        m_includePattern;
-    private Pattern        m_excludePattern;
     private boolean m_formatCompact  = true;
     private boolean m_formatSort     = false;
 
@@ -64,12 +60,6 @@
 
     /** The parameter name for the depth.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_DEPTH   = "depth";
-
-    /** The parameter name for the included pages.  Value is <tt>{@value}</tt>. */
-    public static final String PARAM_INCLUDE = "include";
-    
-    /** The parameter name for the excluded pages.  Value is <tt>{@value}</tt>. */
-    public static final String PARAM_EXCLUDE = "exclude";
     
     /** The parameter name for the format.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_FORMAT  = "format";
@@ -87,6 +77,7 @@
         throws PluginException
     {
         m_engine = context.getEngine();
+        super.initialize( context, params );
 
         WikiPage         page   = context.getPage();
         if( page == null ) return "";
@@ -134,28 +125,6 @@
         // perl5 compiler : .* is 0..n instances of any char -- more powerful
         //PatternCompiler g_compiler = new GlobCompiler();
 
-        try
-        {
-            m_includePattern = Pattern.compile( includePattern );
-
-            m_excludePattern = Pattern.compile( excludePattern );
-        }
-        catch( PatternSyntaxException e )
-        {
-            if (m_includePattern == null )
-            {
-                throw new PluginException( "Illegal include pattern detected." );
-            }
-            else if (m_excludePattern == null )
-            {
-                throw new PluginException("Illegal exclude pattern detected.");
-            }
-            else
-            {
-                throw new PluginException("Illegal internal pattern detected.");
-            }
-        }
-
         // go get all referred links
         getReferredPages(context,rootname, 0);
 
@@ -179,9 +148,13 @@
 
         ReferenceManager mgr = m_engine.getReferenceManager();
 
-        Collection<String> allPages = mgr.findRefersTo( pagename );
+        Collection<String> pages = mgr.findRefersTo( pagename );
+        if( pages != null )
+        {
+            pages = super.filterCollection( pages );
+        }
 
-        handleLinks( context, allPages, ++depth, pagename );
+        handleLinks( context, pages, ++depth, pagename );
     }
 
     private void handleLinks(WikiContext context,Collection<String> links, int depth, String pagename)
@@ -210,9 +183,6 @@
             if( !m_engine.pageExists( link ) ) continue; // hide links to non
                                                          // existing pages
 
-            if( m_excludePattern.matcher( link ).find()) continue;
-            if( !m_includePattern.matcher( link ).find() ) continue;
-
             if( m_exists.contains( link ) )
             {
                 if( !m_formatCompact )

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferringPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferringPagesPlugin.java?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferringPagesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/ReferringPagesPlugin.java Mon Feb  9 17:59:45 2009
@@ -44,7 +44,7 @@
  *  <li><b>page</b> - Which page to get the table of contents from.</li>
  *  </ul>
  *  
- *  From AbstractReferralPlugin:
+ *  From AbstractFilteredPlugin:
  *  <ul>
  *  <li><b>separator</b> - How to separate generated links; default is a wikitext line break,
  *             producing a vertical list.</li>
@@ -52,7 +52,7 @@
  *  </ul>
  */
 public class ReferringPagesPlugin
-    extends AbstractReferralPlugin
+    extends AbstractFilteredPlugin
 {
     private static Logger log = LoggerFactory.getLogger( ReferringPagesPlugin.class );
 

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UndefinedPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UndefinedPagesPlugin.java?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UndefinedPagesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UndefinedPagesPlugin.java Mon Feb  9 17:59:45 2009
@@ -32,7 +32,7 @@
 /**
  *  Plugin that enumerates the pages in the wiki that have not yet been defined.
  *  
- *  Parameters  (from AbstractReferralPlugin):
+ *  Parameters  (from AbstractFilteredPlugin):
  *  <ul>
  *  <li><b>separator</b> - how to separate generated links; default is a wikitext line break,  producing a vertical list</li>
  * <li><b> maxwidth</b> - maximum width, in chars, of generated links.</li>
@@ -40,7 +40,7 @@
  *
  */
 public class UndefinedPagesPlugin
-    extends AbstractReferralPlugin
+    extends AbstractFilteredPlugin
 {
     /**
      *  {@inheritDoc}

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UnusedPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UnusedPagesPlugin.java?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UnusedPagesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/UnusedPagesPlugin.java Mon Feb  9 17:59:45 2009
@@ -35,7 +35,7 @@
  * Plugin for displaying pages that are not linked to in other pages.
  * Uses the ReferenceManager.
  * <p>
- *  Parameters  (from AbstractReferralPlugin):
+ *  Parameters  (from AbstractFilteredPlugin):
  *  <ul>
  *  <li><b>separator</b> - how to separate generated links; default is a wikitext line break,  producing a vertical list</li>
  * <li><b> maxwidth</b> - maximum width, in chars, of generated links.</li>
@@ -43,7 +43,7 @@
  *
  */
 public class UnusedPagesPlugin
-    extends AbstractReferralPlugin
+    extends AbstractFilteredPlugin
 {
     /**
      *  If set to "true", attachments are excluded from display.  Value is {@value}.

Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/AllTests.java?rev=742661&r1=742660&r2=742661&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/AllTests.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/AllTests.java Mon Feb  9 17:59:45 2009
@@ -48,6 +48,7 @@
         suite.addTest( UndefinedPagesPluginTest.suite() );
         suite.addTest( DenouncePluginTest.suite() );
         suite.addTest( ReferredPagesPluginTest.suite() );
+        suite.addTest( RecentChangesPluginTest.suite() );
 
         return suite;
     }

Added: 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=742661&view=auto
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/RecentChangesPluginTest.java (added)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/plugin/RecentChangesPluginTest.java Mon Feb  9 17:59:45 2009
@@ -0,0 +1,132 @@
+/*
+    JSPWiki - a JSP-based WikiWiki clone.
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.    
+ */
+
+package org.apache.wiki.plugin;
+
+import java.util.Properties;
+
+import org.apache.wiki.TestEngine;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.plugin.PluginManager;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+public class RecentChangesPluginTest extends TestCase
+{
+    Properties props = new Properties();
+
+    TestEngine engine;
+
+    WikiContext context;
+
+    PluginManager manager;
+
+    public void setUp() throws Exception
+    {
+        props.load( TestEngine.findTestProperties() );
+
+        engine = new TestEngine( 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" );
+
+//        context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage( "TestPage01" ) );
+        manager = new PluginManager( engine, props );
+    }
+
+    public void tearDown()
+    {
+        TestEngine.deleteTestPage( "TestPage01" );
+        TestEngine.deleteTestPage( "TestPage02" );
+        TestEngine.deleteTestPage( "TestPage03" );
+        
+        TestEngine.emptyWorkDir();
+        
+        engine.shutdown();
+    }
+
+    /**
+     * Plain test without parameters
+     * 
+     * @throws Exception
+     */
+    public void testSimple() throws Exception
+    {
+        context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage(  "TestPage01" ) );
+
+        String res = manager.execute( 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'>Test Page 01</a>" ));
+        assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage02'>Test Page 02</a>" ));
+        assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage03'>Test Page 03</a>" ));
+
+    }
+
+    /**
+     * Test with the include parameter
+     * 
+     * @throws Exception
+     */
+    public void testParmInClude() throws Exception
+    {
+        context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage(  "TestPage02" ) );
+
+        String res = manager.execute( context,
+                                      "{INSERT org.apache.wiki.plugin.RecentChangesPlugin include='TestPage02*'}" );
+        
+        assertTrue(res.contains( "<table cellpadding='4' class='recentchanges'>"));
+        assertFalse(res.contains( "<a href='/Wiki.jsp?page=TestPage01'>Test Page 01</a>" ));
+        assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage02'>Test Page 02</a>" ));
+        assertFalse(res.contains( "<a href='/Wiki.jsp?page=TestPage03'>Test Page 03</a>" ));
+
+    }
+
+    /**
+     * Test with the exclude parameter
+     * 
+     * @throws Exception
+     */
+    public void testParmExClude() throws Exception
+    {
+        context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage(  "TestPage03" ) );
+
+        String res = manager.execute( context,
+                                      "{INSERT org.apache.wiki.plugin.RecentChangesPlugin exclude='TestPage03*'}" );
+        
+        assertTrue(res.contains( "<table cellpadding='4' class='recentchanges'>"));
+        assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage01'>Test Page 01</a>" ));
+        assertTrue(res.contains( "<a href='/Wiki.jsp?page=TestPage02'>Test Page 02</a>" ));
+        assertFalse(res.contains( "<a href='/Wiki.jsp?page=TestPage03'>Test Page 03</a>" ));
+
+    }
+
+    public static Test suite()
+    {
+        return new TestSuite( RecentChangesPluginTest.class );
+    }
+}

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=742661&r1=742660&r2=742661&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 Mon Feb  9 17:59:45 2009
@@ -59,7 +59,7 @@
         engine.saveText( "SomeBodyPointsToMeToo", "Somebody points to this page too" );
         engine.saveText( "IPointToTwoPages", "Reference to [SomeBodyPointsToMe]  and   [SomeBodyPointsToMeToo]." );
 
-        context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage( "IPointToSomeoneElse" ) );
+//        context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage( "IPointToSomeoneElse" ) );
         manager = new PluginManager( engine, props );
     }
 
@@ -119,10 +119,10 @@
         context = engine.getWikiContextFactory().newViewContext( null, null, engine.createPage(  "IPointToTwoPages" ) );
 
         String res = manager.execute( context,
-                                      "{INSERT org.apache.wiki.plugin.ReferredPagesPlugin include='SomeBodyPointsToMe.*'}" );
+                                      "{INSERT org.apache.wiki.plugin.ReferredPagesPlugin include='SomeBodyPointsToMe*'}" );
 
         assertEquals(
-                      "<div class=\"ReferredPagesPlugin\">\n<a class=\"wikipage\" href=\"/Wiki.jsp?page=IPointToTwoPages\" title=\"ReferredPagesPlugin: depth[1] include[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",
+                      "<div class=\"ReferredPagesPlugin\">\n<a class=\"wikipage\" href=\"/Wiki.jsp?page=IPointToTwoPages\" title=\"ReferredPagesPlugin: depth[1] include[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",
                       res );
 
     }



Re: svn commit: r742661 - in /incubator/jspwiki/trunk: ./ .settings/ src/java/org/apache/wiki/plugin/ tests/java/org/apache/wiki/plugin/

Posted by Andrew Jaquith <an...@gmail.com>.
Yes, the rename is also a very good idea...

On Feb 14, 2009, at 4:52, Janne Jalkanen <ja...@ecyrd.com>  
wrote:

>
> Yup, +1 from me too.
>
> We might also want to rename them to DenouncePlugin.properties and  
> ProfanityFilter.properties to make sure they are aligned with the  
> plugin names.  ATM they're not that descriptive.
>
> /Janne
>
> On 14 Feb 2009, at 01:31, Andrew Jaquith wrote:
>
>> +1
>>
>> On Feb 13, 2009, at 14:44, Harry Metske <ha...@gmail.com>  
>> wrote:
>>
>>> then I'd also like to move
>>>
>>> src/java/org/apache/wiki/plugin/denounce.properties
>>> src/java/org/apache/wiki/filters/profanity.properties
>>>
>>> to
>>>
>>> src/WebContent/WEB-INF/classes/denounce.properties
>>> src/WebContent/WEB-INF/classes/profanity.properties
>>>
>>> we then have most property files together.
>>>
>>> /Harry
>>>
>>> 2009/2/10 Janne Jalkanen <ja...@ecyrd.com>
>>>
>>>>
>>>> Yeah, the idea of having WebContent is that we can put all the  
>>>> resources in
>>>> the right places from the get-go...
>>>>
>>>> /Janne
>>>>
>>>>
>>>> On 10 Feb 2009, at 22:31, Harry Metske wrote:
>>>>
>>>> you mean moving it to WEB-INF/classes ?
>>>>>
>>>>> that's also a possibility, needs some tweaks to build.xml
>>>>>
>>>>> Harry
>>>>>
>>>>> 2009/2/9 Janne Jalkanen <ja...@ecyrd.com>
>>>>>
>>>>>    * added etc/i18n to the classpath and changed project setting  
>>>>> "Allow
>>>>>>
>>>>>>> output folders
>>>>>>>  as source folders", this makes it possible to run individual  
>>>>>>> JUnit
>>>>>>> tests again.
>>>>>>>
>>>>>>>
>>>>>> Shouldn't etc/i18n -files be rather under WEB-INF?  Or should  
>>>>>> they go
>>>>>> under
>>>>>> src/resources?
>>>>>>
>>>>>> /Janne
>>>>>>
>>>>>>
>>>>
>

Re: svn commit: r742661 - in /incubator/jspwiki/trunk: ./ .settings/ src/java/org/apache/wiki/plugin/ tests/java/org/apache/wiki/plugin/

Posted by Janne Jalkanen <ja...@ecyrd.com>.
Yup, +1 from me too.

We might also want to rename them to DenouncePlugin.properties and  
ProfanityFilter.properties to make sure they are aligned with the  
plugin names.  ATM they're not that descriptive.

/Janne

On 14 Feb 2009, at 01:31, Andrew Jaquith wrote:

> +1
>
> On Feb 13, 2009, at 14:44, Harry Metske <ha...@gmail.com>  
> wrote:
>
>> then I'd also like to move
>>
>> src/java/org/apache/wiki/plugin/denounce.properties
>> src/java/org/apache/wiki/filters/profanity.properties
>>
>> to
>>
>> src/WebContent/WEB-INF/classes/denounce.properties
>> src/WebContent/WEB-INF/classes/profanity.properties
>>
>> we then have most property files together.
>>
>> /Harry
>>
>> 2009/2/10 Janne Jalkanen <ja...@ecyrd.com>
>>
>>>
>>> Yeah, the idea of having WebContent is that we can put all the  
>>> resources in
>>> the right places from the get-go...
>>>
>>> /Janne
>>>
>>>
>>> On 10 Feb 2009, at 22:31, Harry Metske wrote:
>>>
>>> you mean moving it to WEB-INF/classes ?
>>>>
>>>> that's also a possibility, needs some tweaks to build.xml
>>>>
>>>> Harry
>>>>
>>>> 2009/2/9 Janne Jalkanen <ja...@ecyrd.com>
>>>>
>>>>     * added etc/i18n to the classpath and changed project setting  
>>>> "Allow
>>>>>
>>>>>> output folders
>>>>>>   as source folders", this makes it possible to run individual  
>>>>>> JUnit
>>>>>> tests again.
>>>>>>
>>>>>>
>>>>> Shouldn't etc/i18n -files be rather under WEB-INF?  Or should  
>>>>> they go
>>>>> under
>>>>> src/resources?
>>>>>
>>>>> /Janne
>>>>>
>>>>>
>>>


Re: svn commit: r742661 - in /incubator/jspwiki/trunk: ./ .settings/ src/java/org/apache/wiki/plugin/ tests/java/org/apache/wiki/plugin/

Posted by Andrew Jaquith <an...@gmail.com>.
+1

On Feb 13, 2009, at 14:44, Harry Metske <ha...@gmail.com> wrote:

> then I'd also like to move
>
> src/java/org/apache/wiki/plugin/denounce.properties
> src/java/org/apache/wiki/filters/profanity.properties
>
> to
>
> src/WebContent/WEB-INF/classes/denounce.properties
> src/WebContent/WEB-INF/classes/profanity.properties
>
> we then have most property files together.
>
> /Harry
>
> 2009/2/10 Janne Jalkanen <ja...@ecyrd.com>
>
>>
>> Yeah, the idea of having WebContent is that we can put all the  
>> resources in
>> the right places from the get-go...
>>
>> /Janne
>>
>>
>> On 10 Feb 2009, at 22:31, Harry Metske wrote:
>>
>> you mean moving it to WEB-INF/classes ?
>>>
>>> that's also a possibility, needs some tweaks to build.xml
>>>
>>> Harry
>>>
>>> 2009/2/9 Janne Jalkanen <ja...@ecyrd.com>
>>>
>>>      * added etc/i18n to the classpath and changed project setting  
>>> "Allow
>>>>
>>>>> output folders
>>>>>    as source folders", this makes it possible to run individual  
>>>>> JUnit
>>>>> tests again.
>>>>>
>>>>>
>>>> Shouldn't etc/i18n -files be rather under WEB-INF?  Or should  
>>>> they go
>>>> under
>>>> src/resources?
>>>>
>>>> /Janne
>>>>
>>>>
>>

Re: svn commit: r742661 - in /incubator/jspwiki/trunk: ./ .settings/ src/java/org/apache/wiki/plugin/ tests/java/org/apache/wiki/plugin/

Posted by Harry Metske <ha...@gmail.com>.
then I'd also like to move

src/java/org/apache/wiki/plugin/denounce.properties
src/java/org/apache/wiki/filters/profanity.properties

to

src/WebContent/WEB-INF/classes/denounce.properties
src/WebContent/WEB-INF/classes/profanity.properties

we then have most property files together.

/Harry

2009/2/10 Janne Jalkanen <ja...@ecyrd.com>

>
> Yeah, the idea of having WebContent is that we can put all the resources in
> the right places from the get-go...
>
> /Janne
>
>
> On 10 Feb 2009, at 22:31, Harry Metske wrote:
>
>  you mean moving it to WEB-INF/classes ?
>>
>> that's also a possibility, needs some tweaks to build.xml
>>
>> Harry
>>
>> 2009/2/9 Janne Jalkanen <ja...@ecyrd.com>
>>
>>       * added etc/i18n to the classpath and changed project setting "Allow
>>>
>>>> output folders
>>>>     as source folders", this makes it possible to run individual JUnit
>>>> tests again.
>>>>
>>>>
>>> Shouldn't etc/i18n -files be rather under WEB-INF?  Or should they go
>>> under
>>> src/resources?
>>>
>>> /Janne
>>>
>>>
>

Re: svn commit: r742661 - in /incubator/jspwiki/trunk: ./ .settings/ src/java/org/apache/wiki/plugin/ tests/java/org/apache/wiki/plugin/

Posted by Janne Jalkanen <ja...@ecyrd.com>.
Yeah, the idea of having WebContent is that we can put all the  
resources in the right places from the get-go...

/Janne

On 10 Feb 2009, at 22:31, Harry Metske wrote:

> you mean moving it to WEB-INF/classes ?
>
> that's also a possibility, needs some tweaks to build.xml
>
> Harry
>
> 2009/2/9 Janne Jalkanen <ja...@ecyrd.com>
>
>>       * added etc/i18n to the classpath and changed project setting  
>> "Allow
>>> output folders
>>>      as source folders", this makes it possible to run individual  
>>> JUnit
>>> tests again.
>>>
>>
>> Shouldn't etc/i18n -files be rather under WEB-INF?  Or should they  
>> go under
>> src/resources?
>>
>> /Janne
>>


Re: svn commit: r742661 - in /incubator/jspwiki/trunk: ./ .settings/ src/java/org/apache/wiki/plugin/ tests/java/org/apache/wiki/plugin/

Posted by Harry Metske <ha...@gmail.com>.
you mean moving it to WEB-INF/classes ?

that's also a possibility, needs some tweaks to build.xml

Harry

2009/2/9 Janne Jalkanen <ja...@ecyrd.com>

>        * added etc/i18n to the classpath and changed project setting "Allow
>> output folders
>>       as source folders", this makes it possible to run individual JUnit
>> tests again.
>>
>
> Shouldn't etc/i18n -files be rather under WEB-INF?  Or should they go under
> src/resources?
>
> /Janne
>

Re: svn commit: r742661 - in /incubator/jspwiki/trunk: ./ .settings/ src/java/org/apache/wiki/plugin/ tests/java/org/apache/wiki/plugin/

Posted by Janne Jalkanen <ja...@ecyrd.com>.
> 	* added etc/i18n to the classpath and changed project setting  
> "Allow output folders
>        as source folders", this makes it possible to run individual  
> JUnit tests again.

Shouldn't etc/i18n -files be rather under WEB-INF?  Or should they go  
under src/resources?

/Janne