Sample Howto

Last update : September 25 2001

About
  • What is Cactus ?
  • Features/Status
  • Goals
  • News/Changes
  • Roadmap/Todo
  • Contributors
  • Contributing
  • License
  • Feedback


  • Downloads
  • Downloads


  • Documentation
  • How it works ?
  • Getting Started
  • Mock vs Container
  • API Reference


  • Howto Guides
  • Config Howto
  • TestCase Howto
  • Ant Howto
  • HttpUnit Howto
  • Sample Howto
  • EJB Howto
  • IDE Howto


  • Support
  • Bug database
  • Mailing list
  • FAQ


  • Misc.
  • Why the name ?
  • Resources


  • Developers
  • CVS
  • Coding Conventions


  • 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 the following Servle Engines (however, it is easy to support others)
      • Tomcat 3.2
      • Tomcat 3.3
      • Tomcat 4.0
      • WebLogic 5.1
      • Orion Server 1.4
      • Orion Server 1.5
      • Resin 1.2
      • Resin 1.3
      • Resin 2.0
    • Ant (see the "Installing Ant" tutorial).
    • A Servlet API jar corresponding to the Cactus Sample release you have downloaded (Servlet API 2.2 or 2.3). You can download the jar from :
      You can put these libraries whereever 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 tests_all'. The tests will be executed on all the servlet engines you have defined in the build.properties file you have edited.





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