com.javaforge.tapestry.testng
Class JettyRunner

java.lang.Object
  extended by com.javaforge.tapestry.testng.JettyRunner

public class JettyRunner
extends java.lang.Object

A utitilty class for running an instance of the Jetty servlet container from within a unit test. This code is based on the Jetty 6 code base (which is in beta at the time of writing). When combined with jWebUnit, this allows for basic integration testing of an application from within a unit test case.

Author:
Howard M. Lewis Ship

Field Summary
static java.lang.String DEFAULT_CONTEXT_PATH
           
static int DEFAULT_PORT
           
static java.lang.String DEFAULT_WAR_PATH
           
 
Constructor Summary
JettyRunner()
          Creates and starts a new instance of Jetty, using default configuration values.
JettyRunner(java.lang.String contextPath, int port, java.lang.String warPath)
          Creates and starts a new instance of Jetty.
 
Method Summary
 void stop()
          Stops the Jetty instance.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CONTEXT_PATH

public static final java.lang.String DEFAULT_CONTEXT_PATH
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAULT_WAR_PATH

public static final java.lang.String DEFAULT_WAR_PATH
See Also:
Constant Field Values
Constructor Detail

JettyRunner

public JettyRunner()
Creates and starts a new instance of Jetty, using default configuration values. The contextPath will be /, the port will be 80, the warPath will be src/main/webapp.


JettyRunner

public JettyRunner(java.lang.String contextPath,
                   int port,
                   java.lang.String warPath)
Creates and starts a new instance of Jetty. This should be done from a test case setup method.

Parameters:
contextPath - the context path for the deployed application
port - the port number used to access the application
warPath - the path to the exploded web application (typically, "src/main/webapp")
Method Detail

stop

public void stop()
Stops the Jetty instance. This should be called from a test case tear down method.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2006 Howard M. Lewis Ship. All Rights Reserved.