org.glassfish.fighterfish.test.util
Class AbstractTestObject

java.lang.Object
  extended by org.glassfish.fighterfish.test.util.AbstractTestObject

public abstract class AbstractTestObject
extends java.lang.Object

Author:
Sanjeeb.Sahoo@Sun.COM PAX-EXAM requires each test class to be annotated with RunWith annotation with a value of JUnit4TestRunner. We have also set ExamReactorStrategy as EagerSingleStagedReactorFactory which means for every test method invocation, a new test container instance won't be created. Pax-Exam will create a new test container instance for each TestClass and reuse it for every test method found in that class. Each test can optionally configure the test container by having one or more configuration methods. Each such method must be annotated with Configuration and return an array of Option. The options returned by such a method is used to configure the OSGi framework that's going to be launched by PAX-EXAM. If a test has more than one such methods, then pax-exam will create multiple test container and run the test in each such container. Most of our tests require the OSGi platform to be configured similarly, so we provide this base class as a convenience for our tests. In a lot of way, this shields individual tests from pax-exam details. In addition to providing pax-exam contracts, it also provides some helper methods which are needed in every test. It is not mandatory for tests to extend this class.

Field Summary
protected  org.osgi.framework.BundleContext ctx
           
 
Constructor Summary
AbstractTestObject()
           
 
Method Summary
 org.ops4j.pax.exam.Option[] getPaxExamConfiguration()
          PaxExamJunit driver treats methods in Junit Test class annotated with @Configuration specially.
protected  java.lang.Long getTimeout()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ctx

@Inject
protected org.osgi.framework.BundleContext ctx
Constructor Detail

AbstractTestObject

public AbstractTestObject()
Method Detail

getPaxExamConfiguration

public org.ops4j.pax.exam.Option[] getPaxExamConfiguration()
                                                    throws java.io.IOException
PaxExamJunit driver treats methods in Junit Test class annotated with @Configuration specially. For each such method, it creates a separate test container configuring it with the options as returned by the method.

Returns:
Options used to configure a test container
Throws:
java.io.IOException

getTimeout

protected java.lang.Long getTimeout()


Copyright © 2013. All Rights Reserved.