JUnit decorator for starting and stopping a local instance Jetty for usage
with test cases.
It uses property 'jettyConfig' to load the - mandatory - Jetty configuration
document. Eg '/jetty-test-config.xml' is loaded from the classpath root (so
providing the configuration document in the root of the test classes folder
will suffice) but 'file://c:/mydir/myconfig.xml' should work as well. If
property 'jettyConfig' is not provided (default == null), the properties
'port', 'webappContextRoot' and 'contextPath' are used to start a Jetty
instance.
Property useJettyPlus (default == false) is used to decide whether JettyPlus
should be used, or just the basic version of Jetty. JettyPlus provides
support for JNDI, datasources, transactions etc.
Usage:
...
public static Test suite()
{
TestSuite suite = new TestSuite();
suite.addTest(new JettyDecoratorWithArgsTest("testPing"));
JettyDecorator deco = new JettyDecorator(suite);
deco.setPort(8098);
deco.setWebappContextRoot("src/webapp");
deco.setContextPath("/test");
deco.setUseJettyPlus(false);
return deco;
}
...
Jetty will be started before the tests are actually run, and will be stopped
afterwards.
author: Eelco Hillenius |