You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2005/02/11 10:17:14 UTC
cvs commit: jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/webapp TestWebXml.java
vmassol 2005/02/11 01:17:14
Modified: integration/ant/src/test/org/apache/cactus/integration/ant/deployment/webapp
TestWebXml.java
Log:
Added unit tests for CACTUS-189 (Added support for merging <code><run-as></code> element from a provided <code>web.xml</code> file in the cactifywar Ant task). Thanks to Magnus Grimsell for the patch.
Revision Changes Path
1.2 +43 -1 jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/webapp/TestWebXml.java
Index: TestWebXml.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/deployment/webapp/TestWebXml.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestWebXml.java 31 May 2004 20:05:21 -0000 1.1
+++ TestWebXml.java 11 Feb 2005 09:17:14 -0000 1.2
@@ -1502,6 +1502,48 @@
assertEquals("servlet", order.item(2).getNodeName());
}
+ /**
+ * Tests that the a servlets run-as role-name can be extracted
+ *
+ * @throws Exception If an unexpected error occurs
+ */
+ public void testGetServletRunAsRole() throws Exception
+ {
+ String xml = "<web-app>"
+ + " <servlet>"
+ + " <servlet-name>s1</servlet-name>"
+ + " <servlet-class>sclass1</servlet-class>"
+ + " <run-as>"
+ + " <role-name>r1</role-name>"
+ + " </run-as>"
+ + " </servlet>"
+ + "</web-app>";
+ Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
+ WebXml webXml = new WebXml(doc);
+ String roleName = webXml.getServletRunAsRoleName("s1");
+ assertEquals("r1", roleName);
+ }
+
+ /**
+ * Tests that a run-as role-name can be added to a servlet
+ *
+ * @throws Exception If an unexpected error occurs
+ */
+ public void testAddServletRunAsRole() throws Exception
+ {
+ String xml = "<web-app>"
+ + " <servlet>"
+ + " <servlet-name>s1</servlet-name>"
+ + " <servlet-class>sclass1</servlet-class>"
+ + " </servlet>"
+ + "</web-app>";
+ Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
+ WebXml webXml = new WebXml(doc);
+ webXml.addServletRunAsRoleName("s1", "r1");
+ String roleName = webXml.getServletRunAsRoleName("s1");
+ assertEquals("r1", roleName);
+ }
+
// Private Methods ---------------------------------------------------------
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org