portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlest...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security TestUserManager.java TestGroupManager.java TestRoleManager.java
Date Sat, 08 May 2004 16:17:38 GMT
dlestrat    2004/05/08 09:17:38

  Modified:    components/security/src/test/org/apache/jetspeed/security
                        TestUserManager.java TestGroupManager.java
                        TestRoleManager.java
  Log:
  Modified Security service to support declarative security.  Declarative security
  prevents using "/" in declared security roles.  To support declarative security,
  hierarchical principals are now expressed as {principal}.{subprincipal}.
  
  Revision  Changes    Path
  1.6       +1 -1      jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestUserManager.java
  
  Index: TestUserManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestUserManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestUserManager.java	25 Mar 2004 21:39:55 -0000	1.5
  +++ TestUserManager.java	8 May 2004 16:17:38 -0000	1.6
  @@ -163,7 +163,7 @@
           assertEquals(
               "expected user principal full path == /user/test",
               "/user/test",
  -            SecurityHelper.getPrincipalFullPath(userPrincipal));
  +            SecurityHelper.getPreferencesFullPath(userPrincipal));
           assertEquals("expected user principal name == test", "test", userPrincipal.getName());
   
           // Test the User Preferences.
  
  
  
  1.3       +214 -216  jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestGroupManager.java
  
  Index: TestGroupManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestGroupManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestGroupManager.java	25 Mar 2004 21:39:55 -0000	1.2
  +++ TestGroupManager.java	8 May 2004 16:17:38 -0000	1.3
  @@ -100,19 +100,17 @@
        */
       public void testAddGroup()
       {
  -        // Add group with path beginning with '/'.
           try
           {
  -            gms.addGroup("/testgroup");
  +            gms.addGroup("testgroup");
           }
           catch (SecurityException sex)
           {
               assertTrue("group should not already exists. exception caught: " + sex, false);
           }
  -        // Add group without path beginning with '/'.
           try
           {
  -            gms.addGroup("testgroup/newgroup0");
  +            gms.addGroup("testgroup.newgroup0");
           }
           catch (SecurityException sex)
           {
  @@ -121,7 +119,7 @@
           // Add existing group.
           try
           {
  -            gms.addGroup("/testgroup/newgroup0");
  +            gms.addGroup("testgroup.newgroup0");
               assertTrue("group should already exists. exception not thrown.", false);
           }
           catch (SecurityException sex)
  @@ -131,7 +129,7 @@
           // Cleanup test.
           try
           {
  -            gms.removeGroup("/testgroup");
  +            gms.removeGroup("testgroup");
           }
           catch (SecurityException sex)
           {
  @@ -148,9 +146,9 @@
           try
           {
               ums.addUser("anonuser1", "password");
  -            gms.addGroup("/testusertogroup1");
  -            gms.addGroup("/testusertogroup1/group1");
  -            gms.addGroup("/testusertogroup1/group2");
  +            gms.addGroup("testusertogroup1");
  +            gms.addGroup("testusertogroup1.group1");
  +            gms.addGroup("testusertogroup1.group2");
           }
           catch (SecurityException sex)
           {
  @@ -159,7 +157,7 @@
           // Add group with no prior groups.
           try
           {
  -            gms.addUserToGroup("anonuser1", "/testusertogroup1/group1");
  +            gms.addUserToGroup("anonuser1", "testusertogroup1.group1");
               Collection principals = ums.getUser("anonuser1").getSubject().getPrincipals();
               Principal found =
                   SecurityHelper.getPrincipal(
  @@ -167,8 +165,8 @@
                       GroupPrincipal.class);
               assertNotNull("found principal is null", found);
               assertTrue(
  -                "found principal should be /testusertogroup1/group1, " + found.getName(),
  -                found.getName().equals((new GroupPrincipalImpl("/testusertogroup1/group1")).getName()));
  +                "found principal should be testusertogroup1.group1, " + found.getName(),
  +                found.getName().equals("testusertogroup1.group1"));
           }
           catch (SecurityException sex)
           {
  @@ -177,11 +175,11 @@
           // Add group with existing groups.
           try
           {
  -            gms.addUserToGroup("anonuser1", "/testusertogroup1/group2");
  +            gms.addUserToGroup("anonuser1", "testusertogroup1.group2");
               Collection principals = ums.getUser("anonuser1").getSubject().getPrincipals();
               assertTrue(
  -                "anonuser1 should contain /testusertogroup1/group2",
  -                principals.contains(new GroupPrincipalImpl("/testusertogroup1/group2")));
  +                "anonuser1 should contain testusertogroup1.group2",
  +                principals.contains(new GroupPrincipalImpl("testusertogroup1.group2")));
           }
           catch (SecurityException sex)
           {
  @@ -190,7 +188,7 @@
           // Add group when user does not exist.
           try
           {
  -            gms.addUserToGroup("anonuser123", "/testusertogroup1/group2");
  +            gms.addUserToGroup("anonuser123", "testusertogroup1.group2");
               assertTrue("should catch exception: user does not exist.", false);
           }
           catch (SecurityException sex)
  @@ -199,7 +197,7 @@
           // Add group when group does not exist.
           try
           {
  -            gms.addUserToGroup("anonuser1", "/testusertogroup1/group123");
  +            gms.addUserToGroup("anonuser1", "testusertogroup1.group123");
               assertTrue("should catch exception: group does not exist.", false);
           }
           catch (SecurityException sex)
  @@ -210,7 +208,7 @@
           try
           {
               ums.removeUser("anonuser1");
  -            gms.removeGroup("/testusertogroup1");
  +            gms.removeGroup("testusertogroup1");
           }
           catch (SecurityException sex)
           {
  @@ -227,14 +225,14 @@
           try
           {
               ums.addUser("anonuser2", "password");
  -            gms.addGroup("/testgroup1");
  -            gms.addGroup("/testgroup1/group1");
  -            gms.addGroup("/testgroup1/group2");
  -            gms.addGroup("/testgroup2");
  -            gms.addGroup("/testgroup2/group1");
  -            gms.addUserToGroup("anonuser2", "/testgroup1/group1");
  -            gms.addUserToGroup("anonuser2", "/testgroup1/group2");
  -            gms.addUserToGroup("anonuser2", "/testgroup2/group1");
  +            gms.addGroup("testgroup1");
  +            gms.addGroup("testgroup1.group1");
  +            gms.addGroup("testgroup1.group2");
  +            gms.addGroup("testgroup2");
  +            gms.addGroup("testgroup2.group1");
  +            gms.addUserToGroup("anonuser2", "testgroup1.group1");
  +            gms.addUserToGroup("anonuser2", "testgroup1.group2");
  +            gms.addUserToGroup("anonuser2", "testgroup2.group1");
           }
           catch (SecurityException sex)
           {
  @@ -243,15 +241,15 @@
   
           try
           {
  -            gms.removeGroup("/testgroup1/group1");
  +            gms.removeGroup("testgroup1.group1");
               Collection principals = ums.getUser("anonuser2").getSubject().getPrincipals();
               assertEquals(
  -                "principal size should be == 3 after removing /testgroup1/group1, for principals: " + principals.toString(),
  +                "principal size should be == 3 after removing testgroup1.group1, for principals: " + principals.toString(),
                   3,
                   principals.size());
               assertFalse(
  -                "anonuser2 should not contain /testgroup1/group1",
  -                principals.contains(new GroupPrincipalImpl(GroupPrincipalImpl.getFullPathFromPrincipalName("/testgroup1/group1"))));
  +                "anonuser2 should not contain testgroup1.group1",
  +                principals.contains(new GroupPrincipalImpl("testgroup1.group1")));
           }
           catch (SecurityException sex)
           {
  @@ -262,8 +260,8 @@
           try
           {
               ums.removeUser("anonuser2");
  -            gms.removeGroup("/testgroup1");
  -            gms.removeGroup("/testgroup2");
  +            gms.removeGroup("testgroup1");
  +            gms.removeGroup("testgroup2");
           }
           catch (SecurityException sex)
           {
  @@ -279,7 +277,7 @@
           // Test when the group does not exist.
           try
           {
  -            Group group = gms.getGroup("/testgroupdoesnotexist");
  +            Group group = gms.getGroup("testgroupdoesnotexist");
               assertTrue("group does not exist. should have thrown an exception.", false);
           }
           catch (SecurityException sex)
  @@ -289,8 +287,8 @@
           Group group = null;
           try
           {
  -            gms.addGroup("/testgetgroup");
  -            group = gms.getGroup("/testgetgroup");
  +            gms.addGroup("testgetgroup");
  +            group = gms.getGroup("testgetgroup");
           }
           catch (SecurityException sex)
           {
  @@ -300,19 +298,19 @@
           // Test the GroupPrincipal.
           GroupPrincipal groupPrincipal = group.getPrincipal();
           assertNotNull("group principal is null", groupPrincipal);
  -        assertEquals(
  -            "expected group principal full path == /group/testgetgroup",
  -            "/group/testgetgroup",
  -            SecurityHelper.getPrincipalFullPath(groupPrincipal));
  +        assertEquals("expected group principal full path == testgetgroup", "testgetgroup", groupPrincipal.getName());
   
           // Test the Group Preferences.
           Preferences preferences = group.getPreferences();
  -        assertEquals("expected group node == /group/testgetgroup", "/group/testgetgroup", preferences.absolutePath());
  +        assertEquals(
  +            "expected group node == /group/testgetgroup",
  +            SecurityHelper.getPreferencesFullPath(groupPrincipal),
  +            preferences.absolutePath());
   
           // Cleanup test.
           try
           {
  -            gms.removeGroup("/testgetgroup");
  +            gms.removeGroup("testgetgroup");
           }
           catch (SecurityException sex)
           {
  @@ -320,179 +318,179 @@
           }
       }
   
  -    /**
  -     * <p>Test get groups for user.</p>
  -     */
  -    public void testGetGroupsForUser()
  -    {
  -        // Init test.
  -        try
  -        {
  -            ums.addUser("anonuser2", "password");
  -            gms.addGroup("/testgroup1");
  -            gms.addGroup("/testgroup1/group1");
  -            gms.addGroup("/testgroup1/group2");
  -            gms.addGroup("/testgroup2");
  -            gms.addGroup("/testgroup2/group1");
  -            gms.addUserToGroup("anonuser2", "/testgroup1/group1");
  -            gms.addUserToGroup("anonuser2", "/testgroup1/group2");
  -            gms.addUserToGroup("anonuser2", "/testgroup2/group1");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testGetGroupsForUser(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            Collection groups = gms.getGroupsForUser("anonuser2");
  -            assertEquals("groups size should be == 3", 3, groups.size());
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("user exists. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            ums.removeUser("anonuser2");
  -            gms.removeGroup("/testgroup1");
  -            gms.removeGroup("/testgroup2");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove user and group. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test get users in group.</p>
  -     */
  -    public void testGetUsersInGroup()
  -    {
  -        // Init test.
  -        try
  -        {
  -            ums.addUser("anonuser2", "password");
  -            ums.addUser("anonuser3", "password");
  -            ums.addUser("anonuser4", "password");
  -            gms.addGroup("/testgroup1");
  -            gms.addGroup("/testgroup1/group1");
  -            gms.addUserToGroup("anonuser2", "/testgroup1/group1");
  -            gms.addUserToGroup("anonuser3", "/testgroup1/group1");
  -            gms.addUserToGroup("anonuser4", "/testgroup1/group1");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testGetUsersInGroup(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            Collection users = gms.getUsersInGroup("/testgroup1/group1");
  -            assertEquals("users size should be == 3", 3, users.size());
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("group exists. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            ums.removeUser("anonuser2");
  -            ums.removeUser("anonuser3");
  -            ums.removeUser("anonuser4");
  -            gms.removeGroup("/testgroup1");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove user and group. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test remove user from group.</p>
  -     */
  -    public void testRemoveUserFromGroup()
  -    {
  -        // Init test.
  -        try
  -        {
  -            ums.addUser("anonuser4", "password");
  -            gms.addGroup("/testgroup1");
  -            gms.addGroup("/testgroup1/group1");
  -            gms.addUserToGroup("anonuser4", "/testgroup1/group1");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testRemoveUserFromGroup(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            gms.removeUserFromGroup("anonuser4", "/testgroup1/group1");
  -            Collection groups = gms.getGroupsForUser("anonuser4");
  -            assertEquals("groups size should be == 0", 0, groups.size());
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("user exists. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            ums.removeUser("anonuser4");
  -            gms.removeGroup("/testgroup1");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove user and group. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test is user in role.</p>
  -     */
  -    public void testIsUserInGroup()
  -    {
  -        // Init test.
  -        try
  -        {
  -            ums.addUser("anonuser3", "password");
  -            gms.addGroup("/testgroup1");
  -            gms.addGroup("/testgroup1/group1");
  -            gms.addUserToGroup("anonuser3", "/testgroup1/group1");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testRemoveUserFromGroup(), " + sex, false);
  +        /**
  +         * <p>Test get groups for user.</p>
  +         */
  +        public void testGetGroupsForUser()
  +        {
  +            // Init test.
  +            try
  +            {
  +                ums.addUser("anonuser2", "password");
  +                gms.addGroup("testgroup1");
  +                gms.addGroup("testgroup1.group1");
  +                gms.addGroup("testgroup1.group2");
  +                gms.addGroup("testgroup2");
  +                gms.addGroup("testgroup2.group1");
  +                gms.addUserToGroup("anonuser2", "testgroup1.group1");
  +                gms.addUserToGroup("anonuser2", "testgroup1.group2");
  +                gms.addUserToGroup("anonuser2", "testgroup2.group1");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testGetGroupsForUser(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                Collection groups = gms.getGroupsForUser("anonuser2");
  +                assertEquals("groups size should be == 3", 3, groups.size());
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("user exists. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                ums.removeUser("anonuser2");
  +                gms.removeGroup("testgroup1");
  +                gms.removeGroup("testgroup2");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove user and group. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test get users in group.</p>
  +         */
  +        public void testGetUsersInGroup()
  +        {
  +            // Init test.
  +            try
  +            {
  +                ums.addUser("anonuser2", "password");
  +                ums.addUser("anonuser3", "password");
  +                ums.addUser("anonuser4", "password");
  +                gms.addGroup("testgroup1");
  +                gms.addGroup("testgroup1.group1");
  +                gms.addUserToGroup("anonuser2", "testgroup1.group1");
  +                gms.addUserToGroup("anonuser3", "testgroup1.group1");
  +                gms.addUserToGroup("anonuser4", "testgroup1.group1");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testGetUsersInGroup(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                Collection users = gms.getUsersInGroup("testgroup1.group1");
  +                assertEquals("users size should be == 3", 3, users.size());
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("group exists. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                ums.removeUser("anonuser2");
  +                ums.removeUser("anonuser3");
  +                ums.removeUser("anonuser4");
  +                gms.removeGroup("testgroup1");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove user and group. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test remove user from group.</p>
  +         */
  +        public void testRemoveUserFromGroup()
  +        {
  +            // Init test.
  +            try
  +            {
  +                ums.addUser("anonuser4", "password");
  +                gms.addGroup("testgroup1");
  +                gms.addGroup("testgroup1.group1");
  +                gms.addUserToGroup("anonuser4", "testgroup1.group1");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testRemoveUserFromGroup(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                gms.removeUserFromGroup("anonuser4", "testgroup1.group1");
  +                Collection groups = gms.getGroupsForUser("anonuser4");
  +                assertEquals("groups size should be == 0", 0, groups.size());
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("user exists. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                ums.removeUser("anonuser4");
  +                gms.removeGroup("testgroup1");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove user and group. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test is user in role.</p>
  +         */
  +        public void testIsUserInGroup()
  +        {
  +            // Init test.
  +            try
  +            {
  +                ums.addUser("anonuser3", "password");
  +                gms.addGroup("testgroup1");
  +                gms.addGroup("testgroup1.group1");
  +                gms.addUserToGroup("anonuser3", "testgroup1.group1");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testRemoveUserFromGroup(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                boolean isUserInGroup = gms.isUserInGroup("anonuser3", "testgroup1.group1");
  +                assertTrue("anonuser3 should be in group testgroup1.group1", isUserInGroup);
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("user and group exist. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                ums.removeUser("anonuser4");
  +                gms.removeGroup("testgroup1");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove user and group. exception caught: " + sex, false);
  +            }
           }
   
  -        try
  -        {
  -            boolean isUserInGroup = gms.isUserInGroup("anonuser3", "/testgroup1/group1");
  -            assertTrue("anonuser3 should be in group /testgroup1/group1", isUserInGroup);
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("user and group exist. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            ums.removeUser("anonuser4");
  -            gms.removeGroup("/testgroup1");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove user and group. exception caught: " + sex, false);
  -        }
  -    }
  -
       /**
        * <p>Destroy group test objects.</p>
        */
  @@ -502,10 +500,10 @@
           ums.removeUser("anonuser2");
           ums.removeUser("anonuser3");
           ums.removeUser("anonuser4");
  -        gms.removeGroup("/testgroup1");
  -        gms.removeGroup("/testgroup2");
  -        gms.removeGroup("/testusertogroup1");
  -        gms.removeGroup("/testgetgroup");
  +        gms.removeGroup("testgroup1");
  +        gms.removeGroup("testgroup2");
  +        gms.removeGroup("testusertogroup1");
  +        gms.removeGroup("testgetgroup");
       }
   
   }
  
  
  
  1.3       +380 -382  jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestRoleManager.java
  
  Index: TestRoleManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestRoleManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestRoleManager.java	25 Mar 2004 21:39:55 -0000	1.2
  +++ TestRoleManager.java	8 May 2004 16:17:38 -0000	1.3
  @@ -104,19 +104,17 @@
        */
       public void testAddRole()
       {
  -        // Add role with path beginning with '/'.
           try
           {
  -            rms.addRole("/testrole");
  +            rms.addRole("testrole");
           }
           catch (SecurityException sex)
           {
               assertTrue("role should not already exists. exception caught: " + sex, false);
           }
  -        // Add role without path beginning with '/'.
           try
           {
  -            rms.addRole("testrole/newrole0");
  +            rms.addRole("testrole.newrole0");
           }
           catch (SecurityException sex)
           {
  @@ -125,7 +123,7 @@
           // Add existing role.
           try
           {
  -            rms.addRole("/testrole/newrole0");
  +            rms.addRole("testrole.newrole0");
               assertTrue("role should already exists. exception not thrown.", false);
           }
           catch (SecurityException sex)
  @@ -134,7 +132,7 @@
           // Remove role.
           try
           {
  -            rms.removeRole("/testrole");
  +            rms.removeRole("testrole");
           }
           catch (SecurityException sex)
           {
  @@ -151,9 +149,9 @@
           try
           {
               ums.addUser("anonuser1", "password");
  -            rms.addRole("/testusertorole1");
  -            rms.addRole("/testusertorole1/role1");
  -            rms.addRole("/testusertorole1/role2");
  +            rms.addRole("testusertorole1");
  +            rms.addRole("testusertorole1.role1");
  +            rms.addRole("testusertorole1.role2");
           }
           catch (SecurityException sex)
           {
  @@ -162,7 +160,7 @@
           // Add role with no prior roles.
           try
           {
  -            rms.addRoleToUser("anonuser1", "/testusertorole1/role1");
  +            rms.addRoleToUser("anonuser1", "testusertorole1.role1");
               Collection principals = ums.getUser("anonuser1").getSubject().getPrincipals();
               Principal found =
                   SecurityHelper.getPrincipal(
  @@ -170,8 +168,8 @@
                       RolePrincipal.class);
               assertNotNull("found principal is null", found);
               assertTrue(
  -                "found principal should be /testusertorole1/role1, " + found.getName(),
  -                found.getName().equals((new RolePrincipalImpl("/testusertorole1/role1")).getName()));
  +                "found principal should be testusertorole1.role1, " + found.getName(),
  +                found.getName().equals("testusertorole1.role1"));
           }
           catch (SecurityException sex)
           {
  @@ -180,11 +178,11 @@
           // Add role with existing roles.
           try
           {
  -            rms.addRoleToUser("anonuser1", "/testusertorole1/role2");
  +            rms.addRoleToUser("anonuser1", "testusertorole1.role2");
               Collection principals = ums.getUser("anonuser1").getSubject().getPrincipals();
               assertTrue(
  -                "anonuser1 should contain /testusertorole1/role2",
  -                principals.contains(new RolePrincipalImpl("/testusertorole1/role2")));
  +                "anonuser1 should contain testusertorole1.role2",
  +                principals.contains(new RolePrincipalImpl("testusertorole1.role2")));
           }
           catch (SecurityException sex)
           {
  @@ -193,7 +191,7 @@
           // Add role when user does not exist.
           try
           {
  -            rms.addRoleToUser("anonuser123", "/testusertorole1/role2");
  +            rms.addRoleToUser("anonuser123", "testusertorole1.role2");
               assertTrue("should catch exception: user does not exist.", false);
           }
           catch (SecurityException sex)
  @@ -202,7 +200,7 @@
           // Add role when role does not exist.
           try
           {
  -            rms.addRoleToUser("anonuser1", "/testusertorole1/role123");
  +            rms.addRoleToUser("anonuser1", "testusertorole1.role123");
               assertTrue("should catch exception: role does not exist.", false);
           }
           catch (SecurityException sex)
  @@ -213,7 +211,7 @@
           try
           {
               ums.removeUser("anonuser1");
  -            rms.removeRole("/testusertorole1");
  +            rms.removeRole("testusertorole1");
           }
           catch (SecurityException sex)
           {
  @@ -230,15 +228,15 @@
           try
           {
               ums.addUser("anonuser2", "password");
  -            rms.addRole("/testrole1");
  -            rms.addRole("/testrole1/role1");
  -            rms.addRole("/testrole1/role2");
  -            rms.addRole("/testrole2");
  -            rms.addRole("/testrole2/role1");
  -            rms.addRole("/testrole2/role2");
  -            rms.addRoleToUser("anonuser2", "/testrole1/role1");
  -            rms.addRoleToUser("anonuser2", "/testrole1/role2");
  -            rms.addRoleToUser("anonuser2", "/testrole2/role1");
  +            rms.addRole("testrole1");
  +            rms.addRole("testrole1.role1");
  +            rms.addRole("testrole1.role2");
  +            rms.addRole("testrole2");
  +            rms.addRole("testrole2.role1");
  +            rms.addRole("testrole2.role2");
  +            rms.addRoleToUser("anonuser2", "testrole1.role1");
  +            rms.addRoleToUser("anonuser2", "testrole1.role2");
  +            rms.addRoleToUser("anonuser2", "testrole2.role1");
           }
           catch (SecurityException sex)
           {
  @@ -247,15 +245,15 @@
   
           try
           {
  -            rms.removeRole("/testrole1/role1");
  +            rms.removeRole("testrole1.role1");
               Collection principals = ums.getUser("anonuser2").getSubject().getPrincipals();
               assertEquals(
  -                "principal size should be == 3 after removing /testrole1/role1, for principals: " + principals.toString(),
  +                "principal size should be == 3 after removing testrole1.role1, for principals: " + principals.toString(),
                   3,
                   principals.size());
               assertFalse(
  -                "anonuser2 should not contain /testrole1/role1",
  -                principals.contains(new RolePrincipalImpl(RolePrincipalImpl.getFullPathFromPrincipalName("/testrole1/role1"))));
  +                "anonuser2 should not contain testrole1.role1",
  +                principals.contains(new RolePrincipalImpl("testrole1.role1")));
           }
           catch (SecurityException sex)
           {
  @@ -266,8 +264,8 @@
           try
           {
               ums.removeUser("anonuser2");
  -            rms.removeRole("/testrole1");
  -            rms.removeRole("/testrole2");
  +            rms.removeRole("testrole1");
  +            rms.removeRole("testrole2");
           }
           catch (SecurityException sex)
           {
  @@ -283,7 +281,7 @@
           // Test when the role does not exist.
           try
           {
  -            Role role = rms.getRole("/testroledoesnotexist");
  +            Role role = rms.getRole("testroledoesnotexist");
               assertTrue("role does not exist. should have thrown an exception.", false);
           }
           catch (SecurityException sex)
  @@ -293,8 +291,8 @@
           Role role = null;
           try
           {
  -            rms.addRole("/testgetrole");
  -            role = rms.getRole("/testgetrole");
  +            rms.addRole("testgetrole");
  +            role = rms.getRole("testgetrole");
           }
           catch (SecurityException sex)
           {
  @@ -304,19 +302,19 @@
           // Test the RolePrincipal.
           RolePrincipal rolePrincipal = role.getPrincipal();
           assertNotNull("role principal is null", rolePrincipal);
  -        assertEquals(
  -            "expected role principal full path == /role/testgetrole",
  -            "/role/testgetrole",
  -            SecurityHelper.getPrincipalFullPath(rolePrincipal));
  +        assertEquals("expected role principal full path name == testgetrole", "testgetrole", rolePrincipal.getName());
   
           // Test the Role Preferences.
           Preferences preferences = role.getPreferences();
  -        assertEquals("expected role node == /role/testgetrole", "/role/testgetrole", preferences.absolutePath());
  +        assertEquals(
  +            "expected role node == /role/testgetrole",
  +            SecurityHelper.getPreferencesFullPath(rolePrincipal),
  +            preferences.absolutePath());
   
           // Cleanup test.
           try
           {
  -            rms.removeRole("/testgetrole");
  +            rms.removeRole("testgetrole");
           }
           catch (SecurityException sex)
           {
  @@ -324,341 +322,341 @@
           }
       }
   
  -    /**
  -     * <p>Test get roles for user.</p>
  -     */
  -    public void testGetRolesForUser()
  -    {
  -        // Init test.
  -        try
  -        {
  -            ums.addUser("anonuser3", "password");
  -            rms.addRole("/testuserrolemapping");
  -            rms.addRole("/testuserrolemapping/role1");
  -            rms.addRole("/testuserrolemapping/role2");
  -            rms.addRoleToUser("anonuser3", "/testuserrolemapping");
  -            rms.addRoleToUser("anonuser3", "/testuserrolemapping/role1");
  -            rms.addRoleToUser("anonuser3", "/testuserrolemapping/role2");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testGetRolesForUser(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            Collection roles = rms.getRolesForUser("anonuser3");
  -            assertEquals("roles size should be == 3", 3, roles.size());
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("user exists. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            ums.removeUser("anonuser3");
  -            rms.removeRole("/testuserrolemapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove user and role. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test get users in role.</p>
  -     */
  -    public void testGetUsersInRole()
  -    {
  -        // Init test.
  -        try
  -        {
  -            ums.addUser("anonuser3", "password");
  -            ums.addUser("anonuser4", "password");
  -            rms.addRole("/testuserrolemapping");
  -            rms.addRole("/testuserrolemapping/role1");
  -            rms.addRole("/testuserrolemapping/role2");
  -            rms.addRoleToUser("anonuser3", "/testuserrolemapping");
  -            rms.addRoleToUser("anonuser3", "/testuserrolemapping/role1");
  -            rms.addRoleToUser("anonuser3", "/testuserrolemapping/role2");
  -            rms.addRoleToUser("anonuser4", "/testuserrolemapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testGetUsersInRole(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            Collection users = rms.getUsersInRole("/testuserrolemapping");
  -            assertEquals("users size should be == 2", 2, users.size());
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("role exists. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            ums.removeUser("anonuser3");
  -            ums.removeUser("anonuser4");
  -            rms.removeRole("/testuserrolemapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove user and role. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test get roles for group.</p>
  -     */
  -    public void testGetRolesForGroup()
  -    {
  -        // Init test.
  -        try
  -        {
  -            rms.addRole("/testuserrolemapping");
  -            rms.addRole("/testuserrolemapping/role1");
  -            rms.addRole("/testuserrolemapping/role3");
  -            gms.addGroup("/testrolegroupmapping");
  -            rms.addRoleToGroup("/testuserrolemapping", "/testrolegroupmapping");
  -            rms.addRoleToGroup("/testuserrolemapping/role1", "/testrolegroupmapping");
  -            rms.addRoleToGroup("/testuserrolemapping/role3", "/testrolegroupmapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testGetRolesForGroup(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            Collection roles = rms.getRolesForGroup("/testrolegroupmapping");
  -            assertEquals("roles size should be == 3", 3, roles.size());
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("group exists. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            rms.removeRole("/testuserrolemapping");
  -            gms.removeGroup("/testrolegroupmapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove role and group. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test get groups in role.</p>
  -     */
  -    public void testGetGroupsInRole()
  -    {
  -        // Init test.
  -        try
  -        {
  -            rms.addRole("/testuserrolemapping");
  -            gms.addGroup("/testrolegroupmapping");
  -            gms.addGroup("/testrolegroupmapping/group1");
  -            gms.addGroup("/testrolegroupmapping/group2");
  -            rms.addRoleToGroup("/testuserrolemapping", "/testrolegroupmapping");
  -            rms.addRoleToGroup("/testuserrolemapping", "/testrolegroupmapping/group1");
  -            rms.addRoleToGroup("/testuserrolemapping", "/testrolegroupmapping/group2");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testGetRolesForGroup(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            Collection groups = rms.getGroupsInRole("/testuserrolemapping");
  -            assertEquals("groups size should be == 3", 3, groups.size());
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("role exists. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            rms.removeRole("/testuserrolemapping");
  -            gms.removeGroup("/testrolegroupmapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove role and group. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test remove role from user.</p>
  -     */
  -    public void testRemoveRoleFromUser()
  -    {
  -        // Init test.
  -        try
  -        {
  -            ums.addUser("anonuser5", "password");
  -            rms.addRole("/testrole3");
  -            rms.addRoleToUser("anonuser5", "/testrole3");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testRemoveRoleFromUser(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            rms.removeRoleFromUser("anonuser5", "/testrole3");
  -            Collection roles = rms.getRolesForUser("anonuser5");
  -            assertEquals("roles size should be == 0", 0, roles.size());
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("user exists. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            ums.removeUser("anonuser5");
  -            rms.removeRole("/testrole3");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove user and role. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test is user in role.</p>
  -     */
  -    public void testIsUserInRole()
  -    {
  -        // Init test.
  -        try
  -        {
  -            ums.addUser("anonuser4", "password");
  -            rms.addRole("/testuserrolemapping");
  -            rms.addRoleToUser("anonuser4", "/testuserrolemapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testIsUserInRole(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            boolean isUserInRole = rms.isUserInRole("anonuser4", "/testuserrolemapping");
  -            assertTrue("anonuser4 should be in role /testuserrolemapping", isUserInRole);
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("user and role exist. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            ums.removeUser("anonuser4");
  -            rms.removeRole("/testuserrolemapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove user and role. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test remove role from group.</p>
  -     */
  -    public void testRemoveRoleFromGroup()
  -    {
  -        // Init test.
  -        try
  -        {
  -            rms.addRole("/testuserrolemapping");
  -            rms.addRole("/testuserrolemapping/role1");
  -            rms.addRole("/testuserrolemapping/role3");
  -            gms.addGroup("/testrolegroupmapping");
  -            rms.addRoleToGroup("/testuserrolemapping", "/testrolegroupmapping");
  -            rms.addRoleToGroup("/testuserrolemapping/role1", "/testrolegroupmapping");
  -            rms.addRoleToGroup("/testuserrolemapping/role3", "/testrolegroupmapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testRemoveRoleFromGroup(), " + sex, false);
  -        }
  -
  -        try
  -        {
  -            rms.removeRoleFromGroup("/testuserrolemapping/role3", "/testrolegroupmapping");
  -            Collection roles = rms.getRolesForGroup("/testrolegroupmapping");
  -            assertEquals("roles size should be == 2", 2, roles.size());
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("group exists. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            rms.removeRole("/testuserrolemapping");
  -            gms.removeGroup("/testrolegroupmapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove group and role. exception caught: " + sex, false);
  -        }
  -    }
  -
  -    /**
  -     * <p>Test is user in role.</p>
  -     */
  -    public void testIsGroupInRole()
  -    {
  -        // Init test.
  -        try
  -        {
  -            rms.addRole("/testuserrolemapping");
  -            gms.addGroup("/testrolegroupmapping");
  -            rms.addRoleToGroup("/testuserrolemapping", "/testrolegroupmapping");
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("failed to init testIsGroupInRole(), " + sex, false);
  -        }
  -        try
  -        {
  -            boolean isGroupInRole = rms.isGroupInRole("/testrolegroupmapping", "/testuserrolemapping");
  -            assertTrue("/testrolegroupmapping should be in role /testuserrolemapping", isGroupInRole);
  -        }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("group and role exist. should not have thrown an exception: " + sex, false);
  -        }
  -
  -        // Cleanup test.
  -        try
  -        {
  -            rms.removeRole("/testuserrolemapping");
  -            gms.removeGroup("/testrolegroupmapping");
  +        /**
  +         * <p>Test get roles for user.</p>
  +         */
  +        public void testGetRolesForUser()
  +        {
  +            // Init test.
  +            try
  +            {
  +                ums.addUser("anonuser3", "password");
  +                rms.addRole("testuserrolemapping");
  +                rms.addRole("testuserrolemapping.role1");
  +                rms.addRole("testuserrolemapping.role2");
  +                rms.addRoleToUser("anonuser3", "testuserrolemapping");
  +                rms.addRoleToUser("anonuser3", "testuserrolemapping.role1");
  +                rms.addRoleToUser("anonuser3", "testuserrolemapping.role2");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testGetRolesForUser(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                Collection roles = rms.getRolesForUser("anonuser3");
  +                assertEquals("roles size should be == 3", 3, roles.size());
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("user exists. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                ums.removeUser("anonuser3");
  +                rms.removeRole("testuserrolemapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove user and role. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test get users in role.</p>
  +         */
  +        public void testGetUsersInRole()
  +        {
  +            // Init test.
  +            try
  +            {
  +                ums.addUser("anonuser3", "password");
  +                ums.addUser("anonuser4", "password");
  +                rms.addRole("testuserrolemapping");
  +                rms.addRole("testuserrolemapping.role1");
  +                rms.addRole("testuserrolemapping.role2");
  +                rms.addRoleToUser("anonuser3", "testuserrolemapping");
  +                rms.addRoleToUser("anonuser3", "testuserrolemapping.role1");
  +                rms.addRoleToUser("anonuser3", "testuserrolemapping.role2");
  +                rms.addRoleToUser("anonuser4", "testuserrolemapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testGetUsersInRole(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                Collection users = rms.getUsersInRole("testuserrolemapping");
  +                assertEquals("users size should be == 2", 2, users.size());
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("role exists. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                ums.removeUser("anonuser3");
  +                ums.removeUser("anonuser4");
  +                rms.removeRole("testuserrolemapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove user and role. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test get roles for group.</p>
  +         */
  +        public void testGetRolesForGroup()
  +        {
  +            // Init test.
  +            try
  +            {
  +                rms.addRole("testuserrolemapping");
  +                rms.addRole("testuserrolemapping.role1");
  +                rms.addRole("testuserrolemapping.role3");
  +                gms.addGroup("testrolegroupmapping");
  +                rms.addRoleToGroup("testuserrolemapping", "testrolegroupmapping");
  +                rms.addRoleToGroup("testuserrolemapping.role1", "testrolegroupmapping");
  +                rms.addRoleToGroup("testuserrolemapping.role3", "testrolegroupmapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testGetRolesForGroup(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                Collection roles = rms.getRolesForGroup("testrolegroupmapping");
  +                assertEquals("roles size should be == 3", 3, roles.size());
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("group exists. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                rms.removeRole("testuserrolemapping");
  +                gms.removeGroup("testrolegroupmapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove role and group. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test get groups in role.</p>
  +         */
  +        public void testGetGroupsInRole()
  +        {
  +            // Init test.
  +            try
  +            {
  +                rms.addRole("testuserrolemapping");
  +                gms.addGroup("testrolegroupmapping");
  +                gms.addGroup("testrolegroupmapping.group1");
  +                gms.addGroup("testrolegroupmapping.group2");
  +                rms.addRoleToGroup("testuserrolemapping", "testrolegroupmapping");
  +                rms.addRoleToGroup("testuserrolemapping", "testrolegroupmapping.group1");
  +                rms.addRoleToGroup("testuserrolemapping", "testrolegroupmapping.group2");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testGetRolesForGroup(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                Collection groups = rms.getGroupsInRole("testuserrolemapping");
  +                assertEquals("groups size should be == 3", 3, groups.size());
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("role exists. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                rms.removeRole("testuserrolemapping");
  +                gms.removeGroup("testrolegroupmapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove role and group. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test remove role from user.</p>
  +         */
  +        public void testRemoveRoleFromUser()
  +        {
  +            // Init test.
  +            try
  +            {
  +                ums.addUser("anonuser5", "password");
  +                rms.addRole("testrole3");
  +                rms.addRoleToUser("anonuser5", "testrole3");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testRemoveRoleFromUser(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                rms.removeRoleFromUser("anonuser5", "testrole3");
  +                Collection roles = rms.getRolesForUser("anonuser5");
  +                assertEquals("roles size should be == 0", 0, roles.size());
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("user exists. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                ums.removeUser("anonuser5");
  +                rms.removeRole("testrole3");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove user and role. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test is user in role.</p>
  +         */
  +        public void testIsUserInRole()
  +        {
  +            // Init test.
  +            try
  +            {
  +                ums.addUser("anonuser4", "password");
  +                rms.addRole("testuserrolemapping");
  +                rms.addRoleToUser("anonuser4", "testuserrolemapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testIsUserInRole(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                boolean isUserInRole = rms.isUserInRole("anonuser4", "testuserrolemapping");
  +                assertTrue("anonuser4 should be in role testuserrolemapping", isUserInRole);
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("user and role exist. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                ums.removeUser("anonuser4");
  +                rms.removeRole("testuserrolemapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove user and role. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test remove role from group.</p>
  +         */
  +        public void testRemoveRoleFromGroup()
  +        {
  +            // Init test.
  +            try
  +            {
  +                rms.addRole("testuserrolemapping");
  +                rms.addRole("testuserrolemapping.role1");
  +                rms.addRole("testuserrolemapping.role3");
  +                gms.addGroup("testrolegroupmapping");
  +                rms.addRoleToGroup("testuserrolemapping", "testrolegroupmapping");
  +                rms.addRoleToGroup("testuserrolemapping.role1", "testrolegroupmapping");
  +                rms.addRoleToGroup("testuserrolemapping.role3", "testrolegroupmapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testRemoveRoleFromGroup(), " + sex, false);
  +            }
  +    
  +            try
  +            {
  +                rms.removeRoleFromGroup("testuserrolemapping.role3", "testrolegroupmapping");
  +                Collection roles = rms.getRolesForGroup("testrolegroupmapping");
  +                assertEquals("roles size should be == 2", 2, roles.size());
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("group exists. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                rms.removeRole("testuserrolemapping");
  +                gms.removeGroup("testrolegroupmapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove group and role. exception caught: " + sex, false);
  +            }
  +        }
  +    
  +        /**
  +         * <p>Test is user in role.</p>
  +         */
  +        public void testIsGroupInRole()
  +        {
  +            // Init test.
  +            try
  +            {
  +                rms.addRole("testuserrolemapping");
  +                gms.addGroup("testrolegroupmapping");
  +                rms.addRoleToGroup("testuserrolemapping", "testrolegroupmapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("failed to init testIsGroupInRole(), " + sex, false);
  +            }
  +            try
  +            {
  +                boolean isGroupInRole = rms.isGroupInRole("testrolegroupmapping", "testuserrolemapping");
  +                assertTrue("testrolegroupmapping should be in role testuserrolemapping", isGroupInRole);
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("group and role exist. should not have thrown an exception: " + sex, false);
  +            }
  +    
  +            // Cleanup test.
  +            try
  +            {
  +                rms.removeRole("testuserrolemapping");
  +                gms.removeGroup("testrolegroupmapping");
  +            }
  +            catch (SecurityException sex)
  +            {
  +                assertTrue("could not remove role and group. exception caught: " + sex, false);
  +            }
           }
  -        catch (SecurityException sex)
  -        {
  -            assertTrue("could not remove role and group. exception caught: " + sex, false);
  -        }
  -    }
   
       /**
        * <p>Destroy role test objects.</p>
  @@ -672,12 +670,12 @@
               ums.removeUser("anonuser3");
               ums.removeUser("anonuser4");
               ums.removeUser("anonuser5");
  -            rms.removeRole("/testrole1");
  -            rms.removeRole("/testrole2");
  -            rms.removeRole("/testrole3");
  -            rms.removeRole("/testgetrole");
  -            rms.removeRole("/testuserrolemapping");
  -            gms.removeGroup("/testrolegroupmapping");
  +            rms.removeRole("testrole1");
  +            rms.removeRole("testrole2");
  +            rms.removeRole("testrole3");
  +            rms.removeRole("testgetrole");
  +            rms.removeRole("testuserrolemapping");
  +            gms.removeGroup("testrolegroupmapping");
           }
           catch (SecurityException sex)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message