org.sysunit
Class SystemTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.sysunit.SystemTestCase
All Implemented Interfaces:
junit.framework.Test

public class SystemTestCase
extends junit.framework.TestCase

Base for all system tests.

A test with multiple threads of execution (possibly distributed across multiple machines) should descend from SystemTestCase.

Version:
$Id: SystemTestCase.java,v 1.2 2003/06/06 14:09:10 werken Exp $
Author:
Bob McWhirter
See Also:
TBean, TBeanManager, TBeanManagerFactory, TBeanSynchronizer

Constructor Summary
SystemTestCase()
          Construct.
SystemTestCase(String testName)
          Construct.
 
Method Summary
 void addTBeanFactory(String name, TBeanFactory tbeanFactory)
          Add a TBeanFactory to this test.
 void assertValid()
          Perform default post-validation assertion.
 TBeanFactory[] getTBeanFactories()
          Retrieve all TBeanFactorys.
 TBeanFactory getTBeanFactory(String name)
          Retrieve a TBeanFactory by name.
 String[] getTBeanFactoryNames()
          Retrieve an array of TBeanFactory names.
protected  TBeanManager getTBeanManager()
          Retrieve the TBeanManager.
 void runBare()
           
protected  void setTBeanManager(TBeanManager tbeanManager)
           
protected  void setUpTBeans()
          Set up the TBeans.
protected  void sync(String syncPoint)
          Synchronize a synthesized ThreadMethodTBean at a sync-point.
protected  void tearDownTBeans()
          Tear down the TBeans.
 void testSystem()
          Default test.
protected  Throwable[] validateTBeans()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, setUp, tearDown, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SystemTestCase

public SystemTestCase()
Construct.


SystemTestCase

public SystemTestCase(String testName)
Construct.

Parameters:
testName - The name of the test to run.
Method Detail

addTBeanFactory

public void addTBeanFactory(String name,
                            TBeanFactory tbeanFactory)
Add a TBeanFactory to this test.

Parameters:
name - The unique name of the factory.
tbeanFactory - The TBean factory.

getTBeanFactories

public TBeanFactory[] getTBeanFactories()
Retrieve all TBeanFactorys.

Returns:
The array of TBeanFactory objects associated with this test.

getTBeanFactory

public TBeanFactory getTBeanFactory(String name)
Retrieve a TBeanFactory by name.

Parameters:
name - The unique TBeanFactory name.
Returns:
The associated TBeanFactory or null.

getTBeanFactoryNames

public String[] getTBeanFactoryNames()
Retrieve an array of TBeanFactory names.

Returns:
The possibly empty array of registered TBeanFactory names.

runBare

public void runBare()
             throws Throwable
Overrides:
runBare in class junit.framework.TestCase
Throws:
Throwable
See Also:
TestCase

setUpTBeans

protected void setUpTBeans()
                    throws Exception
Set up the TBeans.

Throws:
Exception - If an error occurs.

validateTBeans

protected Throwable[] validateTBeans()
                              throws Exception
Throws:
Exception

tearDownTBeans

protected void tearDownTBeans()
                       throws Exception
Tear down the TBeans.

Throws:
Exception - If an error occurs.

getTBeanManager

protected TBeanManager getTBeanManager()
                                throws Exception
Retrieve the TBeanManager.

This method may create a new TBeanManager using the TBeanManagerFactory the first time it is called.

Returns:
The TBeanManager.
Throws:
Exception - If an error occurs while attempting to instantiate the TBeanManager.
See Also:
TBeanManagerFactory

setTBeanManager

protected void setTBeanManager(TBeanManager tbeanManager)

sync

protected void sync(String syncPoint)
             throws SynchronizationException,
                    InterruptedException
Synchronize a synthesized ThreadMethodTBean at a sync-point.

This method is usable only by reflected/synthesized ThreadMethodTBean instances. It replaces the sync(...) method in AbstractSynchronizableTBean.

This method relies upon ThreadLocal data-structures that are configured by the test-runner.

Parameters:
syncPoint - The sync-point.
Throws:
SynchronizationException - If an error occurs while attempting to perform synchronization.
InterruptedException - If the synchronization is interrupted.
See Also:
AbstractSynchronizableTBean

testSystem

public void testSystem()
                throws Exception
Default test.

This test, by default, performs nothing and only calls assertValid(), which itself is defaultly a no-op. This structure allows the simplest tests to be completely contained within the TBeans or threads.

Throws:
Exception - If an error occurs.
See Also:
assertValid()

assertValid

public void assertValid()
                 throws Exception
Perform default post-validation assertion.

Throws:
Exception - If an error occurs.
See Also:
testSystem()


Copyright © 2003-2010 SpritSoft, Inc.. All Rights Reserved.