diff --git a/spring-test/src/main/java/org/springframework/test/context/BootstrapUtils.java b/spring-test/src/main/java/org/springframework/test/context/BootstrapUtils.java index bf84a9a80e..6d37763835 100644 --- a/spring-test/src/main/java/org/springframework/test/context/BootstrapUtils.java +++ b/spring-test/src/main/java/org/springframework/test/context/BootstrapUtils.java @@ -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}. * *
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} diff --git a/spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java b/spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java index 459c5a5c9c..2771e51493 100644 --- a/spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java +++ b/spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java @@ -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. * *
Note: {@code CacheAwareContextLoaderDelegate} does not extend the * {@link ContextLoader} or {@link SmartContextLoader} interface. @@ -41,7 +42,7 @@ public interface CacheAwareContextLoaderDelegate { *
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. *
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 diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextCache.java b/spring-test/src/main/java/org/springframework/test/context/cache/ContextCache.java similarity index 97% rename from spring-test/src/main/java/org/springframework/test/context/ContextCache.java rename to spring-test/src/main/java/org/springframework/test/context/cache/ContextCache.java index a7c6b800ef..895109fa59 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ContextCache.java +++ b/spring-test/src/main/java/org/springframework/test/context/cache/ContextCache.java @@ -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 diff --git a/spring-test/src/main/java/org/springframework/test/context/support/DefaultCacheAwareContextLoaderDelegate.java b/spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java similarity index 98% rename from spring-test/src/main/java/org/springframework/test/context/support/DefaultCacheAwareContextLoaderDelegate.java rename to spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java index 7598fa9eb9..5ada74297e 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/DefaultCacheAwareContextLoaderDelegate.java +++ b/spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java @@ -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; diff --git a/spring-test/src/main/java/org/springframework/test/context/support/DefaultContextCache.java b/spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java similarity index 98% rename from spring-test/src/main/java/org/springframework/test/context/support/DefaultContextCache.java rename to spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java index 511a85f611..0967813594 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/DefaultContextCache.java +++ b/spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java @@ -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; diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java index c6b1b0b15c..5b2ded0ac4 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java @@ -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; *
To plug in custom {@link ContextCache} support, override - * {@link #getCacheAwareContextLoaderDelegate()}. + *
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 *
The default implementation simply delegates to * {@code getBootstrapContext().getCacheAwareContextLoaderDelegate()}. *
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() { diff --git a/spring-test/src/test/java/org/springframework/test/context/MergedContextConfigurationTests.java b/spring-test/src/test/java/org/springframework/test/context/MergedContextConfigurationTests.java index 3da7bf810c..ea0521afc3 100644 --- a/spring-test/src/test/java/org/springframework/test/context/MergedContextConfigurationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/MergedContextConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -33,7 +33,8 @@ import static org.junit.Assert.*; * Unit tests for {@link MergedContextConfiguration}. * *
These tests primarily exist to ensure that {@code MergedContextConfiguration} - * can safely be used as the cache key for {@link ContextCache}. + * can safely be used as the cache key for + * {@link org.springframework.test.context.cache.ContextCache ContextCache}. * * @author Sam Brannen * @since 3.1 diff --git a/spring-test/src/test/java/org/springframework/test/context/TestContextTestUtils.java b/spring-test/src/test/java/org/springframework/test/context/TestContextTestUtils.java index 47ec34ebd5..3e88bc1a33 100644 --- a/spring-test/src/test/java/org/springframework/test/context/TestContextTestUtils.java +++ b/spring-test/src/test/java/org/springframework/test/context/TestContextTestUtils.java @@ -16,8 +16,9 @@ package org.springframework.test.context; +import org.springframework.test.context.cache.ContextCache; +import org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate; import org.springframework.test.context.support.DefaultBootstrapContext; -import org.springframework.test.context.support.DefaultCacheAwareContextLoaderDelegate; /** * Collection of test-related utility methods for working with {@link TestContext TestContexts}. diff --git a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTestNGTests.java b/spring-test/src/test/java/org/springframework/test/context/cache/ClassLevelDirtiesContextTestNGTests.java similarity index 97% rename from spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTestNGTests.java rename to spring-test/src/test/java/org/springframework/test/context/cache/ClassLevelDirtiesContextTestNGTests.java index 3b45f158d6..76e5a3fa62 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTestNGTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/cache/ClassLevelDirtiesContextTestNGTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.test.context; +package org.springframework.test.context.cache; import java.util.concurrent.atomic.AtomicInteger; @@ -29,6 +29,8 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; import org.springframework.test.context.support.DirtiesContextTestExecutionListener; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; @@ -37,7 +39,7 @@ import org.springframework.test.context.testng.TrackingTestNGTestListener; import org.testng.TestNG; import static org.junit.Assert.*; -import static org.springframework.test.context.support.ContextCacheTestUtils.*; +import static org.springframework.test.context.cache.ContextCacheTestUtils.*; /** * JUnit 4 based integration test which verifies correct {@linkplain ContextCache diff --git a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java b/spring-test/src/test/java/org/springframework/test/context/cache/ClassLevelDirtiesContextTests.java similarity index 97% rename from spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java rename to spring-test/src/test/java/org/springframework/test/context/cache/ClassLevelDirtiesContextTests.java index 64dced85b8..be644dae60 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/cache/ClassLevelDirtiesContextTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.test.context; +package org.springframework.test.context.cache; import java.util.concurrent.atomic.AtomicInteger; @@ -30,13 +30,15 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.TrackingRunListener; import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; import org.springframework.test.context.support.DirtiesContextTestExecutionListener; import static org.junit.Assert.*; -import static org.springframework.test.context.support.ContextCacheTestUtils.*; +import static org.springframework.test.context.cache.ContextCacheTestUtils.*; /** * JUnit 4 based integration test which verifies correct {@linkplain ContextCache diff --git a/spring-test/src/test/java/org/springframework/test/context/support/ContextCacheTestUtils.java b/spring-test/src/test/java/org/springframework/test/context/cache/ContextCacheTestUtils.java similarity index 96% rename from spring-test/src/test/java/org/springframework/test/context/support/ContextCacheTestUtils.java rename to spring-test/src/test/java/org/springframework/test/context/cache/ContextCacheTestUtils.java index c6127b47c7..8c63afb33a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/ContextCacheTestUtils.java +++ b/spring-test/src/test/java/org/springframework/test/context/cache/ContextCacheTestUtils.java @@ -14,9 +14,7 @@ * limitations under the License. */ -package org.springframework.test.context.support; - -import org.springframework.test.context.ContextCache; +package org.springframework.test.context.cache; import static org.junit.Assert.*; diff --git a/spring-test/src/test/java/org/springframework/test/context/ContextCacheTests.java b/spring-test/src/test/java/org/springframework/test/context/cache/ContextCacheTests.java similarity index 96% rename from spring-test/src/test/java/org/springframework/test/context/ContextCacheTests.java rename to spring-test/src/test/java/org/springframework/test/context/cache/ContextCacheTests.java index e8a4c3e48f..be0440a504 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ContextCacheTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/cache/ContextCacheTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.test.context; +package org.springframework.test.context.cache; import org.junit.Before; import org.junit.Test; @@ -22,12 +22,18 @@ import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext.HierarchyMode; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ActiveProfilesResolver; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.ContextHierarchy; +import org.springframework.test.context.MergedContextConfiguration; +import org.springframework.test.context.TestContext; +import org.springframework.test.context.TestContextTestUtils; import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.test.context.support.DefaultContextCache; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.*; -import static org.springframework.test.context.support.ContextCacheTestUtils.*; +import static org.springframework.test.context.cache.ContextCacheTestUtils.*; /** * Integration tests for verifying proper behavior of the {@link ContextCache} in diff --git a/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java b/spring-test/src/test/java/org/springframework/test/context/cache/SpringRunnerContextCacheTests.java similarity index 91% rename from spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java rename to spring-test/src/test/java/org/springframework/test/context/cache/SpringRunnerContextCacheTests.java index 622d25f88d..44962e7660 100644 --- a/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/cache/SpringRunnerContextCacheTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.test.context; +package org.springframework.test.context.cache; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -26,12 +26,14 @@ import org.junit.runners.MethodSorters; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; import org.springframework.test.context.support.DirtiesContextTestExecutionListener; import static org.junit.Assert.*; -import static org.springframework.test.context.support.ContextCacheTestUtils.*; +import static org.springframework.test.context.cache.ContextCacheTestUtils.*; /** * JUnit 4 based unit test which verifies correct {@link ContextCache @@ -47,7 +49,7 @@ import static org.springframework.test.context.support.ContextCacheTestUtils.*; @RunWith(SpringJUnit4ClassRunner.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class }) -@ContextConfiguration("junit4/SpringJUnit4ClassRunnerAppCtxTests-context.xml") +@ContextConfiguration("../junit4/SpringJUnit4ClassRunnerAppCtxTests-context.xml") public class SpringRunnerContextCacheTests { private static ApplicationContext dirtiedApplicationContext; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4TestSuite.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4TestSuite.java index 6a5de85b4c..b463545169 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4TestSuite.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4TestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 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. @@ -19,9 +19,8 @@ package org.springframework.test.context.junit4; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; - -import org.springframework.test.context.ClassLevelDirtiesContextTests; -import org.springframework.test.context.SpringRunnerContextCacheTests; +import org.springframework.test.context.cache.ClassLevelDirtiesContextTests; +import org.springframework.test.context.cache.SpringRunnerContextCacheTests; import org.springframework.test.context.junit4.annotation.AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests; import org.springframework.test.context.junit4.annotation.BeanOverridingDefaultConfigClassesInheritedTests; import org.springframework.test.context.junit4.annotation.BeanOverridingExplicitConfigClassesInheritedTests;