Package com.sun.ts.lib.harness

# Class EETest

java.lang.Object
com.sun.ts.lib.harness.EETest

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `BaseUrlClient`, `Client`, `secformClient`, `ServiceEETest`

public abstract class EETest extends Object implements Serializable
This abstract class must be extended by all clients of all J2EE-TS tests. All implementations of this class must define a setup, cleanup, and runtest(method names of runtest methods must match the 'testname' tag. EETest uses reflection to invoke these methods which in turn, run the test(s) to completion. Tests are assumed to pass, unless a Fault is thrown.

Author:
  Kyle Grucci
See Also:
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `EETest.Fault`
  This exception must be thrown by all implentations of EETest to signify a test failure.
  `static class`
  `EETest.SetupException`
  This exception is used only by EETest.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected PrintStream`
  `err`
  `protected int`
  `iLogDelaySeconds`
  `protected PrintStream`
  `log`
  `protected String`
  `sTestCase`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EETest()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Status`
  `getPropsReady(String[] argv, Properties p)`
  `protected Properties`
  `getTestPropsFromArgs(String[] argv)`
  `protected Properties`
  `initializeProperties(String sPropertiesFile)`
  `void`
  `logErr(String msg)`
  prints a string to the TestUtil error stream.
  `void`
  `logErr(String msg, Throwable e)`
  prints a string to the TestUtil error stream.
  `void`
  `logMsg(String msg)`
  prints a string to the TestUtil log stream.
  `void`
  `logTrace(String msg)`
  prints a debug string to the TestUtil log stream.
  `void`
  `logTrace(String msg, Throwable e)`
  `Status`
  `run(String[] argv, PrintStream log, PrintStream err)`
  This method is only called when test are run outside of JavaTest.
  `Status`
  `run(String[] argv, PrintWriter log, PrintWriter err)`
  This method is only called when tests are run outside of JavaTest or if the test is being run in the same VM as the harness.
  `Status`
  `run(String[] argv, Properties p)`
  This run method is the one that actually invokes reflection to figure out and invoke the testcase methods.
  `Status`
  `run(String[] argv, Properties p, PrintWriter log, PrintWriter err)`
  This method is only called from JavaTest to run a single testcase.
  `protected Status`
  `runAllTestCases(String[] argv, Properties p, PrintWriter log, PrintWriter err)`
  `protected void`
  `setTestStatus(Status s, Throwable t)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### log

    protected transient PrintStream log

  - ### err

    protected transient PrintStream err

  - ### sTestCase

    protected String sTestCase

  - ### iLogDelaySeconds

    protected int iLogDelaySeconds

- ## Constructor Details

  - ### EETest

    public EETest()

- ## Method Details

  - ### getTestPropsFromArgs

    protected Properties getTestPropsFromArgs(String[] argv)

  - ### initializeProperties

    protected Properties initializeProperties(String sPropertiesFile)

  - ### run

    public Status run(String[] argv, PrintStream log, PrintStream err)
    This method is only called when test are run outside of JavaTest. If a testcase name is passed within argv, then that testcase is run. Otherwise, all testcases within this implementation of EETest are run.
    Parameters:
      `argv` - an array of arguments that a test may use
      `log` - Stream passed to TestUtil for standard loggin
      `err` - Writer passed to TestUtil for error logging
    Returns:
      a Javatest `Status` object (passed or failed)

  - ### run

    public Status run(String[] argv, PrintWriter log, PrintWriter err)
    This method is only called when tests are run outside of JavaTest or if the test is being run in the same VM as the harness. If a testcase name is passed within argv, then that testcase is run. Otherwise, all testcases within this implementation of EETest are run.
    Parameters:
      `argv` - an array of arguments that a test may use
      `log` - Writer passed to TestUtil for standard loggin
      `err` - Writer passed to TestUtil for error logging
    Returns:
      a Javatest `Status` object (passed or failed)

  - ### setTestStatus

    protected void setTestStatus(Status s, Throwable t)

  - ### runAllTestCases

    protected Status runAllTestCases(String[] argv, Properties p, PrintWriter log, PrintWriter err)

  - ### run

    public Status run(String[] argv, Properties p, PrintWriter log, PrintWriter err)
    This method is only called from JavaTest to run a single testcase. All properties are determined from the source code tags.
    Parameters:
      `argv` - an array of arguments that a test may use
      `p` - properties that are used by the testcase
      `log` - stream passed to TestUtil for standard logging
      `err` - stream passed to TestUtil for error logging
    Returns:
      a Javatest Status object (passed or failed)

  - ### getPropsReady

    protected Status getPropsReady(String[] argv, Properties p)

  - ### run

    public Status run(String[] argv, Properties p)
    This run method is the one that actually invokes reflection to figure out and invoke the testcase methods.
    Parameters:
      `argv` - an array of arguments that a test may use
      `p` - properties that are used by the testcase
    Returns:
      a Javatest Status object (passed or failed)

  - ### logMsg

    public void logMsg(String msg)
    prints a string to the TestUtil log stream. All tests should use this method for standard logging messages
    Parameters:
      `msg` - string to print to the log stream

  - ### logTrace

    public void logTrace(String msg)
    prints a debug string to the TestUtil log stream. All tests should use this method for verbose logging messages. Whether or not the string is printed is determined by the last call to the TestUtil setTrace method.
    Parameters:
      `msg` - string to print to the log stream

  - ### logTrace

    public void logTrace(String msg, Throwable e)

  - ### logErr

    public void logErr(String msg)
    prints a string to the TestUtil error stream. All tests should use this method for error messages
    Parameters:
      `msg` - string to print to the error stream

  - ### logErr

    public void logErr(String msg, Throwable e)
    prints a string to the TestUtil error stream. All tests should use this method for error messages
    Parameters:
      `msg` - string to print to the error stream
      `e` - a Throwable whose stacktrace gets printed