roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r541763 [5/5] - in /roller/branches/roller_guice: apps/planet/ apps/planet/nbproject/ apps/planet/src/java/META-INF/ apps/planet/src/java/org/apache/roller/planet/business/ apps/planet/src/java/org/apache/roller/planet/business/hibernate/ a...
Date Fri, 25 May 2007 20:00:00 GMT
Modified: roller/branches/roller_guice/tests/org/apache/roller/business/WeblogTest.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/tests/org/apache/roller/business/WeblogTest.java?view=diff&rev=541763&r1=541762&r2=541763
==============================================================================
--- roller/branches/roller_guice/tests/org/apache/roller/business/WeblogTest.java (original)
+++ roller/branches/roller_guice/tests/org/apache/roller/business/WeblogTest.java Fri May
25 12:59:47 2007
@@ -94,58 +94,65 @@
         
         log.info("BEGIN");
         
-        UserManager mgr = RollerFactory.getRoller().getUserManager();
-        WebsiteData weblog = null;
-        
-        WebsiteData testWeblog = new WebsiteData();
-        testWeblog.setName("Test Weblog");
-        testWeblog.setDescription("Test Weblog");
-        testWeblog.setHandle("testweblog");
-        testWeblog.setEmailAddress("testweblog@dev.null");
-        testWeblog.setEditorPage("editor-text.jsp");
-        testWeblog.setBlacklist("");
-        testWeblog.setEmailFromAddress("");
-        testWeblog.setEditorTheme("basic");
-        testWeblog.setLocale("en_US");
-        testWeblog.setTimeZone("America/Los_Angeles");
-        testWeblog.setDateCreated(new java.util.Date());
-        testWeblog.setCreator(testUser);
-        
-        // make sure test weblog does not exist
-        weblog = mgr.getWebsiteByHandle(testWeblog.getHandle());
-        assertNull(weblog);
-        
-        // add test weblog
-        mgr.addWebsite(testWeblog);
-        String id = testWeblog.getId();
-        TestUtils.endSession(true);
-        
-        // make sure test weblog exists
-        weblog = null;
-        weblog = mgr.getWebsite(id);
-        assertNotNull(weblog);
-        assertEquals(testWeblog, weblog);
-        
-        // modify weblog and save
-        weblog.setName("testtesttest");
-        mgr.saveWebsite(weblog);
-        TestUtils.endSession(true);
-        
-        // make sure changes were saved
-        weblog = null;
-        weblog = mgr.getWebsite(id);
-        assertNotNull(weblog);
-        assertEquals("testtesttest", weblog.getName());
-        
-        // remove test weblog
-        mgr.removeWebsite(weblog);
-        TestUtils.endSession(true);
+        try {
         
-        // make sure weblog no longer exists
-        weblog = null;
-        weblog = mgr.getWebsite(id);
-        assertNull(weblog);
+            UserManager mgr = RollerFactory.getRoller().getUserManager();
+            WebsiteData weblog = null;
+
+            WebsiteData testWeblog = new WebsiteData();
+            testUser = TestUtils.getManagedUser(testUser);
+            testWeblog.setName("Test Weblog");
+            testWeblog.setDescription("Test Weblog");
+            testWeblog.setHandle("testweblog");
+            testWeblog.setEmailAddress("testweblog@dev.null");
+            testWeblog.setEditorPage("editor-text.jsp");
+            testWeblog.setBlacklist("");
+            testWeblog.setEmailFromAddress("");
+            testWeblog.setEditorTheme("basic");
+            testWeblog.setLocale("en_US");
+            testWeblog.setTimeZone("America/Los_Angeles");
+            testWeblog.setDateCreated(new java.util.Date());
+            testWeblog.setCreator(testUser);
+
+            // make sure test weblog does not exist
+            weblog = mgr.getWebsiteByHandle(testWeblog.getHandle());
+            assertNull(weblog);
+
+            // add test weblog
+            mgr.addWebsite(testWeblog);
+            String id = testWeblog.getId();
+            TestUtils.endSession(true);
+
+            // make sure test weblog exists
+            weblog = null;
+            weblog = mgr.getWebsite(id);
+            assertNotNull(weblog);
+            assertEquals(testWeblog, weblog);
+
+            // modify weblog and save
+            weblog.setName("testtesttest");
+            mgr.saveWebsite(weblog);
+            TestUtils.endSession(true);
+
+            // make sure changes were saved
+            weblog = null;
+            weblog = mgr.getWebsite(id);
+            assertNotNull(weblog);
+            assertEquals("testtesttest", weblog.getName());
+
+            // remove test weblog
+            mgr.removeWebsite(weblog);
+            TestUtils.endSession(true);
+
+            // make sure weblog no longer exists
+            weblog = null;
+            weblog = mgr.getWebsite(id);
+            assertNull(weblog);
         
+        } catch(Throwable t) {
+            log.error("Exception running test", t);
+            throw (Exception) t;
+        }
         log.info("END");
     }
     
@@ -156,14 +163,15 @@
     public void testWeblogLookups() throws Exception {
         
         log.info("BEGIN");
-        
+        WebsiteData testWeblog1 = null;
+        WebsiteData testWeblog2 = null;
         try {
             UserManager mgr = RollerFactory.getRoller().getUserManager();
             WebsiteData weblog = null;
             
             // add test weblogs
-            WebsiteData testWeblog1 = TestUtils.setupWeblog("testWeblog1", TestUtils.getManagedUser(testUser));
-            WebsiteData testWeblog2 = TestUtils.setupWeblog("testWeblog2", TestUtils.getManagedUser(testUser));
+            testWeblog1 = TestUtils.setupWeblog("testWeblog1", testUser);
+            testWeblog2 = TestUtils.setupWeblog("testWeblog2", testUser);
             TestUtils.endSession(true);
             
             // lookup by id
@@ -205,7 +213,7 @@
             List weblogs11 = mgr.getWebsites(TestUtils.getManagedUser(testUser), Boolean.TRUE,
Boolean.TRUE, null, null, 0, 1);
             assertEquals(1, weblogs11.size());
             List weblogs12 = mgr.getWebsites(TestUtils.getManagedUser(testUser), Boolean.TRUE,
Boolean.TRUE, null, null, 1, 1);
-            assertEquals(1, weblogs11.size());
+            assertEquals(1, weblogs12.size());
             
             // make sure disabled weblogs are not returned
             weblog.setEnabled(Boolean.FALSE);
@@ -223,13 +231,13 @@
             List weblogs3 = mgr.getWebsites(TestUtils.getManagedUser(testUser), Boolean.TRUE,
Boolean.TRUE, null, null, 0, -1);
             assertEquals(0, weblogs3.size());
             
-            // remove test weblogs
-            TestUtils.teardownWeblog(testWeblog1.getId());
-            TestUtils.teardownWeblog(testWeblog2.getId());
-            TestUtils.endSession(true);
         } catch(Throwable t) {
             log.error("Exception running test", t);
             throw (Exception) t;
+        } finally {
+            TestUtils.teardownWeblog(testWeblog1.getId());
+            TestUtils.teardownWeblog(testWeblog2.getId());
+            TestUtils.endSession(true);
         }
         
         log.info("END");

Modified: roller/branches/roller_guice/tools/roller-planet/roller-planet-business.jar
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/tools/roller-planet/roller-planet-business.jar?view=diff&rev=541763&r1=541762&r2=541763
==============================================================================
Binary files - no diff available.



Mime
View raw message