Save This Page
Home » cactus-1.8.0-src » org.apache.cactus.extension.jetty » [javadoc | source]
org.apache.cactus.extension.jetty
public class: JettyTestSetup [javadoc | source]
java.lang.Object
   junit.extensions.TestSetup
      org.apache.cactus.extension.jetty.JettyTestSetup
Custom JUnit test setup to use to automatically start Jetty. Example:
public static Test suite()
{
TestSuite suite = new TestSuite(Myclass.class);
return new JettyTestSetup(suite);
}
Constructor:
 public JettyTestSetup(Test theTest) 
    Parameters:
    theTest - the test we are decorating (usually a test suite)
 public JettyTestSetup(Test theTest,
    Configuration theBaseConfiguration,
    ServletConfiguration theServletConfiguration,
    FilterConfiguration theFilterConfiguration) 
    Parameters:
    theTest - the test we are decorating (usually a test suite)
    theBaseConfiguration - the base configuration object used to configure Jetty
    theServletConfiguration - the servlet configuration object used to configure Jetty
    theFilterConfiguration - the filter configuration object used to configure Jetty
Method from org.apache.cactus.extension.jetty.JettyTestSetup Summary:
getConfigFile,   getResourceDir,   isAvailable,   isRunning,   readFully,   run,   setConfigFile,   setForceShutdown,   setResourceDir,   setUp,   tearDown,   testConnectivity
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.cactus.extension.jetty.JettyTestSetup Detail:
 protected final File getConfigFile() 
 protected final File getResourceDir() 
 protected boolean isAvailable(int theCode) 
    Tests whether an HTTP return code corresponds to a valid connection to the test URL or not. Success is 200 up to but excluding 300.
 protected boolean isRunning() 
 protected  void readFully(HttpURLConnection theConnection) throws IOException 
    Fully reads the input stream from the passed HTTP URL connection to prevent (harmless) server-side exception.
 public  void run(TestResult theResult) 
 public final  void setConfigFile(File theConfigFile) 
    Sets the configuration file to use for initializing Jetty.
 public final  void setForceShutdown(boolean isForcedShutdown) 
 public final  void setResourceDir(File theResourceDir) 
    Sets the directory in which Jetty will look for the web-application resources.
 protected  void setUp() throws Exception 
    Start an embedded Jetty server. It is allowed to pass a Jetty XML as a system property (cactus.jetty.config) to further configure Jetty. Example: -Dcactus.jetty.config=./jetty.xml.
 protected  void tearDown() throws Exception 
    Stop the running Jetty server.
 protected int testConnectivity(URL theUrl) 
    Tests whether we are able to connect to the HTTP server identified by the specified URL.