|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.unitils.core.util.AnnotatedInstanceManager<org.springframework.context.ApplicationContext,SpringApplicationContext>
org.unitils.spring.util.ApplicationContextManager
public class ApplicationContextManager
A class for managing and creating Spring application contexts.
todo javadoc
Field Summary | |
---|---|
protected ApplicationContextFactory |
applicationContextFactory
Factory for creating ApplicationContexts |
Fields inherited from class org.unitils.core.util.AnnotatedInstanceManager |
---|
annotationClass, instanceClass, instances |
Constructor Summary | |
---|---|
ApplicationContextManager(ApplicationContextFactory applicationContextFactory)
Creates a new instance, using the given ApplicationContextFactory . |
Method Summary | |
---|---|
protected org.springframework.context.ApplicationContext |
createInstanceForValues(Object testObject,
Class<?> testClass,
List<String> locations)
Creates a new application context for the given locations. |
protected List<String> |
getAnnotationValues(SpringApplicationContext annotation)
Gets the locations that are specified for the given SpringApplicationContext annotation. |
org.springframework.context.ApplicationContext |
getApplicationContext(Object testObject)
Gets the application context for the given test as described in the class javadoc. |
boolean |
hasApplicationContext(Object testObject)
Checks whether the given test object has an application context linked to it. |
void |
invalidateApplicationContext(Class<?>... classes)
Forces the reloading of the application context the next time that it is requested. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ApplicationContextFactory applicationContextFactory
Constructor Detail |
---|
public ApplicationContextManager(ApplicationContextFactory applicationContextFactory)
ApplicationContextFactory
. The given list of
BeanPostProcessor
s will be registered on all ApplicationContext
s that are
created.
applicationContextFactory
- The factory for creating ApplicationContext
s, not null.Method Detail |
---|
public org.springframework.context.ApplicationContext getApplicationContext(Object testObject)
testObject
- The test instance, not null
public boolean hasApplicationContext(Object testObject)
getApplicationContext(java.lang.Object)
will return an application context, If false is returned, it will raise
an exception.
testObject
- The test instance, not null
public void invalidateApplicationContext(Class<?>... classes)
classes
- The classes for which to reset the contextsprotected org.springframework.context.ApplicationContext createInstanceForValues(Object testObject, Class<?> testClass, List<String> locations)
BeanPostProcessor
s and
refresh the context.
Note: for this to work, the application context may not have been refreshed in the factory.
By registering the bean post processors before the refresh, we can intercept bean creation and bean wiring.
This is no longer possible if the context is already refreshed.
createInstanceForValues
in class AnnotatedInstanceManager<org.springframework.context.ApplicationContext,SpringApplicationContext>
locations
- The locations where to find configuration files, not nulltestObject
- TODOtestClass
- TODO
protected List<String> getAnnotationValues(SpringApplicationContext annotation)
SpringApplicationContext
annotation. An array with
1 empty string should be considered to be empty and null should be returned.
getAnnotationValues
in class AnnotatedInstanceManager<org.springframework.context.ApplicationContext,SpringApplicationContext>
annotation
- The annotation, not null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |