public class OpenEjbTestContext extends Object implements TestContext
| Modifier and Type | Field and Description |
|---|---|
protected Properties |
contextConfig
Properties object used to initialize InitialContext
|
protected static String |
DEFAULT_CONFIG_FILE_RESOURCE |
protected static String |
LOGIN_CONFIG_RESOURCE |
protected static String |
REALM_PROPERTY_KEY |
| Constructor and Description |
|---|
OpenEjbTestContext(Class clazz)
Constructs a context for a class
|
OpenEjbTestContext(Class clazz,
String securityRole)
Constructs a context for a class
|
OpenEjbTestContext(Method method)
Constructs a context for a method
|
OpenEjbTestContext(Method method,
String securityRole)
Constructs a context for a method
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
configureSecurity(Properties env)
Loads the security configuration into the given Properties object
|
void |
configureTest(Object testObj)
Configures a test instance for this context
|
protected void |
finalize() |
protected Properties |
getContextConfig()
Constructs the configuration needed to create the InitialContext.
|
protected InitialContext |
getInitialContext()
Returns this context's InitialContext, creating it if necessary.
|
protected Object |
getInjectionValue(Field field)
Analyzes the field and returns any values which should be injected on it
|
protected Object |
getOtherTestResource(TestResource resourceConfig)
Override to perform custom resource types injection.
|
protected Class<?> |
getTestClass() |
protected Method |
getTestMethod() |
protected boolean |
loadConfig(Properties env,
ContextConfig contextConfig)
Interprets and loads InitialContext properties from the ContextConfig annotation
|
protected boolean |
loadConfigFile(Properties env,
ContextConfig contextConfig)
Loads the configuration file specified in the
ContextConfig annotation
into the specified Properties instance |
protected boolean |
loadConfigProperties(Properties env,
ContextConfig contextConfig)
Loads the direct properties from the annotation configuration into the given Properties object
|
protected static final String REALM_PROPERTY_KEY
protected static final String LOGIN_CONFIG_RESOURCE
protected static final String DEFAULT_CONFIG_FILE_RESOURCE
protected Properties contextConfig
public OpenEjbTestContext(Class clazz)
testClazz - public OpenEjbTestContext(Method method)
testClazz - method - public OpenEjbTestContext(Class clazz, String securityRole)
testClazz - public void configureTest(Object testObj)
TestContextconfigureTest in interface TestContextprotected void finalize()
throws Throwable
public void close()
close in interface TestContextprotected InitialContext getInitialContext() throws NamingException
NamingExceptionprotected Properties getContextConfig() throws IOException
IOExceptionprotected boolean loadConfig(Properties env, ContextConfig contextConfig) throws IOException
env - contextConfig - IOExceptionprotected boolean loadConfigProperties(Properties env, ContextConfig contextConfig)
env - contextConfig - protected boolean loadConfigFile(Properties env, ContextConfig contextConfig) throws IOException
ContextConfig annotation
into the specified Properties instanceenv - contextConfig - IOExceptionprotected void configureSecurity(Properties env)
env - protected Object getInjectionValue(Field field) throws Exception
field - Exceptionprotected 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 Class<?> getTestClass()
protected Method getTestMethod()
Copyright © 1999–2016 The Apache Software Foundation. All rights reserved.