From 9fba39fc45e1a3d46062483027775a486e475d38 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 7 May 2025 12:13:26 +0100 Subject: [PATCH] Create spring-boot-graphql-test module Closes gh-46146 --- settings.gradle | 2 +- .../spring-boot-dependencies/build.gradle | 2 ++ .../build.gradle | 22 ++++++++++++++----- .../HttpGraphQlTesterContextCustomizer.java | 0 ...GraphQlTesterContextCustomizerFactory.java | 0 .../test/graphql/tester/package-info.java | 0 .../main/resources/META-INF/spring.factories | 3 +++ ...sterContextCustomizerIntegrationTests.java | 0 ...tpGraphQlTesterContextCustomizerTests.java | 0 ...textCustomizerWithCustomBasePathTests.java | 0 ...tCustomizerWithCustomContextPathTests.java | 0 .../spring-boot-test/build.gradle | 1 - .../main/resources/META-INF/spring.factories | 1 - .../context/SpringBootContextLoaderTests.java | 3 +-- 14 files changed, 24 insertions(+), 10 deletions(-) rename spring-boot-project/{spring-boot-test-integration-tests => spring-boot-graphql-test}/build.gradle (65%) rename spring-boot-project/{spring-boot-test => spring-boot-graphql-test}/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizer.java (100%) rename spring-boot-project/{spring-boot-test => spring-boot-graphql-test}/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerFactory.java (100%) rename spring-boot-project/{spring-boot-test => spring-boot-graphql-test}/src/main/java/org/springframework/boot/test/graphql/tester/package-info.java (100%) create mode 100644 spring-boot-project/spring-boot-graphql-test/src/main/resources/META-INF/spring.factories rename spring-boot-project/{spring-boot-test-integration-tests => spring-boot-graphql-test}/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerIntegrationTests.java (100%) rename spring-boot-project/{spring-boot-test => spring-boot-graphql-test}/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerTests.java (100%) rename spring-boot-project/{spring-boot-test-integration-tests => spring-boot-graphql-test}/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomBasePathTests.java (100%) rename spring-boot-project/{spring-boot-test-integration-tests => spring-boot-graphql-test}/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomContextPathTests.java (100%) diff --git a/settings.gradle b/settings.gradle index 3f6dba3c752..7b7de23a471 100644 --- a/settings.gradle +++ b/settings.gradle @@ -87,6 +87,7 @@ include "spring-boot-project:spring-boot-elasticsearch" include "spring-boot-project:spring-boot-flyway" include "spring-boot-project:spring-boot-freemarker" include "spring-boot-project:spring-boot-graphql" +include "spring-boot-project:spring-boot-graphql-test" include "spring-boot-project:spring-boot-groovy-templates" include "spring-boot-project:spring-boot-gson" include "spring-boot-project:spring-boot-h2console" @@ -134,7 +135,6 @@ include "spring-boot-project:spring-boot-session-jdbc" include "spring-boot-project:spring-boot-sql" include "spring-boot-project:spring-boot-test" include "spring-boot-project:spring-boot-test-autoconfigure" -include "spring-boot-project:spring-boot-test-integration-tests" include "spring-boot-project:spring-boot-testcontainers" include "spring-boot-project:spring-boot-thymeleaf" include "spring-boot-project:spring-boot-tomcat" diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 8452aa24260..167bb320899 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -2014,6 +2014,8 @@ bom { "spring-boot-elasticsearch", "spring-boot-flyway", "spring-boot-freemarker", + "spring-boot-graphql", + "spring-boot-graphql-test", "spring-boot-groovy-templates", "spring-boot-gson", "spring-boot-h2console", diff --git a/spring-boot-project/spring-boot-test-integration-tests/build.gradle b/spring-boot-project/spring-boot-graphql-test/build.gradle similarity index 65% rename from spring-boot-project/spring-boot-test-integration-tests/build.gradle rename to spring-boot-project/spring-boot-graphql-test/build.gradle index 70022d72464..b59e9526a68 100644 --- a/spring-boot-project/spring-boot-test-integration-tests/build.gradle +++ b/spring-boot-project/spring-boot-graphql-test/build.gradle @@ -16,20 +16,32 @@ plugins { - id "java" + id "java-library" + id "org.springframework.boot.deployed" + id "org.springframework.boot.optional-dependencies" } -description = "Spring Boot Test Integration Tests" +description = "Spring Boot GraphQL Test" dependencies { - testImplementation(project(":spring-boot-project:spring-boot-test")) + api("org.springframework.graphql:spring-graphql-test") + + implementation(project(":spring-boot-project:spring-boot-test")) + + optional(project(":spring-boot-project:spring-boot-web-server")) + optional(project(":spring-boot-project:spring-boot-web-server-test")) + optional("jakarta.servlet:jakarta.servlet-api") + optional("org.springframework:spring-web") + testImplementation(project(":spring-boot-project:spring-boot-tomcat")) testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) - testImplementation(project(":spring-boot-project:spring-boot-web-server-test")) testImplementation("org.springframework:spring-webflux") testImplementation("org.springframework:spring-webmvc") - testImplementation("org.springframework.graphql:spring-graphql-test") testRuntimeOnly("ch.qos.logback:logback-classic") testRuntimeOnly("com.fasterxml.jackson.core:jackson-databind") } + +tasks.named("javadoc") { + enabled = false +} diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizer.java b/spring-boot-project/spring-boot-graphql-test/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizer.java similarity index 100% rename from spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizer.java rename to spring-boot-project/spring-boot-graphql-test/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizer.java diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerFactory.java b/spring-boot-project/spring-boot-graphql-test/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerFactory.java similarity index 100% rename from spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerFactory.java rename to spring-boot-project/spring-boot-graphql-test/src/main/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerFactory.java diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/package-info.java b/spring-boot-project/spring-boot-graphql-test/src/main/java/org/springframework/boot/test/graphql/tester/package-info.java similarity index 100% rename from spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/package-info.java rename to spring-boot-project/spring-boot-graphql-test/src/main/java/org/springframework/boot/test/graphql/tester/package-info.java diff --git a/spring-boot-project/spring-boot-graphql-test/src/main/resources/META-INF/spring.factories b/spring-boot-project/spring-boot-graphql-test/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000000..ecf5d75359b --- /dev/null +++ b/spring-boot-project/spring-boot-graphql-test/src/main/resources/META-INF/spring.factories @@ -0,0 +1,3 @@ +# Spring Test Context Customizer Factories +org.springframework.test.context.ContextCustomizerFactory=\ +org.springframework.boot.test.graphql.tester.HttpGraphQlTesterContextCustomizerFactory diff --git a/spring-boot-project/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerIntegrationTests.java b/spring-boot-project/spring-boot-graphql-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerIntegrationTests.java similarity index 100% rename from spring-boot-project/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerIntegrationTests.java rename to spring-boot-project/spring-boot-graphql-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerIntegrationTests.java diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerTests.java b/spring-boot-project/spring-boot-graphql-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerTests.java similarity index 100% rename from spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerTests.java rename to spring-boot-project/spring-boot-graphql-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerTests.java diff --git a/spring-boot-project/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomBasePathTests.java b/spring-boot-project/spring-boot-graphql-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomBasePathTests.java similarity index 100% rename from spring-boot-project/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomBasePathTests.java rename to spring-boot-project/spring-boot-graphql-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomBasePathTests.java diff --git a/spring-boot-project/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomContextPathTests.java b/spring-boot-project/spring-boot-graphql-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomContextPathTests.java similarity index 100% rename from spring-boot-project/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomContextPathTests.java rename to spring-boot-project/spring-boot-graphql-test/src/test/java/org/springframework/boot/test/graphql/tester/HttpGraphQlTesterContextCustomizerWithCustomContextPathTests.java diff --git a/spring-boot-project/spring-boot-test/build.gradle b/spring-boot-project/spring-boot-test/build.gradle index c6f9098c288..5900d916692 100644 --- a/spring-boot-project/spring-boot-test/build.gradle +++ b/spring-boot-project/spring-boot-test/build.gradle @@ -27,7 +27,6 @@ dependencies { api(project(":spring-boot-project:spring-boot")) api("org.springframework:spring-test") - optional(project(":spring-boot-project:spring-boot-web-server")) optional("com.fasterxml.jackson.core:jackson-databind") optional("com.google.code.gson:gson") optional("com.jayway.jsonpath:json-path") diff --git a/spring-boot-project/spring-boot-test/src/main/resources/META-INF/spring.factories b/spring-boot-project/spring-boot-test/src/main/resources/META-INF/spring.factories index 90efcfacbf9..64bb8f65866 100644 --- a/spring-boot-project/spring-boot-test/src/main/resources/META-INF/spring.factories +++ b/spring-boot-project/spring-boot-test/src/main/resources/META-INF/spring.factories @@ -2,7 +2,6 @@ org.springframework.test.context.ContextCustomizerFactory=\ org.springframework.boot.test.context.ImportsContextCustomizerFactory,\ org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizerFactory,\ -org.springframework.boot.test.graphql.tester.HttpGraphQlTesterContextCustomizerFactory,\ org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory,\ org.springframework.boot.test.mock.mockito.MockitoContextCustomizerFactory diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java index fa3fe991fb9..bdb8379a5d6 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java @@ -163,8 +163,7 @@ class SpringBootContextLoaderTests { .collect(Collectors.toCollection(ArrayList::new)); String configResource = names.remove(names.size() - 2); assertThat(names).containsExactly("configurationProperties", "Inlined Test Properties", "commandLineArgs", - "servletConfigInitParams", "servletContextInitParams", "systemProperties", "systemEnvironment", - "random", "applicationInfo"); + "systemProperties", "systemEnvironment", "random", "applicationInfo"); assertThat(configResource).startsWith("Config resource"); }