UserRoleDaoService { public void createRole( String roleName ) throws Exception { if ( canAdminister() ) { if ( strNotEmpty( roleName ) ) { IUserRoleDao roleDao = PentahoSystem.get( IUserRoleDao.class, "userRoleDaoProxy", PentahoSessionHolder.getSession() ); roleDao.createRole( null, roleName, "", new String[0] ); } else { throw new ValidationFailedException(); } } else { throw new SecurityException(); } }  UserListWrapper getUsers(); RoleListWrapper getRolesForUser( String user ); void assignRolesToUser( String userName, String roleNames ); void removeRolesFromUser( String userName, String roleNames ); void createRole( String roleName ); RoleListWrapper getRoles(); UserListWrapper getRoleMembers( String roleName ); void createUser( User user ); void changeUserPassword( final String userName, final String newPass, String oldPass ); void deleteUsers( String userNames ); void deleteRoles( String roleNames ); SystemRolesMap getRoleBindingStruct( String locale ); void setLogicalRoles( LogicalRoleAssignments roleAssignments ); void updatePassword( User user, String administratorPassword ); void updatePassword( User user ); static final String PUC_USER_PASSWORD_LENGTH; static final String PUC_USER_PASSWORD_REQUIRE_SPECIAL_CHARACTER; }
@Test( expected = UserRoleDaoService.ValidationFailedException.class ) public void testCreateRoleEmptyName() throws Exception { setupMockSessionUser( SESSION_USER_NAME, true ); userRoleService.createRole( "" ); }
@Test( expected = UserRoleDaoService.ValidationFailedException.class ) public void testCreateRoleNullName() throws Exception { setupMockSessionUser( SESSION_USER_NAME, true ); userRoleService.createRole( null ); }