Package | Description |
---|---|
org.springframework.test.context |
This package contains the Spring TestContext Framework which
provides annotation-driven unit and integration testing support that is
agnostic of the actual testing framework in use.
|
org.springframework.test.context.cache |
Support for context caching within the Spring TestContext Framework.
|
org.springframework.test.context.support |
Support classes for the Spring TestContext Framework.
|
org.springframework.test.context.web |
Web support classes for the Spring TestContext Framework.
|
Modifier and Type | Method and Description |
---|---|
MergedContextConfiguration |
TestContextBootstrapper.buildMergedContextConfiguration()
Build the merged context configuration
for the test class in the
BootstrapContext associated with this
bootstrapper. |
MergedContextConfiguration |
MergedContextConfiguration.getParent()
Get the
MergedContextConfiguration for the parent application context
in a context hierarchy. |
Modifier and Type | Method and Description |
---|---|
void |
CacheAwareContextLoaderDelegate.closeContext(MergedContextConfiguration mergedContextConfiguration,
DirtiesContext.HierarchyMode hierarchyMode)
Remove the application context for the
supplied
MergedContextConfiguration from the ContextCache
and close it if it is
an instance of ConfigurableApplicationContext . |
void |
ContextCustomizer.customizeContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedConfig)
Customize the supplied
ConfigurableApplicationContext after
bean definitions have been loaded into the context but before the
context has been refreshed. |
default boolean |
CacheAwareContextLoaderDelegate.isContextLoaded(MergedContextConfiguration mergedContextConfiguration)
Determine if the application context for
the supplied
MergedContextConfiguration has been loaded (i.e.,
is present in the ContextCache ). |
ApplicationContext |
CacheAwareContextLoaderDelegate.loadContext(MergedContextConfiguration mergedContextConfiguration)
Load the application context for the supplied
MergedContextConfiguration by delegating to the ContextLoader
configured in the given MergedContextConfiguration . |
ApplicationContext |
SmartContextLoader.loadContext(MergedContextConfiguration mergedConfig)
Loads a new
context based on the supplied
merged context configuration ,
configures the context, and finally returns the context in a fully
refreshed state. |
Constructor and Description |
---|
MergedContextConfiguration(Class<?> testClass,
String[] locations,
Class<?>[] classes,
Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses,
String[] activeProfiles,
ContextLoader contextLoader,
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate,
MergedContextConfiguration parent)
Create a new
MergedContextConfiguration instance for the
supplied parameters. |
MergedContextConfiguration(Class<?> testClass,
String[] locations,
Class<?>[] classes,
Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses,
String[] activeProfiles,
String[] propertySourceLocations,
String[] propertySourceProperties,
ContextLoader contextLoader,
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate,
MergedContextConfiguration parent)
Create a new
MergedContextConfiguration instance for the
supplied parameters. |
MergedContextConfiguration(Class<?> testClass,
String[] locations,
Class<?>[] classes,
Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses,
String[] activeProfiles,
String[] propertySourceLocations,
String[] propertySourceProperties,
Set<ContextCustomizer> contextCustomizers,
ContextLoader contextLoader,
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate,
MergedContextConfiguration parent)
Create a new
MergedContextConfiguration instance for the
supplied parameters. |
MergedContextConfiguration(MergedContextConfiguration mergedConfig)
Create a new
MergedContextConfiguration instance by copying
all fields from the supplied MergedContextConfiguration . |
Modifier and Type | Method and Description |
---|---|
void |
DefaultCacheAwareContextLoaderDelegate.closeContext(MergedContextConfiguration mergedContextConfiguration,
DirtiesContext.HierarchyMode hierarchyMode) |
boolean |
ContextCache.contains(MergedContextConfiguration key)
Determine whether there is a cached context for the given key.
|
boolean |
DefaultContextCache.contains(MergedContextConfiguration key)
Determine whether there is a cached context for the given key.
|
ApplicationContext |
ContextCache.get(MergedContextConfiguration key)
Obtain a cached
ApplicationContext for the given key. |
ApplicationContext |
DefaultContextCache.get(MergedContextConfiguration key)
Obtain a cached
ApplicationContext for the given key. |
boolean |
DefaultCacheAwareContextLoaderDelegate.isContextLoaded(MergedContextConfiguration mergedContextConfiguration) |
ApplicationContext |
DefaultCacheAwareContextLoaderDelegate.loadContext(MergedContextConfiguration mergedContextConfiguration) |
protected ApplicationContext |
DefaultCacheAwareContextLoaderDelegate.loadContextInternal(MergedContextConfiguration mergedContextConfiguration)
Load the
ApplicationContext for the supplied merged context configuration. |
void |
ContextCache.put(MergedContextConfiguration key,
ApplicationContext context)
Explicitly add an
ApplicationContext instance to the cache
under the given key, potentially honoring a custom eviction policy. |
void |
DefaultContextCache.put(MergedContextConfiguration key,
ApplicationContext context)
Explicitly add an
ApplicationContext instance to the cache
under the given key, potentially honoring a custom eviction policy. |
void |
ContextCache.remove(MergedContextConfiguration key,
DirtiesContext.HierarchyMode hierarchyMode)
Remove the context with the given key from the cache and explicitly
close
it if it is an instance of
ConfigurableApplicationContext . |
void |
DefaultContextCache.remove(MergedContextConfiguration key,
DirtiesContext.HierarchyMode hierarchyMode)
Remove the context with the given key from the cache and explicitly
close
it if it is an instance of
ConfigurableApplicationContext . |
Modifier and Type | Method and Description |
---|---|
MergedContextConfiguration |
AbstractTestContextBootstrapper.buildMergedContextConfiguration()
Build the merged context configuration
for the test class in the
BootstrapContext associated with this
bootstrapper. |
protected MergedContextConfiguration |
AbstractTestContextBootstrapper.processMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Process the supplied, newly instantiated
MergedContextConfiguration instance. |
Modifier and Type | Method and Description |
---|---|
protected void |
AbstractContextLoader.customizeContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedConfig)
Customize the
ConfigurableApplicationContext created by this
ContextLoader after bean definitions have been loaded
into the context but before the context has been refreshed. |
protected void |
AbstractGenericContextLoader.loadBeanDefinitions(GenericApplicationContext context,
MergedContextConfiguration mergedConfig)
Load bean definitions into the supplied
context
from the locations or classes in the supplied MergedContextConfiguration . |
protected void |
AnnotationConfigContextLoader.loadBeanDefinitions(GenericApplicationContext context,
MergedContextConfiguration mergedConfig)
Register classes in the supplied
context
from the classes in the supplied MergedContextConfiguration . |
protected void |
GenericGroovyXmlContextLoader.loadBeanDefinitions(GenericApplicationContext context,
MergedContextConfiguration mergedConfig)
Load bean definitions into the supplied
context
from the locations in the supplied MergedContextConfiguration using a
GroovyBeanDefinitionReader . |
ConfigurableApplicationContext |
AbstractGenericContextLoader.loadContext(MergedContextConfiguration mergedConfig)
Load a Spring ApplicationContext from the supplied
MergedContextConfiguration . |
ApplicationContext |
AbstractDelegatingSmartContextLoader.loadContext(MergedContextConfiguration mergedConfig)
Delegates to an appropriate candidate
SmartContextLoader to load
an ApplicationContext . |
protected void |
AbstractContextLoader.prepareContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedConfig)
Prepare the
ConfigurableApplicationContext created by this
SmartContextLoader before bean definitions are read. |
protected MergedContextConfiguration |
AbstractTestContextBootstrapper.processMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Process the supplied, newly instantiated
MergedContextConfiguration instance. |
protected void |
GenericPropertiesContextLoader.validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Ensure that the supplied
MergedContextConfiguration does not
contain classes . |
protected void |
AbstractGenericContextLoader.validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Validate the supplied
MergedContextConfiguration with respect to
what this context loader supports. |
protected void |
AnnotationConfigContextLoader.validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Ensure that the supplied
MergedContextConfiguration does not
contain locations . |
protected void |
GenericXmlContextLoader.validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Ensure that the supplied
MergedContextConfiguration does not
contain classes . |
Constructor and Description |
---|
DefaultTestContext(Class<?> testClass,
MergedContextConfiguration mergedContextConfiguration,
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate)
Construct a new
DefaultTestContext from the supplied arguments. |
Modifier and Type | Class and Description |
---|---|
class |
WebMergedContextConfiguration
WebMergedContextConfiguration encapsulates the merged
context configuration declared on a test class and all of its superclasses
via @ContextConfiguration ,
@WebAppConfiguration , and
@ActiveProfiles . |
Modifier and Type | Method and Description |
---|---|
protected MergedContextConfiguration |
WebTestContextBootstrapper.processMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Returns a
WebMergedContextConfiguration if the test class in the
supplied MergedContextConfiguration is annotated with
@WebAppConfiguration and otherwise returns
the supplied instance unmodified. |
Modifier and Type | Method and Description |
---|---|
ConfigurableApplicationContext |
AbstractGenericWebContextLoader.loadContext(MergedContextConfiguration mergedConfig)
Load a Spring
WebApplicationContext from the supplied
MergedContextConfiguration . |
protected MergedContextConfiguration |
WebTestContextBootstrapper.processMergedContextConfiguration(MergedContextConfiguration mergedConfig)
Returns a
WebMergedContextConfiguration if the test class in the
supplied MergedContextConfiguration is annotated with
@WebAppConfiguration and otherwise returns
the supplied instance unmodified. |
Constructor and Description |
---|
WebMergedContextConfiguration(Class<?> testClass,
String[] locations,
Class<?>[] classes,
Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses,
String[] activeProfiles,
String[] propertySourceLocations,
String[] propertySourceProperties,
Set<ContextCustomizer> contextCustomizers,
String resourceBasePath,
ContextLoader contextLoader,
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate,
MergedContextConfiguration parent)
Create a new
WebMergedContextConfiguration instance for the
supplied parameters. |
WebMergedContextConfiguration(Class<?> testClass,
String[] locations,
Class<?>[] classes,
Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses,
String[] activeProfiles,
String[] propertySourceLocations,
String[] propertySourceProperties,
String resourceBasePath,
ContextLoader contextLoader,
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate,
MergedContextConfiguration parent)
Create a new
WebMergedContextConfiguration instance for the
supplied parameters. |
WebMergedContextConfiguration(MergedContextConfiguration mergedConfig,
String resourceBasePath)
Create a new
WebMergedContextConfiguration instance by copying
all properties from the supplied MergedContextConfiguration . |