Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.cactus.internal.client
Class ClientTestCaseCaller  view ClientTestCaseCaller download ClientTestCaseCaller.java

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

public class ClientTestCaseCaller
extends junit.framework.Assert

Provides the ability to run common code before and after each test on the client side. All the methods provided are independent of any communication protocol between client side and server side (HTTP, JMS, etc). Any protocol dependent methods must be provided and implemented in the org.apache.cactus.spi.client.connector.ProtocolHandler implementation class.

Version:
$Id: ClientTestCaseCaller.java,v 1.1 2004/05/22 11:34:47 vmassol Exp $

Field Summary
protected static java.lang.String BEGIN_METHOD_PREFIX
          The prefix of a begin test method.
protected static java.lang.String CLIENT_GLOBAL_BEGIN_METHOD
          The name of the method that is called before each test on the client side (if it exists).
protected static java.lang.String CLIENT_GLOBAL_END_METHOD
          The name of the method that is called after each test on the client side (if it exists).
private  junit.framework.Test delegatedTest
          The test we are delegating for.
protected static java.lang.String END_METHOD_PREFIX
          The prefix of an end test method.
private  org.apache.commons.logging.Log logger
          The logger (only used on the client side).
private  org.apache.cactus.spi.client.connector.ProtocolHandler protocolHandler
          The protocol handler to use to execute the tests on the server side.
protected static java.lang.String TEST_METHOD_PREFIX
          The prefix of a test method.
private  junit.framework.Test wrappedTest
          Pure JUnit Test Case that we are wrapping (if any)
 
Constructor Summary
ClientTestCaseCaller(junit.framework.Test theDelegatedTest, junit.framework.Test theWrappedTest, org.apache.cactus.spi.client.connector.ProtocolHandler theProtocolHandler)
           
 
Method Summary
 void callBeginMethod(org.apache.cactus.Request theRequest)
          Call the test case begin method.
 java.lang.Object callEndMethod(org.apache.cactus.Request theRequest, org.apache.cactus.spi.client.ResponseObjectFactory theResponseFactory)
          Call the test case end method
private  void callGenericBeginMethod(org.apache.cactus.Request theRequest, java.lang.String theMethodName)
          Call a begin method which takes Cactus WebRequest as parameter
private  java.lang.Object callGenericEndMethod(org.apache.cactus.Request theRequest, org.apache.cactus.spi.client.ResponseObjectFactory theResponseFactory, java.lang.String theMethodName, java.lang.Object theResponse)
          Call the global end method.
 void callGlobalBeginMethod(org.apache.cactus.Request theRequest)
          Call the global begin method.
private  void callGlobalEndMethod(org.apache.cactus.Request theRequest, org.apache.cactus.spi.client.ResponseObjectFactory theResponseFactory, java.lang.Object theResponse)
          Call the client tear down up method if it exists.
private  java.lang.String getBaseMethodName()
           
private  java.lang.String getBeginMethodName()
           
private  java.lang.String getCurrentTestName()
           
private  junit.framework.Test getDelegatedTest()
           
private  java.lang.String getEndMethodName()
           
 org.apache.commons.logging.Log getLogger()
           
private  junit.framework.Test getTest()
           
private  junit.framework.Test getWrappedTest()
           
 void runBareInit()
          Perform client side initializations before each test, such as re-initializating the logger and printing some logging information.
 void runTest()
          Execute begin and end methods and calls the different org.apache.cactus.spi.client.connector.ProtocolHandler lifecycle methods to execute the test on the server side.
private  void setDelegatedTest(junit.framework.Test theDelegatedTest)
           
private  void setWrappedTest(junit.framework.Test theWrappedTest)
           
 
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
 

Field Detail

TEST_METHOD_PREFIX

protected static final java.lang.String TEST_METHOD_PREFIX
The prefix of a test method.

See Also:
Constant Field Values

BEGIN_METHOD_PREFIX

protected static final java.lang.String BEGIN_METHOD_PREFIX
The prefix of a begin test method.

See Also:
Constant Field Values

END_METHOD_PREFIX

protected static final java.lang.String END_METHOD_PREFIX
The prefix of an end test method.

See Also:
Constant Field Values

CLIENT_GLOBAL_BEGIN_METHOD

protected static final java.lang.String CLIENT_GLOBAL_BEGIN_METHOD
The name of the method that is called before each test on the client side (if it exists).

See Also:
Constant Field Values

CLIENT_GLOBAL_END_METHOD

protected static final java.lang.String CLIENT_GLOBAL_END_METHOD
The name of the method that is called after each test on the client side (if it exists).

See Also:
Constant Field Values

logger

private org.apache.commons.logging.Log logger
The logger (only used on the client side).


wrappedTest

private junit.framework.Test wrappedTest
Pure JUnit Test Case that we are wrapping (if any)


delegatedTest

private junit.framework.Test delegatedTest
The test we are delegating for.


protocolHandler

private org.apache.cactus.spi.client.connector.ProtocolHandler protocolHandler
The protocol handler to use to execute the tests on the server side.

Constructor Detail

ClientTestCaseCaller

public ClientTestCaseCaller(junit.framework.Test theDelegatedTest,
                            junit.framework.Test theWrappedTest,
                            org.apache.cactus.spi.client.connector.ProtocolHandler theProtocolHandler)
Method Detail

runTest

public void runTest()
             throws java.lang.Throwable
Execute begin and end methods and calls the different org.apache.cactus.spi.client.connector.ProtocolHandler lifecycle methods to execute the test on the server side. Note that this method is overriden from the JUnit junit.framework.TestCase class in order to prevent JUnit from calling the TestCase.setUp()>TestCase.setUp() 55 and TestCase.tearDown()>TestCase.tearDown() 55 methods on the client side. instead we are calling the server redirector proxy and the setup and teardown methods will be executed on the server side.


getLogger

public final org.apache.commons.logging.Log getLogger()

runBareInit

public void runBareInit()
Perform client side initializations before each test, such as re-initializating the logger and printing some logging information.


callBeginMethod

public void callBeginMethod(org.apache.cactus.Request theRequest)
                     throws java.lang.Throwable
Call the test case begin method.


callEndMethod

public java.lang.Object callEndMethod(org.apache.cactus.Request theRequest,
                                      org.apache.cactus.spi.client.ResponseObjectFactory theResponseFactory)
                               throws java.lang.Throwable
Call the test case end method


callGlobalBeginMethod

public void callGlobalBeginMethod(org.apache.cactus.Request theRequest)
                           throws java.lang.Throwable
Call the global begin method. This is the method that is called before each test if it exists. It is called on the client side only.


callGlobalEndMethod

private void callGlobalEndMethod(org.apache.cactus.Request theRequest,
                                 org.apache.cactus.spi.client.ResponseObjectFactory theResponseFactory,
                                 java.lang.Object theResponse)
                          throws java.lang.Throwable
Call the client tear down up method if it exists.


setWrappedTest

private void setWrappedTest(junit.framework.Test theWrappedTest)

setDelegatedTest

private void setDelegatedTest(junit.framework.Test theDelegatedTest)

getWrappedTest

private junit.framework.Test getWrappedTest()

getDelegatedTest

private junit.framework.Test getDelegatedTest()

getTest

private junit.framework.Test getTest()

getBaseMethodName

private java.lang.String getBaseMethodName()

getBeginMethodName

private java.lang.String getBeginMethodName()

getEndMethodName

private java.lang.String getEndMethodName()

callGenericBeginMethod

private void callGenericBeginMethod(org.apache.cactus.Request theRequest,
                                    java.lang.String theMethodName)
                             throws java.lang.Throwable
Call a begin method which takes Cactus WebRequest as parameter


callGenericEndMethod

private java.lang.Object callGenericEndMethod(org.apache.cactus.Request theRequest,
                                              org.apache.cactus.spi.client.ResponseObjectFactory theResponseFactory,
                                              java.lang.String theMethodName,
                                              java.lang.Object theResponse)
                                       throws java.lang.Throwable
Call the global end method. This is the method that is called after each test if it exists. It is called on the client side only.


getCurrentTestName

private java.lang.String getCurrentTestName()