org.exolab.jmscts.core
Class AbstractTestRunner

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.extensions.TestDecorator
              |
              +--junit.extensions.TestSetup
                    |
                    +--org.exolab.jmscts.core.AbstractTestRunner
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
JMSTestRunner, StressTestRunner

public abstract class AbstractTestRunner
extends junit.extensions.TestSetup

This class enables test cases to be run against different JMS providers

The provider configuration file path is passed at construction. This contains a list of providers to run the tests against.

Parameters

Argument Description Required
config the provider configuration file path No
output the report output directory No
filter the test filter configuration file path No
port the registry port No

Version:
$Revision: 1.7 $ $Date: 2004/01/31 13:44:24 $
Author:
Tim Anderson

Field Summary
static java.lang.String DEFAULT_PORT
          The default registry port
 
Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
AbstractTestRunner(java.lang.Class test, java.lang.String[] args)
          Construct an instance using the class of the test case, and the list of arguments to configure the test suite
AbstractTestRunner(junit.framework.Test test, java.lang.String[] args)
          Construct an instance with the test to run, and the list of arguments to configure the test suite
 
Method Summary
 void abort()
          Generate a report, and abort the test
 void basicRun(junit.framework.TestResult result)
          Runs the test case against each provider
abstract  TestContext createContext()
          Creates a test context
protected  java.lang.String getHome()
          Returns the value of the jmscts.home system property, defaulting to the value of user.dir if its not set
 int getPort()
          Returns the registry port
protected  ProviderLoader getProvider()
          Returns the current provider being tested against
protected  void mergeSuites(junit.framework.TestSuite suite, junit.framework.Test test)
          Removes nested TestSuite instances from test, adding the contained Test instances to suite, in order for the ProviderTestRunner to be invoked successfully.
protected  void registerServices(org.exolab.core.service.ServiceGroup services)
          Register services
abstract  void report(java.lang.String path)
          Generate a report
protected  void setUp()
          Reads the provider configuration
 void snapshot(java.lang.String path)
          Snapshot the current state of the test
protected  void startServices()
          Start the services
 void stop()
          Generate a report and stop the test
protected  void tearDown()
          Clean up any resources allocated
 
Methods inherited from class junit.extensions.TestSetup
run
 
Methods inherited from class junit.extensions.TestDecorator
countTestCases, getTest, toString
 
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, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final java.lang.String DEFAULT_PORT
The default registry port
Constructor Detail

AbstractTestRunner

public AbstractTestRunner(java.lang.Class test,
                          java.lang.String[] args)
Construct an instance using the class of the test case, and the list of arguments to configure the test suite
Parameters:
test - a class implementing the ConnectionFactoryTestCase interface
args - command line arguments

AbstractTestRunner

public AbstractTestRunner(junit.framework.Test test,
                          java.lang.String[] args)
Construct an instance with the test to run, and the list of arguments to configure the test suite
Parameters:
test - the test to run
args - command line arguments
Method Detail

report

public abstract void report(java.lang.String path)
                     throws java.lang.Exception
Generate a report
Parameters:
path - the path to write the report to
Throws:
java.lang.Exception - for any error

snapshot

public void snapshot(java.lang.String path)
              throws java.lang.Exception
Snapshot the current state of the test
Parameters:
path - the path to write the report to
Throws:
java.lang.Exception - for any error

stop

public void stop()
Generate a report and stop the test

abort

public void abort()
Generate a report, and abort the test

createContext

public abstract TestContext createContext()
Creates a test context
Returns:
a new test context

basicRun

public void basicRun(junit.framework.TestResult result)
Runs the test case against each provider
Overrides:
basicRun in class junit.extensions.TestDecorator
Parameters:
result - the instance to collect results in

getPort

public int getPort()
Returns the registry port
Returns:
the registry port

setUp

protected void setUp()
              throws java.lang.Exception
Reads the provider configuration
Overrides:
setUp in class junit.extensions.TestSetup
Throws:
java.lang.Exception - if the configuration cannot be initialised

getProvider

protected ProviderLoader getProvider()
Returns the current provider being tested against
Returns:
the current provider being tested against, or null if no test is being run

tearDown

protected void tearDown()
                 throws java.lang.Exception
Clean up any resources allocated
Overrides:
tearDown in class junit.extensions.TestSetup
Throws:
java.lang.Exception - for any error

startServices

protected void startServices()
                      throws java.lang.Exception
Start the services
Throws:
java.lang.Exception - for any error

registerServices

protected void registerServices(org.exolab.core.service.ServiceGroup services)
                         throws org.exolab.core.service.ServiceException
Register services
Parameters:
services - the service group to register the services with
Throws:
org.exolab.core.service.ServiceException - for any error

getHome

protected java.lang.String getHome()
Returns the value of the jmscts.home system property, defaulting to the value of user.dir if its not set
Returns:
the value of the jmscts.home system property

mergeSuites

protected void mergeSuites(junit.framework.TestSuite suite,
                           junit.framework.Test test)
Removes nested TestSuite instances from test, adding the contained Test instances to suite, in order for the ProviderTestRunner to be invoked successfully.
Parameters:
suite - the resulting test suite
test - if an instance of TestSuite, this method will be called recursively with each contained Test; else the test will be added directly to suite


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.