Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cactus.internal.server
Class AbstractWebTestCaller

    java.lang.Object
      org.apache.cactus.internal.server.AbstractWebTestCaller

Direct Known Subclasses:
  FilterTestCaller, ServletTestCaller

public abstract class AbstractWebTestCaller
extends java.lang.Object

Responsible for instanciating the `TestCase` class on the server side, set up the implicit objects and call the test method. This class provides a common abstraction for all test web requests.

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

Field Summary
`protected static java.lang.String` | `TEST_RESULTS` Name of the attribute in the `application` scope that will hold the results of the test.
`protected WebImplicitObjects` | `webImplicitObjects` The implicit objects (which will be used to set the test case fields in the `setTesCaseFields` method.

Constructor Summary
`AbstractWebTestCaller(WebImplicitObjects theObjects)`

Method Summary
`void` | `doCreateSession()` Create an HTTP Session and returns the response that contains the HTTP session as a cookie (unless URL rewriting is used in which case the jsesssionid cookie is not returned).
`void` | `doGetResults()` Return the last test results in the HTTP response.
`void` | `doGetVersion()` Return the cactus version.
`void` | `doRunTest()` Run the connection test between client and server.
`void` | `doTest()` Calls a test method.
`protected abstract java.io.Writer` | `getResponseWriter()`
`protected java.lang.Class` | `getTestClassClass(java.lang.String theClassName)`
`protected junit.framework.TestCase` | `getTestClassInstance(java.lang.String theClassName, java.lang.String theWrappedClassName, java.lang.String theTestCaseName)`
`protected java.lang.String` | `getTestClassName()`
`protected java.lang.String` | `getTestMethodName()`
`protected java.lang.String` | `getWrappedTestClassName()`
`protected boolean` | `isAutoSession()`
`protected abstract void` | `setTestCaseFields(junit.framework.TestCase theTestCase)` Sets the implicit object in the test case class

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TEST_RESULTS

    protected static final java.lang.String TEST_RESULTS

  Name of the attribute in the `application` scope that will hold the results of the test.

  See Also:
    Constant Field Values

### webImplicitObjects

    protected WebImplicitObjects webImplicitObjects

  The implicit objects (which will be used to set the test case fields in the `setTesCaseFields` method.

Constructor Detail

### AbstractWebTestCaller

    public AbstractWebTestCaller(WebImplicitObjects theObjects)

Parameters:
  `theObjects` - the implicit objects coming from the redirector

Method Detail

### setTestCaseFields

    protected abstract void setTestCaseFields(junit.framework.TestCase theTestCase)
                                       throws java.lang.Exception

  Sets the implicit object in the test case class

  Parameters:
    `theTestCase` - the instance of the test case class on which the class variable (implicit objects) should be set
  Throws:
    `java.lang.Exception` - if an errors occurs when setting the implicit objects

### getResponseWriter

    protected abstract java.io.Writer getResponseWriter()
                                                 throws java.io.IOException

  Returns:
    a `Writer` object that will be used to return the test result to the client side.
  Throws:
    `java.io.IOException` - if an error occurs when retrieving the writer

### doTest

    public void doTest()
                throws javax.servlet.ServletException

  Calls a test method. The parameters needed to call this method are found in the HTTP request. Save the results in the `application` scope so that the Get Test Result service can find them.

  Throws:
    `javax.servlet.ServletException` - if an unexpected error occurred

### doGetResults

    public void doGetResults()
                      throws javax.servlet.ServletException

  Return the last test results in the HTTP response.

  Throws:
    `javax.servlet.ServletException` - if an unexpected error occurred

### doRunTest

    public void doRunTest()
                   throws javax.servlet.ServletException

  Run the connection test between client and server. This is just to ensure that configuration is set up correctly.

  Throws:
    `javax.servlet.ServletException` - if an unexpected error occurred

### doGetVersion

    public void doGetVersion()
                      throws javax.servlet.ServletException

  Return the cactus version. This is to make sure both the client side and server side are using the same version.

  Throws:
    `javax.servlet.ServletException` - if an unexpected error occurred

### doCreateSession

    public void doCreateSession()
                         throws javax.servlet.ServletException

  Create an HTTP Session and returns the response that contains the HTTP session as a cookie (unless URL rewriting is used in which case the jsesssionid cookie is not returned).

  Throws:
    `javax.servlet.ServletException` - if an unexpected error occurred

### getTestClassName

    protected java.lang.String getTestClassName()
                                         throws javax.servlet.ServletException

  Returns:
    the class to test class name, extracted from the HTTP request
  Throws:
    `javax.servlet.ServletException` - if the class name of the test case is missing from the HTTP request

### getWrappedTestClassName

    protected java.lang.String getWrappedTestClassName()
                                                throws javax.servlet.ServletException

  Returns:
    the optional test class that is wrapped by a Cactus test case, extracted from the HTTP request
  Throws:
    `javax.servlet.ServletException` - if the wrapped class name is missing from the HTTP request

### getTestMethodName

    protected java.lang.String getTestMethodName()
                                          throws javax.servlet.ServletException

  Returns:
    the class method to call for the current test case, extracted from the HTTP request
  Throws:
    `javax.servlet.ServletException` - if the method name of the test case is missing from the HTTP request

### isAutoSession

    protected boolean isAutoSession()

  Returns:
    true if the auto session flag for the Session can be found in the HTTP request

### getTestClassInstance

    protected junit.framework.TestCase getTestClassInstance(java.lang.String theClassName,
                                                            java.lang.String theWrappedClassName,
                                                            java.lang.String theTestCaseName)
                                                     throws javax.servlet.ServletException

  Parameters:
    `theClassName` - the name of the test class
    `theWrappedClassName` - the name of the wrapped test class. Can be null if there is none
    `theTestCaseName` - the name of the current test case
  Returns:
    an instance of the test class to call
  Throws:
    `javax.servlet.ServletException` - if the test case instance for the current test fails to be instanciated (for example if some information is missing from the HTTP request)

### getTestClassClass

    protected java.lang.Class getTestClassClass(java.lang.String theClassName)
                                         throws javax.servlet.ServletException

  Parameters:
    `theClassName` - the name of the test class
  Returns:
    the class object the test class to call
  Throws:
    `javax.servlet.ServletException` - if the class of the current test case cannot be loaded in memory (i.e. it is not in the classpath)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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