From f8a3253d12fd15ff9cc5643524d318729f7ad0e5 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 11 Jun 2023 16:32:16 +0200 Subject: [PATCH] Polishing --- .../cache/DefaultCacheAwareContextLoaderDelegate.java | 3 +++ .../test/context/cache/DefaultContextCache.java | 1 + .../test/context/cache/ContextFailureThresholdTests.java | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java b/spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java index 8d1f35ca729..145998fdcd6 100644 --- a/spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java +++ b/spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java @@ -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) { diff --git a/spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java b/spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java index 37e687e2b77..161d4654aad 100644 --- a/spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java +++ b/spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java @@ -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. */ diff --git a/spring-test/src/test/java/org/springframework/test/context/cache/ContextFailureThresholdTests.java b/spring-test/src/test/java/org/springframework/test/context/cache/ContextFailureThresholdTests.java index d6a51618f6c..50818efb3a5 100644 --- a/spring-test/src/test/java/org/springframework/test/context/cache/ContextFailureThresholdTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/cache/ContextFailureThresholdTests.java @@ -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);