Introduction
This tutorial explains where to get Cactus samples and how to use them.
There are some samples available as part of the documentation. The samples depend on the kind of test case you are writing (Servlet, Taglibs, Filters, ...). For this reason you'll find some samples in the TestCase Howto tutorial.
However, the majority of Cactus samples are in the form of source samples. These samples are part of the Cactus distribution that you have downloaded (in the
sample/src
directory).The following section explains how to execute the Cactus Samples using Ant (the Samples are packaged to be executed with Ant). If you wish to integrate them in your own build system or in your favorite IDE, you'll have to understand the principles first and manually install them (read the Getting Started and the Configuration Howto tutorials). Some detailed explanations for IDE integration are also available in the IDE Howto tutorial.
Running the Cactus Samples using Ant
Prerequisites
You need to install the following items prior to building the Cactus Sample application:
- A JVM (1.2 or above),
- A Servlet Engine (Servlet API 2.2 or above). The Cactus Sample Ant build script supports automatic running the Cactus unit tests on several Servlet Engines.
- Ant (see the "Installing Ant" tutorial).
- A Servlet/J2EE API jar corresponding to the Cactus Sample release you have downloaded (J2EE 1.2 or 1.3). You can download the jar from:
You can put these libraries anywhere you want on your hard disk. You'll just have to specify the location where they are in the
- For Servlet API 2.2
- From Sun or from the Jakarta reference implementation
- For Servlet API 2.3
- From Sun or from the Jakarta reference implementation
- For the J2EE jar
- From J2EE download page
build.properties
file, as described below.Installing the Cactus Sample
Follow these steps:
- Download the Cactus Sample and unzip it in a directory. Let's call this directory
sampleroot
.- Rename (or copy) the
sampleroot
/build/build.properties.sample
file tobuild.properties
. This file defines the dependencies between the Cactus Sample build process and your environment (location of external jars, home directory for installed servlet engine(s), ...). Edit this file to reflect your environment values.Running the samples
Open a shell, cd to the
sampleroot
/build
directory and type 'ant test.all
'. The tests will be executed on all the servlet engines you have defined in thebuild.properties
file you have edited.