Tomcat Self-test

<%@ page import="java.util.*" %> <%@ taglib uri="http://jakarta.apache.org/taglibs/tomcat_admin-1.0" prefix="adm" %> <%@ taglib uri="http://jakarta.apache.org/taglibs/ant-1.0" prefix="ant" %> This page will show the result of executing the sanity test suite. <%! long t ; %> <%@ include file="sanity-form.jsp" %> <% // This is an ugly hack to make the logs easily accessible. // Keep in mind this is just a way to jump-start testing, not a // production-quality test runner. %> <% out.flush(); if( request.getParameter("target") == null ) return; String port = request.getParameter("port"); String colonPort=null; String notStandAlone=null; try { colonPort = ":" + port; if ( Integer.parseInt(port) == 80 ) { colonPort = ""; notStandAlone="Not standalone"; } } catch (Exception e) { out.println("ERROR: Invalid port number!"); return; } String dirStatus="301"; String redirStatus="301"; if (!staticServer.equals("Tomcat")) { dirStatus="200"; if (!staticServer.equals("Apache")) redirStatus="302"; else redirStatus="301"; } %> <% t = System.currentTimeMillis(); %> <% if ("Tomcat".equals(webServer)) { %> <% } else if ("Apache".equals(webServer)) { %> <% } else if ("IIS".equals(webServer)) { %> <% } else if ("Netscape".equals(webServer)) { %> <% } %> <% if ("Tomcat".equals(staticServer)) { %> <% } else if ("Apache".equals(staticServer)) { %> <% } else if ("IIS".equals(staticServer)) { %> <% } else if ("Netscape".equals(staticServer)) { %> <% } %> <% // Test completed, display the results ( outType=none means // Gtest doesn't generate any output ( but we have to wait untill // it's done ), use 'html' for "interactive" results %>

Test <%= antProperties.getProperty("revision") %>

Executed in <%= System.currentTimeMillis() - t %> Milliseconds.
<% // -------------------- Failures -------------------- %>

FAILED Tests

<% // Need more tags - if, etc %> FAIL ( <%= failures.getHttpClient().getComment() %> ) <%= failures.getHttpRequest().getRequestLine() %>
TEST: <%= failures.getTestDescription() %>
Request:
  <%= failures.getHttpRequest().getFullRequest() %>
Comments: <%= failures.getHttpClient().getComment() %>
Message:
  <%= failures.getMessage() %>
<% // use a tag %> <% if( request.getParameter("debug" ) != null ) { %> Response status: <%= failures.getHttpResponse().getResponseLine() %>
Response headers: (I'm not sure how to do embeded iterations, need JSP expert )
Response body:
  <%= failures.getHttpResponse().getResponseBody() %>
  
<% } %>
<% // -------------------- Success story -------------------- %>

PASSED Tests

OK ( <%= success.getComment() %> ) <%= success.getFirstRequest().getRequestLine() %>