jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject svn commit: r686015 - in /incubator/jspwiki/trunk: ChangeLog src/com/ecyrd/jspwiki/Release.java src/com/ecyrd/jspwiki/content/PageRenamer.java tests/com/ecyrd/jspwiki/content/PageRenamerTest.java
Date Thu, 14 Aug 2008 19:58:02 GMT
Author: metskem
Date: Thu Aug 14 12:58:01 2008
New Revision: 686015

URL: http://svn.apache.org/viewvc?rev=686015&view=rev
Log:
2.7.0-alpha-17  [JSPWIKI-238] PageRenamer now correctly handles links containing blanks, improvements
still necessary

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/PageRenamer.java
    incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/content/PageRenamerTest.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=686015&r1=686014&r2=686015&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Thu Aug 14 12:58:01 2008
@@ -1,3 +1,11 @@
+2008-08-14  Harry Metske <harry.metske@gmail.com>
+
+        * 2.7.0-alpha-17
+        
+        * [JSPWIKI-238] PageRenamer now correctly handles links containing blanks
+          Added an additional JUnit test for this, there is stil one failing JUnit test however
(attachment handling).
+          PageRenamer still needs improvement.
+        
 2008-08-14  Andrew Jaquith <ajaquith AT apache DOT org>
 
         * 2.7.0-alpha-16

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java?rev=686015&r1=686014&r2=686015&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java Thu Aug 14 12:58:01 2008
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "16";
+    public static final String     BUILD         = "17";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/PageRenamer.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/PageRenamer.java?rev=686015&r1=686014&r2=686015&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/PageRenamer.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/PageRenamer.java Thu Aug 14 12:58:01
2008
@@ -362,6 +362,13 @@
         // System.out.println("   "+p+" :: "+p2);
         
         //
+        //  if the original contains blanks, then we should introduce a link, for example:
 [My Page]  =>  [My Page|My Renamed Page]
+        int blank = reallink.indexOf( " ");
+        if (blank!=-1) {
+            return reallink + "|" + newlink; 
+        }
+        
+        //
         //  Yes, these point to the same page.
         //
         if( reallink.equals(from) )

Modified: incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/content/PageRenamerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/content/PageRenamerTest.java?rev=686015&r1=686014&r2=686015&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/content/PageRenamerTest.java (original)
+++ incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/content/PageRenamerTest.java Thu Aug 14
12:58:01 2008
@@ -38,6 +38,8 @@
         TestEngine.deleteTestPage("Test");
         TestEngine.deleteTestPage("CdauthNew");
         TestEngine.deleteTestPage("Cdauth");
+        TestEngine.deleteTestPage("TestPageReferring");
+        TestEngine.deleteTestPage("TestPageReferredNew");
 
         TestEngine.emptyWorkDir();
     }
@@ -428,6 +430,30 @@
         assertEquals( "~[Link to TestPage2|TestPage2|target='_new']", m_engine.getText( "TestPage"
).trim() );
     }
 
+    /**
+     * Test for a referrer containing blanks
+     * 
+     * @throws Exception
+     */
+    public void testReferrerChangeWithBlanks() throws Exception
+    {
+        m_engine.saveText( "TestPageReferred", "bla bla bla som content" );
+        m_engine.saveText( "TestPageReferring", "[Test Page Referred]" );
+
+       rename( "TestPageReferred", "TestPageReferredNew" );
+
+        String data = m_engine.getPureText( "TestPageReferring", WikiProvider.LATEST_VERSION
);
+        assertEquals( "page not renamed", "[Test Page Referred|TestPageReferredNew]", data.trim()
);
+
+        Collection refs = m_engine.getReferenceManager().findReferrers( "TestPageReferred"
);
+        assertNull( "oldpage", refs );
+
+        refs = m_engine.getReferenceManager().findReferrers( "TestPageReferredNew" );
+        assertEquals( "new size", 1, refs.size() );
+        assertEquals( "wrong ref", "TestPageReferring", (String) refs.iterator().next() );
+    }
+
+
     public static Test suite()
     {
         return new TestSuite( PageRenamerTest.class );



Mime
View raw message