org.apache.anteater.test.matchers
Class Header

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
                                |
                                +--org.apache.anteater.test.matchers.Header
All Implemented Interfaces:
Groupable, ObjectModel, org.apache.tools.ant.TaskContainer

public class Header
extends MatcherTest

Maintains an HTTP header.

Version:
$Revision: 1.13 $ $Date: 2003/01/18 04:09:47 $
Author:
Costin Manolache, Ovidiu Predescu, Jeff Turner

Field Summary
protected  String name
          The name of the header.
protected  String pattern
          Regexp pattern that the header should match.
protected  String value
          The value of the header.
 
Fields inherited from class org.apache.anteater.test.MatcherTest
logger, matcher, objectModel, property
 
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
Header()
           
Header(String name, String value)
          Constructor.
 
Method Summary
 void addText(String body)
          Sets the body text.
static Header create(org.apache.tools.ant.Project proj, String name, String value)
          A factory for creating Headers which have their 'project' field properly set.
 boolean equals(Object another)
           
 String getName()
           
 String getValue()
          Get expected value.
 int hashCode()
           
static Header parseHeaderLine(String line)
           
static void parseHeadersAsString(String s, HashMap headers)
           
 void setName(String v)
           
 void setPattern(String v)
          Sets a regexp pattern that the header should match.
 void setValue(String v)
           
 String toString()
           
static String toString(HashMap headers)
           
 boolean validate()
          Return true if this instance matches against the matchOn object of the matcher.
 
Methods inherited from class org.apache.anteater.test.MatcherTest
getMatchOn, getResult, getText, setAssign, setLogger, setMatcher, setObjectModel, setPropertyValue
 
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, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name
The name of the header.


value

protected String value
The value of the header.


pattern

protected String pattern
Regexp pattern that the header should match.

Constructor Detail

Header

public Header()

Header

public Header(String name,
              String value)
Constructor. Note: Headers created with this will have a null 'project', and so cannot be executed. Use create(org.apache.tools.ant.Project, java.lang.String, java.lang.String) to create a Header owned by a project.

Method Detail

create

public static Header create(org.apache.tools.ant.Project proj,
                            String name,
                            String value)
A factory for creating Headers which have their 'project' field properly set.


getName

public String getName()

setName

public void setName(String v)

getValue

public String getValue()
Get expected value.


setValue

public void setValue(String v)

addText

public void addText(String body)
Description copied from class: MatcherTest
Sets the body text.

Overrides:
addText in class MatcherTest

setPattern

public void setPattern(String v)
Sets a regexp pattern that the header should match.


equals

public boolean equals(Object another)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

parseHeadersAsString

public static void parseHeadersAsString(String s,
                                        HashMap headers)

parseHeaderLine

public static Header parseHeaderLine(String line)

toString

public static String toString(HashMap headers)

validate

public boolean validate()
                 throws org.apache.tools.ant.BuildException
Description copied from class: MatcherTest
Return true if this instance matches against the matchOn object of the matcher.

Specified by:
validate in class MatcherTest
Returns:
a boolean value
org.apache.tools.ant.BuildException


Ant Functional Tester -- see Project home page for details