org.apache.cactus.server.runner
Class ServletTestRunner

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.cactus.server.runner.ServletTestRunner
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ServletTestRunner
extends javax.servlet.http.HttpServlet

Helper servlet to start a JUnit Test Runner in a webapp.

This class currently does a couple of reflection tricks to avoid a direct dependancy on the TraX API (javax.xml.transform.*), encapsulated in the XMLTransformer class.

Version:
$Id: ServletTestRunner.java 239016 2004-06-27 15:23:30Z vmassol $
See Also:
Serialized Form

Constructor Summary
ServletTestRunner()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest theRequest, javax.servlet.http.HttpServletResponse theResponse)
          Starts the test suite passed as a HTTP parameter.
 void init()
          Called by the container when the servlet is initialized.
protected  java.lang.String run(java.lang.String theSuiteClassName, java.lang.String theXslFileName, java.lang.String theEncoding)
          Run the suite tests and return the result.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletTestRunner

public ServletTestRunner()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Called by the container when the servlet is initialized.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - If an initialization parameter contains an illegal value

doGet

public void doGet(javax.servlet.http.HttpServletRequest theRequest,
                  javax.servlet.http.HttpServletResponse theResponse)
           throws javax.servlet.ServletException,
                  java.io.IOException
Starts the test suite passed as a HTTP parameter.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
theRequest - the incoming HTTP client request
theResponse - the outgoing HTTP client request to send back.
Throws:
javax.servlet.ServletException - if an error occurs when servicing the request
java.io.IOException - if an error occurs when servicing the request

run

protected java.lang.String run(java.lang.String theSuiteClassName,
                               java.lang.String theXslFileName,
                               java.lang.String theEncoding)
                        throws javax.servlet.ServletException
Run the suite tests and return the result.

Parameters:
theSuiteClassName - the suite containing the tests to run
theXslFileName - the name of the XSL stylesheet or null if we don't want to apply a stylesheet to the returned XML data
theEncoding - the encoding to use for the returned XML or null if default encoding is to be used
Returns:
the result object
Throws:
javax.servlet.ServletException - if the suite failed to be loaded


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.