Merge branch '5.3.x'
# Conflicts: # spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java # spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java # spring-test/src/main/java/org/springframework/test/context/jdbc/Sql.java # spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java
This commit is contained in:
commit
90e0bd146a
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -34,8 +34,8 @@ import java.lang.annotation.Target;
|
|||
*
|
||||
* <p>When declared as a class-level annotation, {@code @Commit} defines
|
||||
* the default commit semantics for all test methods within the test class
|
||||
* hierarchy. When declared as a method-level annotation, {@code @Commit}
|
||||
* defines commit semantics for the specific test method, potentially
|
||||
* hierarchy or nested class hierarchy. When declared as a method-level annotation,
|
||||
* {@code @Commit} defines commit semantics for the specific test method, potentially
|
||||
* overriding class-level default commit or rollback semantics.
|
||||
*
|
||||
* <p><strong>Warning</strong>: {@code @Commit} can be used as direct
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -34,9 +34,9 @@ import java.lang.annotation.Target;
|
|||
*
|
||||
* <p>When declared as a class-level annotation, {@code @Rollback} defines
|
||||
* the default rollback semantics for all test methods within the test class
|
||||
* hierarchy. When declared as a method-level annotation, {@code @Rollback}
|
||||
* defines rollback semantics for the specific test method, potentially
|
||||
* overriding class-level default commit or rollback semantics.
|
||||
* hierarchy or nested class hierarchy. When declared as a method-level annotation,
|
||||
* {@code @Rollback} defines rollback semantics for the specific test method,
|
||||
* potentially overriding class-level default commit or rollback semantics.
|
||||
*
|
||||
* <p>As of Spring Framework 4.2, {@code @Commit} can be used as direct
|
||||
* replacement for {@code @Rollback(false)}.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -78,17 +78,17 @@ public @interface ActiveProfiles {
|
|||
Class<? extends ActiveProfilesResolver> resolver() default ActiveProfilesResolver.class;
|
||||
|
||||
/**
|
||||
* Whether or not bean definition profiles from superclasses should be
|
||||
* <em>inherited</em>.
|
||||
* <p>The default value is {@code true}, which means that a test
|
||||
* class will <em>inherit</em> bean definition profiles defined by a
|
||||
* test superclass. Specifically, the bean definition profiles for a test
|
||||
* class will be appended to the list of bean definition profiles
|
||||
* defined by a test superclass. Thus, subclasses have the option of
|
||||
* <em>extending</em> the list of bean definition profiles.
|
||||
* <p>If {@code inheritProfiles} is set to {@code false}, the bean
|
||||
* definition profiles for the test class will <em>shadow</em> and
|
||||
* effectively replace any bean definition profiles defined by a superclass.
|
||||
* Whether or not bean definition profiles from superclasses and enclosing
|
||||
* classes should be <em>inherited</em>.
|
||||
* <p>The default value is {@code true}, which means that a test class will
|
||||
* <em>inherit</em> bean definition profiles defined by a test superclass or
|
||||
* enclosing class. Specifically, the bean definition profiles for a test
|
||||
* class will be appended to the list of bean definition profiles defined by
|
||||
* a test superclass or enclosing class. Thus, subclasses and nested classes
|
||||
* have the option of <em>extending</em> the list of bean definition profiles.
|
||||
* <p>If {@code inheritProfiles} is set to {@code false}, the bean definition
|
||||
* profiles for the test class will <em>shadow</em> and effectively replace
|
||||
* any bean definition profiles defined by a superclass or enclosing class.
|
||||
* <p>In the following example, the {@code ApplicationContext} for
|
||||
* {@code BaseTest} will be loaded using only the "base"
|
||||
* bean definition profile; beans defined in the "extended" profile
|
||||
|
|
|
@ -171,18 +171,19 @@ public @interface ContextConfiguration {
|
|||
/**
|
||||
* Whether {@linkplain #locations resource locations} or
|
||||
* {@linkplain #classes <em>component classes</em>} from test superclasses
|
||||
* should be <em>inherited</em>.
|
||||
* and enclosing classes should be <em>inherited</em>.
|
||||
* <p>The default value is {@code true}. This means that an annotated test
|
||||
* class will <em>inherit</em> the resource locations or component classes
|
||||
* defined by test superclasses. Specifically, the resource locations or
|
||||
* component classes for a given test class will be appended to the list of
|
||||
* resource locations or component classes defined by test superclasses.
|
||||
* Thus, subclasses have the option of <em>extending</em> the list of resource
|
||||
* defined by test superclasses and enclosing classes. Specifically, the
|
||||
* resource locations or component classes for a given test class will be
|
||||
* appended to the list of resource locations or component classes defined
|
||||
* by test superclasses and enclosing classes. Thus, subclasses and nested
|
||||
* classes have the option of <em>extending</em> the list of resource
|
||||
* locations or component classes.
|
||||
* <p>If {@code inheritLocations} is set to {@code false}, the
|
||||
* resource locations or component classes for the annotated test class
|
||||
* will <em>shadow</em> and effectively replace any resource locations
|
||||
* or component classes defined by superclasses.
|
||||
* or component classes defined by superclasses and enclosing classes.
|
||||
* <p>In the following example that uses path-based resource locations, the
|
||||
* {@link org.springframework.context.ApplicationContext ApplicationContext}
|
||||
* for {@code ExtendedTest} will be loaded from
|
||||
|
@ -225,16 +226,16 @@ public @interface ContextConfiguration {
|
|||
|
||||
/**
|
||||
* Whether {@linkplain #initializers context initializers} from test
|
||||
* superclasses should be <em>inherited</em>.
|
||||
* superclasses and enclosing classes should be <em>inherited</em>.
|
||||
* <p>The default value is {@code true}. This means that an annotated test
|
||||
* class will <em>inherit</em> the application context initializers defined
|
||||
* by test superclasses. Specifically, the initializers for a given test
|
||||
* class will be added to the set of initializers defined by test
|
||||
* superclasses. Thus, subclasses have the option of <em>extending</em> the
|
||||
* set of initializers.
|
||||
* by test superclasses and enclosing classes. Specifically, the initializers
|
||||
* for a given test class will be added to the set of initializers defined by
|
||||
* test superclasses and enclosing classes. Thus, subclasses and nested classes
|
||||
* have the option of <em>extending</em> the set of initializers.
|
||||
* <p>If {@code inheritInitializers} is set to {@code false}, the initializers
|
||||
* for the annotated test class will <em>shadow</em> and effectively replace
|
||||
* any initializers defined by superclasses.
|
||||
* any initializers defined by superclasses and enclosing classes.
|
||||
* <p>In the following example, the
|
||||
* {@link org.springframework.context.ApplicationContext ApplicationContext}
|
||||
* for {@code ExtendedTest} will be initialized using
|
||||
|
@ -263,9 +264,10 @@ public @interface ContextConfiguration {
|
|||
* for loading an {@link org.springframework.context.ApplicationContext
|
||||
* ApplicationContext}.
|
||||
* <p>If not specified, the loader will be inherited from the first superclass
|
||||
* that is annotated or meta-annotated with {@code @ContextConfiguration} and
|
||||
* specifies an explicit loader. If no class in the hierarchy specifies an
|
||||
* explicit loader, a default loader will be used instead.
|
||||
* or enclosing class that is annotated or meta-annotated with
|
||||
* {@code @ContextConfiguration} and specifies an explicit loader. If no class
|
||||
* in the type hierarchy or enclosing class hierarchy specifies an explicit
|
||||
* loader, a default loader will be used instead.
|
||||
* <p>The default concrete implementation chosen at runtime will be either
|
||||
* {@link org.springframework.test.context.support.DelegatingSmartContextLoader
|
||||
* DelegatingSmartContextLoader} or
|
||||
|
@ -290,10 +292,12 @@ public @interface ContextConfiguration {
|
|||
* <p>If not specified the name will be inferred based on the numerical level
|
||||
* within all declared contexts within the hierarchy.
|
||||
* <p>This attribute is only applicable when used within a test class hierarchy
|
||||
* that is configured using {@code @ContextHierarchy}, in which case the name
|
||||
* can be used for <em>merging</em> or <em>overriding</em> this configuration
|
||||
* with configuration of the same name in hierarchy levels defined in superclasses.
|
||||
* See the Javadoc for {@link ContextHierarchy @ContextHierarchy} for details.
|
||||
* or enclosing class hierarchy that is configured using
|
||||
* {@code @ContextHierarchy}, in which case the name can be used for
|
||||
* <em>merging</em> or <em>overriding</em> this configuration with configuration
|
||||
* of the same name in hierarchy levels defined in superclasses or enclosing
|
||||
* classes. See the Javadoc for {@link ContextHierarchy @ContextHierarchy} for
|
||||
* details.
|
||||
* @since 3.2.2
|
||||
*/
|
||||
String name() default "";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -46,7 +46,7 @@ public interface ContextCustomizerFactory {
|
|||
* @param testClass the test class
|
||||
* @param configAttributes the list of context configuration attributes for
|
||||
* the test class, ordered <em>bottom-up</em> (i.e., as if we were traversing
|
||||
* up the class hierarchy); never {@code null} or empty
|
||||
* up the class hierarchy or enclosing class hierarchy); never {@code null} or empty
|
||||
* @return a {@link ContextCustomizer} or {@code null} if no customizer should
|
||||
* be used
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -31,16 +31,16 @@ import org.springframework.util.ObjectUtils;
|
|||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@code MergedContextConfiguration} encapsulates the <em>merged</em>
|
||||
* context configuration declared on a test class and all of its superclasses
|
||||
* via {@link ContextConfiguration @ContextConfiguration},
|
||||
* {@code MergedContextConfiguration} encapsulates the <em>merged</em> context
|
||||
* configuration declared on a test class and all of its superclasses and
|
||||
* enclosing classes via {@link ContextConfiguration @ContextConfiguration},
|
||||
* {@link ActiveProfiles @ActiveProfiles}, and
|
||||
* {@link TestPropertySource @TestPropertySource}.
|
||||
*
|
||||
* <p>Merged context resource locations, annotated classes, active profiles,
|
||||
* property resource locations, and in-lined properties represent all declared
|
||||
* values in the test class hierarchy taking into consideration the semantics
|
||||
* of the {@link ContextConfiguration#inheritLocations},
|
||||
* values in the test class hierarchy and enclosing class hierarchy taking into
|
||||
* consideration the semantics of the {@link ContextConfiguration#inheritLocations},
|
||||
* {@link ActiveProfiles#inheritProfiles},
|
||||
* {@link TestPropertySource#inheritLocations}, and
|
||||
* {@link TestPropertySource#inheritProperties} flags.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -126,7 +126,8 @@ public interface TestContextBootstrapper {
|
|||
* flag of {@link TestExecutionListeners @TestExecutionListeners} must be
|
||||
* taken into consideration. Specifically, if the {@code inheritListeners}
|
||||
* flag is set to {@code true}, listeners declared for a given test class must
|
||||
* be appended to the end of the list of listeners declared in superclasses.
|
||||
* be appended to the end of the list of listeners declared in superclasses
|
||||
* or enclosing classes.
|
||||
* @return a list of {@code TestExecutionListener} instances
|
||||
*/
|
||||
List<TestExecutionListener> getTestExecutionListeners();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -79,15 +79,16 @@ public @interface TestExecutionListeners {
|
|||
|
||||
/**
|
||||
* Whether or not {@link #listeners TestExecutionListeners} from superclasses
|
||||
* should be <em>inherited</em>.
|
||||
* <p>The default value is {@code true}, which means that an annotated
|
||||
* class will <em>inherit</em> the listeners defined by an annotated
|
||||
* superclass. Specifically, the listeners for an annotated class will be
|
||||
* appended to the list of listeners defined by an annotated superclass.
|
||||
* Thus, subclasses have the option of <em>extending</em> the list of
|
||||
* listeners. In the following example, {@code AbstractBaseTest} will
|
||||
* be configured with {@code DependencyInjectionTestExecutionListener}
|
||||
* and {@code DirtiesContextTestExecutionListener}; whereas,
|
||||
* and enclosing classes should be <em>inherited</em>.
|
||||
* <p>The default value is {@code true}, which means that an annotated class
|
||||
* will <em>inherit</em> the listeners defined by an annotated superclass or
|
||||
* enclosing class. Specifically, the listeners for an annotated class will be
|
||||
* appended to the list of listeners defined by an annotated superclass or
|
||||
* enclosing class. Thus, subclasses and nested classes have the option of
|
||||
* <em>extending</em> the list of listeners. In the following example,
|
||||
* {@code AbstractBaseTest} will be configured with
|
||||
* {@code DependencyInjectionTestExecutionListener} and
|
||||
* {@code DirtiesContextTestExecutionListener}; whereas,
|
||||
* {@code TransactionalTest} will be configured with
|
||||
* {@code DependencyInjectionTestExecutionListener},
|
||||
* {@code DirtiesContextTestExecutionListener}, <strong>and</strong>
|
||||
|
@ -107,18 +108,19 @@ public @interface TestExecutionListeners {
|
|||
* }</pre>
|
||||
* <p>If {@code inheritListeners} is set to {@code false}, the listeners for
|
||||
* the annotated class will <em>shadow</em> and effectively replace any
|
||||
* listeners defined by a superclass.
|
||||
* listeners defined by a superclass or enclosing class.
|
||||
*/
|
||||
boolean inheritListeners() default true;
|
||||
|
||||
/**
|
||||
* The <em>merge mode</em> to use when {@code @TestExecutionListeners} is
|
||||
* declared on a class that does <strong>not</strong> inherit listeners
|
||||
* from a superclass.
|
||||
* declared on a class that does <strong>not</strong> inherit listeners from
|
||||
* a superclass or enclosing class.
|
||||
* <p>Can be set to {@link MergeMode#MERGE_WITH_DEFAULTS MERGE_WITH_DEFAULTS}
|
||||
* to have locally declared listeners <em>merged</em> with the default
|
||||
* listeners.
|
||||
* <p>The mode is ignored if listeners are inherited from a superclass.
|
||||
* <p>The mode is ignored if listeners are inherited from a superclass or
|
||||
* enclosing class.
|
||||
* <p>Defaults to {@link MergeMode#REPLACE_DEFAULTS REPLACE_DEFAULTS}
|
||||
* for backwards compatibility.
|
||||
* @see MergeMode
|
||||
|
@ -131,7 +133,8 @@ public @interface TestExecutionListeners {
|
|||
* Enumeration of <em>modes</em> that dictate whether or not explicitly
|
||||
* declared listeners are merged with the default listeners when
|
||||
* {@code @TestExecutionListeners} is declared on a class that does
|
||||
* <strong>not</strong> inherit listeners from a superclass.
|
||||
* <strong>not</strong> inherit listeners from a superclass or enclosing
|
||||
* class.
|
||||
* @since 4.1
|
||||
*/
|
||||
enum MergeMode {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -151,16 +151,18 @@ public @interface TestPropertySource {
|
|||
|
||||
/**
|
||||
* Whether or not test property source {@link #locations} from superclasses
|
||||
* should be <em>inherited</em>.
|
||||
* and enclosing classes should be <em>inherited</em>.
|
||||
* <p>The default value is {@code true}, which means that a test class will
|
||||
* <em>inherit</em> property source locations defined by a superclass.
|
||||
* Specifically, the property source locations for a test class will be
|
||||
* appended to the list of property source locations defined by a superclass.
|
||||
* Thus, subclasses have the option of <em>extending</em> the list of test
|
||||
* property source locations.
|
||||
* <em>inherit</em> property source locations defined by a superclass or
|
||||
* enclosing class. Specifically, the property source locations for a test
|
||||
* class will be appended to the list of property source locations defined
|
||||
* by a superclass or enclosing class. Thus, subclasses and nested classes
|
||||
* have the option of <em>extending</em> the list of test property source
|
||||
* locations.
|
||||
* <p>If {@code inheritLocations} is set to {@code false}, the property
|
||||
* source locations for the test class will <em>shadow</em> and effectively
|
||||
* replace any property source locations defined by a superclass.
|
||||
* replace any property source locations defined by a superclass or
|
||||
* enclosing class.
|
||||
* <p>In the following example, the {@code ApplicationContext} for
|
||||
* {@code BaseTest} will be loaded using only the {@code "base.properties"}
|
||||
* file as a test property source. In contrast, the {@code ApplicationContext}
|
||||
|
@ -228,16 +230,17 @@ public @interface TestPropertySource {
|
|||
String[] properties() default {};
|
||||
|
||||
/**
|
||||
* Whether or not inlined test {@link #properties} from superclasses should
|
||||
* be <em>inherited</em>.
|
||||
* Whether or not inlined test {@link #properties} from superclasses and
|
||||
* enclosing classes should be <em>inherited</em>.
|
||||
* <p>The default value is {@code true}, which means that a test class will
|
||||
* <em>inherit</em> inlined properties defined by a superclass. Specifically,
|
||||
* the inlined properties for a test class will be appended to the list of
|
||||
* inlined properties defined by a superclass. Thus, subclasses have the
|
||||
* option of <em>extending</em> the list of inlined test properties.
|
||||
* <em>inherit</em> inlined properties defined by a superclass or enclosing
|
||||
* class. Specifically, the inlined properties for a test class will be
|
||||
* appended to the list of inlined properties defined by a superclass or
|
||||
* enclosing class. Thus, subclasses and nested classes have the option of
|
||||
* <em>extending</em> the list of inlined test properties.
|
||||
* <p>If {@code inheritProperties} is set to {@code false}, the inlined
|
||||
* properties for the test class will <em>shadow</em> and effectively
|
||||
* replace any inlined properties defined by a superclass.
|
||||
* replace any inlined properties defined by a superclass or enclosing class.
|
||||
* <p>In the following example, the {@code ApplicationContext} for
|
||||
* {@code BaseTest} will be loaded using only the inlined {@code key1}
|
||||
* property. In contrast, the {@code ApplicationContext} for
|
||||
|
@ -261,7 +264,7 @@ public @interface TestPropertySource {
|
|||
* test class hierarchy (i.e., directly present or meta-present on a test
|
||||
* class) are considered to be <em>local</em> annotations, in contrast to
|
||||
* {@code @TestPropertySource} annotations that are inherited from a
|
||||
* superclass.</li>
|
||||
* superclass or enclosing class.</li>
|
||||
* <li>All local {@code @TestPropertySource} annotations must declare the
|
||||
* same value for the {@code inheritProperties} flag.</li>
|
||||
* <li>The {@code inheritProperties} flag is not taken into account between
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -36,6 +36,10 @@ import java.lang.annotation.Target;
|
|||
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
|
||||
* <em>composed annotations</em>.
|
||||
*
|
||||
* <p>This annotation will be inherited from an enclosing test class by default. See
|
||||
* {@link org.springframework.test.context.NestedTestConfiguration @NestedTestConfiguration}
|
||||
* for details.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 5.3.3
|
||||
* @see ApplicationEvents
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -52,6 +52,11 @@ import org.springframework.core.annotation.AliasFor;
|
|||
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
|
||||
* <em>composed annotations</em> with attribute overrides.
|
||||
*
|
||||
* <p>As of Spring Framework 5.3, this annotation will be inherited from an
|
||||
* enclosing test class by default. See
|
||||
* {@link org.springframework.test.context.NestedTestConfiguration @NestedTestConfiguration}
|
||||
* for details.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 4.1
|
||||
* @see SqlConfig
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -54,6 +54,11 @@ import java.lang.annotation.Target;
|
|||
* {@code ""}, <code>{}</code>, or {@code DEFAULT}. Explicit local configuration
|
||||
* therefore <em>overrides</em> global configuration.
|
||||
*
|
||||
* <p>As of Spring Framework 5.3, this annotation will be inherited from an
|
||||
* enclosing test class by default. See
|
||||
* {@link org.springframework.test.context.NestedTestConfiguration @NestedTestConfiguration}
|
||||
* for details.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @author Tadaya Tsuyukubo
|
||||
* @since 4.1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -34,6 +34,11 @@ import java.lang.annotation.Target;
|
|||
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
|
||||
* <em>composed annotations</em>.
|
||||
*
|
||||
* <p>As of Spring Framework 5.3, this annotation will be inherited from an
|
||||
* enclosing test class by default. See
|
||||
* {@link org.springframework.test.context.NestedTestConfiguration @NestedTestConfiguration}
|
||||
* for details.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 4.1
|
||||
* @see Sql
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -37,6 +37,11 @@ import java.lang.annotation.Target;
|
|||
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
|
||||
* <em>composed annotations</em> with attribute overrides.
|
||||
*
|
||||
* <p>As of Spring Framework 5.3, this annotation will be inherited from an
|
||||
* enclosing test class by default. See
|
||||
* {@link org.springframework.test.context.NestedTestConfiguration @NestedTestConfiguration}
|
||||
* for details.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @author Dmitry Semukhin
|
||||
* @since 5.2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -35,6 +35,11 @@ import org.springframework.test.context.ContextConfiguration;
|
|||
* {@link ContextConfiguration @ContextConfiguration} from the <em>Spring TestContext
|
||||
* Framework</em>.
|
||||
*
|
||||
* <p>As of Spring Framework 5.3, this annotation will effectively be inherited
|
||||
* from an enclosing test class by default. See
|
||||
* {@link org.springframework.test.context.NestedTestConfiguration @NestedTestConfiguration}
|
||||
* for details.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 5.0
|
||||
* @see ExtendWith
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -38,6 +38,11 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
|||
* {@link WebAppConfiguration @WebAppConfiguration} from the <em>Spring TestContext
|
||||
* Framework</em>.
|
||||
*
|
||||
* <p>As of Spring Framework 5.3, this annotation will effectively be inherited
|
||||
* from an enclosing test class by default. See
|
||||
* {@link org.springframework.test.context.NestedTestConfiguration @NestedTestConfiguration}
|
||||
* for details.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 5.0
|
||||
* @see ExtendWith
|
||||
|
|
|
@ -37,9 +37,10 @@ import org.springframework.util.Assert;
|
|||
* configuration. Each candidate is given a chance to
|
||||
* {@linkplain #processContextConfiguration process} the
|
||||
* {@link ContextConfigurationAttributes} for each class in the test class hierarchy
|
||||
* that is annotated with {@link ContextConfiguration @ContextConfiguration}, and
|
||||
* the candidate that supports the merged, processed configuration will be used to
|
||||
* actually {@linkplain #loadContext load} the context.
|
||||
* and enclosing class hierarchy that is annotated with
|
||||
* {@link ContextConfiguration @ContextConfiguration}, and the candidate that
|
||||
* supports the merged, processed configuration will be used to actually
|
||||
* {@linkplain #loadContext load} the context.
|
||||
*
|
||||
* <p>Any reference to an <em>XML-based loader</em> can be interpreted to mean
|
||||
* a context loader that supports only XML configuration files or one that
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -318,7 +318,8 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
|||
* should be built (must not be {@code null})
|
||||
* @param configAttributesList the list of context configuration attributes for the
|
||||
* specified test class, ordered <em>bottom-up</em> (i.e., as if we were
|
||||
* traversing up the class hierarchy); never {@code null} or empty
|
||||
* traversing up the class hierarchy and enclosing class hierarchy); never
|
||||
* {@code null} or empty
|
||||
* @param parentConfig the merged context configuration for the parent application
|
||||
* context in a context hierarchy, or {@code null} if there is no parent
|
||||
* @param cacheAwareContextLoaderDelegate the cache-aware context loader delegate to
|
||||
|
@ -430,7 +431,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
|||
* resolved; must not be {@code null}
|
||||
* @param configAttributesList the list of configuration attributes to process; must
|
||||
* not be {@code null}; must be ordered <em>bottom-up</em>
|
||||
* (i.e., as if we were traversing up the class hierarchy)
|
||||
* (i.e., as if we were traversing up the class hierarchy and enclosing class hierarchy)
|
||||
* @return the resolved {@code ContextLoader} for the supplied {@code testClass}
|
||||
* (never {@code null})
|
||||
* @throws IllegalStateException if {@link #getDefaultContextLoaderClass(Class)}
|
||||
|
@ -467,7 +468,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
|||
* </ol>
|
||||
* @param configAttributesList the list of configuration attributes to process;
|
||||
* must not be {@code null}; must be ordered <em>bottom-up</em>
|
||||
* (i.e., as if we were traversing up the class hierarchy)
|
||||
* (i.e., as if we were traversing up the class hierarchy and enclosing class hierarchy)
|
||||
* @return the {@code ContextLoader} class to use for the supplied configuration
|
||||
* attributes, or {@code null} if no explicit loader is found
|
||||
* @throws IllegalArgumentException if supplied configuration attributes are
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -60,11 +60,12 @@ abstract class ActiveProfilesUtils {
|
|||
* <p>Note that the {@link ActiveProfiles#inheritProfiles inheritProfiles} flag of
|
||||
* {@link ActiveProfiles @ActiveProfiles} will be taken into consideration.
|
||||
* Specifically, if the {@code inheritProfiles} flag is set to {@code true}, profiles
|
||||
* defined in the test class will be merged with those defined in superclasses.
|
||||
* defined in the test class will be merged with those defined in superclasses
|
||||
* and enclosing classes.
|
||||
* @param testClass the class for which to resolve the active profiles (must not be
|
||||
* {@code null})
|
||||
* @return the set of active profiles for the specified class, including active
|
||||
* profiles from superclasses if appropriate (never {@code null})
|
||||
* profiles from superclasses and enclosing classes if appropriate (never {@code null})
|
||||
* @see ActiveProfiles
|
||||
* @see ActiveProfilesResolver
|
||||
* @see org.springframework.context.annotation.Profile
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -52,12 +52,13 @@ abstract class ApplicationContextInitializerUtils {
|
|||
* <p>Note that the {@link ContextConfiguration#inheritInitializers inheritInitializers}
|
||||
* flag of {@link ContextConfiguration @ContextConfiguration} will be taken into
|
||||
* consideration. Specifically, if the {@code inheritInitializers} flag is set to
|
||||
* {@code true} for a given level in the class hierarchy represented by the provided
|
||||
* configuration attributes, context initializer classes defined at the given level
|
||||
* will be merged with those defined in higher levels of the class hierarchy.
|
||||
* {@code true} for a given level in the class hierarchy and enclosing class
|
||||
* hierarchy represented by the provided configuration attributes, context
|
||||
* initializer classes defined at the given level will be merged with those
|
||||
* defined in higher levels of the class hierarchy or enclosing class hierarchy.
|
||||
* @param configAttributesList the list of configuration attributes to process; must
|
||||
* not be {@code null} or <em>empty</em>; must be ordered <em>bottom-up</em>
|
||||
* (i.e., as if we were traversing up the class hierarchy)
|
||||
* (i.e., as if we were traversing up the class hierarchy or enclosing class hierarchy)
|
||||
* @return the set of merged context initializer classes, including those from
|
||||
* superclasses if appropriate (never {@code null})
|
||||
* @since 3.2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -63,17 +63,17 @@ abstract class ContextLoaderUtils {
|
|||
/**
|
||||
* Resolve the list of lists of {@linkplain ContextConfigurationAttributes context
|
||||
* configuration attributes} for the supplied {@linkplain Class test class} and its
|
||||
* superclasses, taking into account context hierarchies declared via
|
||||
* {@link ContextHierarchy @ContextHierarchy} and
|
||||
* superclasses and enclosing classes, taking into account context hierarchies
|
||||
* declared via {@link ContextHierarchy @ContextHierarchy} and
|
||||
* {@link ContextConfiguration @ContextConfiguration}.
|
||||
* <p>The outer list represents a top-down ordering of context configuration
|
||||
* attributes, where each element in the list represents the context configuration
|
||||
* declared on a given test class in the class hierarchy. Each nested list
|
||||
* contains the context configuration attributes declared either via a single
|
||||
* instance of {@code @ContextConfiguration} on the particular class or via
|
||||
* multiple instances of {@code @ContextConfiguration} declared within a
|
||||
* single {@code @ContextHierarchy} instance on the particular class.
|
||||
* Furthermore, each nested list maintains the order in which
|
||||
* declared on a given test class in the class hierarchy or enclosing class
|
||||
* hierarchy. Each nested list contains the context configuration attributes
|
||||
* declared either via a single instance of {@code @ContextConfiguration} on
|
||||
* the particular class or via multiple instances of {@code @ContextConfiguration}
|
||||
* declared within a single {@code @ContextHierarchy} instance on the particular
|
||||
* class. Furthermore, each nested list maintains the order in which
|
||||
* {@code @ContextConfiguration} instances are declared.
|
||||
* <p>Note that the {@link ContextConfiguration#inheritLocations inheritLocations} and
|
||||
* {@link ContextConfiguration#inheritInitializers() inheritInitializers} flags of
|
||||
|
@ -157,14 +157,14 @@ abstract class ContextLoaderUtils {
|
|||
|
||||
/**
|
||||
* Build a <em>context hierarchy map</em> for the supplied {@linkplain Class
|
||||
* test class} and its superclasses, taking into account context hierarchies
|
||||
* declared via {@link ContextHierarchy @ContextHierarchy} and
|
||||
* {@link ContextConfiguration @ContextConfiguration}.
|
||||
* test class} and its superclasses and enclosing classes, taking into account
|
||||
* context hierarchies declared via {@link ContextHierarchy @ContextHierarchy}
|
||||
* and {@link ContextConfiguration @ContextConfiguration}.
|
||||
* <p>Each value in the map represents the consolidated list of {@linkplain
|
||||
* ContextConfigurationAttributes context configuration attributes} for a
|
||||
* given level in the context hierarchy (potentially across the test class
|
||||
* hierarchy), keyed by the {@link ContextConfiguration#name() name} of the
|
||||
* context hierarchy level.
|
||||
* hierarchy and enclosing class hierarchy), keyed by the
|
||||
* {@link ContextConfiguration#name() name} of the context hierarchy level.
|
||||
* <p>If a given level in the context hierarchy does not have an explicit
|
||||
* name (i.e., configured via {@link ContextConfiguration#name}), a name will
|
||||
* be generated for that hierarchy level by appending the numerical level to
|
||||
|
@ -217,8 +217,8 @@ abstract class ContextLoaderUtils {
|
|||
|
||||
/**
|
||||
* Resolve the list of {@linkplain ContextConfigurationAttributes context
|
||||
* configuration attributes} for the supplied {@linkplain Class test class} and its
|
||||
* superclasses.
|
||||
* configuration attributes} for the supplied {@linkplain Class test class}
|
||||
* and its superclasses and enclosing classes.
|
||||
* <p>Note that the {@link ContextConfiguration#inheritLocations inheritLocations} and
|
||||
* {@link ContextConfiguration#inheritInitializers() inheritInitializers} flags of
|
||||
* {@link ContextConfiguration @ContextConfiguration} will <strong>not</strong>
|
||||
|
@ -227,8 +227,8 @@ abstract class ContextLoaderUtils {
|
|||
* @param testClass the class for which to resolve the configuration attributes
|
||||
* (must not be {@code null})
|
||||
* @return the list of configuration attributes for the specified class, ordered
|
||||
* <em>bottom-up</em> (i.e., as if we were traversing up the class hierarchy);
|
||||
* never {@code null}
|
||||
* <em>bottom-up</em> (i.e., as if we were traversing up the class hierarchy
|
||||
* and enclosing class hierarchy); never {@code null}
|
||||
* @throws IllegalArgumentException if the supplied class is {@code null} or if
|
||||
* {@code @ContextConfiguration} is not <em>present</em> on the supplied class
|
||||
*/
|
||||
|
|
|
@ -24,9 +24,9 @@ import org.springframework.test.context.TestPropertySource;
|
|||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@code MergedTestPropertySources} encapsulates the <em>merged</em>
|
||||
* property sources declared on a test class and all of its superclasses
|
||||
* via {@link TestPropertySource @TestPropertySource}.
|
||||
* {@code MergedTestPropertySources} encapsulates the <em>merged</em> property
|
||||
* sources declared on a test class and all of its superclasses and enclosing
|
||||
* classes via {@link TestPropertySource @TestPropertySource}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 4.1
|
||||
|
|
|
@ -73,10 +73,10 @@ import org.springframework.util.StringUtils;
|
|||
* to be run within a transaction that will, by default, be automatically
|
||||
* <em>rolled back</em> after completion of the test. If a test class is
|
||||
* annotated with {@code @Transactional}, each test method within that class
|
||||
* hierarchy will be run within a transaction. Test methods that are
|
||||
* <em>not</em> annotated with {@code @Transactional} (at the class or method
|
||||
* level) will not be run within a transaction. Furthermore, tests that
|
||||
* <em>are</em> annotated with {@code @Transactional} but have the
|
||||
* hierarchy or nested class hierarchy will be run within a transaction. Test
|
||||
* methods that are <em>not</em> annotated with {@code @Transactional} (at the
|
||||
* class or method level) will not be run within a transaction. Furthermore,
|
||||
* tests that <em>are</em> annotated with {@code @Transactional} but have the
|
||||
* {@link Transactional#propagation propagation} type set to
|
||||
* {@link org.springframework.transaction.annotation.Propagation#NOT_SUPPORTED NOT_SUPPORTED}
|
||||
* or {@link org.springframework.transaction.annotation.Propagation#NEVER NEVER}
|
||||
|
|
Loading…
Reference in New Issue