craigmcc 01/05/10 13:46:03
Modified: tester/src/bin tester.xml
tester/src/tester/org/apache/tester ErrorPage06.java
tester/web ErrorPage06.jsp
tester/web/WEB-INF web.xml
Added: tester/web ErrorPage08.jsp
Log:
Expand error page tests to check for runtime exceptions thrown by JSP
pages as well as servlets.
Revision Changes Path
1.42 +39 -1 jakarta-tomcat-4.0/tester/src/bin/tester.xml
Index: tester.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/tester/src/bin/tester.xml,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- tester.xml 2001/05/10 01:21:26 1.41
+++ tester.xml 2001/05/10 20:45:48 1.42
@@ -216,7 +216,7 @@
outContent="ErrorPage02 PASSED"/>
- <!-- ========== Exception Mapping ===================================== -->
+ <!-- ========== Exception Mapping (Servlet Source) ==================== -->
<tester host="${host}" port="${port}" protocol="${protocol}"
request="${context.path}/ErrorPage03" debug="${debug}"
@@ -274,6 +274,44 @@
request="${context.path}/WrappedErrorPage07"
debug="${debug}"
status="503"/>
+
+ <!-- ========== Exception Mapping (JSP Source) ======================== -->
+
+ <tester host="${host}" port="${port}" protocol="${protocol}"
+ request="${context.path}/ErrorPage08?type=Arithmetic"
+ debug="${debug}"
+ status="200"
+ outContent="ErrorPage06 PASSED - SERVLET"/>
+
+ <tester host="${host}" port="${port}" protocol="${protocol}"
+ request="${context.path}/WrappedErrorPage08?type=Arithmetic"
+ debug="${debug}"
+ status="200"
+ outContent="ErrorPage06 PASSED - SERVLET"/>
+
+ <tester host="${host}" port="${port}" protocol="${protocol}"
+ request="${context.path}/ErrorPage08?type=Array"
+ debug="${debug}"
+ status="200"
+ outContent="ErrorPage06 PASSED - JSP"/>
+
+ <tester host="${host}" port="${port}" protocol="${protocol}"
+ request="${context.path}/WrappedErrorPage08?type=Array"
+ debug="${debug}"
+ status="200"
+ outContent="ErrorPage06 PASSED - JSP"/>
+
+ <tester host="${host}" port="${port}" protocol="${protocol}"
+ request="${context.path}/ErrorPage08?type=Number"
+ debug="${debug}"
+ status="200"
+ outContent="ErrorPage06 PASSED - HTML"/>
+
+ <tester host="${host}" port="${port}" protocol="${protocol}"
+ request="${context.path}/WrappedErrorPage08?type=Number"
+ debug="${debug}"
+ status="200"
+ outContent="ErrorPage06 PASSED - HTML"/>
</target>
1.4 +9 -4
jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/ErrorPage06.java
Index: ErrorPage06.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/ErrorPage06.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ErrorPage06.java 2001/05/10 19:20:29 1.3
+++ ErrorPage06.java 2001/05/10 20:45:52 1.4
@@ -67,7 +67,7 @@
* the ErrorPage05 servlet returns the appropriate exception.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2001/05/10 19:20:29 $
+ * @version $Revision: 1.4 $ $Date: 2001/05/10 20:45:52 $
*/
public class ErrorPage06 extends HttpServlet {
@@ -123,7 +123,8 @@
sb.append(" message class is ");
sb.append(value.getClass().getName());
sb.append("/");
- } else if (!"ErrorPage05 Threw ArithmeticException".equals(value)) {
+ } else if (!"ErrorPage05 Threw ArithmeticException".equals(value) &&
+ !"ErrorPage08 Threw ArithmeticException".equals(value)) {
sb.append(" message is not correct");
}
@@ -139,7 +140,10 @@
String request_uri = (String) value;
String test1 = request.getContextPath() + "/ErrorPage05";
String test2 = request.getContextPath() + "/WrappedErrorPage05";
- if (!request_uri.equals(test1) && !request_uri.equals(test2)) {
+ String test3 = request.getContextPath() + "/ErrorPage08.jsp";
+ String test4 = request.getContextPath() + "/WrappedErrorPage08.jsp";
+ if (!request_uri.equals(test1) && !request_uri.equals(test2) &&
+ !request_uri.equals(test3) && !request_uri.equals(test4)) {
sb.append(" request_uri is ");
sb.append(request_uri);
sb.append("/");
@@ -156,7 +160,8 @@
sb.append("/");
} else {
String servlet_name = (String) value;
- if (!"ErrorPage05".equals(servlet_name)) {
+ if (!"ErrorPage05".equals(servlet_name) &&
+ !"ErrorPage08".equals(servlet_name)) {
sb.append(" servlet_name is ");
sb.append(servlet_name);
sb.append("/");
1.3 +8 -3 jakarta-tomcat-4.0/tester/web/ErrorPage06.jsp
Index: ErrorPage06.jsp
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/tester/web/ErrorPage06.jsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ErrorPage06.jsp 2001/05/10 19:20:31 1.2
+++ ErrorPage06.jsp 2001/05/10 20:45:56 1.3
@@ -37,7 +37,8 @@
sb.append(" message class is ");
sb.append(value.getClass().getName());
sb.append("/");
- } else if (!"ErrorPage05 Threw
ArrayIndexOutOfBoundsException".equals(value)) {
+ } else if (!"ErrorPage05 Threw
ArrayIndexOutOfBoundsException".equals(value) &&
+ !"ErrorPage08 Threw
ArrayIndexOutOfBoundsException".equals(value)) {
sb.append(" message is not correct");
}
@@ -52,7 +53,10 @@
String request_uri = (String) value;
String test1 = request.getContextPath() + "/ErrorPage05";
String test2 = request.getContextPath() + "/WrappedErrorPage05";
- if (!request_uri.equals(test1) && !request_uri.equals(test2)) {
+ String test3 = request.getContextPath() + "/ErrorPage08.jsp";
+ String test4 = request.getContextPath() + "/WrappedErrorPage08.jsp";
+ if (!request_uri.equals(test1) && !request_uri.equals(test2) &&
+ !request_uri.equals(test3) && !request_uri.equals(test4)) {
sb.append(" request_uri is ");
sb.append(request_uri);
sb.append("/");
@@ -68,7 +72,8 @@
sb.append("/");
} else {
String servlet_name = (String) value;
- if (!"ErrorPage05".equals(servlet_name)) {
+ if (!"ErrorPage05".equals(servlet_name) &&
+ !"ErrorPage08".equals(servlet_name)) {
sb.append(" servlet_name is ");
sb.append(servlet_name);
sb.append("/");
1.1 jakarta-tomcat-4.0/tester/web/ErrorPage08.jsp
Index: ErrorPage08.jsp
===================================================================
<%@ page contentType="text/plain" %><%
// Write a FAILED message that should get replaced by the error text
out.println("ErrorPage08 FAILED - Original response returned");
// Throw the specified exception
String type = request.getParameter("type");
if ("Arithmetic".equals(type)) {
throw new ArithmeticException
("ErrorPage08 Threw ArithmeticException");
} else if ("Array".equals(type)) {
throw new ArrayIndexOutOfBoundsException
("ErrorPage08 Threw ArrayIndexOutOfBoundsException");
} else if ("Number".equals(type)) {
throw new NumberFormatException
("ErrorPage08 Threw NumberFormatException");
}
%>
1.31 +20 -0 jakarta-tomcat-4.0/tester/web/WEB-INF/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/tester/web/WEB-INF/web.xml,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- web.xml 2001/05/10 01:21:26 1.30
+++ web.xml 2001/05/10 20:46:00 1.31
@@ -104,6 +104,11 @@
<filter-mapping>
<filter-name>HttpFilter</filter-name>
+ <url-pattern>/WrappedErrorPage08</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>HttpFilter</filter-name>
<url-pattern>/WrappedForward00</url-pattern>
</filter-mapping>
@@ -362,6 +367,11 @@
</servlet>
<servlet>
+ <servlet-name>ErrorPage08</servlet-name>
+ <jsp-file>/ErrorPage08.jsp</jsp-file>
+ </servlet>
+
+ <servlet>
<servlet-name>Forward00</servlet-name>
<servlet-class>org.apache.tester.Forward00</servlet-class>
</servlet>
@@ -703,6 +713,16 @@
<servlet-mapping>
<servlet-name>ErrorPage07</servlet-name>
<url-pattern>/WrappedErrorPage07</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ErrorPage08</servlet-name>
+ <url-pattern>/ErrorPage08</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ErrorPage08</servlet-name>
+ <url-pattern>/WrappedErrorPage08</url-pattern>
</servlet-mapping>
<servlet-mapping>