Examples of UserRoleVo


Examples of org.sete.vo.admin.UserRoleVo

                //put in the form one privilege assignment with r/w action and another one with r/o action
        mrf.setUserRolePrivileges(new String[]{"projIdea", "projDoc"});
        mrf.setPrivilegesWithWriteAllowed(new String[]{"projIdea"});

        //record the UserRoleVo that is expected (one privilege with r/w assigned!)
        final UserRoleVo urVo = new UserRoleVo();
        {
            urVo.setUserRole("student");
            final ArrayList<RolePrivilegeVo> rolePrivVos = new ArrayList<RolePrivilegeVo>(1);
            //put the r/w one
            {
                final RolePrivilegeVo rpVo = new RolePrivilegeVo();
                rpVo.setUserRolePrivilege("projIdea");
                rpVo.setPrivilegeActions("rw");
               
                rolePrivVos.add(rpVo);
            }
            //put the r/o one
            {
                final RolePrivilegeVo rpVo = new RolePrivilegeVo();
                rpVo.setUserRolePrivilege("projDoc");
                rpVo.setPrivilegeActions("r");
               
                rolePrivVos.add(rpVo);
            }
            urVo.setUserRolePrivileges( rolePrivVos );
        }
       
        EasyMock.reset( urs );
        urs.updateUserRole(urVo);
        EasyMock.expectLastCall().once();
        EasyMock.replay( urs );

        //and execute the code to be tested       
        mra.saveAssignedPrivileges( am, mrf, req, res);
       
        //and check the execution result
        final UserRoleVo savedUserRoleVo = mra.getLastSavedUserRoleVo();
       
        assertTrue( "student".equals( savedUserRoleVo.getUserRole() ) );
        assertTrue( 2 == savedUserRoleVo.getUserRolePrivileges().size() );
       
        assertTrue( "projIdea".equals(savedUserRoleVo.getUserRolePrivileges().get(0).getUserRolePrivilege()) );
        assertTrue( "rw".equals(savedUserRoleVo.getUserRolePrivileges().get(0).getPrivilegeActions()) );
       
        assertTrue( "projDoc".equals(savedUserRoleVo.getUserRolePrivileges().get(1).getUserRolePrivilege()) );
        assertTrue( "r".equals(savedUserRoleVo.getUserRolePrivileges().get(1).getPrivilegeActions()) );       
    }
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.