List<ParamValueMetaData> s19params = servlet19.getInitParam();
assertEquals(1, s19params.size());
ParamValueMetaData s19p0 = s19params.get(0);
assertEquals("ejbName", s19p0.getParamName());
assertEquals("ejb/UnsecureRunAsServletWithPrincipalNameAndRolesTarget", s19p0.getParamValue());
RunAsMetaData s19RunAs = servlet19.getRunAs();
assertEquals("Assume an InternalUser role to access a private EJB", getDescription(s19RunAs.getDescriptions()));
assertEquals("InternalUser", s19RunAs.getRoleName());
assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal", servlet19.getRunAsPrincipal());
RunAsIdentityMetaData s19RunAsID = jbossWeb.getRunAsIdentity("UnsecureRunAsServletWithPrincipalNameAndRoles");
assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal", s19RunAsID.getPrincipalName());
Set<String> s19RunAsPrincipalRoles = jbossWeb.getSecurityRoles().getSecurityRoleNamesByPrincipal("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal");
assertEquals(set("ExtraRole1"), s19RunAsPrincipalRoles);
assertEquals(set("ExtraRole1", "InternalUser"), s19RunAsID.getRunAsRoles());
assertEquals(true, s19RunAsID.doesUserHaveRole("ExtraRole1"));
assertEquals(true, s19RunAsID.doesUserHaveRole("InternalUser"));
// servlet20
JBossServletMetaData servlet20 = jbossWeb.getServletByName("UnsecureRunAsJsp");
assertNotNull(servlet20);
assertEquals("servlet20", servlet20.getId());
assertEquals("UnsecureRunAsJsp", servlet20.getServletName());
assertEquals(null, servlet20.getServletClass());
assertEquals("/runAs.jsp", servlet20.getJspFile());
RunAsMetaData s20RunAs = servlet20.getRunAs();
assertEquals("Assume an InternalUser role to access a private EJB", getDescription(s19RunAs.getDescriptions()));
assertEquals("InternalUser", s20RunAs.getRoleName());
assertEquals(null, servlet20.getRunAsPrincipal());
RunAsIdentityMetaData s20RunAsID = jbossWeb.getRunAsIdentity("UnsecureRunAsJsp");
assertEquals("anonymous", s20RunAsID.getPrincipalName());
assertEquals(set("InternalUser"), s20RunAsID.getRunAsRoles());
assertEquals(true, s20RunAsID.doesUserHaveRole("InternalUser"));