org.apache.cactus.internal.client
Class WebClientTestCaseDelegate

java.lang.Object
  extended byjunit.framework.Assert
      extended byorg.apache.cactus.internal.client.ClientTestCaseDelegate
          extended byorg.apache.cactus.internal.client.WebClientTestCaseDelegate

public class WebClientTestCaseDelegate
extends ClientTestCaseDelegate

Delegator extension to support test cases using the HTTP protocol. It adds support for end methods (as they are dependent on the protocol used, which is HTTP here).

Version:
$Id: WebClientTestCaseDelegate.java,v 1.1 2003/07/12 19:31:40 vmassol Exp $
Author:
Vincent Massol

Field Summary
 
Fields inherited from class org.apache.cactus.internal.client.ClientTestCaseDelegate
BEGIN_METHOD_PREFIX, CLIENT_GLOBAL_BEGIN_METHOD, CLIENT_GLOBAL_END_METHOD, END_METHOD_PREFIX, TEST_METHOD_PREFIX
 
Constructor Summary
WebClientTestCaseDelegate(junit.framework.Test theDelegatedTest, junit.framework.Test theWrappedTest, Configuration theConfiguration)
           
 
Method Summary
protected  void callClientGlobalEnd(WebRequest theRequest, java.net.HttpURLConnection theConnection, java.lang.Object theResponse)
          Call the client tear down up method if it exists.
 java.lang.Object callEndMethod(WebRequest theRequest, java.net.HttpURLConnection theConnection)
          Call the test case end method
protected  void runGenericTest(DefaultHttpClient theHttpClient)
          Execute the test case begin method, then connect to the server proxy redirector (where the test case test method is executed) and then executes the test case end method.
 void runTest()
          Runs a test case.
 
Methods inherited from class org.apache.cactus.internal.client.ClientTestCaseDelegate
callBeginMethod, callClientGlobalBegin, getBeginMethodName, getConfiguration, getCurrentTestMethod, getCurrentTestName, getDelegatedTest, getEndMethodName, getLogger, getWrappedTest, getWrappedTestName, isWrappingATest, runBareInit, setConfiguration, setDelegatedTest, setLogger, setWrappedTest
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebClientTestCaseDelegate

public WebClientTestCaseDelegate(junit.framework.Test theDelegatedTest,
                                 junit.framework.Test theWrappedTest,
                                 Configuration theConfiguration)
Parameters:
theDelegatedTest - the test we are delegating for
theWrappedTest - the test being wrapped by this delegator (or null if none)
theConfiguration - the configuration to use
Method Detail

callClientGlobalEnd

protected void callClientGlobalEnd(WebRequest theRequest,
                                   java.net.HttpURLConnection theConnection,
                                   java.lang.Object theResponse)
                            throws java.lang.Throwable
Call the client tear down up method if it exists.

Parameters:
theRequest - the request data that were used to open the connection.
theConnection - the HttpURLConnection that was used to open the connection to the redirection servlet. The response codes, headers, cookies can be checked using the get methods of this object.
theResponse - the Response object if it exists. Can be null in which case it is created from the HttpURLConnection
Throws:
java.lang.Throwable - any error that occurred when calling the method

callEndMethod

public java.lang.Object callEndMethod(WebRequest theRequest,
                                      java.net.HttpURLConnection theConnection)
                               throws java.lang.Throwable
Call the test case end method

Parameters:
theRequest - the request data that were used to open the connection.
theConnection - the HttpURLConnection that was used to open the connection to the redirection servlet. The response codes, headers, cookies can be checked using the get methods of this object.
Returns:
the created WebReponse object (either Cactus or HttpClient)
Throws:
java.lang.Throwable - any error that occurred when calling the end method for the current test case.

runTest

public void runTest()
             throws java.lang.Throwable
Runs a test case. This method is overriden from the JUnit TestCase class in order to seamlessly call the Cactus redirection servlet.

Throws:
java.lang.Throwable - if any error happens during the execution of the test

runGenericTest

protected void runGenericTest(DefaultHttpClient theHttpClient)
                       throws java.lang.Throwable
Execute the test case begin method, then connect to the server proxy redirector (where the test case test method is executed) and then executes the test case end method.

Parameters:
theHttpClient - the HTTP client class to use to connect to the proxy redirector.
Throws:
java.lang.Throwable - any error that occurred when calling the test method for the current test case.


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.