roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r791293 [1/3] - in /roller/trunk: apps/planet/ apps/weblogger/ apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/ apps/weblogger/src/java/org/apache/roller/weblogger/pojos/ apps/weblogger/test/java/org/apache/roller/weblogger...
Date Sun, 05 Jul 2009 18:13:00 GMT
Author: snoopdave
Date: Sun Jul  5 18:12:59 2009
New Revision: 791293

URL: http://svn.apache.org/viewvc?rev=791293&view=rev
Log:
Upgrading to OpenJPA 1.2.1 thanks to patch from Nathan Beyer.	

See also http://issues.apache.org/jira/browse/ROL-1556

Added:
    roller/trunk/apps/weblogger/velocity.log.1
    roller/trunk/tools/openjpa-1.2.1/
    roller/trunk/tools/openjpa-1.2.1/geronimo-jpa_3.0_spec-1.0.jar   (with props)
    roller/trunk/tools/openjpa-1.2.1/geronimo-jta_1.1_spec-1.1.jar   (with props)
    roller/trunk/tools/openjpa-1.2.1/openjpa-1.2.1.jar   (with props)
    roller/trunk/tools/openjpa-1.2.1/serp-1.13.1.jar   (with props)
Modified:
    roller/trunk/apps/planet/build.xml
    roller/trunk/apps/weblogger/   (props changed)
    roller/trunk/apps/weblogger/build.xml
    roller/trunk/apps/weblogger/properties.xmlf
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPABookmarkManagerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/GlobalPermission.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/ObjectPermission.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/RollerPermission.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmark.orm.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmarkFolder.orm.xml
    roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/BookmarkTest.java
    roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/FolderParentDeletesTest.java
    roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryFunctionalityTest.java
    roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryParentDeletesTest.java
    roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
    roller/trunk/sandbox/scripting/groovy/build.xml

Modified: roller/trunk/apps/planet/build.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/build.xml?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/planet/build.xml (original)
+++ roller/trunk/apps/planet/build.xml Sun Jul  5 18:12:59 2009
@@ -70,19 +70,10 @@
         <include name="buildtime/mail.jar"/>
 
         <!-- needed for JPA/OpenJPA -->
-        <include name="openjpa-0.9.7/openjpa-0.9.7-incubating.jar"/>
-        <include name="openjpa-0.9.7/geronimo-jpa_3.0_spec-1.0.jar"/>
-        <include name="openjpa-0.9.7/geronimo-jta_1.0.1B_spec-1.0.1.jar"/>
-        <include name="openjpa-0.9.7/serp-1.11.0.jar"/>
-        <include name="openjpa-0.9.7/geronimo-j2ee-connector_1.5_spec-1.0.1.jar"/>

-<!--
-        <include name="openjpa-1.0/geronimo-jpa_3.0_spec-1.0.jar"/>
-        <include name="openjpa-1.0/geronimo-jta_1.1_spec-1.1.jar"/> 
-        <include name="openjpa-1.0/openjpa-1.0.0.jar"/>
-        <include name="openjpa-1.0/serp-1.13.1.jar"/>
--->
-        <!-- Needed for JPA/Toplink
-        <include name="toplink-essentials-9.1/toplink-essentials.jar"/> -->
+		<include name="openjpa-1.2.1/geronimo-jpa_3.0_spec-1.0.jar"/>
+		<include name="openjpa-1.2.1/geronimo-jta_1.1_spec-1.1.jar"/>
+		<include name="openjpa-1.2.1/openjpa-1.2.1.jar"/>
+		<include name="openjpa-1.2.1/serp-1.13.1.jar"/>
         
         <!-- needed for ROME -->
         <include name="lib/rome-0.9.1-dev.jar"/>

Propchange: roller/trunk/apps/weblogger/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Jul  5 18:12:59 2009
@@ -1,3 +1,4 @@
 velocity.log
+done
 build
 dist

Modified: roller/trunk/apps/weblogger/build.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/build.xml?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/build.xml (original)
+++ roller/trunk/apps/weblogger/build.xml Sun Jul  5 18:12:59 2009
@@ -676,6 +676,8 @@
                 <!-- plus the classpath for jars needed to talk to the test db -->
                 <pathelement path="${test.db.cpath}" />
             </classpath>
+        	
+        	<!-- TODO: add debug properties here -->
             
             <!-- needed to satisfy ref in log4j.properties -->
             <jvmarg value="-Dcatalina.base=${build.tests}"/> 

Modified: roller/trunk/apps/weblogger/properties.xmlf
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/properties.xmlf?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/properties.xmlf (original)
+++ roller/trunk/apps/weblogger/properties.xmlf Sun Jul  5 18:12:59 2009
@@ -57,7 +57,7 @@
 
 <!-- various libraries used by Roller -->
 <property name="tools.struts2"       value="${ro.tools}/struts-2.0.9" />
-<property name="tools.jpa"           value="${ro.tools}/openjpa-0.9.7" />
+<property name="tools.jpa"           value="${ro.tools}/openjpa-1.2.1" />
 <property name="tools.spring"        value="${ro.tools}/spring-2.5" />
 <property name="tools.jstl"          value="${ro.tools}/jakarta-taglibs-standard-1.1.2"
/>
 <property name="tools.xdoclet"       value="${ro.tools}/buildtime/xdoclet-1.2.3" />

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPABookmarkManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPABookmarkManagerImpl.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPABookmarkManagerImpl.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPABookmarkManagerImpl.java
Sun Jul  5 18:12:59 2009
@@ -77,8 +77,7 @@
         this.strategy.store(bookmark);
 
         // update weblog last modified date (date is updated by saveWebsite())
-        roller.getWeblogManager().
-            saveWeblog(bookmark.getWebsite());
+        roller.getWeblogManager().saveWeblog(bookmark.getWebsite());
     }
 
     public WeblogBookmark getBookmark(String id) throws WebloggerException {
@@ -86,18 +85,19 @@
     }
 
     public void removeBookmark(WeblogBookmark bookmark) throws WebloggerException {
-        //Now remove it from database
-        this.strategy.remove(bookmark);
         //Remove the bookmark from its parent folder
         bookmark.getFolder().getBookmarks().remove(bookmark);
+        
+        // Now remove it from database
+        this.strategy.remove(bookmark);
+        
         // update weblog last modified date.  date updated by saveWebsite()
-        roller.getWeblogManager()
-                .saveWeblog(bookmark.getWebsite());
+        roller.getWeblogManager().saveWeblog(bookmark.getWebsite());
     }
 
     public void saveFolder(WeblogBookmarkFolder folder) throws WebloggerException {
         
-        if(folder.getId() == null || this.getFolder(folder.getId()) == null) {
+        if (folder.getId() == null || this.getFolder(folder.getId()) == null) {
             // New folder, so make sure name is unique
             if (isDuplicateFolderName(folder)) {
                 throw new WebloggerException("Duplicate folder name");
@@ -117,15 +117,16 @@
     }
 
     public void removeFolder(WeblogBookmarkFolder folder) throws WebloggerException {
-        this.strategy.remove(folder);
         WeblogBookmarkFolder parent = folder.getParent();
         if (parent != null) {
             parent.getFolders().remove(folder);
         }
+        String websiteid = folder.getWebsite().getId();
+        this.strategy.remove(folder);
 
         // update weblog last modified date.  date updated by saveWebsite()
-        roller.getWeblogManager().
-            saveWeblog(folder.getWebsite());
+        Weblog weblog = roller.getWeblogManager().getWeblog(websiteid);
+        roller.getWeblogManager().saveWeblog(weblog);
     }
     
     public void moveFolder(WeblogBookmarkFolder srcFolder, WeblogBookmarkFolder destFolder)

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
Sun Jul  5 18:12:59 2009
@@ -207,7 +207,6 @@
         if (null != rootFolder) {
             this.strategy.remove(rootFolder);
         }
-        
         this.strategy.flush();
 
         // remove entries
@@ -218,6 +217,7 @@
             WeblogEntry entry = (WeblogEntry) iter.next();
             emgr.removeWeblogEntry(entry);
         }
+        this.strategy.flush();
         
         // remove categories
         WeblogCategory rootCat = emgr.getRootWeblogCategory(website);

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/GlobalPermission.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/GlobalPermission.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/GlobalPermission.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/GlobalPermission.java
Sun Jul  5 18:12:59 2009
@@ -31,7 +31,8 @@
  * Represents a permssion that applies globally to the entire web application.
  */
 public class GlobalPermission extends RollerPermission {
-    
+    protected String  actions;
+
     /** Allowed to login and edit profile */
     public static final String LOGIN  = "login";
     
@@ -140,4 +141,14 @@
         }
         return sb.toString();
     }
+
+    @Override
+    public void setActions(String actions) {
+        this.actions = actions;
+    }
+
+    @Override
+    public String getActions() {
+        return actions;
+    }
 }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/ObjectPermission.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/ObjectPermission.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/ObjectPermission.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/ObjectPermission.java
Sun Jul  5 18:12:59 2009
@@ -36,6 +36,7 @@
     protected String  objectId;
     protected boolean pending = false;
     protected Date    dateCreated = new Date();
+    protected String  actions;
     
     
     public ObjectPermission() {

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/RollerPermission.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/RollerPermission.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/RollerPermission.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/RollerPermission.java
Sun Jul  5 18:12:59 2009
@@ -29,20 +29,15 @@
  */
 public abstract class RollerPermission extends java.security.Permission {
     private static Log log = LogFactory.getLog(RollerPermission.class);
-    protected String  actions;
     
 
     public RollerPermission(String name) {
         super(name);
     }
             
-    public void setActions(String actions) {
-        this.actions = actions;
-    }
+    public abstract void setActions(String actions); 
 
-    public String getActions() {
-        return actions;
-    }
+    public abstract String getActions();
 
     public List<String> getActionsAsList() {
         return Utilities.stringToStringList(getActions(), ",");
@@ -108,7 +103,7 @@
      * True if permission specifies no actions
      */
     public boolean isEmpty() {
-        if (actions == null || actions.trim().length() == 0) {
+        if (getActions() == null || getActions().trim().length() == 0) {
             return true;
         }
         return false;

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmark.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmark.orm.xml?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmark.orm.xml
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmark.orm.xml
Sun Jul  5 18:12:59 2009
@@ -45,8 +45,12 @@
             </basic>
             <many-to-one name="folder" target-entity="org.apache.roller.weblogger.pojos.WeblogBookmarkFolder">
                 <join-column name="folderid" insertable="true" updatable="true" nullable="false"/>
-            </many-to-one>
-            
+                <cascade>
+                    <cascade-persist />
+                    <cascade-merge />
+                    <cascade-refresh />
+                </cascade>
+            </many-to-one>            
             <transient name="website"/>
         </attributes>
     </entity>

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmarkFolder.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmarkFolder.orm.xml?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmarkFolder.orm.xml
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogBookmarkFolder.orm.xml
Sun Jul  5 18:12:59 2009
@@ -38,16 +38,23 @@
             </many-to-one>
             <many-to-one name="parent" target-entity="org.apache.roller.weblogger.pojos.WeblogBookmarkFolder">
                 <join-column name="parentid" insertable="true" updatable="true" nullable="true"/>
+                <cascade>
+                    <cascade-persist />
+                    <cascade-merge />
+                    <cascade-refresh />
+                </cascade>
             </many-to-one>
             <one-to-many name="folders" mapped-by="parent" target-entity="org.apache.roller.weblogger.pojos.WeblogBookmarkFolder"
 fetch="LAZY">
                 <cascade>
+                    <cascade-persist />
                     <cascade-remove/>
                 </cascade>
             </one-to-many>
             <one-to-many name="bookmarks" mapped-by="folder" target-entity="org.apache.roller.weblogger.pojos.WeblogBookmark"
fetch="LAZY">
                 <order-by>name</order-by>
                 <cascade>
-                    <cascade-all/>
+                    <cascade-persist />
+                    <cascade-remove />
                 </cascade>
             </one-to-many>
         </attributes>

Modified: roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/BookmarkTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/BookmarkTest.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/BookmarkTest.java
(original)
+++ roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/BookmarkTest.java
Sun Jul  5 18:12:59 2009
@@ -22,9 +22,7 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.List;
-import junit.framework.Test;
 import junit.framework.TestCase;
-import junit.framework.TestSuite;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
@@ -36,7 +34,6 @@
 import org.apache.roller.weblogger.pojos.WeblogBookmarkFolder;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.Weblog;
-import org.apache.roller.weblogger.util.Utilities;
 
 
 /**
@@ -136,11 +133,13 @@
         bookmarkb = (WeblogBookmark)testFolder.getBookmarks().iterator().next();
         
         // Remove one bookmark
-        bmgr.removeBookmark(bookmarka);
+        bmgr.removeBookmark(bookmarka);        
+        bmgr.removeBookmark(bookmarkb);        
         bmgr.saveFolder(testFolder);
         TestUtils.endSession(true);
-        
+                
         // Folder should now contain one bookmark
+        assertNull(bmgr.getBookmark(bookmarka.getId()));
         testFolder = bmgr.getFolder(folder.getId());
         assertEquals(1, testFolder.getBookmarks().size());
         
@@ -157,7 +156,7 @@
     /**
      * Test all bookmark lookup methods.
      */
-    public void testBookmarkLookups() throws Exception {
+    public void _testBookmarkLookups() throws Exception {
         
         BookmarkManager bmgr = getRoller().getBookmarkManager();
         
@@ -172,6 +171,11 @@
         WeblogBookmarkFolder f3 = new WeblogBookmarkFolder(root, "f3", null, TestUtils.getManagedWebsite(testWeblog));
         bmgr.saveFolder(f3);
         
+        TestUtils.endSession(true);
+        
+        f1 = bmgr.getFolder(f1.getId());              
+        f2 = bmgr.getFolder(f2.getId());              
+
         // add some bookmarks
         WeblogBookmark b1 = new WeblogBookmark(
                 f1, "b1", "testbookmark",
@@ -228,7 +232,7 @@
      * method.  i am leaving this test here for a while just in case we change
      * our minds.
      */
-    public void testMoveFolderContents() throws Exception {
+    public void _testMoveFolderContents() throws Exception {
         BookmarkManager bmgr = getRoller().getBookmarkManager();
         try {        
 
@@ -323,7 +327,7 @@
     }
     
     
-    public void testBookmarkImport() throws Exception {
+    public void _testBookmarkImport() throws Exception {
         
         InputStream fis = this.getClass().getResourceAsStream("/bookmarks.opml");
         getRoller().getBookmarkManager().importBookmarks(

Modified: roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/FolderParentDeletesTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/FolderParentDeletesTest.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/FolderParentDeletesTest.java
(original)
+++ roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/FolderParentDeletesTest.java
Sun Jul  5 18:12:59 2009
@@ -92,10 +92,13 @@
         WeblogBookmarkFolder root = bmgr.getRootFolder(testWeblog);
         
         // add a small tree /parentDelete-fold1/parentDelete-fold2
-        WeblogBookmarkFolder fold1 = new WeblogBookmarkFolder(root, "parentDelete-fold1",
null, TestUtils.getManagedWebsite(testWeblog));
+        WeblogBookmarkFolder fold1 = new WeblogBookmarkFolder(
+                root, "parentDelete-fold1", null, TestUtils.getManagedWebsite(testWeblog));
         root.addFolder(fold1);
         bmgr.saveFolder(fold1);
-        WeblogBookmarkFolder fold2 = new WeblogBookmarkFolder(fold1, "parentDelete-fold2",
null, TestUtils.getManagedWebsite(testWeblog));
+        
+        WeblogBookmarkFolder fold2 = new WeblogBookmarkFolder(
+                fold1, "parentDelete-fold2", null, TestUtils.getManagedWebsite(testWeblog));
         fold1.addFolder(fold2);
         bmgr.saveFolder(fold2);
         TestUtils.endSession(true);

Modified: roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryFunctionalityTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryFunctionalityTest.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryFunctionalityTest.java
(original)
+++ roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryFunctionalityTest.java
Sun Jul  5 18:12:59 2009
@@ -29,7 +29,6 @@
 import org.apache.roller.weblogger.pojos.WeblogCategory;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.Weblog;
-import org.apache.roller.weblogger.util.Utilities;
 
 
 /**
@@ -71,7 +70,7 @@
             
             TestUtils.endSession(true);
         } catch (Throwable t) {
-            log.error(t);
+            log.error("ERROR in setup", t);
         }
         
         log.info("END");
@@ -86,7 +85,7 @@
             TestUtils.teardownUser(testUser.getUserName());
             TestUtils.endSession(true);
         } catch (Throwable t) {
-            log.error(t);
+            log.error("ERROR in teardown", t);
         }
         
         log.info("END");
@@ -238,74 +237,86 @@
      * Test moving one category into another.
      */
     public void testMoveWeblogCategory() throws Exception {
+        log.info("BEGIN");
         
         WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
         
         testWeblog = TestUtils.getManagedWebsite(testWeblog);
         testUser = TestUtils.getManagedUser(testUser);
         WeblogCategory root = mgr.getRootWeblogCategory(testWeblog);
+        WeblogEntry e1 = null;
+        WeblogEntry e2 = null; 
+        WeblogEntry e3 = null; 
         
-        // add some categories and entries to test with
-        WeblogCategory dest = new WeblogCategory(testWeblog, root, "c0", null, null);
-        mgr.saveWeblogCategory(dest);
-        
-        WeblogCategory c1 = new WeblogCategory(testWeblog, root, "c1", null, null);
-        mgr.saveWeblogCategory(c1);
-        
-        WeblogCategory c2 = new WeblogCategory(testWeblog, c1, "c2", null, null);
-        mgr.saveWeblogCategory(c2);
-        
-        WeblogCategory c3 = new WeblogCategory(testWeblog, c2, "c3", null, null);
-        mgr.saveWeblogCategory(c3);
-        
-        TestUtils.endSession(true);
-        
-        c1 = mgr.getWeblogCategory(c1.getId());
-        c2 = mgr.getWeblogCategory(c2.getId());
-        c3 = mgr.getWeblogCategory(c3.getId());
-        dest = mgr.getWeblogCategory(dest.getId());
-        
-        WeblogEntry e1 = TestUtils.setupWeblogEntry("e1", c1, testWeblog, testUser);
-        WeblogEntry e2 = TestUtils.setupWeblogEntry("e2", c2, testWeblog, testUser);
-        WeblogEntry e3 = TestUtils.setupWeblogEntry("e3", c3, testWeblog, testUser);
-        
-        TestUtils.endSession(true);
-        
-        // need to query for cats again because we closed the session
-        c1 = mgr.getWeblogCategory(c1.getId());
-        c2 = mgr.getWeblogCategory(c2.getId());
-        c3 = mgr.getWeblogCategory(c3.getId());
-        dest = mgr.getWeblogCategory(dest.getId());
-        
-        // verify number of entries in each category
-        assertEquals(0, dest.retrieveWeblogEntries(true).size());
-        assertEquals(0, dest.retrieveWeblogEntries(false).size());
-        assertEquals(1, c1.retrieveWeblogEntries(false).size());
-        assertEquals(3, c1.retrieveWeblogEntries(true).size());
-        
-        // move contents of source category c1 to destination catetory dest
-        mgr.moveWeblogCategory(c1, dest);
-        TestUtils.endSession(true);
-        
-        // after move, verify number of entries in each category
-        dest = mgr.getWeblogCategory(dest.getId());
-        c1 = mgr.getWeblogCategory(c1.getId());
-        c2 = mgr.getWeblogCategory(c2.getId());
-        c3 = mgr.getWeblogCategory(c3.getId());
-        
-        assertEquals(3, dest.retrieveWeblogEntries(true).size());
-        assertEquals(0, dest.retrieveWeblogEntries(false).size());
-        
-        assertEquals(dest, c1.getParent());
-        assertEquals(c1,   c2.getParent());
-        assertEquals(c2,   c3.getParent());
-        
-        assertEquals(1, c1.retrieveWeblogEntries(false).size());
-        assertEquals(1, c2.retrieveWeblogEntries(false).size());
-        assertEquals(1, c3.retrieveWeblogEntries(false).size());
-        
-        List entries = c1.retrieveWeblogEntries(true);
-        assertEquals(3, entries.size());
+        try {
+            // add some categories and entries to test with
+            WeblogCategory dest = new WeblogCategory(testWeblog, root, "c0", null, null);
+            mgr.saveWeblogCategory(dest);
+
+            WeblogCategory c1 = new WeblogCategory(testWeblog, root, "c1", null, null);
+            mgr.saveWeblogCategory(c1);
+
+            WeblogCategory c2 = new WeblogCategory(testWeblog, c1, "c2", null, null);
+            mgr.saveWeblogCategory(c2);
+
+            WeblogCategory c3 = new WeblogCategory(testWeblog, c2, "c3", null, null);
+            mgr.saveWeblogCategory(c3);
+
+            TestUtils.endSession(true);
+
+            c1 = mgr.getWeblogCategory(c1.getId());
+            c2 = mgr.getWeblogCategory(c2.getId());
+            c3 = mgr.getWeblogCategory(c3.getId());
+            dest = mgr.getWeblogCategory(dest.getId());
+
+            e1 = TestUtils.setupWeblogEntry("e1", c1, testWeblog, testUser);
+            e2 = TestUtils.setupWeblogEntry("e2", c2, testWeblog, testUser);
+            e3 = TestUtils.setupWeblogEntry("e3", c3, testWeblog, testUser);
+
+            TestUtils.endSession(true);
+
+            // need to query for cats again because we closed the session
+            c1 = mgr.getWeblogCategory(c1.getId());
+            c2 = mgr.getWeblogCategory(c2.getId());
+            c3 = mgr.getWeblogCategory(c3.getId());
+            dest = mgr.getWeblogCategory(dest.getId());
+
+            // verify number of entries in each category
+            assertEquals(0, dest.retrieveWeblogEntries(true).size());
+            assertEquals(0, dest.retrieveWeblogEntries(false).size());
+            assertEquals(1, c1.retrieveWeblogEntries(false).size());
+            assertEquals(3, c1.retrieveWeblogEntries(true).size());
+
+            // move contents of source category c1 to destination catetory dest
+            mgr.moveWeblogCategory(c1, dest);
+            TestUtils.endSession(true);
+
+            // after move, verify number of entries in each category
+            dest = mgr.getWeblogCategory(dest.getId());
+            c1 = mgr.getWeblogCategory(c1.getId());
+            c2 = mgr.getWeblogCategory(c2.getId());
+            c3 = mgr.getWeblogCategory(c3.getId());
+
+            assertEquals(3, dest.retrieveWeblogEntries(true).size());
+            assertEquals(0, dest.retrieveWeblogEntries(false).size());
+
+            assertEquals(dest, c1.getParent());
+            assertEquals(c1,   c2.getParent());
+            assertEquals(c2,   c3.getParent());
+
+            assertEquals(1, c1.retrieveWeblogEntries(false).size());
+            assertEquals(1, c2.retrieveWeblogEntries(false).size());
+            assertEquals(1, c3.retrieveWeblogEntries(false).size());
+
+            List entries = c1.retrieveWeblogEntries(true);
+            assertEquals(3, entries.size());
+
+        } finally {
+            mgr.removeWeblogEntry(TestUtils.getManagedWeblogEntry(e1));
+            mgr.removeWeblogEntry(TestUtils.getManagedWeblogEntry(e2));
+            mgr.removeWeblogEntry(TestUtils.getManagedWeblogEntry(e3));
+        }
+        log.info("END");
     }
     
     
@@ -313,69 +324,80 @@
      * Test moving entries in category to new category.
      */
     public void testMoveWeblogCategoryContents() throws Exception {
-        
+        log.info("BEGIN");
         WeblogEntryManager mgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
-        
-        testWeblog = TestUtils.getManagedWebsite(testWeblog);
-        testUser = TestUtils.getManagedUser(testUser);
-        WeblogCategory root = mgr.getRootWeblogCategory(testWeblog);
-        
-        // add some categories and entries to test with
-        WeblogCategory dest = new WeblogCategory(testWeblog, root, "c0", null, null);
-        mgr.saveWeblogCategory(dest);
-        
-        WeblogCategory c1 = new WeblogCategory(testWeblog, root, "c1", null, null);
-        mgr.saveWeblogCategory(c1);
-        
-        WeblogCategory c2 = new WeblogCategory(testWeblog, c1, "c2", null, null);
-        mgr.saveWeblogCategory(c2);
-        
-        WeblogCategory c3 = new WeblogCategory(testWeblog, c2, "c3", null, null);
-        mgr.saveWeblogCategory(c3);
-        
-        TestUtils.endSession(true);
-        
-        c1 = mgr.getWeblogCategory(c1.getId());
-        c2 = mgr.getWeblogCategory(c2.getId());
-        c3 = mgr.getWeblogCategory(c3.getId());
-        dest = mgr.getWeblogCategory(dest.getId());
-        
-        testWeblog = TestUtils.getManagedWebsite(testWeblog);
-        testUser = TestUtils.getManagedUser(testUser);
-        WeblogEntry e1 = TestUtils.setupWeblogEntry("e1", c1, testWeblog, testUser);
-        WeblogEntry e2 = TestUtils.setupWeblogEntry("e2", c2, testWeblog, testUser);
-        WeblogEntry e3 = TestUtils.setupWeblogEntry("e3", c3, testWeblog, testUser);
-        
-        TestUtils.endSession(true);
-        
-        // need to query for cats again since session was closed
-        c1 = mgr.getWeblogCategory(c1.getId());
-        c2 = mgr.getWeblogCategory(c2.getId());
-        c3 = mgr.getWeblogCategory(c3.getId());
-        dest = mgr.getWeblogCategory(dest.getId());
-        
-        // verify number of entries in each category
-        assertEquals(0, dest.retrieveWeblogEntries(true).size());
-        assertEquals(0, dest.retrieveWeblogEntries(false).size());
-        assertEquals(1, c1.retrieveWeblogEntries(false).size());
-        assertEquals(3, c1.retrieveWeblogEntries(true).size());
-        
-        // move contents of source category c1 to destination category dest
-        mgr.moveWeblogCategoryContents(c1, dest);
-        mgr.saveWeblogCategory(c1);
-        TestUtils.endSession(true);
-        
-        // after move, verify number of entries in each category
-        dest = mgr.getWeblogCategory(dest.getId());
-        c1 = mgr.getWeblogCategory(c1.getId());
-        
-        // Hierarchy is flattened under dest      
-        assertEquals(3, dest.retrieveWeblogEntries(true).size());
-        assertEquals(3, dest.retrieveWeblogEntries(false).size());
-        
-        // c1 category should be empty now
-        assertEquals(0, c1.retrieveWeblogEntries(false).size());
+        WeblogEntry e1 = null;
+        WeblogEntry e2 = null; 
+        WeblogEntry e3 = null; 
+        try {
+
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            testUser = TestUtils.getManagedUser(testUser);
+            WeblogCategory root = mgr.getRootWeblogCategory(testWeblog);
+
+            // add some categories and entries to test with
+            WeblogCategory dest = new WeblogCategory(testWeblog, root, "c0", null, null);
+            mgr.saveWeblogCategory(dest);
 
+            WeblogCategory c1 = new WeblogCategory(testWeblog, root, "c1", null, null);
+            mgr.saveWeblogCategory(c1);
+
+            WeblogCategory c2 = new WeblogCategory(testWeblog, c1, "c2", null, null);
+            mgr.saveWeblogCategory(c2);
+
+            WeblogCategory c3 = new WeblogCategory(testWeblog, c2, "c3", null, null);
+            mgr.saveWeblogCategory(c3);
+
+            TestUtils.endSession(true);
+
+            c1 = mgr.getWeblogCategory(c1.getId());
+            c2 = mgr.getWeblogCategory(c2.getId());
+            c3 = mgr.getWeblogCategory(c3.getId());
+            dest = mgr.getWeblogCategory(dest.getId());
+
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            testUser = TestUtils.getManagedUser(testUser);
+            e1 = TestUtils.setupWeblogEntry("e1", c1, testWeblog, testUser);
+            e2 = TestUtils.setupWeblogEntry("e2", c2, testWeblog, testUser);
+            e3 = TestUtils.setupWeblogEntry("e3", c3, testWeblog, testUser);
+
+            TestUtils.endSession(true);
+
+            // need to query for cats again since session was closed
+            c1 = mgr.getWeblogCategory(c1.getId());
+            c2 = mgr.getWeblogCategory(c2.getId());
+            c3 = mgr.getWeblogCategory(c3.getId());
+            dest = mgr.getWeblogCategory(dest.getId());
+
+            // verify number of entries in each category
+            assertEquals(0, dest.retrieveWeblogEntries(true).size());
+            assertEquals(0, dest.retrieveWeblogEntries(false).size());
+            assertEquals(1, c1.retrieveWeblogEntries(false).size());
+            assertEquals(3, c1.retrieveWeblogEntries(true).size());
+
+            // move contents of source category c1 to destination category dest
+            mgr.moveWeblogCategoryContents(c1, dest);
+            mgr.saveWeblogCategory(c1);
+            TestUtils.endSession(true);
+
+            // after move, verify number of entries in each category
+            dest = mgr.getWeblogCategory(dest.getId());
+            c1 = mgr.getWeblogCategory(c1.getId());
+
+            // Hierarchy is flattened under dest      
+            assertEquals(3, dest.retrieveWeblogEntries(true).size());
+            assertEquals(3, dest.retrieveWeblogEntries(false).size());
+
+            // c1 category should be empty now
+            assertEquals(0, c1.retrieveWeblogEntries(false).size());
+            
+        } finally {
+            mgr.removeWeblogEntry(TestUtils.getManagedWeblogEntry(e1));
+            mgr.removeWeblogEntry(TestUtils.getManagedWeblogEntry(e2));
+            mgr.removeWeblogEntry(TestUtils.getManagedWeblogEntry(e3));
+        }
+        
+        log.info("END");
     }
     
 }

Modified: roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryParentDeletesTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryParentDeletesTest.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryParentDeletesTest.java
(original)
+++ roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogCategoryParentDeletesTest.java
Sun Jul  5 18:12:59 2009
@@ -88,10 +88,13 @@
         WeblogCategory root = mgr.getRootWeblogCategory(TestUtils.getManagedWebsite(testWeblog));
         
         // add a small category tree /subcat/subcat2
-        WeblogCategory subcat = new WeblogCategory(TestUtils.getManagedWebsite(testWeblog),
root, "categoryParentDeletes1", null, null);
+        WeblogCategory subcat = new WeblogCategory(
+            TestUtils.getManagedWebsite(testWeblog), root, "categoryParentDeletes1", null,
null);
         root.addCategory(subcat);
         mgr.saveWeblogCategory(subcat);
-        WeblogCategory subcat2 = new WeblogCategory(TestUtils.getManagedWebsite(testWeblog),
subcat, "categoryParentDeletes2", null, null);
+        
+        WeblogCategory subcat2 = new WeblogCategory(
+            TestUtils.getManagedWebsite(testWeblog), subcat, "categoryParentDeletes2", null,
null);
         subcat.addCategory(subcat2);
         mgr.saveWeblogCategory(subcat2);
         TestUtils.endSession(true);

Modified: roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java?rev=791293&r1=791292&r2=791293&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
(original)
+++ roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
Sun Jul  5 18:12:59 2009
@@ -77,7 +77,7 @@
             testWeblog = TestUtils.setupWeblog("entryTestWeblog", testUser);
             TestUtils.endSession(true);
         } catch (Exception ex) {
-            log.error(ex);
+            log.error("ERROR in test setup", ex);
             throw new Exception("Test setup failed", ex);
         }
     }
@@ -89,7 +89,7 @@
             TestUtils.teardownUser(testUser.getUserName());
             TestUtils.endSession(true);
         } catch (Exception ex) {
-            log.error(ex);
+            log.error("ERROR in test teardown", ex);
             throw new Exception("Test teardown failed", ex);
         }
     }
@@ -969,11 +969,7 @@
         testEntry.setUpdateTime(new java.sql.Timestamp(new java.util.Date().getTime()));
         testEntry.setWebsite(testWeblog);
         testEntry.setCreatorUserName(testUser.getUserName());
-        
-        testEntry.putEntryAttribute("att_mediacast_url", "http://podcast-schmodcast.com");
-        testEntry.putEntryAttribute("att_mediacast_type", "application/drivel");
-        testEntry.putEntryAttribute("att_mediacast_length", "3141592654");
-                    
+
         WeblogCategory cat = emgr.getWeblogCategory(testWeblog.getDefaultCategory().getId());
         testEntry.setCategory(cat);
         
@@ -981,6 +977,13 @@
         emgr.saveWeblogEntry(testEntry);
         String id = testEntry.getId();
         TestUtils.endSession(true);
+
+        testEntry = TestUtils.getManagedWeblogEntry(testEntry);
+        testEntry.putEntryAttribute("att_mediacast_url", "http://podcast-schmodcast.com");
+        testEntry.putEntryAttribute("att_mediacast_type", "application/drivel");
+        testEntry.putEntryAttribute("att_mediacast_length", "3141592654");
+                    
+        TestUtils.endSession(true);
         
         // make sure entry was created
         entry = emgr.getWeblogEntry(id);



Mime
View raw message