diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/AotTestMappings.java b/spring-test/src/main/java/org/springframework/test/context/aot/TestAotMappings.java
similarity index 92%
rename from spring-test/src/main/java/org/springframework/test/context/aot/AotTestMappings.java
rename to spring-test/src/main/java/org/springframework/test/context/aot/TestAotMappings.java
index 6b031307a0..8b563112ee 100644
--- a/spring-test/src/main/java/org/springframework/test/context/aot/AotTestMappings.java
+++ b/spring-test/src/main/java/org/springframework/test/context/aot/TestAotMappings.java
@@ -28,7 +28,7 @@ import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
/**
- * {@code AotTestMappings} provides mappings from test classes to AOT-optimized
+ * {@code TestAotMappings} provides mappings from test classes to AOT-optimized
* context initializers.
*
*
If a test class is not {@linkplain #isSupportedTestClass(Class) supported} in
@@ -42,27 +42,27 @@ import org.springframework.util.ReflectionUtils;
* @author Stephane Nicoll
* @since 6.0
*/
-public class AotTestMappings {
+public class TestAotMappings {
// TODO Add support in ClassNameGenerator for supplying a predefined class name.
// There is a similar issue in Spring Boot where code relies on a generated name.
- // Ideally we would generate a class named: org.springframework.test.context.aot.GeneratedAotTestMappings
- static final String GENERATED_MAPPINGS_CLASS_NAME = AotTestMappings.class.getName() + "__Generated";
+ // Ideally we would generate a class named: org.springframework.test.context.aot.GeneratedTestAotMappings
+ static final String GENERATED_MAPPINGS_CLASS_NAME = TestAotMappings.class.getName() + "__Generated";
static final String GENERATED_MAPPINGS_METHOD_NAME = "getContextInitializers";
private final Map>> contextInitializers;
- public AotTestMappings() {
+ public TestAotMappings() {
this(GENERATED_MAPPINGS_CLASS_NAME);
}
- AotTestMappings(String initializerClassName) {
+ TestAotMappings(String initializerClassName) {
this(loadContextInitializersMap(initializerClassName));
}
- AotTestMappings(Map>> contextInitializers) {
+ TestAotMappings(Map>> contextInitializers) {
this.contextInitializers = contextInitializers;
}
diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/AotTestMappingsCodeGenerator.java b/spring-test/src/main/java/org/springframework/test/context/aot/TestAotMappingsCodeGenerator.java
similarity index 91%
rename from spring-test/src/main/java/org/springframework/test/context/aot/AotTestMappingsCodeGenerator.java
rename to spring-test/src/main/java/org/springframework/test/context/aot/TestAotMappingsCodeGenerator.java
index 03997f82c2..62b6bf65a5 100644
--- a/spring-test/src/main/java/org/springframework/test/context/aot/AotTestMappingsCodeGenerator.java
+++ b/spring-test/src/main/java/org/springframework/test/context/aot/TestAotMappingsCodeGenerator.java
@@ -41,14 +41,14 @@ import org.springframework.javapoet.WildcardTypeName;
import org.springframework.util.MultiValueMap;
/**
- * Internal code generator for mappings used by {@link AotTestMappings}.
+ * Internal code generator for mappings used by {@link TestAotMappings}.
*
* @author Sam Brannen
* @since 6.0
*/
-class AotTestMappingsCodeGenerator {
+class TestAotMappingsCodeGenerator {
- private static final Log logger = LogFactory.getLog(AotTestMappingsCodeGenerator.class);
+ private static final Log logger = LogFactory.getLog(TestAotMappingsCodeGenerator.class);
private static final ParameterizedTypeName CONTEXT_INITIALIZER = ParameterizedTypeName.get(
ClassName.get(ApplicationContextInitializer.class),
@@ -67,7 +67,7 @@ class AotTestMappingsCodeGenerator {
private final GeneratedClass generatedClass;
- AotTestMappingsCodeGenerator(MultiValueMap> initializerClassMappings,
+ TestAotMappingsCodeGenerator(MultiValueMap> initializerClassMappings,
GeneratedClasses generatedClasses) {
this.initializerClassMappings = initializerClassMappings;
@@ -82,13 +82,13 @@ class AotTestMappingsCodeGenerator {
private void generateType(TypeSpec.Builder type) {
logger.debug(LogMessage.format("Generating AOT test mappings in %s",
this.generatedClass.getName().reflectionName()));
- type.addJavadoc("Generated mappings for {@link $T}.", AotTestMappings.class);
+ type.addJavadoc("Generated mappings for {@link $T}.", TestAotMappings.class);
type.addModifiers(Modifier.PUBLIC);
type.addMethod(generateMappingMethod());
}
private MethodSpec generateMappingMethod() {
- MethodSpec.Builder method = MethodSpec.methodBuilder(AotTestMappings.GENERATED_MAPPINGS_METHOD_NAME);
+ MethodSpec.Builder method = MethodSpec.methodBuilder(TestAotMappings.GENERATED_MAPPINGS_METHOD_NAME);
method.addModifiers(Modifier.PUBLIC, Modifier.STATIC);
method.returns(CONTEXT_SUPPLIER_MAP);
method.addCode(generateMappingCode());
diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java b/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java
index 7b430a9f41..f64a9adb2c 100644
--- a/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java
+++ b/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java
@@ -138,7 +138,7 @@ public class TestContextAotGenerator {
}
});
- generateAotTestMappings(initializerClassMappings);
+ generateTestAotMappings(initializerClassMappings);
}
/**
@@ -230,14 +230,14 @@ public class TestContextAotGenerator {
return "TestContext%03d_".formatted(this.sequence.incrementAndGet());
}
- private void generateAotTestMappings(MultiValueMap> initializerClassMappings) {
- ClassNameGenerator classNameGenerator = new ClassNameGenerator(AotTestMappings.class);
+ private void generateTestAotMappings(MultiValueMap> initializerClassMappings) {
+ ClassNameGenerator classNameGenerator = new ClassNameGenerator(TestAotMappings.class);
DefaultGenerationContext generationContext =
new DefaultGenerationContext(classNameGenerator, this.generatedFiles, this.runtimeHints);
GeneratedClasses generatedClasses = generationContext.getGeneratedClasses();
- AotTestMappingsCodeGenerator codeGenerator =
- new AotTestMappingsCodeGenerator(initializerClassMappings, generatedClasses);
+ TestAotMappingsCodeGenerator codeGenerator =
+ new TestAotMappingsCodeGenerator(initializerClassMappings, generatedClasses);
generationContext.writeGeneratedContent();
String className = codeGenerator.getGeneratedClass().getName().reflectionName();
this.runtimeHints.reflection()
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 bcfea5500f..41b0c01880 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
@@ -32,7 +32,7 @@ import org.springframework.test.context.ContextLoader;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.SmartContextLoader;
import org.springframework.test.context.aot.AotContextLoader;
-import org.springframework.test.context.aot.AotTestMappings;
+import org.springframework.test.context.aot.TestAotMappings;
import org.springframework.test.context.aot.TestContextAotException;
import org.springframework.util.Assert;
@@ -57,7 +57,7 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
static final ContextCache defaultContextCache = new DefaultContextCache();
@Nullable
- private final AotTestMappings aotTestMappings = getAotTestMappings();
+ private final TestAotMappings testAotMappings = getTestAotMappings();
private final ContextCache contextCache;
@@ -168,7 +168,7 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
protected ApplicationContext loadContextInAotMode(MergedContextConfiguration mergedConfig) throws Exception {
Class> testClass = mergedConfig.getTestClass();
ApplicationContextInitializer contextInitializer =
- this.aotTestMappings.getContextInitializer(testClass);
+ this.testAotMappings.getContextInitializer(testClass);
Assert.state(contextInitializer != null,
() -> "Failed to load AOT ApplicationContextInitializer for test class [%s]"
.formatted(testClass.getName()));
@@ -200,17 +200,17 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
* Determine if we are running in AOT mode for the supplied test class.
*/
private boolean runningInAotMode(Class> testClass) {
- return (this.aotTestMappings != null && this.aotTestMappings.isSupportedTestClass(testClass));
+ return (this.testAotMappings != null && this.testAotMappings.isSupportedTestClass(testClass));
}
@Nullable
- private static AotTestMappings getAotTestMappings() {
+ private static TestAotMappings getTestAotMappings() {
if (AotDetector.useGeneratedArtifacts()) {
try {
- return new AotTestMappings();
+ return new TestAotMappings();
}
catch (Exception ex) {
- throw new IllegalStateException("Failed to instantiate AotTestMappings", ex);
+ throw new IllegalStateException("Failed to instantiate TestAotMappings", ex);
}
}
return null;
diff --git a/spring-test/src/main/java/org/springframework/test/context/support/DependencyInjectionTestExecutionListener.java b/spring-test/src/main/java/org/springframework/test/context/support/DependencyInjectionTestExecutionListener.java
index ce3780db7f..ca133ccbf2 100644
--- a/spring-test/src/main/java/org/springframework/test/context/support/DependencyInjectionTestExecutionListener.java
+++ b/spring-test/src/main/java/org/springframework/test/context/support/DependencyInjectionTestExecutionListener.java
@@ -28,7 +28,7 @@ import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.Conventions;
import org.springframework.lang.Nullable;
import org.springframework.test.context.TestContext;
-import org.springframework.test.context.aot.AotTestMappings;
+import org.springframework.test.context.aot.TestAotMappings;
/**
* {@code TestExecutionListener} which provides support for dependency
@@ -61,7 +61,7 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
private static final Log logger = LogFactory.getLog(DependencyInjectionTestExecutionListener.class);
@Nullable
- private final AotTestMappings aotTestMappings = getAotTestMappings();
+ private final TestAotMappings testAotMappings = getTestAotMappings();
/**
@@ -162,17 +162,17 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
* Determine if we are running in AOT mode for the supplied test class.
*/
private boolean runningInAotMode(Class> testClass) {
- return (this.aotTestMappings != null && this.aotTestMappings.isSupportedTestClass(testClass));
+ return (this.testAotMappings != null && this.testAotMappings.isSupportedTestClass(testClass));
}
@Nullable
- private static AotTestMappings getAotTestMappings() {
+ private static TestAotMappings getTestAotMappings() {
if (AotDetector.useGeneratedArtifacts()) {
try {
- return new AotTestMappings();
+ return new TestAotMappings();
}
catch (Exception ex) {
- throw new IllegalStateException("Failed to instantiate AotTestMappings", ex);
+ throw new IllegalStateException("Failed to instantiate TestAotMappings", ex);
}
}
return null;
diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/AbstractAotTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/AbstractAotTests.java
index f41bd7bde7..15f6eb161f 100644
--- a/spring-test/src/test/java/org/springframework/test/context/aot/AbstractAotTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/aot/AbstractAotTests.java
@@ -31,7 +31,7 @@ abstract class AbstractAotTests {
static final String[] expectedSourceFilesForBasicSpringTests = {
// Global
- "org/springframework/test/context/aot/AotTestMappings__Generated.java",
+ "org/springframework/test/context/aot/TestAotMappings__Generated.java",
// BasicSpringJupiterSharedConfigTests
"org/springframework/context/event/DefaultEventListenerFactory__TestContext001_BeanDefinitions.java",
"org/springframework/context/event/EventListenerMethodProcessor__TestContext001_BeanDefinitions.java",
diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/AotIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/AotIntegrationTests.java
index 5e9361a819..3bda401ee8 100644
--- a/spring-test/src/test/java/org/springframework/test/context/aot/AotIntegrationTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/aot/AotIntegrationTests.java
@@ -130,7 +130,7 @@ class AotIntegrationTests extends AbstractAotTests {
private static final String[] expectedSourceFilesForBasicSpringJupiterTests = {
// Global
- "org/springframework/test/context/aot/AotTestMappings__Generated.java",
+ "org/springframework/test/context/aot/TestAotMappings__Generated.java",
// BasicSpringJupiterSharedConfigTests
"org/springframework/context/event/DefaultEventListenerFactory__TestContext001_BeanDefinitions.java",
"org/springframework/context/event/EventListenerMethodProcessor__TestContext001_BeanDefinitions.java",
diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java
index 20407fbf0d..4a2213030e 100644
--- a/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java
@@ -72,7 +72,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
/**
- * Tests for {@link TestContextAotGenerator}, {@link AotTestMappings},
+ * Tests for {@link TestContextAotGenerator}, {@link TestAotMappings},
* {@link AotContextLoader}, and run-time hints.
*
* @author Sam Brannen
@@ -85,7 +85,7 @@ class TestContextAotGeneratorTests extends AbstractAotTests {
* @see AotIntegrationTests#endToEndTests()
*/
@Test
- void processAheadOfTimeAndGenerateAotTestMappings() {
+ void processAheadOfTimeAndGenerateTestAotMappings() {
Set> testClasses = Set.of(
BasicSpringJupiterSharedConfigTests.class,
BasicSpringJupiterTests.class,
@@ -107,7 +107,7 @@ class TestContextAotGeneratorTests extends AbstractAotTests {
assertThat(sourceFiles).containsExactlyInAnyOrder(expectedSourceFiles);
TestCompiler.forSystem().withFiles(generatedFiles).compile(ThrowingConsumer.of(compiled -> {
- AotTestMappings aotTestMappings = new AotTestMappings();
+ TestAotMappings aotTestMappings = new TestAotMappings();
for (Class> testClass : testClasses) {
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
ApplicationContextInitializer contextInitializer =
@@ -129,7 +129,7 @@ class TestContextAotGeneratorTests extends AbstractAotTests {
}
private static void assertRuntimeHints(RuntimeHints runtimeHints) {
- assertReflectionRegistered(runtimeHints, AotTestMappings.GENERATED_MAPPINGS_CLASS_NAME, INVOKE_PUBLIC_METHODS);
+ assertReflectionRegistered(runtimeHints, TestAotMappings.GENERATED_MAPPINGS_CLASS_NAME, INVOKE_PUBLIC_METHODS);
Stream.of(
org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.class,
@@ -331,7 +331,7 @@ class TestContextAotGeneratorTests extends AbstractAotTests {
private static final String[] expectedSourceFiles = {
// Global
- "org/springframework/test/context/aot/AotTestMappings__Generated.java",
+ "org/springframework/test/context/aot/TestAotMappings__Generated.java",
// BasicSpringJupiterSharedConfigTests
"org/springframework/context/event/DefaultEventListenerFactory__TestContext001_BeanDefinitions.java",
"org/springframework/context/event/EventListenerMethodProcessor__TestContext001_BeanDefinitions.java",