Introduce dedicated 'cache' subpackage in the TCF
Since the ContextCache is now a published SPI, it and its collaborators have been moved to a dedicated 'org.sfw.test.context.cache' subpackage. Issue: SPR-12683
This commit is contained in:
@@ -40,7 +40,7 @@ abstract class BootstrapUtils {
|
||||
|
||||
private static final String DEFAULT_BOOTSTRAP_CONTEXT_CLASS_NAME = "org.springframework.test.context.support.DefaultBootstrapContext";
|
||||
|
||||
private static final String DEFAULT_CACHE_AWARE_CONTEXT_LOADER_DELEGATE_CLASS_NAME = "org.springframework.test.context.support.DefaultCacheAwareContextLoaderDelegate";
|
||||
private static final String DEFAULT_CACHE_AWARE_CONTEXT_LOADER_DELEGATE_CLASS_NAME = "org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate";
|
||||
|
||||
private static final String DEFAULT_TEST_CONTEXT_BOOTSTRAPPER_CLASS_NAME = "org.springframework.test.context.support.DefaultTestContextBootstrapper";
|
||||
|
||||
@@ -55,7 +55,7 @@ abstract class BootstrapUtils {
|
||||
* Create the {@code BootstrapContext} for the specified {@linkplain Class test class}.
|
||||
*
|
||||
* <p>Uses reflection to create a {@link org.springframework.test.context.support.DefaultBootstrapContext}
|
||||
* that uses a {@link org.springframework.test.context.support.DefaultCacheAwareContextLoaderDelegate}.
|
||||
* that uses a {@link org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate}.
|
||||
*
|
||||
* @param testClass the test class for which the bootstrap context should be created
|
||||
* @return a new {@code BootstrapContext}; never {@code null}
|
||||
|
||||
@@ -23,8 +23,9 @@ import org.springframework.test.annotation.DirtiesContext.HierarchyMode;
|
||||
/**
|
||||
* A {@code CacheAwareContextLoaderDelegate} is responsible for {@linkplain
|
||||
* #loadContext loading} and {@linkplain #closeContext closing} application
|
||||
* contexts, interacting transparently with a {@link ContextCache} behind
|
||||
* the scenes.
|
||||
* contexts, interacting transparently with a
|
||||
* {@link org.springframework.test.context.cache.ContextCache ContextCache}
|
||||
* behind the scenes.
|
||||
*
|
||||
* <p>Note: {@code CacheAwareContextLoaderDelegate} does not extend the
|
||||
* {@link ContextLoader} or {@link SmartContextLoader} interface.
|
||||
@@ -41,7 +42,7 @@ public interface CacheAwareContextLoaderDelegate {
|
||||
* <p>If the context is present in the {@code ContextCache} it will simply
|
||||
* be returned; otherwise, it will be loaded, stored in the cache, and returned.
|
||||
* <p>The cache statistics should be logged by invoking
|
||||
* {@link ContextCache#logStatistics()}.
|
||||
* {@link org.springframework.test.context.cache.ContextCache#logStatistics()}.
|
||||
* @param mergedContextConfiguration the merged context configuration to use
|
||||
* to load the application context; never {@code null}
|
||||
* @return the application context
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.context;
|
||||
package org.springframework.test.context.cache;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.annotation.DirtiesContext.HierarchyMode;
|
||||
import org.springframework.test.context.MergedContextConfiguration;
|
||||
|
||||
/**
|
||||
* {@code ContextCache} defines the SPI for caching Spring
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.context.support;
|
||||
package org.springframework.test.context.cache;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -22,7 +22,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.annotation.DirtiesContext.HierarchyMode;
|
||||
import org.springframework.test.context.CacheAwareContextLoaderDelegate;
|
||||
import org.springframework.test.context.ContextCache;
|
||||
import org.springframework.test.context.ContextLoader;
|
||||
import org.springframework.test.context.MergedContextConfiguration;
|
||||
import org.springframework.test.context.SmartContextLoader;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.context.support;
|
||||
package org.springframework.test.context.cache;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -31,7 +31,6 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
import org.springframework.test.annotation.DirtiesContext.HierarchyMode;
|
||||
import org.springframework.test.context.ContextCache;
|
||||
import org.springframework.test.context.MergedContextConfiguration;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.core.io.support.SpringFactoriesLoader;
|
||||
import org.springframework.test.context.BootstrapContext;
|
||||
import org.springframework.test.context.CacheAwareContextLoaderDelegate;
|
||||
import org.springframework.test.context.ContextCache;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.ContextConfigurationAttributes;
|
||||
import org.springframework.test.context.ContextHierarchy;
|
||||
@@ -68,8 +67,9 @@ import org.springframework.util.StringUtils;
|
||||
* <li>{@link #processMergedContextConfiguration}
|
||||
* </ul>
|
||||
*
|
||||
* <p>To plug in custom {@link ContextCache} support, override
|
||||
* {@link #getCacheAwareContextLoaderDelegate()}.
|
||||
* <p>To plug in custom
|
||||
* {@link org.springframework.test.context.cache.ContextCache ContextCache}
|
||||
* support, override {@link #getCacheAwareContextLoaderDelegate()}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @author Juergen Hoeller
|
||||
@@ -481,8 +481,9 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
* <p>The default implementation simply delegates to
|
||||
* {@code getBootstrapContext().getCacheAwareContextLoaderDelegate()}.
|
||||
* <p>Concrete subclasses may choose to override this method to return a
|
||||
* custom {@code CacheAwareContextLoaderDelegate} implementation with
|
||||
* custom {@link ContextCache} support.
|
||||
* custom {@code CacheAwareContextLoaderDelegate} implementation with custom
|
||||
* {@link org.springframework.test.context.cache.ContextCache ContextCache}
|
||||
* support.
|
||||
* @return the context loader delegate (never {@code null})
|
||||
*/
|
||||
protected CacheAwareContextLoaderDelegate getCacheAwareContextLoaderDelegate() {
|
||||
|
||||
Reference in New Issue
Block a user