roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r571831 - in /roller/branches/roller_4.1_dev/apps/weblogger: src/java/org/apache/roller/weblogger/business/jpa/ src/java/org/apache/roller/weblogger/pojos/ test/java/org/apache/roller/weblogger/business/
Date Sat, 01 Sep 2007 17:26:57 GMT
Author: snoopdave
Date: Sat Sep  1 10:26:57 2007
New Revision: 571831

URL: http://svn.apache.org/viewvc?rev=571831&view=rev
Log:
Fixing some problems found by unit tests

http://opensource.atlassian.com/projects/roller/browse/ROL-1534

Modified:
    roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
    roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogPermission.java
    roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
    roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogTest.java

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java?rev=571831&r1=571830&r2=571831&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
(original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
Sat Sep  1 10:26:57 2007
@@ -482,7 +482,9 @@
         for (WeblogPermission perm : perms) {
             Weblog weblog = perm.getWeblog();
             if (!enabledOnly || weblog.getEnabled().booleanValue()) {
-                weblogs.add(weblog);
+                if (weblog.getActive() != null && weblog.getActive().booleanValue())
{
+                    weblogs.add(weblog);
+                }
             }
         }
         return weblogs;

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogPermission.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogPermission.java?rev=571831&r1=571830&r2=571831&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogPermission.java
(original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogPermission.java
Sat Sep  1 10:26:57 2007
@@ -41,7 +41,7 @@
     }
     
     public Weblog getWeblog() throws WebloggerException {
-        return WebloggerFactory.getWeblogger().getWeblogManager().getWeblogByHandle((objectId));
+        return WebloggerFactory.getWeblogger().getWeblogManager().getWeblogByHandle(objectId,
null);
     }
 
     public User getUser() throws WebloggerException {

Modified: roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java?rev=571831&r1=571830&r2=571831&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
(original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogEntryTest.java
Sat Sep  1 10:26:57 2007
@@ -962,10 +962,13 @@
     
     public void testWeblogStats() throws Exception {
         
+        
         WeblogEntryManager emgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
         WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
         UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
         
+        long existingUserCount = umgr.getUserCount() - 1;
+        
         User user1 = TestUtils.setupUser("statuser1");
         Weblog blog1 = TestUtils.setupWeblog("statblog1", user1);
         Weblog blog2 = TestUtils.setupWeblog("statblog2", user1);
@@ -1007,7 +1010,7 @@
             assertEquals(5L, emgr.getCommentCount());
 
             assertEquals(4L, wmgr.getWeblogCount());
-            assertEquals(2L, umgr.getUserCount());
+            assertEquals(existingUserCount + 2L, umgr.getUserCount());
             
         } finally {
             

Modified: roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogTest.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogTest.java?rev=571831&r1=571830&r2=571831&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogTest.java
(original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/test/java/org/apache/roller/weblogger/business/WeblogTest.java
Sat Sep  1 10:26:57 2007
@@ -210,13 +210,7 @@
             List weblogs1 = mgr.getUserWeblogs(TestUtils.getManagedUser(testUser), true);
             assertEquals(2, weblogs1.size());
             weblog = (Weblog) weblogs1.get(0);
-            assertNotNull(weblog);
-            
-            // testing paging
-            List weblogs11 = mgr.getUserWeblogs(TestUtils.getManagedUser(testUser), true);
-            assertEquals(1, weblogs11.size());
-            List weblogs12 = mgr.getUserWeblogs(TestUtils.getManagedUser(testUser), true);
-            assertEquals(1, weblogs12.size());
+            assertNotNull(weblog);           
             
             // make sure disabled weblogs are not returned
             weblog.setEnabled(Boolean.FALSE);
@@ -234,9 +228,6 @@
             List weblogs3 = mgr.getUserWeblogs(TestUtils.getManagedUser(testUser), true);
             assertEquals(0, weblogs3.size());
             
-        } catch(Throwable t) {
-            log.error("Exception running test", t);
-            throw (Exception) t;
         } finally {
             TestUtils.teardownWeblog(testWeblog1.getId());
             TestUtils.teardownWeblog(testWeblog2.getId());



Mime
View raw message