diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizer.java similarity index 87% rename from spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizer.java rename to spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizer.java index d079bd5b76..6039ff36c6 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizer.java @@ -35,7 +35,6 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.Ordered; -import org.springframework.graphql.test.tester.GraphQlTester; import org.springframework.graphql.test.tester.WebGraphQlTester; import org.springframework.test.context.ContextCustomizer; import org.springframework.test.context.MergedContextConfiguration; @@ -46,32 +45,32 @@ import org.springframework.util.StringUtils; import org.springframework.web.context.WebApplicationContext; /** - * {@link ContextCustomizer} for {@link GraphQlTester}. + * {@link ContextCustomizer} for {@link WebGraphQlTester}. * * @author Brian Clozel */ -class GraphQlTesterContextCustomizer implements ContextCustomizer { +class WebGraphQlTesterContextCustomizer implements ContextCustomizer { @Override public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) { SpringBootTest springBootTest = TestContextAnnotationUtils.findMergedAnnotation(mergedConfig.getTestClass(), SpringBootTest.class); if (springBootTest.webEnvironment().isEmbedded()) { - registerGraphQlTester(context); + registerWebGraphQlTester(context); } } - private void registerGraphQlTester(ConfigurableApplicationContext context) { + private void registerWebGraphQlTester(ConfigurableApplicationContext context) { ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); if (beanFactory instanceof BeanDefinitionRegistry) { - registerGraphQlTester((BeanDefinitionRegistry) beanFactory); + registerWebGraphQlTester((BeanDefinitionRegistry) beanFactory); } } - private void registerGraphQlTester(BeanDefinitionRegistry registry) { - RootBeanDefinition definition = new RootBeanDefinition(GraphQlTesterRegistrar.class); + private void registerWebGraphQlTester(BeanDefinitionRegistry registry) { + RootBeanDefinition definition = new RootBeanDefinition(WebGraphQlTesterRegistrar.class); definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); - registry.registerBeanDefinition(GraphQlTesterRegistrar.class.getName(), definition); + registry.registerBeanDefinition(WebGraphQlTesterRegistrar.class.getName(), definition); } @Override @@ -84,7 +83,7 @@ class GraphQlTesterContextCustomizer implements ContextCustomizer { return getClass().hashCode(); } - private static class GraphQlTesterRegistrar + private static class WebGraphQlTesterRegistrar implements BeanDefinitionRegistryPostProcessor, Ordered, BeanFactoryAware { private BeanFactory beanFactory; @@ -97,9 +96,9 @@ class GraphQlTesterContextCustomizer implements ContextCustomizer { @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors((ListableBeanFactory) this.beanFactory, - GraphQlTester.class, false, false).length == 0) { + WebGraphQlTester.class, false, false).length == 0) { registry.registerBeanDefinition(WebGraphQlTester.class.getName(), - new RootBeanDefinition(GraphQlTesterFactory.class)); + new RootBeanDefinition(WebGraphQlTesterFactory.class)); } } @@ -115,7 +114,7 @@ class GraphQlTesterContextCustomizer implements ContextCustomizer { } - public static class GraphQlTesterFactory implements FactoryBean, ApplicationContextAware { + public static class WebGraphQlTesterFactory implements FactoryBean, ApplicationContextAware { private static final String SERVLET_APPLICATION_CONTEXT_CLASS = "org.springframework.web.context.WebApplicationContext"; @@ -123,7 +122,7 @@ class GraphQlTesterContextCustomizer implements ContextCustomizer { private ApplicationContext applicationContext; - private GraphQlTester object; + private WebGraphQlTester object; @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { @@ -137,11 +136,11 @@ class GraphQlTesterContextCustomizer implements ContextCustomizer { @Override public Class getObjectType() { - return GraphQlTester.class; + return WebGraphQlTester.class; } @Override - public GraphQlTester getObject() throws Exception { + public WebGraphQlTester getObject() throws Exception { if (this.object == null) { this.object = createGraphQlTester(); } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerFactory.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerFactory.java similarity index 82% rename from spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerFactory.java rename to spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerFactory.java index 497db17727..d0642a568f 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerFactory.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerFactory.java @@ -30,11 +30,11 @@ import org.springframework.util.ClassUtils; * {@link ContextCustomizerFactory} for {@link GraphQlTester}. * * @author Brian Clozel - * @see GraphQlTesterContextCustomizer + * @see WebGraphQlTesterContextCustomizer */ -class GraphQlTesterContextCustomizerFactory implements ContextCustomizerFactory { +class WebGraphQlTesterContextCustomizerFactory implements ContextCustomizerFactory { - private static final String GRAPHQLTESTER_CLASS = "org.springframework.graphql.test.tester.GraphQlTester"; + private static final String WEBGRAPHQLTESTER_CLASS = "org.springframework.graphql.test.tester.WebGraphQlTester"; private static final String WEBTESTCLIENT_CLASS = "org.springframework.test.web.reactive.server.WebTestClient"; @@ -43,12 +43,12 @@ class GraphQlTesterContextCustomizerFactory implements ContextCustomizerFactory List configAttributes) { SpringBootTest springBootTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, SpringBootTest.class); - return (springBootTest != null && isGraphQlTesterPresent()) ? new GraphQlTesterContextCustomizer() : null; + return (springBootTest != null && isGraphQlTesterPresent()) ? new WebGraphQlTesterContextCustomizer() : null; } private boolean isGraphQlTesterPresent() { return ClassUtils.isPresent(WEBTESTCLIENT_CLASS, getClass().getClassLoader()) - && ClassUtils.isPresent(GRAPHQLTESTER_CLASS, getClass().getClassLoader()); + && ClassUtils.isPresent(WEBGRAPHQLTESTER_CLASS, getClass().getClassLoader()); } } 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 3dd1783cd9..a0dac2ca69 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,7 @@ org.springframework.test.context.ContextCustomizerFactory=\ org.springframework.boot.test.context.ImportsContextCustomizerFactory,\ org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizerFactory,\ -org.springframework.boot.test.graphql.tester.GraphQlTesterContextCustomizerFactory,\ +org.springframework.boot.test.graphql.tester.WebGraphQlTesterContextCustomizerFactory,\ org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory,\ org.springframework.boot.test.mock.mockito.MockitoContextCustomizerFactory,\ org.springframework.boot.test.web.client.TestRestTemplateContextCustomizerFactory,\ diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerIntegrationTests.java similarity index 92% rename from spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerIntegrationTests.java rename to spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerIntegrationTests.java index b9c334ca88..622c05a162 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerIntegrationTests.java @@ -28,7 +28,7 @@ import org.springframework.boot.web.embedded.tomcat.TomcatReactiveWebServerFacto import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.buffer.DefaultDataBufferFactory; -import org.springframework.graphql.test.tester.GraphQlTester; +import org.springframework.graphql.test.tester.WebGraphQlTester; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.server.reactive.ContextPathCompositeHandler; @@ -38,17 +38,17 @@ import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.test.annotation.DirtiesContext; /** - * Integration test for {@link GraphQlTesterContextCustomizer}. + * Integration test for {@link WebGraphQlTesterContextCustomizer}. * * @author Brian Clozel */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=reactive") @DirtiesContext -class GraphQlTesterContextCustomizerIntegrationTests { +class WebGraphQlTesterContextCustomizerIntegrationTests { @Autowired - GraphQlTester graphQlTester; + WebGraphQlTester graphQlTester; @Test void shouldHandleGraphQlRequests() { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerWithCustomBasePathTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerWithCustomBasePathTests.java similarity index 91% rename from spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerWithCustomBasePathTests.java rename to spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerWithCustomBasePathTests.java index 6c1ecb4e19..fea9634620 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerWithCustomBasePathTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerWithCustomBasePathTests.java @@ -28,7 +28,7 @@ import org.springframework.boot.web.embedded.tomcat.TomcatReactiveWebServerFacto import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.buffer.DefaultDataBufferFactory; -import org.springframework.graphql.test.tester.GraphQlTester; +import org.springframework.graphql.test.tester.WebGraphQlTester; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.server.reactive.ContextPathCompositeHandler; @@ -38,17 +38,17 @@ import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.test.context.TestPropertySource; /** - * Tests for {@link GraphQlTesterContextCustomizer} with a custom context path for a + * Tests for {@link WebGraphQlTesterContextCustomizer} with a custom context path for a * Reactive web application. * * @author Brian Clozel */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestPropertySource(properties = { "spring.main.web-application-type=reactive", "spring.webflux.base-path=/test" }) -class GraphQlTesterContextCustomizerWithCustomBasePathTests { +class WebGraphQlTesterContextCustomizerWithCustomBasePathTests { @Autowired - GraphQlTester graphQlTester; + WebGraphQlTester graphQlTester; @Test void shouldHandleGraphQlRequests() { diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerWithCustomContextPathTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerWithCustomContextPathTests.java similarity index 89% rename from spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerWithCustomContextPathTests.java rename to spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerWithCustomContextPathTests.java index 095e432041..2a3bec2a55 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/GraphQlTesterContextCustomizerWithCustomContextPathTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/graphql/tester/WebGraphQlTesterContextCustomizerWithCustomContextPathTests.java @@ -24,7 +24,7 @@ import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactor import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import org.springframework.graphql.test.tester.GraphQlTester; +import org.springframework.graphql.test.tester.WebGraphQlTester; import org.springframework.http.MediaType; import org.springframework.test.context.TestPropertySource; import org.springframework.web.bind.annotation.PostMapping; @@ -32,17 +32,17 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.DispatcherServlet; /** - * Tests for {@link GraphQlTesterContextCustomizer} with a custom context path for a + * Tests for {@link WebGraphQlTesterContextCustomizer} with a custom context path for a * Servlet web application. * * @author Brian Clozel */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestPropertySource(properties = "server.servlet.context-path=/test") -class GraphQlTesterContextCustomizerWithCustomContextPathTests { +class WebGraphQlTesterContextCustomizerWithCustomContextPathTests { @Autowired - GraphQlTester graphQlTester; + WebGraphQlTester graphQlTester; @Test void shouldHandleGraphQlRequests() {