This class provides a wrapper around a JUnit test that will run the test as the subject identified by
LoginContext
passed to the constructor.
The operations performed depend on the context. The default is to simply forward the call to run
to the Test
passed to the constructor.
If, however, the class weblogic.security.Security
is available, the test will be passed to its runAs
method.
While the usage of the test decorator pattern is straightforward, it imposes some problems when an individual test is to be run in an interactive invironment like Eclipse. There, you can select a test class, but you cannot choose to run this test class only after wrapping it in a decorator.
As an alternative usage pattern, you can therefore override the run
method of your test class. This is not trivial, as EJBClientTest.run
must call the super.run
of your test class:
/ * Runs the tests with an appropriate login context. * * @param testResult a TestResult
value */ public void run(final TestResult testResult) { EJBClientTest.run (new Runnable () { public void run () { ProcLifeCycle.super.run (testResult); } }, loginContext, testResult); }
@author
@version $Revision: 1607 $