roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r394019 - in /incubator/roller/branches/roller-newbackend/tests/org/roller/business: PermissionTest.java UserTest.java WeblogCategoryTest.java WeblogEntryTest.java
Date Fri, 14 Apr 2006 05:07:37 GMT
Author: agilliland
Date: Thu Apr 13 22:07:35 2006
New Revision: 394019

URL: http://svn.apache.org/viewcvs?rev=394019&view=rev
Log:
some more unit test updates.


Added:
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogCategoryTest.java
Modified:
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/PermissionTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/UserTest.java
    incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogEntryTest.java

Modified: incubator/roller/branches/roller-newbackend/tests/org/roller/business/PermissionTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/tests/org/roller/business/PermissionTest.java?rev=394019&r1=394018&r2=394019&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/tests/org/roller/business/PermissionTest.java
(original)
+++ incubator/roller/branches/roller-newbackend/tests/org/roller/business/PermissionTest.java
Thu Apr 13 22:07:35 2006
@@ -1,5 +1,7 @@
 package org.roller.business;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -167,12 +169,58 @@
      * Test advanced CRUD methods.
      */
     public void testAdvancedPermissionCRUD() throws Exception {
-        // TODO: implement testAdvancedPermissionCRUD
         
-        // add permissions (collection)
+        log.info("Test Advanced Permission CRUD");
         
-        // store permissions (collection)
+        UserManager mgr = RollerFactory.getRoller().getUserManager();
+        List perms = null;
         
+        // need a second user and weblog to test with
+        UserData testUser2 = TestUtils.setupUser("permUser2");
+        WebsiteData testWeblog2 = TestUtils.setupWeblog("permWeblog2", testUser);
+        
+        // some perms to test with
+        PermissionsData perm1 = new PermissionsData();
+        perm1.setUser(testUser2);
+        perm1.setWebsite(testWeblog);
+        perm1.setPending(false);
+        perm1.setPermissionMask(PermissionsData.AUTHOR);
+        
+        PermissionsData perm2 = new PermissionsData();
+        perm2.setUser(testUser2);
+        perm2.setWebsite(testWeblog2);
+        perm2.setPending(false);
+        perm2.setPermissionMask(PermissionsData.AUTHOR);
+        
+        Collection newPerms = new ArrayList();
+        newPerms.add(perm1);
+        newPerms.add(perm2);
+        
+        // add perms (collection)
+        mgr.storePermissions(newPerms);
+        
+        // make sure perms were added
+        perms = null;
+        perms = mgr.getAllPermissions(testUser2);
+        assertNotNull(perms);
+        assertEquals(2, perms.size());
+        
+        // store perms (collection)
+        perm1 = mgr.getPermissions(testWeblog, testUser2);
+        perm2 = mgr.getPermissions(testWeblog2, testUser2);
+        perm1.setPending(true);
+        perm2.setPending(true);
+        mgr.storePermissions(newPerms);
+        
+        // make sure perms were stored
+        perms = null;
+        perms = mgr.getPendingPermissions(testUser2);
+        assertNotNull(perms);
+        assertEquals(2, perms.size());
+        
+        // remove test data
+        TestUtils.teardownWeblog(testWeblog2.getId());
+        TestUtils.teardownUser(testUser2.getId());
     }
     
     

Modified: incubator/roller/branches/roller-newbackend/tests/org/roller/business/UserTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/tests/org/roller/business/UserTest.java?rev=394019&r1=394018&r2=394019&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/tests/org/roller/business/UserTest.java (original)
+++ incubator/roller/branches/roller-newbackend/tests/org/roller/business/UserTest.java Thu
Apr 13 22:07:35 2006
@@ -152,7 +152,7 @@
         UserData user = null;
         
         // add test user
-        UserData testUser = TestUtils.setupUser("userTestUser");
+        UserData testUser = TestUtils.setupUser("roleTestUser");
         
         // verify user has 2 roles, admin & editor
         user = mgr.getUser(testUser.getUserName());

Added: incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogCategoryTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogCategoryTest.java?rev=394019&view=auto
==============================================================================
--- incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogCategoryTest.java
(added)
+++ incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogCategoryTest.java
Thu Apr 13 22:07:35 2006
@@ -0,0 +1,69 @@
+/*
+ * WeblogCategoryTest.java
+ *
+ * Created on April 13, 2006, 10:07 PM
+ */
+
+package org.roller.business;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.roller.TestUtils;
+import org.roller.pojos.UserData;
+import org.roller.pojos.WebsiteData;
+
+/**
+ * Test Weblog Category related business operations.
+ */
+public class WeblogCategoryTest extends TestCase {
+    
+    public static Log log = LogFactory.getLog(WeblogCategoryTest.class);
+    
+    UserData testUser = null;
+    WebsiteData testWeblog = null;
+    
+    
+    public WeblogCategoryTest() {
+    }
+    
+    
+    public static Test suite() {
+        return new TestSuite(WeblogCategoryTest.class);
+    }
+    
+    
+    /**
+     * All tests in this suite require a user and a weblog.
+     */
+    public void setUp() throws Exception {
+        
+        try {
+            testUser = TestUtils.setupUser("entryTestUser");
+            testWeblog = TestUtils.setupWeblog("entryTestWeblog", testUser);
+        } catch (Exception ex) {
+            log.error(ex);
+        }
+    }
+    
+    public void tearDown() throws Exception {
+        
+        try {
+            TestUtils.teardownWeblog(testWeblog.getId());
+            TestUtils.teardownUser(testUser.getId());
+        } catch (Exception ex) {
+            log.error(ex);
+        }
+    }
+    
+    
+    /**
+     * Test basic persistence operations ... Create, Update, Delete.
+     */
+    public void testWeblogCategoryCRUD() throws Exception {
+        
+    }
+    
+}

Modified: incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogEntryTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogEntryTest.java?rev=394019&r1=394018&r2=394019&view=diff
==============================================================================
--- incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogEntryTest.java
(original)
+++ incubator/roller/branches/roller-newbackend/tests/org/roller/business/WeblogEntryTest.java
Thu Apr 13 22:07:35 2006
@@ -23,8 +23,6 @@
 
 /**
  * Test WeblogEntry related business operations.
- *
- * That includes:
  */
 public class WeblogEntryTest extends TestCase {
     
@@ -33,6 +31,7 @@
     UserData testUser = null;
     WebsiteData testWeblog = null;
     
+    
     public WeblogEntryTest(String name) {
         super(name);
     }
@@ -68,7 +67,7 @@
     
     
     /**
-     * Test basic persistence operations ... Create, Update, Delete
+     * Test basic persistence operations ... Create, Update, Delete.
      */
     public void testWeblogEntryCRUD() throws Exception {
         



Mime
View raw message