org.apache.cactus.internal.client.connector.http
Class HttpProtocolHandler

java.lang.Object
  extended by org.apache.cactus.internal.client.connector.http.HttpProtocolHandler
All Implemented Interfaces:
ProtocolHandler

public class HttpProtocolHandler
extends java.lang.Object
implements ProtocolHandler

Implementation for the HTTP protocol. It connects to the redirector proxy using HTTP and passing Cactus information (test case to run, etc) as HTTP GET parameters.

Version:
$Id: HttpProtocolHandler.java 238991 2004-05-22 11:34:50Z vmassol $

Constructor Summary
HttpProtocolHandler(WebConfiguration theConfiguration)
           
 
Method Summary
 void afterTest(ProtocolState theState)
          Let the connector implementor clean up after the test.
 Request createRequest()
          Create a request object that will be passed to the begin() and beginXXX() methods.
 ResponseObjectFactory createResponseObjectFactory(ProtocolState theState)
          Create a factory that is used by the core to create test response object that will be passed to the endXXX() and end() methods.
 ProtocolState runTest(junit.framework.Test theDelegatedTest, junit.framework.Test theWrappedTest, Request theRequest)
          Connect to the server side (to the redirector proxy), passing all information to execute the test there, trigger the test execution and gather the test results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpProtocolHandler

public HttpProtocolHandler(WebConfiguration theConfiguration)
Parameters:
theConfiguration - configuration data
Method Detail

createRequest

public Request createRequest()
Create a request object that will be passed to the begin() and beginXXX() methods. They will in turn enrich it with values set by the user.

Specified by:
createRequest in interface ProtocolHandler
Returns:
the request object
See Also:
ProtocolHandler.createRequest()

runTest

public ProtocolState runTest(junit.framework.Test theDelegatedTest,
                             junit.framework.Test theWrappedTest,
                             Request theRequest)
                      throws java.lang.Throwable
Connect to the server side (to the redirector proxy), passing all information to execute the test there, trigger the test execution and gather the test results.

Specified by:
runTest in interface ProtocolHandler
Parameters:
theDelegatedTest - the Cactus test to execute
theWrappedTest - optionally specify a pure JUnit test case that is being wrapped and will be executed on the server side
theRequest - the request containing data to connect to the redirector proxy
Returns:
an object holding state information that should be preserved and that will be passed to ProtocolHandler.createResponseObjectFactory(org.apache.cactus.spi.client.connector.ProtocolState) and ProtocolHandler.afterTest(org.apache.cactus.spi.client.connector.ProtocolState) later on
Throws:
java.lang.Throwable - any error that occurred when connecting to the server side, when executing the test or when gathering the test result.
See Also:
ProtocolHandler.runTest(Test, Test, Request)

createResponseObjectFactory

public ResponseObjectFactory createResponseObjectFactory(ProtocolState theState)
Create a factory that is used by the core to create test response object that will be passed to the endXXX() and end() methods.

Specified by:
createResponseObjectFactory in interface ProtocolHandler
Parameters:
theState - any state information that has been preserved from the ProtocolHandler.runTest(junit.framework.Test, junit.framework.Test, org.apache.cactus.Request) method (e.g. the HTTP connection object)
Returns:
the response object factory
See Also:
ProtocolHandler.createResponseObjectFactory(ProtocolState)

afterTest

public void afterTest(ProtocolState theState)
               throws java.io.IOException
Let the connector implementor clean up after the test. For example, the HTTP connector implementation closes the HTTP connection if the user has not closed it himself.

Specified by:
afterTest in interface ProtocolHandler
Parameters:
theState - any state information that has been preserved from the ProtocolHandler.runTest(junit.framework.Test, junit.framework.Test, org.apache.cactus.Request) method (e.g. the HTTP connection object)
Throws:
java.io.IOException
See Also:
ProtocolHandler.afterTest(ProtocolState)


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