Class WebMergedContextConfiguration
- All Implemented Interfaces:
Serializable
WebMergedContextConfiguration encapsulates the merged context
configuration declared on a test class and all of its superclasses and
enclosing classes via
@ContextConfiguration,
@WebAppConfiguration,
@ActiveProfiles, and
@TestPropertySource.
WebMergedContextConfiguration extends the contract of
MergedContextConfiguration by adding support for the resource base path configured via @WebAppConfiguration.
This allows the ContextCache
to properly cache the corresponding WebApplicationContext
that was loaded using properties of this WebMergedContextConfiguration.
- Since:
- 3.2
- Author:
- Sam Brannen
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionWebMergedContextConfiguration(Class<?> testClass, String @Nullable [] locations, Class<?> @Nullable [] classes, @Nullable Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, String @Nullable [] activeProfiles, String @Nullable [] propertySourceLocations, String @Nullable [] propertySourceProperties, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) Deprecated.WebMergedContextConfiguration(Class<?> testClass, String @Nullable [] locations, Class<?> @Nullable [] classes, @Nullable Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, String @Nullable [] activeProfiles, String @Nullable [] propertySourceLocations, String @Nullable [] propertySourceProperties, @Nullable Set<ContextCustomizer> contextCustomizers, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) WebMergedContextConfiguration(Class<?> testClass, String @Nullable [] locations, Class<?> @Nullable [] classes, @Nullable Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, String @Nullable [] activeProfiles, List<PropertySourceDescriptor> propertySourceDescriptors, String @Nullable [] propertySourceProperties, @Nullable Set<ContextCustomizer> contextCustomizers, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) Create a newWebMergedContextConfigurationinstance for the supplied parameters.WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, String resourceBasePath) Create a newWebMergedContextConfigurationinstance by copying all properties from the suppliedMergedContextConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine if the supplied object is equal to thisWebMergedContextConfigurationinstance by comparing both objects' locations, annotated classes, context initializer classes, active profiles, resource base paths, property source descriptors, property source properties, context customizers, parents, and the fully qualified names of theirContextLoaders.Get the resource path to the root directory of the web application for the test class, configured via@WebAppConfiguration.inthashCode()Generate a unique hash code for all properties of thisWebMergedContextConfigurationexcluding the test class.toString()Provide a String representation of the test class, locations, annotated classes, context initializer classes, active profiles, property source descriptors, property source properties, context customizers, resource base path, the name of theContextLoader, and the parent configuration.Methods inherited from class MergedContextConfiguration
getActiveProfiles, getClasses, getContextCustomizers, getContextInitializerClasses, getContextLoader, getLocations, getParent, getParentApplicationContext, getPropertySourceDescriptors, getPropertySourceLocations, getPropertySourceProperties, getTestClass, hasClasses, hasLocations, hasResources, nullSafeClassName, processStrings
-
Constructor Details
-
WebMergedContextConfiguration
public WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, String resourceBasePath) Create a newWebMergedContextConfigurationinstance by copying all properties from the suppliedMergedContextConfiguration.If an empty value is supplied for the
resourceBasePathan empty string will be used.- Parameters:
resourceBasePath- the resource path to the root directory of the web application- Since:
- 4.1
-
WebMergedContextConfiguration
@Deprecated(since="6.1") public WebMergedContextConfiguration(Class<?> testClass, String @Nullable [] locations, Class<?> @Nullable [] classes, @Nullable Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, String @Nullable [] activeProfiles, String @Nullable [] propertySourceLocations, String @Nullable [] propertySourceProperties, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) Deprecated.Create a newWebMergedContextConfigurationinstance for the supplied parameters.If a
nullvalue is supplied forlocations,classes,activeProfiles,propertySourceLocations, orpropertySourcePropertiesan empty array will be stored instead. If anullvalue is supplied for thecontextInitializerClassesan empty set will be stored instead. If an empty value is supplied for theresourceBasePathan empty string will be used. Furthermore, active profiles will be sorted, and duplicate profiles will be removed.- Parameters:
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 mergedPropertySourcelocationspropertySourceProperties- the mergedPropertySourcepropertiesresourceBasePath- the resource path to the root directory of the web applicationcontextLoader- the resolvedContextLoadercacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parent contextparent- the parent configuration ornullif there is no parent- Since:
- 4.1
-
WebMergedContextConfiguration
@Deprecated(since="6.1") public WebMergedContextConfiguration(Class<?> testClass, String @Nullable [] locations, Class<?> @Nullable [] classes, @Nullable Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, String @Nullable [] activeProfiles, String @Nullable [] propertySourceLocations, String @Nullable [] propertySourceProperties, @Nullable Set<ContextCustomizer> contextCustomizers, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) Deprecated.Create a newWebMergedContextConfigurationinstance for the supplied parameters.If a
nullvalue is supplied forlocations,classes,activeProfiles,propertySourceLocations, orpropertySourcePropertiesan empty array will be stored instead. If anullvalue is supplied forcontextInitializerClassesorcontextCustomizers, an empty set will be stored instead. If an empty value is supplied for theresourceBasePathan empty string will be used. Furthermore, active profiles will be sorted, and duplicate profiles will be removed.- Parameters:
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 mergedPropertySourcelocationspropertySourceProperties- the mergedPropertySourcepropertiescontextCustomizers- the context customizersresourceBasePath- the resource path to the root directory of the web applicationcontextLoader- the resolvedContextLoadercacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parent contextparent- the parent configuration ornullif there is no parent- Since:
- 4.3
-
WebMergedContextConfiguration
public WebMergedContextConfiguration(Class<?> testClass, String @Nullable [] locations, Class<?> @Nullable [] classes, @Nullable Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, String @Nullable [] activeProfiles, List<PropertySourceDescriptor> propertySourceDescriptors, String @Nullable [] propertySourceProperties, @Nullable Set<ContextCustomizer> contextCustomizers, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) Create a newWebMergedContextConfigurationinstance for the supplied parameters.If a
nullvalue is supplied forlocations,classes,activeProfiles, orpropertySourcePropertiesan empty array will be stored instead. If anullvalue is supplied forcontextInitializerClassesorcontextCustomizers, an empty set will be stored instead. Furthermore, active profiles will be sorted, and duplicate profiles will be removed.- Parameters:
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 profilespropertySourceDescriptors- the merged property source descriptorspropertySourceProperties- the merged inlined propertiescontextCustomizers- the context customizersresourceBasePath- the resource path to the root directory of the web applicationcontextLoader- the resolvedContextLoadercacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parentApplicationContextparent- the parent configuration ornullif there is no parent- Since:
- 6.1
-
-
Method Details
-
getResourceBasePath
Get the resource path to the root directory of the web application for the test class, configured via@WebAppConfiguration.- See Also:
-
equals
Determine if the supplied object is equal to thisWebMergedContextConfigurationinstance by comparing both objects' locations, annotated classes, context initializer classes, active profiles, resource base paths, property source descriptors, property source properties, context customizers, parents, and the fully qualified names of theirContextLoaders.- Overrides:
equalsin classMergedContextConfiguration
-
hashCode
public int hashCode()Generate a unique hash code for all properties of thisWebMergedContextConfigurationexcluding the test class.- Overrides:
hashCodein classMergedContextConfiguration
-
toString
Provide a String representation of the test class, locations, annotated classes, context initializer classes, active profiles, property source descriptors, property source properties, context customizers, resource base path, the name of theContextLoader, and the parent configuration.- Overrides:
toStringin classMergedContextConfiguration
-
WebMergedContextConfiguration(Class, String[], Class[], Set, String[], List, String[], Set, String, ContextLoader, CacheAwareContextLoaderDelegate, MergedContextConfiguration)