org.apache.anteater.test
Class ContentHandlerTask

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.anteater.test.BaseTask
                    |
                    +--org.apache.anteater.test.ContentHandlerTask
All Implemented Interfaces:
Groupable, org.apache.tools.ant.TaskContainer
Direct Known Subclasses:
MatcherTest, SendResponse

public abstract class ContentHandlerTask
extends BaseTask
implements org.apache.tools.ant.TaskContainer

A superclass which can magically convert certain nested Task types into body text. For example, descendants of this class can have a nested <jelly script="..."/> element. At runtime, the indicated jelly script will be run, and it's output sent to the addText(java.lang.String) method, as if the user entered it directly.

This is all done through the ContentHandler system, a pluggable set of adapters that convert tasks to text, usually by running them.

If a task not recognised by the ContentHandler system is encountered, it is executed as normal.

Since:
Oct 4, 2002
Version:
$Revision: 1.3 $ $Date: 2002/10/06 08:24:11 $
Author:
Jeff Turner

Field Summary
protected  ContentHandlerFactory handlerFactory
           
protected  ArrayList matcherTests
          List of nested tasks.
 
Fields inherited from class org.apache.anteater.test.BaseTask
debug, debugWasSet
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
ContentHandlerTask()
           
 
Method Summary
 void addTask(org.apache.tools.ant.Task task)
           
abstract  void addText(String text)
          Used to directly set the text to compare the response against.
 void execute()
          For each nested task, locate a ContentHandler and use it to generate body text.
 
Methods inherited from class org.apache.anteater.test.BaseTask
debug, getDebug, getGroup, print, println, resolveContentURL, setDebug, setGroup, setGroup
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matcherTests

protected ArrayList matcherTests
List of nested tasks.


handlerFactory

protected ContentHandlerFactory handlerFactory
Constructor Detail

ContentHandlerTask

public ContentHandlerTask()
Method Detail

addText

public abstract void addText(String text)
                      throws org.apache.tools.ant.BuildException
Used to directly set the text to compare the response against. Called if the text is set in the element body.

org.apache.tools.ant.BuildException

addTask

public void addTask(org.apache.tools.ant.Task task)
Specified by:
addTask in interface org.apache.tools.ant.TaskContainer

execute

public void execute()
             throws org.apache.tools.ant.BuildException
For each nested task, locate a ContentHandler and use it to generate body text. Alternatively if no ContentHandler for the task is registered, simple perform() the task.

Overrides:
execute in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException


Ant Functional Tester -- see Project home page for details