Sample Howto

Last update : July 29 2002
Doc for : v1.4b1

About
  • What is Cactus ?
  • News
  • Changes
  • Features/Status
  • Goals
  • Roadmap/Todo
  • Contributors
  • Contributing
  • Cactus Users
  • Tested on ...
  • License


  • Downloads
  • Downloads


  • Documentation
  • How it works ?
  • Getting Started
  • Mock vs Container
  • Javadocs
  • FAQ


  • Howto Guides
  • Classpath Howto
  • Config Howto
  • Migration Howto
  • TestCase Howto
  • Runner Howto
  • Security Howto
  • Ant Howto
  • HttpUnit Howto
  • Sample Howto
  • EJB Howto
  • IDE Howto
  • Tomcat Howto
  • JUnitEE Howto


  • Support
  • Bug database
  • Mailing list


  • Misc.
  • Why the name ?
  • Logo Challenge
  • Resources
  • Test Coverage
  • Stats


  • Developers
  • CVS
  • Coding Conventions
  • Build results
  • Release Checklist


  • 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 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 to build.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 the build.properties file you have edited.





    Copyright © 2000-2002 The Apache Software Foundation. All Rights Reserved.