org.apache.cactus.extension.jetty
Class JettyTestSetup

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.extensions.TestDecorator
          extended byjunit.extensions.TestSetup
              extended byorg.apache.cactus.extension.jetty.JettyTestSetup
All Implemented Interfaces:
junit.framework.Test

public class JettyTestSetup
extends junit.extensions.TestSetup

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);
 }
 

Version:
$Id: JettyTestSetup.java,v 1.2 2003/07/14 13:42:55 cmlenz Exp $
Author:
Vincent Massol

Field Summary
 
Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
JettyTestSetup(junit.framework.Test theTest)
           
 
Method Summary
protected  java.io.File getConfigFile()
           
protected  java.io.File getResourceDir()
           
 void setConfigFile(java.io.File theConfigFile)
          Sets the configuration file to use for initializing Jetty.
 void setResourceDir(java.io.File theResourceDir)
          Sets the directory in which Jetty will look for the web-application resources.
 void setUp()
          Start an embedded Jetty server.
 
Methods inherited from class junit.extensions.TestSetup
run, tearDown
 
Methods inherited from class junit.extensions.TestDecorator
basicRun, countTestCases, getTest, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JettyTestSetup

public JettyTestSetup(junit.framework.Test theTest)
Parameters:
theTest - the test we are decorating (usually a test suite)
Method Detail

setUp

public void setUp()
           throws java.lang.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.

Throws:
java.lang.Exception - if an error happens during initialization

setConfigFile

public final void setConfigFile(java.io.File theConfigFile)
Sets the configuration file to use for initializing Jetty.

Parameters:
theConfigFile - The configuration file to set

setResourceDir

public final void setResourceDir(java.io.File theResourceDir)
Sets the directory in which Jetty will look for the web-application resources.

Parameters:
theResourceDir - The resource directory to set

getConfigFile

protected final java.io.File getConfigFile()
Returns:
The resource directory, or null if it has not been set

getResourceDir

protected final java.io.File getResourceDir()
Returns:
The resource directory, or null if it has not been set


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.