public class OpenEjbTestContext extends java.lang.Object implements TestContext
Modifier and Type | Field and Description |
---|---|
protected java.util.Properties |
contextConfig
Properties object used to initialize InitialContext
|
protected static java.lang.String |
DEFAULT_CONFIG_FILE_RESOURCE |
protected static java.lang.String |
LOGIN_CONFIG_RESOURCE |
protected static java.lang.String |
REALM_PROPERTY_KEY |
Constructor and Description |
---|
OpenEjbTestContext(java.lang.Class clazz)
Constructs a context for a class
|
OpenEjbTestContext(java.lang.Class clazz,
java.lang.String securityRole)
Constructs a context for a class
|
OpenEjbTestContext(java.lang.reflect.Method method)
Constructs a context for a method
|
OpenEjbTestContext(java.lang.reflect.Method method,
java.lang.String securityRole)
Constructs a context for a method
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
configureSecurity(java.util.Properties env)
Loads the security configuration into the given Properties object
|
void |
configureTest(java.lang.Object testObj)
Configures a test instance for this context
|
protected java.util.Properties |
getContextConfig()
Constructs the configuration needed to create the InitialContext.
|
protected javax.naming.InitialContext |
getInitialContext()
Returns this context's InitialContext, creating it if necessary.
|
protected java.lang.Object |
getInjectionValue(java.lang.reflect.Field field)
Analyzes the field and returns any values which should be injected on it
|
protected java.lang.Object |
getOtherTestResource(TestResource resourceConfig)
Override to perform custom resource types injection.
|
protected java.lang.Class<?> |
getTestClass() |
protected java.lang.reflect.Method |
getTestMethod() |
protected boolean |
loadConfig(java.util.Properties env,
ContextConfig contextConfig)
Interprets and loads InitialContext properties from the ContextConfig annotation
|
protected boolean |
loadConfigFile(java.util.Properties env,
ContextConfig contextConfig)
Loads the configuration file specified in the
ContextConfig annotation
into the specified Properties instance |
protected boolean |
loadConfigProperties(java.util.Properties env,
ContextConfig contextConfig)
Loads the direct properties from the annotation configuration into the given Properties object
|
protected static final java.lang.String REALM_PROPERTY_KEY
protected static final java.lang.String LOGIN_CONFIG_RESOURCE
protected static final java.lang.String DEFAULT_CONFIG_FILE_RESOURCE
protected java.util.Properties contextConfig
public OpenEjbTestContext(java.lang.Class clazz)
clazz
- public OpenEjbTestContext(java.lang.reflect.Method method)
method
- public OpenEjbTestContext(java.lang.Class clazz, java.lang.String securityRole)
clazz
- securityRole
- public OpenEjbTestContext(java.lang.reflect.Method method, java.lang.String securityRole)
method
- securityRole
- public void configureTest(java.lang.Object testObj)
TestContext
configureTest
in interface TestContext
public void close()
close
in interface TestContext
protected javax.naming.InitialContext getInitialContext() throws javax.naming.NamingException
javax.naming.NamingException
protected java.util.Properties getContextConfig() throws java.io.IOException
java.io.IOException
protected boolean loadConfig(java.util.Properties env, ContextConfig contextConfig) throws java.io.IOException
env
- contextConfig
- java.io.IOException
protected boolean loadConfigProperties(java.util.Properties env, ContextConfig contextConfig)
env
- contextConfig
- protected boolean loadConfigFile(java.util.Properties env, ContextConfig contextConfig) throws java.io.IOException
ContextConfig
annotation
into the specified Properties instanceenv
- contextConfig
- java.io.IOException
protected void configureSecurity(java.util.Properties env)
env
- protected java.lang.Object getInjectionValue(java.lang.reflect.Field field) throws java.lang.Exception
field
- java.lang.Exception
protected java.lang.Object getOtherTestResource(TestResource resourceConfig)
TestResource
annotation wasn't
understood by the performInjections(java.lang.Object)
method. This
method will be called, supplying the annotation, and you can then interpret and
create the value to be injected. By default this method just returns null.
You can use this to inject values into annotated fields which contain custom
values in their names.resourceConfig
- protected java.lang.Class<?> getTestClass()
protected java.lang.reflect.Method getTestMethod()