public void testAddServletRunAsRole() throws Exception {
  String xml=WEBAPP_TEST_HEADER + "  <servlet>" + "    <servlet-name>s1</servlet-name>"+ "    <servlet-class>sclass1</servlet-class>"+ "  </servlet>"+ "</web-app>";
  WebXml webXml=WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes("UTF-8")),getEntityResolver());
  WebXmlUtils.addServletRunAsRoleName(webXml,"s1","r1");
  String roleName=WebXmlUtils.getServletRunAsRoleName(webXml,"s1");
  assertEquals("r1",roleName);
}

public void testAddServletRunAsRole ( ) throws Exception { String xml = WEBAPP_TEST_HEADER + "  <servlet>" + "    <servlet-name>s1</servlet-name>" + "    <servlet-class>sclass1</servlet-class>" + "  </servlet>" + "</web-app>" ; WebXml webXml = WebXmlIo . parseWebXml ( new ByteArrayInputStream ( xml . getBytes ( "UTF-8" ) ) , getEntityResolver ( ) ) ; WebXmlUtils . addServletRunAsRoleName ( webXml , "s1" , "r1" ) ; String roleName = WebXmlUtils . getServletRunAsRoleName ( webXml , "s1" ) ; assertEquals ( "r1" , roleName ) ; }
tests that a run - as role - name can be added to a servlet .
