Examples of RolePrincipalImpl


Examples of org.apache.jetspeed.security.impl.RolePrincipalImpl

            Collection principals = getPrincipals(subject, RolePrincipal.class);
            assertEquals("shoud have one principal;", 1 , principals.size());
           
            assertTrue(
                    "should contain rootrole",
                    principals.contains(new RolePrincipalImpl("rootrole")));
           
            rms.removeRoleFromUser("test","rootrole");
           
            user = ums.getUser("test");
            principals= getPrincipals(user.getSubject(),RolePrincipal.class);
            assertEquals("shoud not have any principals;", 0,principals.size());
           
        }
        catch (SecurityException sex)
        {
            assertTrue("test with parent role "+sex.getMessage(), false);
        }
       
        try
        {
            rms.addRoleToUser("test","rootrole.childrole1");
       
            user = ums.getUser("test");
            Subject subject = user.getSubject();
            assertNotNull("subject is null", subject);
            Collection principals=getPrincipals(subject,RolePrincipal.class);
            assertEquals("expected 2 principals;", 2,principals.size());
           
            assertTrue(
                    "should contain rootrole",
                    principals.contains(new RolePrincipalImpl("rootrole")));
           
            assertTrue(
                    "should contain rootrole",
                    principals.contains(new RolePrincipalImpl("rootrole.childrole1")));
          
            rms.removeRoleFromUser("test","rootrole.childrole1");
           
            user = ums.getUser("test");
            principals=getPrincipals(user.getSubject(),RolePrincipal.class);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.