public class WebMergedContextConfiguration extends MergedContextConfiguration
WebMergedContextConfiguration
encapsulates the merged
context configuration declared on a test class and all of its superclasses
via @ContextConfiguration
,
@WebAppConfiguration
, and
@ActiveProfiles
.
WebMergedContextConfiguration
extends the contract of
MergedContextConfiguration
by adding support for the resource base path
configured via @WebAppConfiguration
.
This allows the TestContext
to properly cache the corresponding WebApplicationContext
that was loaded using properties of this WebMergedContextConfiguration
.
WebAppConfiguration
,
MergedContextConfiguration
,
ContextConfiguration
,
ActiveProfiles
,
ContextConfigurationAttributes
,
SmartContextLoader.loadContext(MergedContextConfiguration)
,
Serialized FormConstructor and Description |
---|
WebMergedContextConfiguration(java.lang.Class<?> testClass,
java.lang.String[] locations,
java.lang.Class<?>[] classes,
java.util.Set<java.lang.Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses,
java.lang.String[] activeProfiles,
java.lang.String[] propertySourceLocations,
java.lang.String[] propertySourceProperties,
java.util.Set<ContextCustomizer> contextCustomizers,
java.lang.String resourceBasePath,
ContextLoader contextLoader,
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate,
MergedContextConfiguration parent)
Create a new
WebMergedContextConfiguration instance for the
supplied parameters. |
WebMergedContextConfiguration(java.lang.Class<?> testClass,
java.lang.String[] locations,
java.lang.Class<?>[] classes,
java.util.Set<java.lang.Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses,
java.lang.String[] activeProfiles,
java.lang.String[] propertySourceLocations,
java.lang.String[] propertySourceProperties,
java.lang.String resourceBasePath,
ContextLoader contextLoader,
CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate,
MergedContextConfiguration parent)
Create a new
WebMergedContextConfiguration instance for the
supplied parameters. |
WebMergedContextConfiguration(MergedContextConfiguration mergedConfig,
java.lang.String resourceBasePath)
Create a new
WebMergedContextConfiguration instance by copying
all properties from the supplied MergedContextConfiguration . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other)
Determine if the supplied object is equal to this
WebMergedContextConfiguration
instance by comparing both object's locations,
annotated classes,
context initializer classes,
active profiles,
resource base path,
parents, and the fully qualified names of their
ContextLoaders . |
java.lang.String |
getResourceBasePath()
Get the resource path to the root directory of the web application for the
test class, configured via
@WebAppConfiguration . |
int |
hashCode()
Generate a unique hash code for all properties of this
WebMergedContextConfiguration excluding the
test class. |
java.lang.String |
toString()
Provide a String representation of the test class,
locations, annotated classes,
context initializer classes,
active profiles,
property source locations,
property source properties,
context customizers,
resource base path, the name of the
ContextLoader , and the
parent configuration. |
getActiveProfiles, getClasses, getContextCustomizers, getContextInitializerClasses, getContextLoader, getLocations, getParent, getParentApplicationContext, getPropertySourceLocations, getPropertySourceProperties, getTestClass, hasClasses, hasLocations, hasResources, nullSafeClassName
public WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, java.lang.String resourceBasePath)
WebMergedContextConfiguration
instance by copying
all properties from the supplied MergedContextConfiguration
.
If an empty value is supplied for the resourceBasePath
an empty string will be used.
resourceBasePath
- the resource path to the root directory of the web applicationpublic WebMergedContextConfiguration(java.lang.Class<?> testClass, @Nullable java.lang.String[] locations, @Nullable java.lang.Class<?>[] classes, @Nullable java.util.Set<java.lang.Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, @Nullable java.lang.String[] activeProfiles, @Nullable java.lang.String[] propertySourceLocations, @Nullable java.lang.String[] propertySourceProperties, java.lang.String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent)
WebMergedContextConfiguration
instance for the
supplied parameters.
If a null
value is supplied for locations
,
classes
, activeProfiles
, propertySourceLocations
,
or propertySourceProperties
an empty array will be stored instead.
If a null
value is supplied for the
contextInitializerClasses
an empty set will be stored instead.
If an empty value is supplied for the resourceBasePath
an empty string will be used. Furthermore, active profiles will be sorted,
and duplicate profiles will be removed.
testClass
- the test class for which the configuration was mergedlocations
- the merged resource locationsclasses
- the merged annotated classescontextInitializerClasses
- the merged context initializer classesactiveProfiles
- the merged active bean definition profilespropertySourceLocations
- the merged PropertySource
locationspropertySourceProperties
- the merged PropertySource
propertiesresourceBasePath
- the resource path to the root directory of the web applicationcontextLoader
- the resolved ContextLoader
cacheAwareContextLoaderDelegate
- a cache-aware context loader
delegate with which to retrieve the parent contextparent
- the parent configuration or null
if there is no parentpublic WebMergedContextConfiguration(java.lang.Class<?> testClass, @Nullable java.lang.String[] locations, @Nullable java.lang.Class<?>[] classes, @Nullable java.util.Set<java.lang.Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, @Nullable java.lang.String[] activeProfiles, @Nullable java.lang.String[] propertySourceLocations, @Nullable java.lang.String[] propertySourceProperties, @Nullable java.util.Set<ContextCustomizer> contextCustomizers, java.lang.String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent)
WebMergedContextConfiguration
instance for the
supplied parameters.
If a null
value is supplied for locations
,
classes
, activeProfiles
, propertySourceLocations
,
or propertySourceProperties
an empty array will be stored instead.
If a null
value is supplied for contextInitializerClasses
or contextCustomizers
, an empty set will be stored instead.
If an empty value is supplied for the resourceBasePath
an empty string will be used. Furthermore, active profiles will be sorted,
and duplicate profiles will be removed.
testClass
- the test class for which the configuration was mergedlocations
- the merged context resource locationsclasses
- the merged annotated classescontextInitializerClasses
- the merged context initializer classesactiveProfiles
- the merged active bean definition profilespropertySourceLocations
- the merged PropertySource
locationspropertySourceProperties
- the merged PropertySource
propertiescontextCustomizers
- the context customizersresourceBasePath
- the resource path to the root directory of the web applicationcontextLoader
- the resolved ContextLoader
cacheAwareContextLoaderDelegate
- a cache-aware context loader
delegate with which to retrieve the parent contextparent
- the parent configuration or null
if there is no parentpublic java.lang.String getResourceBasePath()
@WebAppConfiguration
.WebAppConfiguration
public boolean equals(@Nullable java.lang.Object other)
WebMergedContextConfiguration
instance by comparing both object's locations,
annotated classes,
context initializer classes,
active profiles,
resource base path,
parents, and the fully qualified names of their
ContextLoaders
.equals
in class MergedContextConfiguration
public int hashCode()
WebMergedContextConfiguration
excluding the
test class.hashCode
in class MergedContextConfiguration
public java.lang.String toString()
ContextLoader
, and the
parent configuration.toString
in class MergedContextConfiguration