public void testRoles()
throws Exception
{
SecurityValidationContext context = new SecurityValidationContext();
CPrivilege priv = new CPrivilege();
priv.setId("priv");
priv.setName("priv");
priv.setType("invalid");
context.addExistingPrivilegeIds();
context.getExistingPrivilegeIds().add("priv");
CRole role1 = new CRole();
role1.setId("role1");
role1.setName("role1");
role1.setDescription("desc");
role1.setSessionTimeout(50);
role1.addPrivilege(priv.getId());
role1.addRole("role2");
ArrayList<String> containedRoles = new ArrayList<String>();
containedRoles.add("role2");
context.addExistingRoleIds();
context.getExistingRoleIds().add("role1");
context.getRoleContainmentMap().put("role1", containedRoles);
CRole role2 = new CRole();
role2.setId("role2");
role2.setName("role2");
role2.setDescription("desc");
role2.setSessionTimeout(50);
role2.addPrivilege(priv.getId());
role2.addRole("role3");
containedRoles = new ArrayList<String>();
containedRoles.add("role3");
context.addExistingRoleIds();
context.getExistingRoleIds().add("role2");
context.getRoleContainmentMap().put("role2", containedRoles);
CRole role3 = new CRole();
role3.setId("role3");
role3.setName("role3");
role3.setDescription("desc");
role3.setSessionTimeout(50);
role3.addPrivilege(priv.getId());
role3.addRole("role1");
containedRoles = new ArrayList<String>();
containedRoles.add("role1");
context.addExistingRoleIds();
context.getExistingRoleIds().add("role3");