public class

ReactorManager

extends Object
java.lang.Object
   ↳ org.ops4j.pax.exam.spi.reactors.ReactorManager

Class Overview

Manages the exam system and reactor required by a test driver. This class is a singleton and keeps track of all tests in the current test suite and lets a reactor reuse the Exam system and the test probe, where applicable.

This class was factored out from the JUnit4TestRunner of Pax Exam 2.x and does not depend on JUnit.

TODO check if there are any concurrency issues. Some methods are synchronized, which is just inherited from the 2.1.0 implementation. The use cases are not quite clear.

Summary

Public Methods
void afterClass(StagedExamReactor stagedReactor, Class<?> klass)
void afterSuite(StagedExamReactor stagedReactor)
void beforeClass(StagedExamReactor stagedReactor, Object testClassInstance)
void beforeSuite(StagedExamReactor stagedReactor)
TestProbeBuilder createProbeBuilder(Object testClassInstance)
Lazily creates a probe builder.
synchronized static ReactorManager getInstance()
Returns the singleton ReactorManager instance.
int getNumConfigurations()
Returns the number of configurations for the current reactor.
String getSystemType()
void inject(Object test)
Performs field injection on the given test class instance.
Object lookupTestMethod(TestAddress address)
Looks up a test method for a given address.
synchronized ExamReactor prepareReactor(Class<?> _testClass, Object testClassInstance)
Prepares the unstaged reactor for the given test class instance.
void setAnnotationHandler(AnnotationHandler annotationHandler)
StagedExamReactor stageReactor()
Stages the reactor for the current class.
void storeTestMethod(TestAddress address, Object testMethod)
Stores the test method wrapper for a given test address
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void afterClass (StagedExamReactor stagedReactor, Class<?> klass)

public void afterSuite (StagedExamReactor stagedReactor)

public void beforeClass (StagedExamReactor stagedReactor, Object testClassInstance)

public void beforeSuite (StagedExamReactor stagedReactor)

public TestProbeBuilder createProbeBuilder (Object testClassInstance)

Lazily creates a probe builder. The same probe builder will be reused for all test classes, unless the default builder is overridden in a given class.@return

Throws
IOException
ExamConfigurationException
IOException

public static synchronized ReactorManager getInstance ()

Returns the singleton ReactorManager instance.

public int getNumConfigurations ()

Returns the number of configurations for the current reactor.

Returns
  • number of configurations

public String getSystemType ()

Returns
  • the systemType

public void inject (Object test)

Performs field injection on the given test class instance.

Parameters
test test class instance

public Object lookupTestMethod (TestAddress address)

Looks up a test method for a given address.

Parameters
address test method address used by probe
Returns
  • test method wrapper - the type is only known to the test driver.

public synchronized ExamReactor prepareReactor (Class<?> _testClass, Object testClassInstance)

Prepares the unstaged reactor for the given test class instance. Any configurations from Configuration methods of the class are added to the reactor.@return

Throws
IllegalAccessException
InstantiationException
IOException
InvocationTargetException
IllegalArgumentException
IOException
IllegalAccessException
InstantiationException
InvocationTargetException

public void setAnnotationHandler (AnnotationHandler annotationHandler)

Parameters
annotationHandler the annotationHandler to set

public StagedExamReactor stageReactor ()

Stages the reactor for the current class.

Returns
  • staged reactor
Throws
IOException
InstantiationException
IllegalAccessException
IOException
InstantiationException

public void storeTestMethod (TestAddress address, Object testMethod)

Stores the test method wrapper for a given test address

Parameters
address test method address used by probe
testMethod test method wrapper - the type is only known to the test driver