org.apache.tomcat.util.test
Class HttpClient

java.lang.Object
  extended byorg.apache.tomcat.util.test.HttpClient

public class HttpClient
extends java.lang.Object

HttpClient can send requests and execute matchers against the request. This is the main tool that is used to test tomcat's web applications. Typical use:

      
        
        
      
  
Part of GTest - send a Http request.


Constructor Summary
HttpClient()
           
 
Method Summary
 void addGoldenMatch(GoldenMatch m)
           
 void addHeaderMatch(HeaderMatch m)
           
 void addHttpRequest(HttpRequest b)
          Add a request that will be executed.
 void addHttpStatusMatch(HttpStatusMatch m)
           
 void addMatcher(Matcher m)
          Add a matcher.
 void addResponseMatch(ResponseMatch m)
           
 void addResponseMatchFile(ResponseMatchFile m)
           
 void addSessionMatch(SessionMatch m)
           
 Body createComment()
           
 void execute()
           
 java.lang.String getComment()
           
 int getDebug()
           
 Matcher getFailingMatch()
           
 java.lang.String getFailureMessage()
           
 HttpRequest getFirstRequest()
           
static java.util.Hashtable getHttpClients()
          Return one of the "named" clients that have been executed so far.
 java.lang.String getMatchDescription()
           
 org.apache.tools.ant.Project getProject()
           
 boolean getResult()
           
static java.util.Vector getTestFailures()
          Vector of GTest elements, containing all test instances that were run and failed.
static java.util.Vector getTestResults()
          Vector of GTest elements, containing all test instances that were run.
static java.util.Vector getTestSuccess()
          Vector of GTest elements, containing all test instances that were run and failed.
static java.lang.String read(java.io.InputStream input)
          Read a line from the specified servlet input stream, and strip off the trailing carriage return and newline (if any).
 void setDebug(int d)
          Display debug info
 void setDescription(java.lang.String s)
           
 void setId(java.lang.String id)
          Set an unique id to this request.
 void setIf(java.lang.String prop)
           
 void setOutput(java.lang.String t)
           
 void setProject(org.apache.tools.ant.Project p)
           
 void setUnless(java.lang.String prop)
           
 void setWriter(java.io.PrintWriter pw)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClient

public HttpClient()
Method Detail

setProject

public void setProject(org.apache.tools.ant.Project p)

getProject

public org.apache.tools.ant.Project getProject()

setIf

public void setIf(java.lang.String prop)

setUnless

public void setUnless(java.lang.String prop)

setId

public void setId(java.lang.String id)
Set an unique id to this request. This allows it to be referenced later, for complex tests/matchers that look at multiple requests.


setDebug

public void setDebug(int d)
Display debug info


getDebug

public int getDebug()

addHttpRequest

public void addHttpRequest(HttpRequest b)
Add a request that will be executed.


createComment

public Body createComment()

getComment

public java.lang.String getComment()

setDescription

public void setDescription(java.lang.String s)

setWriter

public void setWriter(java.io.PrintWriter pw)

setOutput

public void setOutput(java.lang.String t)

addMatcher

public void addMatcher(Matcher m)
Add a matcher.


addGoldenMatch

public void addGoldenMatch(GoldenMatch m)

addHeaderMatch

public void addHeaderMatch(HeaderMatch m)

addHttpStatusMatch

public void addHttpStatusMatch(HttpStatusMatch m)

addResponseMatch

public void addResponseMatch(ResponseMatch m)

addResponseMatchFile

public void addResponseMatchFile(ResponseMatchFile m)

addSessionMatch

public void addSessionMatch(SessionMatch m)

getFirstRequest

public HttpRequest getFirstRequest()

getFailingMatch

public Matcher getFailingMatch()

getFailureMessage

public java.lang.String getFailureMessage()

getResult

public boolean getResult()

execute

public void execute()

read

public static java.lang.String read(java.io.InputStream input)
                             throws java.io.IOException
Read a line from the specified servlet input stream, and strip off the trailing carriage return and newline (if any). Return the remaining characters that were read as a string.

Throws:
java.io.IOException - if an input/output error occurred

getHttpClients

public static java.util.Hashtable getHttpClients()
Return one of the "named" clients that have been executed so far.


getTestResults

public static java.util.Vector getTestResults()
Vector of GTest elements, containing all test instances that were run.


getTestFailures

public static java.util.Vector getTestFailures()
Vector of GTest elements, containing all test instances that were run and failed.


getTestSuccess

public static java.util.Vector getTestSuccess()
Vector of GTest elements, containing all test instances that were run and failed.


getMatchDescription

public java.lang.String getMatchDescription()


Copyright ? 2001 Apache Software Foundation. All Rights Reserved.