jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r885988 - in /incubator/jspwiki/trunk: ./ src/java/org/apache/wiki/ tests/java/org/apache/wiki/ tests/java/org/apache/wiki/content/
Date Tue, 01 Dec 2009 22:50:11 GMT
Author: jalkanen
Date: Tue Dec  1 22:50:11 2009
New Revision: 885988

URL: http://svn.apache.org/viewvc?rev=885988&view=rev
Log:
Deprecated WikiEngine.getPureText().

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/JSPWikiTestBase.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/ContentManagerTest.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=885988&r1=885987&r2=885988&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Tue Dec  1 22:50:11 2009
@@ -1,3 +1,18 @@
+2009-12-01 Janne Jalkanen <jalkanen@apache.org>
+
+        * 3.0.0-svn-187
+        
+        * Bug fix: ContentManager.deleteVersion() no longer restores
+        the page (as empty) after deletion.  Oops.  (Technically,
+        JCRWikiPage.getJCRNode() was creating the page instead of throwing
+        an exception.)
+        
+        * Deprecated WikiEngine.getPureText() [use WikiPage.getContentAsString()
+        instead.]
+        
+        * ContentManager.deleteVersion() fires a NODE_SAVED instead of NODE_DELETED,
+        since deletion implies removal of the entire page.
+        
 2009-11-28 Janne Jalkanen <jalkanen@apache.org>
 
         * 3.0.0-svn-186

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=885988&r1=885987&r2=885988&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Tue Dec  1 22:50:11 2009
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "186";
+    public static final String     BUILD         = "187";
 
     /**
      *  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=885988&r1=885987&r2=885988&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java Tue Dec  1 22:50:11 2009
@@ -1421,6 +1421,7 @@
      *  latest version.
      *  @return The page contents.  If the page does not exist,
      *          returns an empty string.
+     *  @deprecated Please use {@link WikiPage#getContentAsString()}
      */
     // FIXME: Should throw an exception on unknown page/version?
     public String getPureText( String page, int version )
@@ -1456,11 +1457,14 @@
      *
      *  @param page A handle to the WikiPage
      *  @return String of WikiText.
+     *  @throws ProviderException If the page content cannot be read. 
+     *  @throws PageNotFoundException If the page cannot be located
      *  @since 2.1.13.
+     *  @deprecated Please use {@link WikiPage#getContentAsString()}
      */
-    public String getPureText( WikiPage page )
+    public String getPureText( WikiPage page ) throws PageNotFoundException, ProviderException
     {
-        return getPureText( page.getName(), page.getVersion() );
+        return page.getContentAsString();
     }
 
     /**
@@ -1727,19 +1731,22 @@
      *  be of type {@link org.apache.wiki.workflow.DecisionRequiredException}. Individual
      *  PageFilters, such as the {@link org.apache.wiki.filters.SpamFilter} may also
      *  throw a {@link org.apache.wiki.filters.RedirectException}.
+     *  @throws PageNotFoundException 
      */
     public void saveText( WikiContext context, String text )
         throws WikiException
     {
         // Check if page data actually changed; bail if not
         WikiPage page = context.getPage();
-        String oldText = getPureText( page );
+        String oldText = page.getContentAsString();
         String proposedText = TextUtil.normalizePostData( text );
         if ( oldText != null && oldText.equals( proposedText ) )
         {
             return;
         }
 
+        if( oldText == null ) oldText = ""; // FIXME: This is not pretty.
+        
         // Check if creation of empty pages is allowed; bail if not
         boolean allowEmpty = TextUtil.getBooleanProperty( m_properties, 
                                                           PROP_ALLOW_CREATION_OF_EMPTY_PAGES,


Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/JSPWikiTestBase.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/JSPWikiTestBase.java?rev=885988&r1=885987&r2=885988&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/JSPWikiTestBase.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/JSPWikiTestBase.java Tue Dec  1 22:50:11
2009
@@ -3,6 +3,8 @@
 import junit.framework.TestCase;
 import junit.framework.TestResult;
 
+import org.apache.wiki.content.WikiPath;
+
 /**
  *  Provides a base class for all JSPWiki tests.  Any tests which want to throw a NotExecutableException
  *  should extend from this class.
@@ -15,6 +17,5 @@
     {
         super.run(new JSPWikiTestResult(testResult));
     }
-    
-    
+
 }

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=885988&r1=885987&r2=885988&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java Tue Dec  1 22:50:11
2009
@@ -340,9 +340,10 @@
      * @param pageName
      * @param content
      * @throws WikiException
+     * @throws PageNotFoundException 
      */
     public void saveText( String pageName, String content )
-        throws WikiException
+        throws WikiException, PageNotFoundException
     {
         // Build new request and associate our admin session
         MockHttpServletRequest request = newHttpRequest();
@@ -366,7 +367,7 @@
             page = getPage( pageName );
         }
         catch ( PageNotFoundException e )
-        {
+        { 
             try
             {
                 page = createPage( WikiPath.valueOf( pageName ) );
@@ -382,7 +383,7 @@
     }
 
     public void saveTextAsJanne( String pageName, String content )
-        throws WikiException
+        throws WikiException, PageNotFoundException
     {
         // Build new request and associate our Janne session
         MockHttpServletRequest request = newHttpRequest();

Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/ContentManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/ContentManagerTest.java?rev=885988&r1=885987&r2=885988&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/ContentManagerTest.java (original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/content/ContentManagerTest.java Tue
Dec  1 22:50:11 2009
@@ -238,14 +238,17 @@
         
         p = m_engine.getPage( "TestPage", 100 );
         assertEquals( "content 100","Test 100", p.getContentAsString() );
+        assertEquals( "content 100/2", p.getContentAsString(), m_engine.getPureText( p )
);
         assertEquals( "version 100", 100, p.getVersion() );
         
         p = m_engine.getPage( "TestPage", 1 );
         assertEquals( "content 1","Test 1", p.getContentAsString() );
+        assertEquals( "content 1/2", p.getContentAsString(), m_engine.getPureText( p ) );
         assertEquals( "version 1", 1, p.getVersion() );
         
         p = m_engine.getPage( "TestPage", 51 );
         assertEquals( "content 51","Test 51", p.getContentAsString() );
+        assertEquals( "content 51/2", p.getContentAsString(), m_engine.getPureText( p ) );
         assertEquals( "version 51", 51, p.getVersion() );
     }
     



Mime
View raw message