roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r541452 [1/2] - in /roller/trunk: apps/planet/test/java/org/apache/roller/planet/business/ tests/org/apache/roller/business/
Date Thu, 24 May 2007 22:16:21 GMT
Author: snoopdave
Date: Thu May 24 15:16:19 2007
New Revision: 541452

URL: http://svn.apache.org/viewvc?view=rev&rev=541452
Log:
New JPA backend merge: changes to tests. Probably should have been commited to trunk long ago. All should be safe: they simply ensure that 1) tests work against managed objects only and 2) relationships are maintained on both sides.

Modified:
    roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java
    roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java
    roller/trunk/tests/org/apache/roller/business/BookmarkTest.java
    roller/trunk/tests/org/apache/roller/business/CommentTest.java
    roller/trunk/tests/org/apache/roller/business/FolderCRUDTest.java
    roller/trunk/tests/org/apache/roller/business/FolderFunctionalityTest.java
    roller/trunk/tests/org/apache/roller/business/FolderParentDeletesTest.java
    roller/trunk/tests/org/apache/roller/business/HitCountTest.java
    roller/trunk/tests/org/apache/roller/business/PermissionTest.java
    roller/trunk/tests/org/apache/roller/business/PingsTest.java
    roller/trunk/tests/org/apache/roller/business/RefererTest.java
    roller/trunk/tests/org/apache/roller/business/WeblogCategoryCRUDTest.java
    roller/trunk/tests/org/apache/roller/business/WeblogCategoryFunctionalityTest.java
    roller/trunk/tests/org/apache/roller/business/WeblogCategoryParentDeletesTest.java
    roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java
    roller/trunk/tests/org/apache/roller/business/WeblogPageTest.java
    roller/trunk/tests/org/apache/roller/business/WeblogTest.java

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java Thu May 24 15:16:19 2007
@@ -56,7 +56,11 @@
         
         // now associate both subscriptions with the test group
         testGroup1.getSubscriptions().add(testSub1);
+        testSub1.getGroups().add(testGroup1);
+        
         testGroup1.getSubscriptions().add(testSub2);
+        testSub2.getGroups().add(testGroup1);
+        
         PlanetFactory.getPlanet().getPlanetManager().saveGroup(testGroup1);
         PlanetFactory.getPlanet().flush();
         

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java Thu May 24 15:16:19 2007
@@ -88,18 +88,28 @@
         
         // add
         group.getSubscriptions().add(sub1);
+        sub1.getGroups().add(group);
+
         group.getSubscriptions().add(sub2);
+        sub2.getGroups().add(group);
+        
         planet.saveGroup(group);
         TestUtils.endSession(true);
         
         // verify
         group = null;
         group = planet.getGroupById(testGroup1.getId());
+        sub1 = planet.getSubscriptionById(testSub1.getId());
+        sub2 = planet.getSubscriptionById(testSub2.getId());
         assertEquals(2, group.getSubscriptions().size());
         
         // remove
         group.getSubscriptions().remove(sub1);
+        sub1.getGroups().remove(group);
+        
         group.getSubscriptions().remove(sub2);
+        sub2.getGroups().remove(group);
+
         planet.saveGroup(group);
         TestUtils.endSession(true);
         

Modified: roller/trunk/tests/org/apache/roller/business/BookmarkTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/BookmarkTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/BookmarkTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/BookmarkTest.java Thu May 24 15:16:19 2007
@@ -72,7 +72,7 @@
             TestUtils.teardownUser(testUser.getId());
             TestUtils.endSession(true);
         } catch (Exception ex) {
-            log.error(ex);
+            log.error("ERROR in tearDown", ex);
             throw new Exception("Test teardown failed", ex);
         }
     }
@@ -86,6 +86,7 @@
         
         BookmarkManager bmgr = getRoller().getBookmarkManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         FolderData root = bmgr.getRootFolder(testWeblog);
         
         FolderData folder = new FolderData(root, "TestFolder2", null, TestUtils.getManagedWebsite(testWeblog));
@@ -157,6 +158,7 @@
         
         BookmarkManager bmgr = getRoller().getBookmarkManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         FolderData root = bmgr.getRootFolder(testWeblog);
         
         // add some folders
@@ -224,90 +226,97 @@
      * our minds.
      */
     public void testMoveFolderContents() throws Exception {
-        
         BookmarkManager bmgr = getRoller().getBookmarkManager();
-        
-        FolderData root = bmgr.getRootFolder(testWeblog);
-        
-        FolderData dest = new FolderData(root, "dest", null, TestUtils.getManagedWebsite(testWeblog));
-        bmgr.saveFolder(dest);
-        
-        // create source folder f1
-        FolderData f1 = new FolderData(root, "f1", null, TestUtils.getManagedWebsite(testWeblog));
-        bmgr.saveFolder(f1);
-        
-        // create bookmark b1 inside source folder f1
-        BookmarkData b1 = new BookmarkData(
-                f1, "b1", "testbookmark",
-                "http://example.com", "http://example.com/rss",
-                new Integer(1), new Integer(1), "image.gif");
-        f1.addBookmark(b1);
-        
-        // create folder f2 inside f1
-        FolderData f2 = new FolderData(f1, "f2", null, TestUtils.getManagedWebsite(testWeblog));
-        bmgr.saveFolder(f2);
-        
-        // create bookmark b2 inside folder f2
-        BookmarkData b2 = new BookmarkData(
-                f2, "b2", "testbookmark",
-                "http://example.com", "http://example.com/rss",
-                new Integer(1), new Integer(1), "image.gif");
-        f2.addBookmark(b2);
-        
-        // create folder f3 inside folder f2
-        FolderData f3 = new FolderData(f2, "f3", null, TestUtils.getManagedWebsite(testWeblog));
-        bmgr.saveFolder(f3);
-        
-        // crete bookmark b3 inside folder f3
-        BookmarkData b3 = new BookmarkData(
-                f3, "b3", "testbookmark",
-                "http://example.com", "http://example.com/rss",
-                new Integer(1), new Integer(1), "image.gif");
-        f3.addBookmark(b3);
-        
-        TestUtils.endSession(true);
-        
-        // verify our new tree
-        dest = bmgr.getFolder(dest.getId());
-        f1 = bmgr.getFolder(f1.getId());
-        f2 = bmgr.getFolder(f2.getId());
-        f3 = bmgr.getFolder(f3.getId());
-        assertEquals(0, dest.getBookmarks().size());
-        assertEquals(1, f1.getBookmarks().size());
-        assertEquals(1, f2.getBookmarks().size());
-        assertEquals(1, f3.getBookmarks().size());
-        assertEquals(0, dest.retrieveBookmarks(true).size());
-        assertEquals(3, f1.retrieveBookmarks(true).size());
-        
-        // test that parent cannot be moved into child
-        boolean safe = false;
-        try {
-            // Move folder into one of it's children
-            bmgr.moveFolder(f1, f3);
+        try {        
+
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            FolderData root = bmgr.getRootFolder(testWeblog);
+
+            FolderData dest = new FolderData(root, "dest", null, testWeblog);
+            bmgr.saveFolder(dest);
+
+            // create source folder f1
+            FolderData f1 = new FolderData(root, "f1", null, testWeblog);
+            bmgr.saveFolder(f1);
+
+            // create bookmark b1 inside source folder f1
+            BookmarkData b1 = new BookmarkData(
+                    f1, "b1", "testbookmark",
+                    "http://example.com", "http://example.com/rss",
+                    new Integer(1), new Integer(1), "image.gif");
+            f1.addBookmark(b1);
+
+            // create folder f2 inside f1
+            FolderData f2 = new FolderData(f1, "f2", null, testWeblog);
+            bmgr.saveFolder(f2);
+
+            // create bookmark b2 inside folder f2
+            BookmarkData b2 = new BookmarkData(
+                    f2, "b2", "testbookmark",
+                    "http://example.com", "http://example.com/rss",
+                    new Integer(1), new Integer(1), "image.gif");
+            f2.addBookmark(b2);
+
+            // create folder f3 inside folder f2
+            FolderData f3 = new FolderData(f2, "f3", null, testWeblog);
+            bmgr.saveFolder(f3);
+
+            // crete bookmark b3 inside folder f3
+            BookmarkData b3 = new BookmarkData(
+                    f3, "b3", "testbookmark",
+                    "http://example.com", "http://example.com/rss",
+                    new Integer(1), new Integer(1), "image.gif");
+            f3.addBookmark(b3);
+
+            TestUtils.endSession(true);
+
+            // verify our new tree
+            dest = bmgr.getFolder(dest.getId());
+            f1 = bmgr.getFolder(f1.getId());
+            f2 = bmgr.getFolder(f2.getId());
+            f3 = bmgr.getFolder(f3.getId());
+            assertEquals(0, dest.getBookmarks().size());
+            assertEquals(1, f1.getBookmarks().size());
+            assertEquals(1, f2.getBookmarks().size());
+            assertEquals(1, f3.getBookmarks().size());
+            assertEquals(0, dest.retrieveBookmarks(true).size());
+            assertEquals(3, f1.retrieveBookmarks(true).size());
+
+            // test that parent cannot be moved into child
+            boolean safe = false;
+            try {
+                // Move folder into one of it's children
+                bmgr.moveFolder(f1, f3);
+                TestUtils.endSession(true);
+            } catch (RollerException e) {
+                safe = true;
+            }
+            assertTrue(safe);
+
+            // move f1 to dest
+            f1   = bmgr.getFolder( f1.getId());   //Get managed copy
+            dest = bmgr.getFolder( dest.getId()); //Get managed copy
+            bmgr.moveFolder(f1, dest);
+            TestUtils.endSession(true);
+
+            // after move, verify number of entries in eacch folder
+            dest = bmgr.getFolder(dest.getId());
+            f1 = bmgr.getFolder(f1.getId());
+            assertEquals(3, dest.retrieveBookmarks(true).size());
+
+            // check that paths and child folders are correct
+            assertEquals("/dest/f1", f1.getPath());
+            assertEquals(1, dest.getFolders().size());
+        
+            bmgr.removeFolder(f1);
+            bmgr.removeFolder(dest);
+
+        } catch(Throwable t) {
+            log.error("Exception running test", t);
+            throw (Exception) t;
+        } finally {
             TestUtils.endSession(true);
-        } catch (RollerException e) {
-            safe = true;
         }
-        assertTrue(safe);
-        
-        // move f1 to dest
-        f1   = bmgr.getFolder( f1.getId());   //Get managed copy
-        dest = bmgr.getFolder( dest.getId()); //Get managed copy
-        bmgr.moveFolder(f1, dest);
-        TestUtils.endSession(true);
-        
-        // after move, verify number of entries in eacch folder
-        dest = bmgr.getFolder(dest.getId());
-        f1 = bmgr.getFolder(f1.getId());
-        assertEquals(3, dest.retrieveBookmarks(true).size());
-        
-        // check that paths and child folders are correct
-        assertEquals("/dest/f1", f1.getPath());
-        assertEquals(1, dest.getFolders().size());
-        
-        bmgr.removeFolder(f1);
-        bmgr.removeFolder(dest);
-        TestUtils.endSession(true);
     }
     
     
@@ -320,6 +329,7 @@
         
         FolderData fd = null;
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         fd = getRoller().getBookmarkManager().getFolder(testWeblog, "ZZZ_imports_ZZZ");
         assertTrue(fd.retrieveBookmarks(true).size() > 0 );
         getRoller().getBookmarkManager().removeFolder(fd);

Modified: roller/trunk/tests/org/apache/roller/business/CommentTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/CommentTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/CommentTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/CommentTest.java Thu May 24 15:16:19 2007
@@ -18,6 +18,8 @@
 
 package org.apache.roller.business;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.List;
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -26,8 +28,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
 import org.apache.roller.TestUtils;
-import org.apache.roller.business.RollerFactory;
-import org.apache.roller.business.WeblogManager;
 import org.apache.roller.pojos.CommentData;
 import org.apache.roller.pojos.UserData;
 import org.apache.roller.pojos.WeblogEntryData;
@@ -147,6 +147,7 @@
         List comments = null;
         
         // we need some comments to play with
+        testEntry = TestUtils.getManagedWeblogEntry(testEntry);
         CommentData comment1 = TestUtils.setupComment("comment1", testEntry);
         CommentData comment2 = TestUtils.setupComment("comment2", testEntry);
         CommentData comment3 = TestUtils.setupComment("comment3", testEntry);
@@ -159,6 +160,7 @@
         assertEquals(3, comments.size());
         
         // get all comments for entry
+        testEntry = TestUtils.getManagedWeblogEntry(testEntry);
         comments = null;
         comments = mgr.getComments(null, testEntry, null, null, null, null, false, 0, -1);
         assertNotNull(comments);
@@ -206,51 +208,67 @@
         
         log.info("BEGIN");
         
-        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
-        UserManager umgr = RollerFactory.getRoller().getUserManager();
-        
-        // first make sure we can delete an entry with comments
-        UserData user = TestUtils.setupUser("commentParentDeleteUser");
-        WebsiteData weblog = TestUtils.setupWeblog("commentParentDelete", user);
-        WeblogEntryData entry = TestUtils.setupWeblogEntry("CommentParentDeletes1", weblog.getDefaultCategory(), weblog, user);
-        
-        CommentData comment1 = TestUtils.setupComment("comment1", entry);
-        CommentData comment2 = TestUtils.setupComment("comment2", entry);
-        CommentData comment3 = TestUtils.setupComment("comment3", entry);
-        TestUtils.endSession(true);
-        
-        // now deleting the entry should succeed and delete all comments
-        Exception ex = null;
         try {
-            wmgr.removeWeblogEntry(TestUtils.getManagedWeblogEntry(entry));
+            WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();        
+            UserManager umgr = RollerFactory.getRoller().getUserManager();
+
+            // first make sure we can delete an entry with comments
+            UserData user = TestUtils.setupUser("commentParentDeleteUser");
+            WebsiteData weblog = TestUtils.setupWeblog("commentParentDelete", user);
+            WeblogEntryData entry = TestUtils.setupWeblogEntry("CommentParentDeletes1", 
+                    weblog.getDefaultCategory(), weblog, user);
             TestUtils.endSession(true);
-        } catch (RollerException e) {
-            ex = e;
-        }
-        assertNull(ex);
-        
-        // now make sure we can delete a weblog with comments
-        weblog = TestUtils.getManagedWebsite(weblog);
-        entry = TestUtils.setupWeblogEntry("CommentParentDeletes2", weblog.getDefaultCategory(), weblog, user);
-        
-        comment1 = TestUtils.setupComment("comment1", entry);
-        comment2 = TestUtils.setupComment("comment2", entry);
-        comment3 = TestUtils.setupComment("comment3", entry);
-        TestUtils.endSession(true);
-        
-        // now deleting the entry should succeed and delete all comments
-        ex = null;
-        try {
-            umgr.removeWebsite(TestUtils.getManagedWebsite(weblog));
+
+            entry = TestUtils.getManagedWeblogEntry(entry);
+            TestUtils.setupComment("comment1", entry);
+            TestUtils.setupComment("comment2", entry);
+            TestUtils.setupComment("comment3", entry);
+            TestUtils.endSession(true);
+
+            // now deleting the entry should succeed and delete all comments
+            Exception ex = null;
+            try {
+                wmgr.removeWeblogEntry(TestUtils.getManagedWeblogEntry(entry));
+                TestUtils.endSession(true);
+            } catch (RollerException e) {
+                ex = e;
+            }
+            assertNull(ex);
+
+            // now make sure we can delete a weblog with comments
+            weblog = TestUtils.getManagedWebsite(weblog);
+            user = TestUtils.getManagedUser(user);
+            entry = TestUtils.setupWeblogEntry("CommentParentDeletes2", 
+                    weblog.getDefaultCategory(), weblog, user);
+            TestUtils.endSession(true);
+
+            entry = TestUtils.getManagedWeblogEntry(entry);
+            TestUtils.setupComment("comment1", entry);
+            TestUtils.setupComment("comment2", entry);
+            TestUtils.setupComment("comment3", entry);
+            TestUtils.endSession(true);
+
+            // now deleting the website should succeed 
+            ex = null;
+            try {
+                weblog = TestUtils.getManagedWebsite(weblog);
+                umgr.removeWebsite(weblog);
+                TestUtils.endSession(true);
+            } catch (RollerException e) {
+                StringWriter sw = new StringWriter();
+                PrintWriter pw = new PrintWriter(sw); 
+                e.printStackTrace(pw);
+                log.info(sw.toString());
+                ex = e;
+            }
+            assertNull(ex);
+
+            // and delete test user as well
+            umgr.removeUser(TestUtils.getManagedUser(user));
+            
+        } finally {
             TestUtils.endSession(true);
-        } catch (RollerException e) {
-            ex = e;
         }
-        assertNull(ex);
-        
-        // and delete test user as well
-        umgr.removeUser(user);
-        TestUtils.endSession(true);
         
         log.info("END");
     }

Modified: roller/trunk/tests/org/apache/roller/business/FolderCRUDTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/FolderCRUDTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/FolderCRUDTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/FolderCRUDTest.java Thu May 24 15:16:19 2007
@@ -83,6 +83,7 @@
         
         BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         FolderData root = bmgr.getRootFolder(testWeblog);
         
         FolderData testFolder = new FolderData(null, "root", "root", TestUtils.getManagedWebsite(testWeblog));
@@ -104,6 +105,7 @@
         
         BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         FolderData root = bmgr.getRootFolder(testWeblog);
         
         // start out with no folders and no bookmarks
@@ -116,6 +118,7 @@
         TestUtils.endSession(true);
         
         // check that folder was saved
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         root = bmgr.getRootFolder(testWeblog);
         assertEquals(1, root.getFolders().size());
         FolderData folder = (FolderData) root.getFolders().iterator().next();
@@ -127,6 +130,7 @@
         TestUtils.endSession(true);
         
         // check that folder was saved
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         root = bmgr.getRootFolder(testWeblog);
         folder = (FolderData) root.getFolders().iterator().next();
         assertEquals("folderTest1", folder.getName());
@@ -136,6 +140,7 @@
         TestUtils.endSession(true);
         
         // make sure folder was removed
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         root = bmgr.getRootFolder(testWeblog);
         assertEquals(0, root.getFolders().size());
         folder = bmgr.getFolder(newFolder.getId());
@@ -154,18 +159,20 @@
         
         BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         FolderData root = bmgr.getRootFolder(testWeblog);
         
         // add a small tree /fold1/fold2
-        FolderData fold1 = new FolderData(root, "fold1", null, TestUtils.getManagedWebsite(testWeblog));
+        FolderData fold1 = new FolderData(root, "fold1", null, testWeblog);
         root.addFolder(fold1);
         bmgr.saveFolder(fold1);
-        FolderData fold2 = new FolderData(fold1, "fold2", null, TestUtils.getManagedWebsite(testWeblog));
+        FolderData fold2 = new FolderData(fold1, "fold2", null, testWeblog);
         fold1.addFolder(fold2);
         bmgr.saveFolder(fold2);
         TestUtils.endSession(true);
         
         // check that tree can be navigated
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         root = bmgr.getRootFolder(testWeblog);
         assertEquals(1, root.getFolders().size());
         fold1 = (FolderData) root.getFolders().iterator().next();
@@ -179,9 +186,10 @@
         TestUtils.endSession(true);
         
         // verify cascading delete succeeded
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         root = bmgr.getRootFolder(testWeblog);
         assertEquals(0, root.getFolders().size());
-        assertNull(bmgr.getFolder(TestUtils.getManagedWebsite(testWeblog), "/fold1/fold2"));
+        assertNull(bmgr.getFolder(testWeblog, "/fold1/fold2"));
         
         log.info("END");
     }

Modified: roller/trunk/tests/org/apache/roller/business/FolderFunctionalityTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/FolderFunctionalityTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/FolderFunctionalityTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/FolderFunctionalityTest.java Thu May 24 15:16:19 2007
@@ -18,19 +18,18 @@
 
 package org.apache.roller.business;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import junit.framework.TestCase;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
 import org.apache.roller.TestUtils;
 import org.apache.roller.pojos.FolderData;
 import org.apache.roller.pojos.UserData;
 import org.apache.roller.pojos.WebsiteData;
-import org.apache.roller.util.Utilities;
-
 
 /**
  * Test folder business functions and lookups.
@@ -150,6 +149,7 @@
         
         BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         FolderData root = bmgr.getRootFolder(testWeblog);
         
         // check that root has folder
@@ -165,23 +165,32 @@
     public void testUniquenessOfFolderNames() throws Exception {
         
         log.info("BEGIN");
-        
-        BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
-        
-        FolderData root = bmgr.getRootFolder(testWeblog);
-        
-        boolean exception = false;
         try {
-            // child folder with same name as first
-            FolderData dupeFolder = new FolderData(root, testFolder.getName(), null, TestUtils.getManagedWebsite(testWeblog));
-            bmgr.saveFolder(dupeFolder);
-            TestUtils.endSession(true);
-        } catch (RollerException e) {
-            exception = true;
-        }
-        
-        assertTrue(exception);
-        
+            BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
+
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            FolderData root = bmgr.getRootFolder(testWeblog);
+
+            boolean exception = false;
+            try {
+                // child folder with same name as first
+                FolderData dupeFolder = new FolderData(root, testFolder.getName(), null, testWeblog);
+                bmgr.saveFolder(dupeFolder);
+                TestUtils.endSession(true);
+            } catch (Throwable e) {
+                exception = true;
+            }
+
+            assertTrue(exception);
+            
+        } catch (Throwable t) {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw); 
+            t.printStackTrace(pw);
+            log.info(sw.toString());
+        }        
+        TestUtils.endSession(true);
+
         log.info("END");
     }
     
@@ -213,6 +222,7 @@
         
         BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         FolderData folder = bmgr.getFolder(testWeblog, "/folderFuncTest-f1");
         assertNotNull(folder);
         assertEquals(f1, folder);
@@ -242,6 +252,7 @@
         BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
         
         // get all folders, including root
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         List allFolders = bmgr.getAllFolders(testWeblog);
         assertNotNull(allFolders);
         assertEquals(5, allFolders.size());

Modified: roller/trunk/tests/org/apache/roller/business/FolderParentDeletesTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/FolderParentDeletesTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/FolderParentDeletesTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/FolderParentDeletesTest.java Thu May 24 15:16:19 2007
@@ -85,6 +85,7 @@
         
         BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         FolderData root = bmgr.getRootFolder(testWeblog);
         
         // add a small tree /parentDelete-fold1/parentDelete-fold2

Modified: roller/trunk/tests/org/apache/roller/business/HitCountTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/HitCountTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/HitCountTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/HitCountTest.java Thu May 24 15:16:19 2007
@@ -132,6 +132,7 @@
         
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         HitCountData testCount = new HitCountData();
         testCount.setWeblog(testWeblog);
         testCount.setDailyHits(10);
@@ -150,6 +151,7 @@
         
         // test lookup by weblog
         hitCount = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         hitCount = mgr.getHitCountByWeblog(testWeblog);
         assertNotNull(hitCount);
         assertEquals(testCount, hitCount);
@@ -171,6 +173,7 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
         HitCountData testCount = new HitCountData();
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         testCount.setWeblog(testWeblog);
         testCount.setDailyHits(10);
         
@@ -181,6 +184,7 @@
         
         // make sure it was created
         HitCountData hitCount = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         hitCount = mgr.getHitCountByWeblog(testWeblog);
         assertNotNull(hitCount);
         assertEquals(10, hitCount.getDailyHits());
@@ -191,6 +195,7 @@
         
         // make sure it was incremented properly
         hitCount = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         hitCount = mgr.getHitCountByWeblog(testWeblog);
         assertNotNull(hitCount);
         assertEquals(35, hitCount.getDailyHits());
@@ -207,9 +212,9 @@
     
     
     public void testResetHitCounts() throws Exception {
-        
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
+        testUser = TestUtils.getManagedUser(testUser);
         WebsiteData blog1 = TestUtils.setupWeblog("hitCntTest1", testUser);
         WebsiteData blog2 = TestUtils.setupWeblog("hitCntTest2", testUser);
         WebsiteData blog3 = TestUtils.setupWeblog("hitCntTest3", testUser);
@@ -220,46 +225,50 @@
         
         TestUtils.endSession(true);
         
-        // make sure data was properly initialized
-        HitCountData testCount = null;
-        testCount = mgr.getHitCount(cnt1.getId());
-        assertEquals(10, testCount.getDailyHits());
-        testCount = mgr.getHitCount(cnt2.getId());
-        assertEquals(20, testCount.getDailyHits());
-        testCount = mgr.getHitCount(cnt3.getId());
-        assertEquals(30, testCount.getDailyHits());
-        
-        // reset count for one weblog
-        mgr.resetHitCount(blog1);
-        TestUtils.endSession(true);
-        
-        // make sure it reset only one weblog
-        testCount = mgr.getHitCount(cnt1.getId());
-        assertEquals(0, testCount.getDailyHits());
-        testCount = mgr.getHitCount(cnt2.getId());
-        assertEquals(20, testCount.getDailyHits());
-        testCount = mgr.getHitCount(cnt3.getId());
-        assertEquals(30, testCount.getDailyHits());
-        
-        // reset all counts
-        mgr.resetAllHitCounts();
-        TestUtils.endSession(true);
-        
-        // make sure it reset all counts
-        testCount = mgr.getHitCount(cnt1.getId());
-        assertEquals(0, testCount.getDailyHits());
-        testCount = mgr.getHitCount(cnt2.getId());
-        assertEquals(0, testCount.getDailyHits());
-        testCount = mgr.getHitCount(cnt3.getId());
-        assertEquals(0, testCount.getDailyHits());
-        
-        // cleanup
-        TestUtils.teardownHitCount(cnt1.getId());
-        TestUtils.teardownHitCount(cnt2.getId());
-        TestUtils.teardownHitCount(cnt3.getId());
-        TestUtils.teardownWeblog(blog1.getId());
-        TestUtils.teardownWeblog(blog2.getId());
-        TestUtils.teardownWeblog(blog3.getId());
+        try {
+            // make sure data was properly initialized
+            HitCountData testCount = null;
+            testCount = mgr.getHitCount(cnt1.getId());
+            assertEquals(10, testCount.getDailyHits());
+            testCount = mgr.getHitCount(cnt2.getId());
+            assertEquals(20, testCount.getDailyHits());
+            testCount = mgr.getHitCount(cnt3.getId());
+            assertEquals(30, testCount.getDailyHits());
+
+            // reset count for one weblog
+            blog1 = TestUtils.getManagedWebsite(blog1);
+            mgr.resetHitCount(blog1);
+            TestUtils.endSession(true);
+
+            // make sure it reset only one weblog
+            testCount = mgr.getHitCount(cnt1.getId());
+            assertEquals(0, testCount.getDailyHits());
+            testCount = mgr.getHitCount(cnt2.getId());
+            assertEquals(20, testCount.getDailyHits());
+            testCount = mgr.getHitCount(cnt3.getId());
+            assertEquals(30, testCount.getDailyHits());
+
+            // reset all counts
+            mgr.resetAllHitCounts();
+            TestUtils.endSession(true);
+
+            // make sure it reset all counts
+            testCount = mgr.getHitCount(cnt1.getId());
+            assertEquals(0, testCount.getDailyHits());
+            testCount = mgr.getHitCount(cnt2.getId());
+            assertEquals(0, testCount.getDailyHits());
+            testCount = mgr.getHitCount(cnt3.getId());
+            assertEquals(0, testCount.getDailyHits());
+        
+        } finally {
+            // cleanup
+            TestUtils.teardownHitCount(cnt1.getId());
+            TestUtils.teardownHitCount(cnt2.getId());
+            TestUtils.teardownHitCount(cnt3.getId());
+            TestUtils.teardownWeblog(blog1.getId());
+            TestUtils.teardownWeblog(blog2.getId());
+            TestUtils.teardownWeblog(blog3.getId());
+        }
     }
 
     
@@ -267,6 +276,7 @@
         
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
+        testUser = TestUtils.getManagedUser(testUser);
         WebsiteData blog1 = TestUtils.setupWeblog("hitCntHotTest1", testUser);
         WebsiteData blog2 = TestUtils.setupWeblog("hitCntHotTest2", testUser);
         WebsiteData blog3 = TestUtils.setupWeblog("hitCntHotTest3", testUser);

Modified: roller/trunk/tests/org/apache/roller/business/PermissionTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/PermissionTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/PermissionTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/PermissionTest.java Thu May 24 15:16:19 2007
@@ -99,8 +99,10 @@
         
         UserManager mgr = RollerFactory.getRoller().getUserManager();
         PermissionsData perm = null;
-        
+                
         // delete permissions
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         perm = mgr.getPermissions(testWeblog, testUser);
         assertNotNull(perm);
         mgr.removePermissions(perm);
@@ -108,19 +110,23 @@
         
         // check that delete was successful
         perm = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         perm = mgr.getPermissions(testWeblog, testUser);
         assertNull(perm);
         
         // create permissions
         perm = new PermissionsData();
-        perm.setUser(TestUtils.getManagedUser(testUser) );
-        perm.setWebsite(TestUtils.getManagedWebsite(testWeblog));
+        perm.setUser(testUser);
+        perm.setWebsite(testWeblog);
         perm.setPending(false);
         perm.setPermissionMask(PermissionsData.ADMIN);
         mgr.savePermissions(perm);
         TestUtils.endSession(true);
         
         // check that create was successful
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         perm = null;
         perm = mgr.getPermissions(testWeblog, testUser);
         assertNotNull(perm);
@@ -132,6 +138,8 @@
         TestUtils.endSession(true);
 
         // check that update was successful
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         perm = null;
         perm = mgr.getPermissions(testWeblog, testUser);
         assertNotNull(perm);
@@ -237,6 +245,8 @@
         TestUtils.endSession(true);
 
         // accept invitation
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        user = TestUtils.getManagedUser(user);
         perm = mgr.getPermissions(testWeblog, user);
         perm.setPending(false);
         mgr.savePermissions(perm);
@@ -247,6 +257,8 @@
         testWeblog = mgr.getWebsiteByHandle(testWeblog.getHandle());
 
         // assert that invitation list is empty
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        user = TestUtils.getManagedUser(user);
         assertTrue(mgr.getPendingPermissions(user).isEmpty());
         assertTrue(mgr.getPendingPermissions(testWeblog).isEmpty());
 

Modified: roller/trunk/tests/org/apache/roller/business/PingsTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/PingsTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/PingsTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/PingsTest.java Thu May 24 15:16:19 2007
@@ -197,6 +197,7 @@
         TestUtils.endSession(true);
         
         // create custom ping
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         testCustomPing.setWebsite(testWeblog);
         mgr.savePingTarget(testCustomPing);
         String customId = testCustomPing.getId();
@@ -214,6 +215,7 @@
         assertEquals(1, commonPings.size());
         
         // lookup all custom pings for weblog
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         List customPings = mgr.getCustomPingTargets(testWeblog);
         assertNotNull(customPings);
         assertEquals(1, customPings.size());
@@ -290,6 +292,7 @@
     public void testPingTargetRemovals() throws Exception {
         
         AutoPingManager mgr = RollerFactory.getRoller().getAutopingManager();
+        PingTargetManager ptmgr = RollerFactory.getRoller().getPingTargetManager();
         AutoPingData testAutoPing = null;
         
         // create ping target to use for tests
@@ -297,54 +300,63 @@
         PingTargetData pingTarget2 = TestUtils.setupPingTarget("blahPing", "http://blah/null");
         PingTargetData pingTarget3 = TestUtils.setupPingTarget("gahPing", "http://gah/null");
         
-        // create auto pings for test
-        AutoPingData autoPing = TestUtils.setupAutoPing(pingTarget, testWeblog);
-        AutoPingData autoPing2 = TestUtils.setupAutoPing(pingTarget2, testWeblog);
-        AutoPingData autoPing3 = TestUtils.setupAutoPing(pingTarget3, testWeblog);
-        TestUtils.endSession(true);
-        
-        // remove by weblog/target
-        mgr.removeAutoPing(pingTarget, testWeblog);
-        TestUtils.endSession(true);
-        
-        // make sure remove succeeded
-        testAutoPing = null;
-        testAutoPing = mgr.getAutoPing(autoPing.getId());
-        assertNull(testAutoPing);
-        
-        // remove a collection
-        List autoPings = new ArrayList();
-        autoPing2 = mgr.getAutoPing(autoPing2.getId()); //Get managed version of autoPing2
-        autoPings.add(autoPing2);
-        autoPing3 = mgr.getAutoPing(autoPing3.getId()); //Get managed version of autoPing2
-        autoPings.add(autoPing3);
-        mgr.removeAutoPings(autoPings);
-        TestUtils.endSession(true);
-        
-        // make sure delete was successful
-        autoPings = mgr.getAutoPingsByWebsite(testWeblog);
-        assertNotNull(autoPings);
-        assertEquals(0, autoPings.size());
-        
-        // need to create more test pings
-        autoPing = TestUtils.setupAutoPing(pingTarget, testWeblog);
-        autoPing2 = TestUtils.setupAutoPing(pingTarget2, testWeblog);
-        autoPing3 = TestUtils.setupAutoPing(pingTarget3, testWeblog);
-        TestUtils.endSession(true);
-        
-        // remove all
-        mgr.removeAllAutoPings();
-        TestUtils.endSession(true);
-        
-        // make sure remove succeeded
-        autoPings = mgr.getAutoPingsByWebsite(testWeblog);
-        assertNotNull(autoPings);
-        assertEquals(0, autoPings.size());
+        try {
         
-        // teardown test ping target
-        TestUtils.teardownPingTarget(pingTarget.getId());
-        TestUtils.teardownPingTarget(pingTarget2.getId());
-        TestUtils.endSession(true);
+            // create auto pings for test
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            AutoPingData autoPing = TestUtils.setupAutoPing(pingTarget, testWeblog);
+            AutoPingData autoPing2 = TestUtils.setupAutoPing(pingTarget2, testWeblog);
+            AutoPingData autoPing3 = TestUtils.setupAutoPing(pingTarget3, testWeblog);
+            TestUtils.endSession(true);
+
+            // remove by weblog/target
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            pingTarget = ptmgr.getPingTarget(pingTarget.getId());
+            mgr.removeAutoPing(pingTarget, testWeblog);
+            TestUtils.endSession(true);
+
+            // make sure remove succeeded
+            testAutoPing = null;
+            testAutoPing = mgr.getAutoPing(autoPing.getId());
+            assertNull(testAutoPing);
+
+            // remove a collection
+            List autoPings = new ArrayList();
+            autoPing2 = mgr.getAutoPing(autoPing2.getId()); //Get managed version of autoPing2
+            autoPings.add(autoPing2);
+            autoPing3 = mgr.getAutoPing(autoPing3.getId()); //Get managed version of autoPing2
+            autoPings.add(autoPing3);
+            mgr.removeAutoPings(autoPings);
+            TestUtils.endSession(true);
+
+            // make sure delete was successful
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            autoPings = mgr.getAutoPingsByWebsite(testWeblog);
+            assertNotNull(autoPings);
+            assertEquals(0, autoPings.size());
+
+            // need to create more test pings
+            autoPing = TestUtils.setupAutoPing(pingTarget, testWeblog);
+            autoPing2 = TestUtils.setupAutoPing(pingTarget2, testWeblog);
+            autoPing3 = TestUtils.setupAutoPing(pingTarget3, testWeblog);
+            TestUtils.endSession(true);
+
+            // remove all
+            mgr.removeAllAutoPings();
+            TestUtils.endSession(true);
+
+            // make sure remove succeeded
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            autoPings = mgr.getAutoPingsByWebsite(testWeblog);
+            assertNotNull(autoPings);
+            assertEquals(0, autoPings.size());
+        
+        } finally {
+            // teardown test ping target
+            TestUtils.teardownPingTarget(pingTarget.getId());
+            TestUtils.teardownPingTarget(pingTarget2.getId());
+            TestUtils.endSession(true);
+        }
     }
     
     
@@ -354,6 +366,7 @@
     public void testAutoPingLookups() throws Exception {
         
         AutoPingManager mgr = RollerFactory.getRoller().getAutopingManager();
+        PingTargetManager ptmgr = RollerFactory.getRoller().getPingTargetManager();
         AutoPingData autoPing = null;
         
         // create autoPing target to use for tests
@@ -361,6 +374,8 @@
         TestUtils.endSession(true);
         
         // create autoPing
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        pingTarget = ptmgr.getPingTarget(pingTarget.getId());
         autoPing = new AutoPingData(null, pingTarget, testWeblog);
         mgr.saveAutoPing(autoPing);
         String id = autoPing.getId();
@@ -373,17 +388,20 @@
         assertEquals(pingTarget, autoPing.getPingTarget());
         
         // lookup by ping target
+        pingTarget = ptmgr.getPingTarget(pingTarget.getId());
         List autoPings = mgr.getAutoPingsByTarget(pingTarget);
         assertNotNull(autoPings);
         assertEquals(1, autoPings.size());
         
         // lookup by weblog
         autoPings = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         autoPings = mgr.getAutoPingsByWebsite(testWeblog);
         assertNotNull(autoPing);
         assertEquals(1, autoPings.size());
         
         // delete autoPing
+        autoPing = mgr.getAutoPing(autoPing.getId());
         mgr.removeAutoPing(autoPing);
         TestUtils.endSession(true);
         

Modified: roller/trunk/tests/org/apache/roller/business/RefererTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/RefererTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/RefererTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/RefererTest.java Thu May 24 15:16:19 2007
@@ -137,6 +137,7 @@
         RefererManager mgr = RollerFactory.getRoller().getRefererManager();
         RefererData referer = null;
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         RefererData testReferer = new RefererData();
         testReferer.setWebsite(testWeblog);
         testReferer.setDateString("20060420");
@@ -187,6 +188,7 @@
         
         RefererManager rmgr = RollerFactory.getRoller().getRefererManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         List referers = rmgr.getReferersToDate(testWeblog, testDay);
         assertEquals("Should be one Referer.", referers.size(), 1);
     }
@@ -196,6 +198,7 @@
         
         RefererManager rmgr = RollerFactory.getRoller().getRefererManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         List refs = rmgr.getReferers(testWeblog);
         assertEquals("number of referers should equal count", count, refs.size());
         
@@ -210,6 +213,7 @@
         
         RefererManager rmgr = RollerFactory.getRoller().getRefererManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         List refs = rmgr.getReferers(testWeblog);
         assertEquals(count, refs.size());
         
@@ -223,6 +227,7 @@
         rmgr.applyRefererFilters();
         TestUtils.endSession(true);
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         refs = rmgr.getReferers(testWeblog);
         assertEquals(0, refs.size());
         
@@ -239,20 +244,23 @@
         
         RefererManager rmgr = RollerFactory.getRoller().getRefererManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         List refs = rmgr.getReferers(testWeblog);
         assertEquals(count, refs.size());
         String origWords = null;
         
         UserManager umgr = RollerFactory.getRoller().getUserManager();
-        testWeblog = umgr.getWebsite(testWeblog.getId());
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         origWords = testWeblog.getBlacklist();
         testWeblog.setBlacklist("test");
         umgr.saveWebsite(testWeblog);
         TestUtils.endSession(true);
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         rmgr.applyRefererFilters(testWeblog);
         TestUtils.endSession(true);
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         refs = rmgr.getReferers(testWeblog);
         assertEquals(0, refs.size());
     }

Modified: roller/trunk/tests/org/apache/roller/business/WeblogCategoryCRUDTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/WeblogCategoryCRUDTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/WeblogCategoryCRUDTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/WeblogCategoryCRUDTest.java Thu May 24 15:16:19 2007
@@ -83,6 +83,7 @@
         
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         WeblogCategoryData root = mgr.getRootWeblogCategory(testWeblog);
         
         WeblogCategoryData testCat = new WeblogCategoryData(testWeblog, null, "root", "root", null);
@@ -107,13 +108,14 @@
         List cats = null;
         
         // root category is always available
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         WeblogCategoryData root = mgr.getRootWeblogCategory(testWeblog);
         
         // make sure we are starting with 0 categories (beneath root)
         assertEquals(0, root.getWeblogCategories().size());
         
         // add a new category
-        WeblogCategoryData newCat = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), root, "catTestCategory", null, null);
+        WeblogCategoryData newCat = new WeblogCategoryData(testWeblog, root, "catTestCategory", null, null);
         mgr.saveWeblogCategory(newCat);
         TestUtils.endSession(true);
         
@@ -124,6 +126,7 @@
         assertEquals(newCat, cat);
         
         // make sure category count increased
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         root = mgr.getRootWeblogCategory(testWeblog);
         assertEquals(1, root.getWeblogCategories().size());
         
@@ -148,6 +151,7 @@
         assertNull(cat);
         
         // make sure category count decreased
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         root = mgr.getRootWeblogCategory(testWeblog);
         assertEquals(0, root.getWeblogCategories().size());
         
@@ -165,6 +169,7 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
         // root category is always available
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         WeblogCategoryData root = mgr.getRootWeblogCategory(testWeblog);
         
         // add a small category tree /subcat/subcat2
@@ -177,6 +182,7 @@
         TestUtils.endSession(true);
         
         // check that subcat tree can be navigated
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         root = mgr.getRootWeblogCategory(testWeblog);
         assertEquals(1, root.getWeblogCategories().size());
         subcat = (WeblogCategoryData) root.getWeblogCategories().iterator().next();
@@ -190,6 +196,7 @@
         TestUtils.endSession(true);
         
         // verify cascading delete succeeded
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         root = mgr.getRootWeblogCategory(testWeblog);
         assertEquals(0, root.getWeblogCategories().size());
         assertNull(mgr.getWeblogCategoryByPath(TestUtils.getManagedWebsite(testWeblog), "/subcatTest1/subcatTest2"));

Modified: roller/trunk/tests/org/apache/roller/business/WeblogCategoryFunctionalityTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/WeblogCategoryFunctionalityTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/WeblogCategoryFunctionalityTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/WeblogCategoryFunctionalityTest.java Thu May 24 15:16:19 2007
@@ -184,6 +184,7 @@
         
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         WeblogCategoryData cat = mgr.getWeblogCategoryByPath(testWeblog, "/catTest-cat1");
         assertNotNull(cat);
         assertEquals(cat, cat1);
@@ -216,6 +217,7 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
         // including root
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         List cats = mgr.getWeblogCategories(testWeblog, true);
         assertNotNull(cats);
         assertEquals(5, cats.size());
@@ -236,19 +238,21 @@
         
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogCategoryData root = mgr.getRootWeblogCategory(testWeblog);
         
         // add some categories and entries to test with
-        WeblogCategoryData dest = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), root, "c0", null, null);
+        WeblogCategoryData dest = new WeblogCategoryData(testWeblog, root, "c0", null, null);
         mgr.saveWeblogCategory(dest);
         
-        WeblogCategoryData c1 = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), root, "c1", null, null);
+        WeblogCategoryData c1 = new WeblogCategoryData(testWeblog, root, "c1", null, null);
         mgr.saveWeblogCategory(c1);
         
-        WeblogCategoryData c2 = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), c1, "c2", null, null);
+        WeblogCategoryData c2 = new WeblogCategoryData(testWeblog, c1, "c2", null, null);
         mgr.saveWeblogCategory(c2);
         
-        WeblogCategoryData c3 = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), c2, "c3", null, null);
+        WeblogCategoryData c3 = new WeblogCategoryData(testWeblog, c2, "c3", null, null);
         mgr.saveWeblogCategory(c3);
         
         TestUtils.endSession(true);
@@ -309,19 +313,21 @@
         
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogCategoryData root = mgr.getRootWeblogCategory(testWeblog);
         
         // add some categories and entries to test with
-        WeblogCategoryData dest = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), root, "c0", null, null);
+        WeblogCategoryData dest = new WeblogCategoryData(testWeblog, root, "c0", null, null);
         mgr.saveWeblogCategory(dest);
         
-        WeblogCategoryData c1 = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), root, "c1", null, null);
+        WeblogCategoryData c1 = new WeblogCategoryData(testWeblog, root, "c1", null, null);
         mgr.saveWeblogCategory(c1);
         
-        WeblogCategoryData c2 = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), c1, "c2", null, null);
+        WeblogCategoryData c2 = new WeblogCategoryData(testWeblog, c1, "c2", null, null);
         mgr.saveWeblogCategory(c2);
         
-        WeblogCategoryData c3 = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), c2, "c3", null, null);
+        WeblogCategoryData c3 = new WeblogCategoryData(testWeblog, c2, "c3", null, null);
         mgr.saveWeblogCategory(c3);
         
         TestUtils.endSession(true);
@@ -331,6 +337,8 @@
         c3 = mgr.getWeblogCategory(c3.getId());
         dest = mgr.getWeblogCategory(dest.getId());
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData e1 = TestUtils.setupWeblogEntry("e1", c1, testWeblog, testUser);
         WeblogEntryData e2 = TestUtils.setupWeblogEntry("e2", c2, testWeblog, testUser);
         WeblogEntryData e3 = TestUtils.setupWeblogEntry("e3", c3, testWeblog, testUser);

Modified: roller/trunk/tests/org/apache/roller/business/WeblogCategoryParentDeletesTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/WeblogCategoryParentDeletesTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/WeblogCategoryParentDeletesTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/WeblogCategoryParentDeletesTest.java Thu May 24 15:16:19 2007
@@ -82,13 +82,13 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
         
         // root category is always available
-        WeblogCategoryData root = mgr.getRootWeblogCategory(testWeblog);
+        WeblogCategoryData root = mgr.getRootWeblogCategory(TestUtils.getManagedWebsite(testWeblog));
         
         // add a small category tree /subcat/subcat2
-        WeblogCategoryData subcat = new WeblogCategoryData(testWeblog, root, "categoryParentDeletes1", null, null);
+        WeblogCategoryData subcat = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), root, "categoryParentDeletes1", null, null);
         root.addCategory(subcat);
         mgr.saveWeblogCategory(subcat);
-        WeblogCategoryData subcat2 = new WeblogCategoryData(testWeblog, subcat, "categoryParentDeletes2", null, null);
+        WeblogCategoryData subcat2 = new WeblogCategoryData(TestUtils.getManagedWebsite(testWeblog), subcat, "categoryParentDeletes2", null, null);
         subcat.addCategory(subcat2);
         mgr.saveWeblogCategory(subcat2);
         TestUtils.endSession(true);

Modified: roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java Thu May 24 15:16:19 2007
@@ -18,6 +18,8 @@
 
 package org.apache.roller.business;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -154,6 +156,8 @@
         Map entryMap = null;
         
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry1 = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
         WeblogEntryData entry2 = TestUtils.setupWeblogEntry("entry2", testWeblog.getDefaultCategory(), testWeblog, testUser);
         WeblogEntryData entry3 = TestUtils.setupWeblogEntry("entry3", testWeblog.getDefaultCategory(), testWeblog, testUser);
@@ -182,10 +186,19 @@
         
         TestUtils.endSession(true);
         
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
+
         log.debug("entry1 = "+entry1.getUpdateTime());
         log.debug("entry2 = "+entry2.getUpdateTime());
         log.debug("entry3 = "+entry3.getUpdateTime());
         
+        entry1 = TestUtils.getManagedWeblogEntry(entry1);
+        entry2 = TestUtils.getManagedWeblogEntry(entry2);
+        entry3 = TestUtils.getManagedWeblogEntry(entry3);
+        entry4 = TestUtils.getManagedWeblogEntry(entry4);
+        entry5 = TestUtils.getManagedWeblogEntry(entry5);
+        
         // get entry by id
         entry = null;
         entry = mgr.getWeblogEntry(entry1.getId());
@@ -299,15 +312,20 @@
         List entries = null;
         
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry1 = TestUtils.setupWeblogEntry("entry1", testWeblog.getDefaultCategory(), testWeblog, testUser);
         TestUtils.endSession(true);
         
         // make sure createAnchor gives us a new anchor value
+        entry1 = TestUtils.getManagedWeblogEntry(entry1);
         String anchor = mgr.createAnchor(entry1);
         assertNotNull(anchor);
         assertNotSame("entry1", anchor);
         
         // make sure we can create a new entry with specified anchor
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry2 = TestUtils.setupWeblogEntry(anchor, testWeblog.getDefaultCategory(), testWeblog, testUser);
         TestUtils.endSession(true);
         assertNotNull(entry2);
@@ -319,43 +337,53 @@
     }
     
     public void testCreateAnEntryWithTagsShortcut() throws Exception {
+        try {
+            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
+            WeblogEntryData entry = null;
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            testUser = TestUtils.getManagedUser(testUser);
+
+            WeblogEntryData testEntry = new WeblogEntryData();
+            testEntry.setTitle("entryTestEntry");
+            testEntry.setLink("testEntryLink");
+            testEntry.setText("blah blah entry");
+            testEntry.setAnchor("testEntryAnchor");
+            testEntry.setPubTime(
+                    new java.sql.Timestamp(new java.util.Date().getTime()));
+            testEntry.setUpdateTime(
+                    new java.sql.Timestamp(new java.util.Date().getTime()));
+            testEntry.setWebsite(testWeblog);
+            testEntry.setCreator(testUser);
+            testEntry.setCategory(testWeblog.getDefaultCategory());
+
+            // shortcut
+            testEntry.addTag("testTag");
+
+            // create a weblog entry
+            mgr.saveWeblogEntry(testEntry);
+            String id = testEntry.getId();
+            TestUtils.endSession(true);
 
-        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
-        WeblogEntryData entry = null;
-
-        WeblogEntryData testEntry = new WeblogEntryData();
-        testEntry.setTitle("entryTestEntry");
-        testEntry.setLink("testEntryLink");
-        testEntry.setText("blah blah entry");
-        testEntry.setAnchor("testEntryAnchor");
-        testEntry.setPubTime(new java.sql.Timestamp(new java.util.Date()
-                .getTime()));
-        testEntry.setUpdateTime(new java.sql.Timestamp(new java.util.Date()
-                .getTime()));
-        testEntry.setWebsite(testWeblog);
-        testEntry.setCreator(testUser);
-        testEntry.setCategory(testWeblog.getDefaultCategory());
-
-        // shortcut
-        testEntry.addTag("testTag");
-
-        // create a weblog entry
-        mgr.saveWeblogEntry(testEntry);
-        String id = testEntry.getId();
-        TestUtils.endSession(true);
-
-        // make sure entry was created
-        entry = mgr.getWeblogEntry(id);
-        assertNotNull(entry);
-        assertEquals(testEntry, entry);
-        assertNotNull(entry.getTags());
-        assertEquals(1, entry.getTags().size());
-        assertEquals("testtag", ((WeblogEntryTagData) entry.getTags()
-                .iterator().next()).getName());
+            // make sure entry was created
+            entry = mgr.getWeblogEntry(id);
+            assertNotNull(entry);
+            assertEquals(testEntry, entry);
+            assertNotNull(entry.getTags());
+            assertEquals(1, entry.getTags().size());
+            assertEquals("testtag", ((WeblogEntryTagData) entry.getTags()
+                    .iterator().next()).getName());
+            TestUtils.endSession(true);
 
-        // teardown our test entry
-        TestUtils.teardownWeblogEntry(id);
-        TestUtils.endSession(true);
+            // teardown our test entry
+            TestUtils.teardownWeblogEntry(id);
+            TestUtils.endSession(true);
+        
+        } catch (Throwable t) {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw); 
+            t.printStackTrace(pw);
+            log.info(sw.toString());
+        }
     }
         
     public void testAddMultipleTags() throws Exception {
@@ -363,6 +391,8 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         entry.addTag("testTag");
@@ -389,6 +419,8 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         entry.addTag("testTag");
@@ -410,54 +442,65 @@
     }    
     
     public void testRemoveTagsViaShortcut() throws Exception {
+        try {
+            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
-        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
-
-        // setup some test entries to use
-        WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
-        entry.addTag("testTag");
-        entry.addTag("testTag2");
-        String id = entry.getId();
-        mgr.saveWeblogEntry(entry);
-        TestUtils.endSession(true);
+            // setup some test entries to use
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            testUser = TestUtils.getManagedUser(testUser);
+            WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
+                    .getDefaultCategory(), testWeblog, testUser);
+            entry.addTag("testTag");
+            entry.addTag("testTag2");
+            String id = entry.getId();
+            mgr.saveWeblogEntry(entry);
+            TestUtils.endSession(true);
 
-        entry = mgr.getWeblogEntry(id);
-        assertEquals(2, entry.getTags().size());
-        TestUtils.endSession(true);
+            entry = mgr.getWeblogEntry(id);
+            assertEquals(2, entry.getTags().size());
+            TestUtils.endSession(true);
 
-        entry = mgr.getWeblogEntry(id);
-        mgr.removeWeblogEntryTag("testtag", entry);
-        mgr.removeWeblogEntryTag("testtag2", entry);
-        mgr.saveWeblogEntry(entry);
-        TestUtils.endSession(true);
+            entry = mgr.getWeblogEntry(id);
+            mgr.removeWeblogEntryTag("testtag", entry);
+            mgr.removeWeblogEntryTag("testtag2", entry);
+            mgr.saveWeblogEntry(entry);
+            TestUtils.endSession(true);
 
-        entry = mgr.getWeblogEntry(id);
-        assertEquals(0, entry.getTags().size());
-        TestUtils.endSession(true);
+            entry = mgr.getWeblogEntry(id);
+            assertEquals(0, entry.getTags().size());
+            TestUtils.endSession(true);
 
-        // teardown our test entry
-        TestUtils.teardownWeblogEntry(id);
-        TestUtils.endSession(true);
+            // teardown our test entry
+            TestUtils.teardownWeblogEntry(id);
+            TestUtils.endSession(true);
+            
+        } catch (Throwable t) {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw); 
+            t.printStackTrace(pw);
+            log.info(sw.toString());
+        }
     }
     
     public void testTagsExist() throws Exception {
         
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WebsiteData weblog = TestUtils.setupWeblog("tagsExistWeblog1", testUser);
         String wid = weblog.getId();
         
         // setup some test entries to use
-        WeblogEntryData entry = TestUtils.setupWeblogEntry("tagsExistEntry1", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
+        WeblogEntryData entry = TestUtils.setupWeblogEntry("tagsExistEntry1", 
+                testWeblog.getDefaultCategory(), testWeblog, testUser);
         String id1 = entry.getId();
         entry.addTag("blahTag");
         entry.addTag("fooTag");
         mgr.saveWeblogEntry(entry);
 
-        WeblogEntryData entry2 = TestUtils.setupWeblogEntry("tagsExistEntry2", weblog
-                .getDefaultCategory(), weblog, testUser);
+        WeblogEntryData entry2 = TestUtils.setupWeblogEntry("tagsExistEntry2", 
+                weblog.getDefaultCategory(), weblog, testUser);
         String id2 = entry2.getId();
         entry2.addTag("aaaTag");
         entry2.addTag("bbbTag");
@@ -476,6 +519,8 @@
         this.assertFalse(mgr.getTagComboExists(tags1, null));
         
         // test weblog specific
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        weblog = TestUtils.getManagedWebsite(weblog);
         this.assertTrue(mgr.getTagComboExists(tags2, testWeblog));
         this.assertFalse(mgr.getTagComboExists(tags1, testWeblog));
         this.assertFalse(mgr.getTagComboExists(tags2, weblog));
@@ -490,34 +535,47 @@
     }
     
     public void testGetEntriesByTag() throws Exception {
+        try {
+            WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
-        WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
-
-        // setup some test entries to use
-        WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
-        entry.addTag("testTag");
-        String id = entry.getId();
-        mgr.saveWeblogEntry(entry);
-        TestUtils.endSession(true);
+            // setup some test entries to use
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            testUser = TestUtils.getManagedUser(testUser);
+            WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", 
+                    testWeblog.getDefaultCategory(), testWeblog, testUser);
+            String id = entry.getId();
+            entry.addTag("testTag");
+            mgr.saveWeblogEntry(entry);
+            TestUtils.endSession(true);
 
-        List results = mgr.getWeblogEntries(testWeblog, null, null, null, null,
-                Arrays.asList(new String[] { "testtag" }), null, null, null, null, null, 0,
-                -1);
-        assertEquals(1, results.size());
-        WeblogEntryData testEntry = (WeblogEntryData) results.iterator().next();
-        assertEquals(entry, testEntry);
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
 
-        // teardown our test entry
-        TestUtils.teardownWeblogEntry(id);
-        TestUtils.endSession(true);
-    }  
+            List results = mgr.getWeblogEntries(testWeblog, null, null, null, null,
+                Arrays.asList(new String[] { "testtag" }), null, null, null, null, null, 0, -1);
+            assertEquals(1, results.size());
+            WeblogEntryData testEntry = (WeblogEntryData) results.iterator().next();
+            assertEquals(entry, testEntry);
+        
+            // teardown our test entry
+            TestUtils.teardownWeblogEntry(id);
+            TestUtils.endSession(true);
+            
+        } catch (Throwable t) {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw); 
+            t.printStackTrace(pw);
+            log.info(sw.toString());
+        }
+    }
+        
     
     public void testRemoveEntryTagCascading() throws Exception {
 
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         entry.addTag("testTag");
@@ -525,9 +583,9 @@
         mgr.saveWeblogEntry(entry);
         TestUtils.endSession(true);
 
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         List results = mgr.getWeblogEntries(testWeblog, null, null, null, null,
-                Arrays.asList(new String[] { "testtag" }), null, null, null, null, null, 0,
-                -1);
+        Arrays.asList(new String[] { "testtag" }), null, null, null, null, null, 0, -1);
         assertEquals(1, results.size());
         WeblogEntryData testEntry = (WeblogEntryData) results.iterator().next();
         assertEquals(entry, testEntry);
@@ -536,20 +594,22 @@
         TestUtils.teardownWeblogEntry(id);
         TestUtils.endSession(true);
 
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         results = mgr.getWeblogEntries(testWeblog, null, null, null, null,
-                Arrays.asList(new String[] { "testtag" }), null, null, null, null, null, 0,
-                -1);
+        Arrays.asList(new String[] { "testtag" }), null, null, null, null, null, 0, -1);
         assertEquals(0, results.size());
 
         // terminate
         TestUtils.endSession(true);
-    }
+    } 
     
     public void testUpdateTags() throws Exception {
 
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         entry.addTag("testWillStayTag");
@@ -598,6 +658,8 @@
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
         // setup some test entries to use
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
         WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
                 .getDefaultCategory(), testWeblog, testUser);
         String id = entry.getId();
@@ -647,152 +709,166 @@
     }
 
     public void testTagAggregates() throws Exception {
-
-        WebsiteData testWeblog2 = TestUtils.setupWeblog("entryTestWeblog2",
-                testUser);
-
+        log.info("BEGIN");
+        
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
-        // let's make sure we are starting from scratch
-
-        // site-wide
-        List tags = mgr.getTags(null, null, null, -1);
-        assertEquals(0, tags.size());
-
-        // first weblog
-        tags = mgr.getTags(testWeblog, null, null, -1);
-        assertEquals(0, tags.size());
-
-        // second weblog
-        tags = mgr.getTags(testWeblog2, null, null, -1);
-        assertEquals(0, tags.size());
-
-        // setup some test entries to use
-        WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
-        entry.addTag("one");
-        entry.addTag("two");
-        mgr.saveWeblogEntry(entry);
-
-        entry = TestUtils.setupWeblogEntry("entry2", testWeblog
-                .getDefaultCategory(), testWeblog, testUser);
-        entry.addTag("one");
-        entry.addTag("two");
-        entry.addTag("three");
-        mgr.saveWeblogEntry(entry);
-
-        TestUtils.endSession(true);
-
-        tags = mgr.getTags(testWeblog, null, null, -1);
-        assertEquals(3, tags.size());
-
-        HashMap expectedWeblogTags = new HashMap();
-        expectedWeblogTags.put("one", new Integer(2));
-        expectedWeblogTags.put("two", new Integer(2));
-        expectedWeblogTags.put("three", new Integer(1));
-
-        for (Iterator it = tags.iterator(); it.hasNext();) {
-            TagStat stat = (TagStat) it.next();
-            if (!expectedWeblogTags.containsKey(stat.getName()))
-                fail("Unexpected tagName.");
-
-            Integer expectedCount = (Integer) expectedWeblogTags.get(stat
-                    .getName());
-            assertEquals(expectedCount.intValue(), stat.getCount());
-        }
-
-        // now add another entry in another blog
-        entry = TestUtils.setupWeblogEntry("entry3", testWeblog2
-                .getDefaultCategory(), testWeblog2, testUser);
-        entry.addTag("one");
-        entry.addTag("three");
-        entry.addTag("four");
-        mgr.saveWeblogEntry(entry);
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
+        WebsiteData testWeblog2 = TestUtils.setupWeblog("entryTestWeblog2", testUser);
         
-        TestUtils.endSession(true);
-        
-        // let's fetch "site" tags now
-        tags = mgr.getTags(null, null, null, -1);
-        assertEquals(4, tags.size());
-
-        HashMap expectedSiteTags = new HashMap();
-        expectedSiteTags.put("one", new Integer(3));
-        expectedSiteTags.put("two", new Integer(2));
-        expectedSiteTags.put("three", new Integer(2));
-        expectedSiteTags.put("four", new Integer(1));
-
-        for (Iterator it = tags.iterator(); it.hasNext();) {
-            TagStat stat = (TagStat) it.next();
-            if (!expectedSiteTags.containsKey(stat.getName()))
-                fail("Unexpected tagName.");
-
-            Integer expectedCount = (Integer) expectedSiteTags.get(stat
-                    .getName());
-            assertEquals(expectedCount.intValue(), stat.getCount());
-        }
-
-        TestUtils.endSession(true);
-
-        entry = mgr.getWeblogEntryByAnchor(testWeblog, "entry2");
-        List updateTags = new ArrayList();
-        updateTags.add("one");
-        updateTags.add("three");
-        updateTags.add("five");
-        entry.updateTags(updateTags);
-        mgr.saveWeblogEntry(entry);
+        try {
+            // let's make sure we are starting from scratch
 
-        TestUtils.endSession(true);
+            // site-wide
+            List tags = mgr.getTags(null, null, null, -1);
+            assertEquals(0, tags.size());
+
+            // first weblog
+            tags = mgr.getTags(testWeblog, null, null, -1);
+            assertEquals(0, tags.size());
+
+            // second weblog
+            tags = mgr.getTags(testWeblog2, null, null, -1);
+            assertEquals(0, tags.size());
+
+            // setup some test entries to use
+            WeblogEntryData entry = TestUtils.setupWeblogEntry("entry1", 
+                    testWeblog.getDefaultCategory(), testWeblog, testUser);
+            entry.addTag("one");
+            entry.addTag("two");
+            mgr.saveWeblogEntry(entry);
+
+            entry = TestUtils.setupWeblogEntry("entry2", 
+                    testWeblog.getDefaultCategory(), testWeblog, testUser);
+            entry.addTag("one");
+            entry.addTag("two");
+            entry.addTag("three");
+            mgr.saveWeblogEntry(entry);
 
-        tags = mgr.getTags(testWeblog, null, null, -1);
-        assertEquals(4, tags.size());
+            TestUtils.endSession(true);
 
-        expectedWeblogTags = new HashMap();
-        expectedWeblogTags.put("one", new Integer(2));
-        expectedWeblogTags.put("two", new Integer(1));
-        expectedWeblogTags.put("three", new Integer(1));
-        expectedWeblogTags.put("five", new Integer(1));
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            tags = mgr.getTags(testWeblog, null, null, -1);
+            assertEquals(3, tags.size());
+
+            HashMap expectedWeblogTags = new HashMap();
+            expectedWeblogTags.put("one", new Integer(2));
+            expectedWeblogTags.put("two", new Integer(2));
+            expectedWeblogTags.put("three", new Integer(1));
+
+            for (Iterator it = tags.iterator(); it.hasNext();) {
+                TagStat stat = (TagStat) it.next();
+                if (!expectedWeblogTags.containsKey(stat.getName()))
+                    fail("Unexpected tagName.");
+
+                Integer expectedCount = (Integer)expectedWeblogTags.get(stat.getName());
+                assertEquals(expectedCount.intValue(), stat.getCount());
+            }
+
+            // now add another entry in another blog
+            testWeblog2 = TestUtils.getManagedWebsite(testWeblog2);
+            testUser = TestUtils.getManagedUser(testUser);
+            entry = TestUtils.setupWeblogEntry("entry3", 
+                    testWeblog2.getDefaultCategory(), testWeblog2, testUser);
+            entry.addTag("one");
+            entry.addTag("three");
+            entry.addTag("four");
+            mgr.saveWeblogEntry(entry);
 
-        for (Iterator it = tags.iterator(); it.hasNext();) {
-            TagStat stat = (TagStat) it.next();
-            if (!expectedWeblogTags.containsKey(stat.getName()))
-                fail("Unexpected tagName.");
+            TestUtils.endSession(true);
 
-            Integer expectedCount = (Integer) expectedWeblogTags.get(stat
-                    .getName());
-            assertEquals(stat.getName(), expectedCount.intValue(), stat
-                    .getCount());
-        }
+            // let's fetch "site" tags now
+            tags = mgr.getTags(null, null, null, -1);
+            assertEquals(4, tags.size());
+
+            HashMap expectedSiteTags = new HashMap();
+            expectedSiteTags.put("one", new Integer(3));
+            expectedSiteTags.put("two", new Integer(2));
+            expectedSiteTags.put("three", new Integer(2));
+            expectedSiteTags.put("four", new Integer(1));
+
+            for (Iterator it = tags.iterator(); it.hasNext();) {
+                TagStat stat = (TagStat) it.next();
+                if (!expectedSiteTags.containsKey(stat.getName()))
+                    fail("Unexpected tagName.");
+
+                Integer expectedCount = (Integer) expectedSiteTags.get(stat.getName());
+                assertEquals(expectedCount.intValue(), stat.getCount());
+            }
 
-        tags = mgr.getTags(null, null, null, -1);
-        assertEquals(5, tags.size());
+            TestUtils.endSession(true);
 
-        expectedSiteTags = new HashMap();
-        expectedSiteTags.put("one", new Integer(3));
-        expectedSiteTags.put("two", new Integer(1));
-        expectedSiteTags.put("three", new Integer(2));
-        expectedSiteTags.put("four", new Integer(1));
-        expectedSiteTags.put("five", new Integer(1));
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            entry = mgr.getWeblogEntryByAnchor(testWeblog, "entry2");
+            List updateTags = new ArrayList();
+            updateTags.add("one");
+            updateTags.add("three");
+            updateTags.add("five");
+            entry.updateTags(updateTags);
+            mgr.saveWeblogEntry(entry);
 
-        for (Iterator it = tags.iterator(); it.hasNext();) {
-            TagStat stat = (TagStat) it.next();
-            if (!expectedSiteTags.containsKey(stat.getName()))
-                fail("Unexpected tagName.");
+            TestUtils.endSession(true);
 
-            Integer expectedCount = (Integer) expectedSiteTags.get(stat
-                    .getName());
-            assertEquals(stat.getName(), expectedCount.intValue(), stat
-                    .getCount());
+            testWeblog = TestUtils.getManagedWebsite(testWeblog);
+            tags = mgr.getTags(testWeblog, null, null, -1);
+            assertEquals(4, tags.size());
+
+            expectedWeblogTags = new HashMap();
+            expectedWeblogTags.put("one", new Integer(2));
+            expectedWeblogTags.put("two", new Integer(1));
+            expectedWeblogTags.put("three", new Integer(1));
+            expectedWeblogTags.put("five", new Integer(1));
+
+            for (Iterator it = tags.iterator(); it.hasNext();) {
+                TagStat stat = (TagStat) it.next();
+                if (!expectedWeblogTags.containsKey(stat.getName()))
+                    fail("Unexpected tagName.");
+
+                Integer expectedCount = 
+                        (Integer)expectedWeblogTags.get(stat.getName());
+                assertEquals(stat.getName(), 
+                        expectedCount.intValue(), stat.getCount());
+            }
+
+            tags = mgr.getTags(null, null, null, -1);
+            assertEquals(5, tags.size());
+
+            expectedSiteTags = new HashMap();
+            expectedSiteTags.put("one", new Integer(3));
+            expectedSiteTags.put("two", new Integer(1));
+            expectedSiteTags.put("three", new Integer(2));
+            expectedSiteTags.put("four", new Integer(1));
+            expectedSiteTags.put("five", new Integer(1));
+
+            for (Iterator it = tags.iterator(); it.hasNext();) {
+                TagStat stat = (TagStat) it.next();
+                if (!expectedSiteTags.containsKey(stat.getName()))
+                    fail("Unexpected tagName.");
+
+                Integer expectedCount = (Integer)expectedSiteTags.get(stat.getName());
+                assertEquals(stat.getName(), expectedCount.intValue(), stat.getCount());
+            }
+            
+            TestUtils.teardownWeblog(testWeblog2.getId());
+            TestUtils.endSession(true);
+            
+        } catch (Throwable t) {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw); 
+            t.printStackTrace(pw);
+            log.info(sw.toString());
         }
-
-        // teardown our test blog 2
-        TestUtils.teardownWeblog(testWeblog2.getId());
-        TestUtils.endSession(true);
+        
+        log.info("END");
     }
 
     public void testTagAggregatesCaseSensitivity() throws Exception {
 
         WebsiteData testWeblog2 = TestUtils.setupWeblog("entryTestWeblog2",
                 testUser);
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
+        testUser = TestUtils.getManagedUser(testUser);
 
         WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
 
@@ -912,8 +988,12 @@
         CommentData comment3 = TestUtils.setupComment("comment3", entry3);
         CommentData comment4 = TestUtils.setupComment("comment4", entry3);
         CommentData comment5 = TestUtils.setupComment("comment5", entry3);
+        TestUtils.endSession(true);
 
         try {
+            blog1 = umgr.getWebsite(blog1.getId());
+            blog2 = umgr.getWebsite(blog2.getId());
+            
             assertEquals(2L, blog1.getEntryCount());
             assertEquals(3L, blog2.getEntryCount());
             assertEquals(5L, wmgr.getEntryCount());
@@ -943,7 +1023,9 @@
             TestUtils.teardownWeblog(blog2.getId());
             TestUtils.teardownWeblog(blog3.getId());
 
-            TestUtils.teardownUser(user1.getId());            
+            TestUtils.teardownUser(user1.getId());      
+            
+            TestUtils.endSession(true);
         }
     }
 }

Modified: roller/trunk/tests/org/apache/roller/business/WeblogPageTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/tests/org/apache/roller/business/WeblogPageTest.java?view=diff&rev=541452&r1=541451&r2=541452
==============================================================================
--- roller/trunk/tests/org/apache/roller/business/WeblogPageTest.java (original)
+++ roller/trunk/tests/org/apache/roller/business/WeblogPageTest.java Thu May 24 15:16:19 2007
@@ -107,6 +107,7 @@
         TestUtils.endSession(true);
         
         // check that create was successful
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         template = null;
         template = mgr.getPageByName(testWeblog, testPage.getName());
         assertNotNull(template);
@@ -119,6 +120,7 @@
         
         // check that update was successful
         template = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         template = mgr.getPageByName(testWeblog, "testtesttest");
         assertNotNull(template);
         assertEquals(testPage.getContents(), template.getContents());
@@ -129,6 +131,7 @@
         
         // check that delete was successful
         template = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         template = mgr.getPageByName(testWeblog, testPage.getName());
         assertNull(template);
     }
@@ -154,6 +157,7 @@
         
         // lookup by action
         page = null;
+        testWeblog = TestUtils.getManagedWebsite(testWeblog);
         page = mgr.getPageByAction(testWeblog, testPage.getAction());
         assertNotNull(page);
         assertEquals(testPage.getContents(), page.getContents());



Mime
View raw message