Browse Source

Polishing

pull/30636/head
Sam Brannen 3 years ago
parent
commit
f8a3253d12
  1. 3
      spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java
  2. 1
      spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java
  3. 6
      spring-test/src/test/java/org/springframework/test/context/cache/ContextFailureThresholdTests.java

3
spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java vendored

@ -158,6 +158,9 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext @@ -158,6 +158,9 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
this.contextCache.put(mergedConfig, context);
}
catch (Exception ex) {
if (logger.isTraceEnabled()) {
logger.trace("Incrementing ApplicationContext failure count for " + mergedConfig);
}
this.contextCache.incrementFailureCount(mergedConfig);
Throwable cause = ex;
if (ex instanceof ContextLoadException cle) {

1
spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java vendored

@ -57,6 +57,7 @@ public class DefaultContextCache implements ContextCache { @@ -57,6 +57,7 @@ public class DefaultContextCache implements ContextCache {
private static final Log statsLogger = LogFactory.getLog(CONTEXT_CACHE_LOGGING_CATEGORY);
/**
* Map of context keys to Spring {@code ApplicationContext} instances.
*/

6
spring-test/src/test/java/org/springframework/test/context/cache/ContextFailureThresholdTests.java vendored

@ -45,13 +45,13 @@ import static org.springframework.test.context.cache.ContextCacheTestUtils.reset @@ -45,13 +45,13 @@ import static org.springframework.test.context.cache.ContextCacheTestUtils.reset
*/
class ContextFailureThresholdTests {
private static final AtomicInteger passingLoadCount = new AtomicInteger(0);
private static final AtomicInteger failingLoadCount = new AtomicInteger(0);
private static final AtomicInteger passingLoadCount = new AtomicInteger();
private static final AtomicInteger failingLoadCount = new AtomicInteger();
@BeforeEach
@AfterEach
void resetFlag() {
void resetTestFixtures() {
resetContextCache();
passingLoadCount.set(0);
failingLoadCount.set(0);

Loading…
Cancel
Save