org.apache.anteater.test
Class MatcherTest

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.anteater.test.BaseTask
                    |
                    +--org.apache.anteater.test.ContentHandlerTask
                          |
                          +--org.apache.anteater.test.MatcherTest
All Implemented Interfaces:
Groupable, ObjectModel, org.apache.tools.ant.TaskContainer
Direct Known Subclasses:
Blob, ContentEquals, Header, Jing, Method, Parameter, Regexp, ResponseCode, Template, XPath

public abstract class MatcherTest
extends ContentHandlerTask
implements ObjectModel

Matches an object against another. This class is the parent of all Matcher Tests, which make up the majority of Anteater tasks. This class contains some fields common to all matcher tests ('assign' property, body content, owner Matcher, object model).

A MatcherTest's lifecycle consists of the methods:

A MatcherTest is owned and taken through it's lifecycle by a Matcher element. This corresponds to how <match> elements contain nested tests.

Version:
$Revision: 1.12 $ $Date: 2002/10/04 14:26:22 $
Author:
Costin Manolache, Ovidiu Predescu, Jeff Turner

Field Summary
protected  Logger logger
           
protected  Matcher matcher
          The container of this matcher.
protected  Map objectModel
          The object model inherited from our container, usually a Matcher.
protected  String property
          The Ant property name under which the value of the matching object should be stored.
 
Fields inherited from class org.apache.anteater.test.ContentHandlerTask
handlerFactory, matcherTests
 
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
 
Fields inherited from interface org.apache.anteater.test.ObjectModel
NAMESPACES_KEY, PROPERTIES_KEY
 
Constructor Summary
MatcherTest()
           
 
Method Summary
 void addText(String text)
          Sets the body text.
 Object getMatchOn()
           
 boolean getResult()
           
protected  String getText()
          Retrieves the body text.
 void setAssign(String name)
           
 void setLogger(Logger logger)
           
 void setMatcher(Matcher parent)
           
 void setObjectModel(Map objectModel)
          Set the context in the receiving object.
protected  void setPropertyValue(String value)
          Called by subclasses to set the 'assign' property to a value from the matched object.
abstract  boolean validate()
          Return true if this instance matches against the matchOn object of the matcher.
 
Methods inherited from class org.apache.anteater.test.ContentHandlerTask
addTask, execute
 
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

matcher

protected Matcher matcher
The container of this matcher.


property

protected String property
The Ant property name under which the value of the matching object should be stored.


objectModel

protected Map objectModel
The object model inherited from our container, usually a Matcher.


logger

protected Logger logger
Constructor Detail

MatcherTest

public MatcherTest()
Method Detail

addText

public void addText(String text)
             throws org.apache.tools.ant.BuildException
Sets the body text.

Specified by:
addText in class ContentHandlerTask
org.apache.tools.ant.BuildException

getText

protected String getText()
Retrieves the body text.


setObjectModel

public void setObjectModel(Map objectModel)
Description copied from interface: ObjectModel
Set the context in the receiving object.

Specified by:
setObjectModel in interface ObjectModel
Parameters:
objectModel - a HashMap value

setLogger

public void setLogger(Logger logger)

setMatcher

public void setMatcher(Matcher parent)

setAssign

public void setAssign(String name)

setPropertyValue

protected void setPropertyValue(String value)
Called by subclasses to set the 'assign' property to a value from the matched object. Idempotent.


getMatchOn

public Object getMatchOn()

validate

public abstract boolean validate()
                          throws org.apache.tools.ant.BuildException
Return true if this instance matches against the matchOn object of the matcher.

Returns:
a boolean value
org.apache.tools.ant.BuildException

getResult

public boolean getResult()


Ant Functional Tester -- see Project home page for details