Improve extensibility of TestContext bootstrapping & context caching

- DefaultBootstrapContext and DefaultCacheAwareContextLoaderDelegate
   are now public classes in the 'support' subpackage.

 - Introduced getCacheAwareContextLoaderDelegate() in
   AbstractTestContextBootstrapper as an extension point for configuring
   custom ContextCache support.

 - Introduced reflection-based createBootstrapContext() utility method
   in BootstrapUtils; TestContextManager now delegates to BootstrapUtils
   in order to avoid package cycles.

 - Introduced logStatistics() method in the ContextCache API and defined
   statistics logging category as a constant.

 - DefaultCacheAwareContextLoaderDelegate now delegates to
   ContextCache.logStatistics().

Issue: SPR-12683
This commit is contained in:
Sam Brannen
2015-04-19 18:14:11 +02:00
parent e6c24f7167
commit 129488cb4f
16 changed files with 184 additions and 55 deletions

View File

@@ -16,6 +16,8 @@
package org.springframework.test.context;
import org.springframework.test.context.support.DefaultBootstrapContext;
/**
* Collection of test-related utility methods for working with {@link BootstrapContext
* BootstrapContexts} and {@link TestContextBootstrapper TestContextBootstrappers}.

View File

@@ -37,7 +37,7 @@ import org.springframework.test.context.testng.TrackingTestNGTestListener;
import org.testng.TestNG;
import static org.junit.Assert.*;
import static org.springframework.test.context.ContextCacheTestUtils.*;
import static org.springframework.test.context.support.ContextCacheTestUtils.*;
/**
* JUnit 4 based integration test which verifies correct {@linkplain ContextCache

View File

@@ -36,7 +36,7 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
import static org.junit.Assert.*;
import static org.springframework.test.context.ContextCacheTestUtils.*;
import static org.springframework.test.context.support.ContextCacheTestUtils.*;
/**
* JUnit 4 based integration test which verifies correct {@linkplain ContextCache

View File

@@ -18,6 +18,7 @@ package org.springframework.test.context;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext.HierarchyMode;
@@ -26,7 +27,7 @@ import org.springframework.test.context.support.DefaultContextCache;
import org.springframework.test.util.ReflectionTestUtils;
import static org.junit.Assert.*;
import static org.springframework.test.context.ContextCacheTestUtils.*;
import static org.springframework.test.context.support.ContextCacheTestUtils.*;
/**
* Integration tests for verifying proper behavior of the {@link ContextCache} in

View File

@@ -31,7 +31,7 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
import static org.junit.Assert.*;
import static org.springframework.test.context.ContextCacheTestUtils.*;
import static org.springframework.test.context.support.ContextCacheTestUtils.*;
/**
* JUnit 4 based unit test which verifies correct {@link ContextCache

View File

@@ -16,6 +16,9 @@
package org.springframework.test.context;
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}.
*

View File

@@ -14,7 +14,9 @@
* limitations under the License.
*/
package org.springframework.test.context;
package org.springframework.test.context.support;
import org.springframework.test.context.ContextCache;
import static org.junit.Assert.*;