org.jboss.jrunit.decorators
Class JunitThreadDecorator

java.lang.Object
  extended byjunit.framework.TestSuite
      extended byorg.jboss.jrunit.decorators.JunitThreadDecorator
All Implemented Interfaces:
junit.framework.Test, ThreadListener
Direct Known Subclasses:
ThreadLocalDecorator

public class JunitThreadDecorator
extends junit.framework.TestSuite
implements ThreadListener, junit.framework.Test

Decorates a testcase with a number of Threads and Loops *

Author:
Clebert Suconic

Constructor Summary
JunitThreadDecorator(java.lang.Class testClazz, int numberOfThreads, int loops, long timeWait)
           
 
Method Summary
 int countTestCases()
           
 void run(junit.framework.TestResult result)
           
 junit.framework.Test testAt(int index)
           
 void threadFinished(junit.framework.Test test, junit.framework.TestResult result)
          This method is called by JUnitLoopDecorator each time a thread is finished.
 void threadsSetup()
          Called before starting threads
 void threadsTearDown()
          Called when all threads have been finished
 void waitForFinishedThreads()
           
 
Methods inherited from class junit.framework.TestSuite
addTest, addTestSuite, createTest, getName, getTestConstructor, runTest, setName, testCount, tests, toString, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JunitThreadDecorator

public JunitThreadDecorator(java.lang.Class testClazz,
                            int numberOfThreads,
                            int loops,
                            long timeWait)
Method Detail

countTestCases

public int countTestCases()
Specified by:
countTestCases in interface junit.framework.Test

testAt

public junit.framework.Test testAt(int index)

threadFinished

public void threadFinished(junit.framework.Test test,
                           junit.framework.TestResult result)
This method is called by JUnitLoopDecorator each time a thread is finished. By finishing a thread, we will copy results from the Thread-Test to the main result. This is a implementation of the interface ThreadListener.

Specified by:
threadFinished in interface ThreadListener

run

public void run(junit.framework.TestResult result)
Specified by:
run in interface junit.framework.Test

waitForFinishedThreads

public void waitForFinishedThreads()

threadsSetup

public void threadsSetup()
Called before starting threads


threadsTearDown

public void threadsTearDown()
Called when all threads have been finished



JRunit, a JUnit extension for distributed client/server tests.