vmassol 01/09/05 01:41:18
Modified: cactus/src/sample/share/org/apache/commons/cactus/sample/unit
TestServletTestCase2.java
Log:
added test case for bug #3427 : disable follow redirects in the Cactus HTTP client
(thanks to Tony Payne)
Revision Changes Path
1.13 +25 -1
jakarta-commons/cactus/src/sample/share/org/apache/commons/cactus/sample/unit/TestServletTestCase2.java
Index: TestServletTestCase2.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/sample/share/org/apache/commons/cactus/sample/unit/TestServletTestCase2.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TestServletTestCase2.java 2001/08/31 16:55:51 1.12
+++ TestServletTestCase2.java 2001/09/05 08:41:18 1.13
@@ -77,7 +77,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase2.java,v 1.12 2001/08/31 16:55:51 vmassol Exp $
+ * @version $Id: TestServletTestCase2.java,v 1.13 2001/09/05 08:41:18 vmassol Exp $
*/
public class TestServletTestCase2 extends ServletTestCase
{
@@ -515,6 +515,30 @@
throws IOException
{
assertEquals(HttpServletResponse.SC_UNAUTHORIZED,
+ theResponse.getConnection().getResponseCode());
+ }
+
+ //-------------------------------------------------------------------------
+
+ /**
+ * Verify that we can assert HTTP status code when it is a redirect and
+ * that the client side of Cactus does not follow the redirect.
+ */
+ public void testRedirect() throws IOException
+ {
+ response.sendRedirect("http://jakarta.apache.org");
+ }
+
+ /**
+ * Verify that we can assert HTTP status code when it is a redirect and
+ * that the client side of Cactus does not follow the redirect.
+ *
+ * @param theResponse the response from the server side.
+ */
+ public void endRedirect(WebResponse theResponse)
+ throws IOException
+ {
+ assertEquals(HttpServletResponse.SC_MOVED_TEMPORARILY,
theResponse.getConnection().getResponseCode());
}