From bba56ffc8bfc6dbf4b5d786f77203c6ffd82cf1c Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 29 Sep 2025 12:55:17 -0700 Subject: [PATCH] Move `RestTestClientBuilderCustomizer` to `spring-boot-test` Relocate `RestTestClientBuilderCustomizer` to `spring-boot-test` and break the direct link to web-server by making use of `spring.factories` and the new `BaseUrlProviders` class. See gh-46356 --- .../client/BaseUrlUriBuilderFactory.java | 84 +++++++++++++++++++ .../RestTestClientBuilderCustomizer.java | 15 ++-- .../RestTestClientContextCustomizer.java | 56 ++++++------- ...estTestClientContextCustomizerFactory.java | 2 +- .../test/web/servlet/client/package-info.java | 24 ++++++ .../main/resources/META-INF/spring.factories | 5 +- .../testing/spring-boot-applications.adoc | 2 +- .../pages/testing/test-utilities.adoc | 2 + .../MyRandomPortTestRestTemplateTests.java | 2 +- .../testresttemplate/MySpringBootTests.java | 2 +- .../utilities/testresttemplate/MyTests.java | 2 +- .../MyRandomPortTestRestTemplateTests.kt | 2 +- .../testresttemplate/MySpringBootTests.kt | 2 +- .../utilities/testresttemplate/MyTests.kt | 2 +- .../build.gradle | 3 + .../test}/NoTestRestTemplateBeanChecker.java | 2 +- ...lateContextCustomizerIntegrationTests.java | 2 +- ...estRestTemplateContextCustomizerTests.java | 4 +- ...ContextCustomizerWithFactoryBeanTests.java | 4 +- ...ustomizerWithOverrideIntegrationTests.java | 2 +- .../test/scan/SimpleFactoryBean.java | 0 .../LocalHostUriTemplateHandlerTests.java | 3 +- .../client/NoRestTestClientBeanChecker.java | 2 +- ...ientContextCustomizerIntegrationTests.java | 6 +- .../RestTestClientContextCustomizerTests.java | 4 +- ...WithCustomContextPathIntegrationTests.java | 6 +- ...mizerWithOverridePathIntegrationTests.java | 6 +- .../client/TestWebMvcConfiguration.java | 2 +- ...stEmbeddedReactiveWebEnvironmentTests.java | 2 +- ...gBootTestWebServerWebEnvironmentTests.java | 2 +- .../server/test/LocalManagementPortTests.java | 0 .../web/server/test/LocalServerPortTests.java | 0 ...ndomPortEnvironmentPostProcessorTests.java | 0 ...eactiveWebEnvironmentDefinedPortTests.java | 0 ...ReactiveWebEnvironmentRandomPortTests.java | 0 ...nmentUserDefinedTestRestTemplateTests.java | 0 ...tTestUserDefinedTestRestTemplateTests.java | 0 ...stWebEnvironmentContextHierarchyTests.java | 0 ...ootTestWebEnvironmentDefinedPortTests.java | 0 ...bEnvironmentRandomPortCustomPortTests.java | 0 ...BootTestWebEnvironmentRandomPortTests.java | 0 module/spring-boot-devtools/build.gradle | 3 +- .../tests/DevToolsIntegrationTests.java | 2 +- ...ithLazyInitializationIntegrationTests.java | 2 +- module/spring-boot-mustache/build.gradle | 1 + ...oConfigurationServletIntegrationTests.java | 2 +- .../spring-boot-restclient-test/build.gradle | 7 +- .../restclient/test}/TestRestTemplate.java | 9 +- .../TestRestTemplateContextCustomizer.java | 31 ++----- ...tRestTemplateContextCustomizerFactory.java | 2 +- .../test}/TestRestTemplateExtensions.kt | 2 +- .../main/resources/META-INF/spring.factories | 4 + .../test}/TestRestTemplateTests.java | 23 ++--- module/spring-boot-security/build.gradle | 1 + ...ConfigurationEarlyInitializationTests.java | 2 +- .../spring-boot-web-server-test/build.gradle | 2 - .../main/resources/META-INF/spring.factories | 2 - ...rverApplicationContextBaseUrlProvider.java | 3 +- ...rverApplicationContextBaseUrlProvider.java | 3 +- .../MockMvcAutoConfigurationTests.java | 2 +- module/spring-boot-webmvc/build.gradle | 1 + .../WelcomePageIntegrationTests.java | 2 +- .../BasicErrorControllerIntegrationTests.java | 2 +- .../RemappedErrorViewIntegrationTests.java | 2 +- ...ractSampleActuatorCustomSecurityTests.java | 2 +- .../CorsSampleActuatorApplicationTests.java | 2 +- ...AndPathSampleActuatorApplicationTests.java | 2 +- ...tCustomServletPathSampleActuatorTests.java | 2 +- ...mpleActuatorExtensionApplicationTests.java | 2 +- .../SampleActuatorUiApplicationPortTests.java | 2 +- .../ui/SampleActuatorUiApplicationTests.java | 2 +- ...AndPathSampleActuatorApplicationTests.java | 2 +- .../CorsSampleActuatorApplicationTests.java | 2 +- ...pertiesSampleActuatorApplicationTests.java | 2 +- ...gementAddressActuatorApplicationTests.java | 2 +- ...HandlerSampleActuatorApplicationTests.java | 2 +- ...entPortSampleActuatorApplicationTests.java | 2 +- ...entPathSampleActuatorApplicationTests.java | 2 +- ...entPortSampleActuatorApplicationTests.java | 2 +- ...gementPortWithLazyInitializationTests.java | 2 +- ...agementSampleActuatorApplicationTests.java | 2 +- ...icationIsolatedObjectMapperFalseTests.java | 2 +- ...licationIsolatedObjectMapperTrueTests.java | 2 +- .../SampleActuatorApplicationTests.java | 2 +- ...letPathSampleActuatorApplicationTests.java | 2 +- ...hutdownSampleActuatorApplicationTests.java | 2 +- ...leDevToolsApplicationIntegrationTests.java | 2 +- .../SampleHateoasApplicationTests.java | 2 +- .../jsp/SampleWebJspApplicationTests.java | 2 +- .../ssl/SampleJettySslApplicationTests.java | 2 +- .../jetty/SampleJettyApplicationTests.java | 2 +- ...h2AuthorizationServerApplicationTests.java | 2 +- .../SampleOAuth2ClientApplicationTests.java | 2 +- ...eOauth2ResourceServerApplicationTests.java | 2 +- .../SamplePrometheusApplicationTests.java | 2 +- .../SampleQuartzApplicationWebTests.java | 2 +- ...mpleSaml2RelyingPartyApplicationTests.java | 2 +- .../SampleServletApplicationTests.java | 2 +- .../SampleSessionMongoApplicationTests.java | 2 +- .../SampleSessionRedisApplicationTests.java | 2 +- ...ampleSessionHazelcastApplicationTests.java | 2 +- .../SampleSessionJdbcApplicationTests.java | 2 +- ...pleTestApplicationWebIntegrationTests.java | 2 +- .../build.gradle | 1 + .../testng/SampleTestNGApplicationTests.java | 2 +- .../jsp/SampleWebJspApplicationTests.java | 2 +- ...leTomcatTwoConnectorsApplicationTests.java | 2 +- .../ssl/SampleTomcatSslApplicationTests.java | 2 +- ...igurationSampleTomcatApplicationTests.java | 2 +- .../tomcat/SampleTomcatApplicationTests.java | 2 +- .../SampleTraditionalApplicationTests.java | 2 +- .../SampleWebFreeMarkerApplicationTests.java | 2 +- .../SampleGroovyTemplateApplicationTests.java | 2 +- .../jsp/SampleWebJspApplicationTests.java | 2 +- .../SampleMethodSecurityApplicationTests.java | 2 +- .../SampleWebMustacheApplicationTests.java | 2 +- ...SampleWebSecureCustomApplicationTests.java | 2 +- .../SampleWebSecureJdbcApplicationTests.java | 2 +- .../web/secure/AbstractErrorPageTests.java | 2 +- ...AbstractUnauthenticatedErrorPageTests.java | 2 +- .../SampleWebSecureApplicationTests.java | 2 +- .../SampleWebStaticApplicationTests.java | 2 +- .../SampleWebUiApplicationTests.java | 2 +- ...ApplicationActuatorDifferentPortTests.java | 2 +- .../deployment/AbstractDeploymentTests.java | 2 +- 125 files changed, 291 insertions(+), 192 deletions(-) create mode 100644 core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/BaseUrlUriBuilderFactory.java rename {module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test => core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet}/client/RestTestClientBuilderCustomizer.java (65%) rename {module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test => core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet}/client/RestTestClientContextCustomizer.java (78%) rename {module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test => core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet}/client/RestTestClientContextCustomizerFactory.java (97%) create mode 100644 core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/package-info.java rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test}/NoTestRestTemplateBeanChecker.java (96%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test}/TestRestTemplateContextCustomizerIntegrationTests.java (97%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test}/TestRestTemplateContextCustomizerTests.java (94%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test}/TestRestTemplateContextCustomizerWithFactoryBeanTests.java (94%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test}/TestRestTemplateContextCustomizerWithOverrideIntegrationTests.java (97%) rename {module/spring-boot-restclient-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/restclient/test/scan/SimpleFactoryBean.java (100%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet}/client/LocalHostUriTemplateHandlerTests.java (96%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet}/client/NoRestTestClientBeanChecker.java (96%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet}/client/RestTestClientContextCustomizerIntegrationTests.java (92%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet}/client/RestTestClientContextCustomizerTests.java (94%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet}/client/RestTestClientContextCustomizerWithCustomContextPathIntegrationTests.java (93%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet}/client/RestTestClientContextCustomizerWithOverridePathIntegrationTests.java (92%) rename {module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test => integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet}/client/TestWebMvcConfiguration.java (96%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java (98%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java (98%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/LocalManagementPortTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/LocalServerPortTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/SpringBootTestRandomPortEnvironmentPostProcessorTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentDefinedPortTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentRandomPortTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/SpringBootTestUserDefinedTestRestTemplateTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentContextHierarchyTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentDefinedPortTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortCustomPortTests.java (100%) rename {module/spring-boot-web-server-test => integration-test/spring-boot-test-integration-tests}/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortTests.java (100%) rename module/{spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client => spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test}/TestRestTemplate.java (99%) rename module/{spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client => spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test}/TestRestTemplateContextCustomizer.java (85%) rename module/{spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client => spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test}/TestRestTemplateContextCustomizerFactory.java (97%) rename module/{spring-boot-web-server-test/src/main/kotlin/org/springframework/boot/web/server/test/client => spring-boot-restclient-test/src/main/kotlin/org/springframework/boot/restclient/test}/TestRestTemplateExtensions.kt (99%) rename module/{spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client => spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test}/TestRestTemplateTests.java (95%) diff --git a/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/BaseUrlUriBuilderFactory.java b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/BaseUrlUriBuilderFactory.java new file mode 100644 index 00000000000..663f9885502 --- /dev/null +++ b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/BaseUrlUriBuilderFactory.java @@ -0,0 +1,84 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.test.web.servlet.client; + +import java.net.URI; +import java.util.Map; + +import org.jspecify.annotations.Nullable; + +import org.springframework.boot.test.http.server.BaseUrl; +import org.springframework.util.Assert; +import org.springframework.web.util.DefaultUriBuilderFactory; +import org.springframework.web.util.UriBuilder; +import org.springframework.web.util.UriBuilderFactory; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * {@link UriBuilderFactory} to support {@link BaseUrl}. + * + * @author Phillip Webb + * @since 4.0.0 + */ +public class BaseUrlUriBuilderFactory implements UriBuilderFactory { + + private final UriBuilderFactory delegate; + + private final BaseUrl baseUrl; + + /** + * Create a new {@link BaseUrlUriBuilderFactory} instance. + * @param delegate the delegate {@link UriBuilderFactory} + * @param baseUrl the base URL to use + */ + public BaseUrlUriBuilderFactory(UriBuilderFactory delegate, BaseUrl baseUrl) { + Assert.notNull(delegate, "'delegate' must not be null"); + Assert.notNull(baseUrl, "'baseUrl' must not be null"); + this.delegate = delegate; + this.baseUrl = baseUrl; + } + + @Override + public UriBuilder uriString(String uriTemplate) { + return UriComponentsBuilder.fromUriString(apply(uriTemplate)); + } + + @Override + public UriBuilder builder() { + return UriComponentsBuilder.newInstance(); + } + + @Override + public URI expand(String uriTemplate, Map uriVariables) { + return this.delegate.expand(apply(uriTemplate), uriVariables); + } + + @Override + public URI expand(String uriTemplate, @Nullable Object... uriVariables) { + return this.delegate.expand(apply(uriTemplate), uriVariables); + } + + String apply(String uriTemplate) { + return (uriTemplate.startsWith("/")) ? this.baseUrl.resolve(uriTemplate) : uriTemplate; + } + + public static UriBuilderFactory get(@Nullable BaseUrl baseUrl) { + DefaultUriBuilderFactory delegate = new DefaultUriBuilderFactory(); + return (baseUrl != null) ? new BaseUrlUriBuilderFactory(delegate, baseUrl) : delegate; + } + +} diff --git a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/RestTestClientBuilderCustomizer.java b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/RestTestClientBuilderCustomizer.java similarity index 65% rename from module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/RestTestClientBuilderCustomizer.java rename to core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/RestTestClientBuilderCustomizer.java index aa178a78c9a..442f2fc3bb4 100644 --- a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/RestTestClientBuilderCustomizer.java +++ b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/RestTestClientBuilderCustomizer.java @@ -14,14 +14,17 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; +import org.springframework.context.ApplicationContext; import org.springframework.test.web.servlet.client.RestTestClient; +import org.springframework.test.web.servlet.client.RestTestClient.Builder; /** - * A customizer that can be implemented by beans wishing to customize the - * {@link RestTestClient.Builder} to fine-tine its auto-configuration before a - * {@link RestTestClient} is created. + * A customizer that can be implemented by beans wishing to customize the {@link Builder} + * to fine-tune its auto-configuration before a {@link RestTestClient} is created. + * Implementations can be registered in the {@link ApplicationContext} or + * {@code spring.factories}. * * @author Stephane Nicoll * @since 4.0.0 @@ -30,9 +33,9 @@ import org.springframework.test.web.servlet.client.RestTestClient; public interface RestTestClientBuilderCustomizer { /** - * Customize the given {@link RestTestClient.Builder Builder}. + * Customize the given {@link Builder Builder}. * @param builder the builder */ - void customize(RestTestClient.Builder builder); + void customize(Builder builder); } diff --git a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizer.java b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizer.java similarity index 78% rename from module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizer.java rename to core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizer.java index b8d6594860d..405a3c58975 100644 --- a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizer.java +++ b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizer.java @@ -14,7 +14,10 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; + +import java.util.ArrayList; +import java.util.List; import org.jspecify.annotations.Nullable; @@ -25,20 +28,21 @@ import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanFactoryUtils; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.ListableBeanFactory; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.boot.restclient.RootUriBuilderFactory; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.reactive.AbstractReactiveWebServerFactory; +import org.springframework.boot.test.http.server.BaseUrl; +import org.springframework.boot.test.http.server.BaseUrlProviders; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.ConfigurationClassPostProcessor; import org.springframework.core.Ordered; +import org.springframework.core.io.support.SpringFactoriesLoader; +import org.springframework.core.io.support.SpringFactoriesLoader.ArgumentResolver; import org.springframework.test.context.ContextCustomizer; import org.springframework.test.context.MergedContextConfiguration; import org.springframework.test.context.TestContextAnnotationUtils; @@ -49,6 +53,7 @@ import org.springframework.util.Assert; * {@link ContextCustomizer} for {@link RestTestClient}. * * @author Stephane Nicoll + * @author Phillip Webb */ class RestTestClientContextCustomizer implements ContextCustomizer { @@ -95,8 +100,7 @@ class RestTestClientContextCustomizer implements ContextCustomizer { */ static class RestTestClientRegistrar implements BeanDefinitionRegistryPostProcessor, Ordered, BeanFactoryAware { - @SuppressWarnings("NullAway.Init") - private BeanFactory beanFactory; + private @Nullable BeanFactory beanFactory; @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { @@ -110,7 +114,7 @@ class RestTestClientContextCustomizer implements ContextCustomizer { @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { - if (AotDetector.useGeneratedArtifacts()) { + if (this.beanFactory == null || AotDetector.useGeneratedArtifacts()) { return; } if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors((ListableBeanFactory) this.beanFactory, @@ -132,8 +136,7 @@ class RestTestClientContextCustomizer implements ContextCustomizer { */ public static class RestTestClientFactory implements FactoryBean, ApplicationContextAware { - @SuppressWarnings("NullAway.Init") - private ApplicationContext applicationContext; + private @Nullable ApplicationContext applicationContext; private @Nullable RestTestClient object; @@ -161,32 +164,27 @@ class RestTestClientContextCustomizer implements ContextCustomizer { } private RestTestClient createRestTestClient() { - boolean sslEnabled = isSslEnabled(this.applicationContext); - LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler( - this.applicationContext.getEnvironment(), sslEnabled ? "https" : "http"); + Assert.state(this.applicationContext != null, "ApplicationContext not injected"); RestTestClient.Builder builder = RestTestClient.bindToServer(); customizeRestTestClientBuilder(builder, this.applicationContext); - return builder.uriBuilderFactory(new RootUriBuilderFactory(handler.getRootUri(), handler)).build(); - } - - private boolean isSslEnabled(ApplicationContext context) { - try { - AbstractReactiveWebServerFactory webServerFactory = context - .getBean(AbstractReactiveWebServerFactory.class); - return webServerFactory.getSsl() != null && webServerFactory.getSsl().isEnabled(); - } - catch (NoSuchBeanDefinitionException ex) { - return false; - } + BaseUrl baseUrl = new BaseUrlProviders(this.applicationContext).getBaseUrl(); + return builder.uriBuilderFactory(BaseUrlUriBuilderFactory.get(baseUrl)).build(); } private void customizeRestTestClientBuilder(RestTestClient.Builder clientBuilder, ApplicationContext context) { - for (RestTestClientBuilderCustomizer customizer : context - .getBeansOfType(RestTestClientBuilderCustomizer.class) - .values()) { - customizer.customize(clientBuilder); - } + Assert.state(this.applicationContext != null, "ApplicationContext not injected"); + getRestTestClientBuilderCustomizers(this.applicationContext) + .forEach((customizer) -> customizer.customize(clientBuilder)); + } + + private List getRestTestClientBuilderCustomizers(ApplicationContext context) { + List customizers = new ArrayList<>(); + SpringFactoriesLoader.forDefaultResourceLocation(context.getClassLoader()) + .load(RestTestClientBuilderCustomizer.class, ArgumentResolver.of(ApplicationContext.class, context)) + .forEach(customizers::add); + context.getBeansOfType(RestTestClientBuilderCustomizer.class).values().forEach(customizers::add); + return customizers; } } diff --git a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerFactory.java b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerFactory.java similarity index 97% rename from module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerFactory.java rename to core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerFactory.java index 7b4a11bd263..ab89be4980e 100644 --- a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerFactory.java +++ b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; import java.util.List; diff --git a/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/package-info.java b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/package-info.java new file mode 100644 index 00000000000..3a49edcd998 --- /dev/null +++ b/core/spring-boot-test/src/main/java/org/springframework/boot/test/web/servlet/client/package-info.java @@ -0,0 +1,24 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Spring Boot support for testing Spring Servlet server endpoints via + * {@link org.springframework.test.web.servlet.client.RestTestClient}. + */ +@NullMarked +package org.springframework.boot.test.web.servlet.client; + +import org.jspecify.annotations.NullMarked; diff --git a/core/spring-boot-test/src/main/resources/META-INF/spring.factories b/core/spring-boot-test/src/main/resources/META-INF/spring.factories index fa085a63a02..6ab6fb5634f 100644 --- a/core/spring-boot-test/src/main/resources/META-INF/spring.factories +++ b/core/spring-boot-test/src/main/resources/META-INF/spring.factories @@ -5,8 +5,9 @@ org.springframework.boot.test.context.PropertyMappingContextCustomizerFactory,\ org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizerFactory,\ org.springframework.boot.test.context.filter.annotation.TypeExcludeFiltersContextCustomizerFactory,\ org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory,\ -org.springframework.boot.test.web.reactive.client.WebTestClientContextCustomizerFactory +org.springframework.boot.test.web.reactive.client.WebTestClientContextCustomizerFactory,\ +org.springframework.boot.test.web.servlet.client.RestTestClientContextCustomizerFactory # Application Context Initializers org.springframework.context.ApplicationContextInitializer=\ -org.springframework.boot.test.context.filter.ExcludeFilterApplicationContextInitializer +org.springframework.boot.test.context.filter.ExcludeFilterApplicationContextInitializer \ No newline at end of file diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc index 5f189951a51..d73e3a1fc81 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc @@ -189,7 +189,7 @@ include-code::MyRandomPortWebTestClientTests[] TIP: javadoc:org.springframework.test.web.reactive.server.WebTestClient[] can also used with a xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.with-mock-environment[mock environment], removing the need for a running server, by annotating your test class with javadoc:org.springframework.boot.webflux.test.autoconfigure.AutoConfigureWebTestClient[format=annotation] from `spring-boot-webflux-test`. -The `spring-boot-web-server-test` modules also provides a javadoc:org.springframework.boot.web.server.test.client.TestRestTemplate[] facility: +The `spring-boot-retclient-test` modules also provides a javadoc:org.springframework.boot.restclient.test.TestRestTemplate[] facility: include-code::MyRandomPortTestRestTemplateTests[] diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/test-utilities.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/test-utilities.adoc index ab6e23c2a7d..2e6b19a2e98 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/test-utilities.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/test-utilities.adoc @@ -43,6 +43,8 @@ include-code::MyOutputCaptureTests[] == TestRestTemplate javadoc:org.springframework.boot.test.web.client.TestRestTemplate[] is a convenience alternative to Spring's javadoc:org.springframework.web.client.RestTemplate[] that is useful in integration tests. +It's provided by the `spring-boot-restclient-test` module. + You can get a vanilla template or one that sends Basic HTTP authentication (with a username and password). In either case, the template is fault tolerant. This means that it behaves in a test-friendly way by not throwing exceptions on 4xx and 5xx errors. diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortTestRestTemplateTests.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortTestRestTemplateTests.java index c8787d8b0aa..87a21aa96a7 100644 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortTestRestTemplateTests.java +++ b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortTestRestTemplateTests.java @@ -19,9 +19,9 @@ package org.springframework.boot.docs.testing.springbootapplications.withrunning import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import static org.assertj.core.api.Assertions.assertThat; diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.java index 7dfa0bc3ef7..7a8aac60eee 100644 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.java +++ b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.TestConfiguration; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.http.HttpHeaders; diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MyTests.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MyTests.java index a8767d9c768..08c9871f982 100644 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MyTests.java +++ b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MyTests.java @@ -18,7 +18,7 @@ package org.springframework.boot.docs.testing.utilities.testresttemplate; import org.junit.jupiter.api.Test; -import org.springframework.boot.web.server.test.client.TestRestTemplate; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.http.ResponseEntity; import static org.assertj.core.api.Assertions.assertThat; diff --git a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortTestRestTemplateTests.kt b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortTestRestTemplateTests.kt index bc85b291d45..4c9a48e10b9 100644 --- a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortTestRestTemplateTests.kt +++ b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortTestRestTemplateTests.kt @@ -19,9 +19,9 @@ package org.springframework.boot.docs.testing.springbootapplications.withrunning import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.restclient.test.TestRestTemplate import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.context.SpringBootTest.WebEnvironment -import org.springframework.boot.web.server.test.client.TestRestTemplate @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) class MyRandomPortTestRestTemplateTests { diff --git a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.kt b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.kt index e2635bdb2da..fc7a643ef71 100644 --- a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.kt +++ b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.kt @@ -22,8 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.context.SpringBootTest.WebEnvironment import org.springframework.boot.test.context.TestConfiguration -import org.springframework.boot.web.server.test.client.TestRestTemplate import org.springframework.boot.restclient.RestTemplateBuilder +import org.springframework.boot.restclient.test.TestRestTemplate import org.springframework.context.annotation.Bean import java.time.Duration diff --git a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MyTests.kt b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MyTests.kt index 671f2559c9b..7fc903dd0e9 100644 --- a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MyTests.kt +++ b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MyTests.kt @@ -18,7 +18,7 @@ package org.springframework.boot.docs.testing.utilities.testresttemplate import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.springframework.boot.web.server.test.client.TestRestTemplate +import org.springframework.boot.restclient.test.TestRestTemplate class MyTests { diff --git a/integration-test/spring-boot-test-integration-tests/build.gradle b/integration-test/spring-boot-test-integration-tests/build.gradle index 014c524c6ba..5155e16be60 100644 --- a/integration-test/spring-boot-test-integration-tests/build.gradle +++ b/integration-test/spring-boot-test-integration-tests/build.gradle @@ -22,11 +22,14 @@ plugins { description = "Spring Boot Test Integration Tests" dependencies { + testImplementation(project(":core:spring-boot-autoconfigure")) testImplementation(project(":core:spring-boot-test")) testImplementation(project(":test-support:spring-boot-test-support")) testImplementation(project(":module:spring-boot-http-codec")) + testImplementation(project(":module:spring-boot-restclient-test")) testImplementation(project(":module:spring-boot-tomcat")) testImplementation(project(":module:spring-boot-web-server")) + testImplementation(project(":module:spring-boot-web-server-test")) testImplementation("io.projectreactor.netty:reactor-netty-http") testImplementation("org.springframework:spring-webmvc") testImplementation("org.springframework:spring-webflux") diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/NoTestRestTemplateBeanChecker.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/NoTestRestTemplateBeanChecker.java similarity index 96% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/NoTestRestTemplateBeanChecker.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/NoTestRestTemplateBeanChecker.java index 3d51c2fe8b4..85feb1eb17b 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/NoTestRestTemplateBeanChecker.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/NoTestRestTemplateBeanChecker.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.restclient.test; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerIntegrationTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerIntegrationTests.java similarity index 97% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerIntegrationTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerIntegrationTests.java index e1ad9363aff..027ecf9ea42 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerIntegrationTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.restclient.test; import java.io.IOException; import java.io.PrintWriter; diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerTests.java similarity index 94% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerTests.java index 80a5492091f..7a5f6376135 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerTests.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.restclient.test; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.boot.restclient.test.TestRestTemplateContextCustomizer.TestRestTemplateRegistrar; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.boot.web.server.test.client.TestRestTemplateContextCustomizer.TestRestTemplateRegistrar; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.test.context.MergedContextConfiguration; diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerWithFactoryBeanTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerWithFactoryBeanTests.java similarity index 94% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerWithFactoryBeanTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerWithFactoryBeanTests.java index 12c65e349e5..d09b7ea100c 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerWithFactoryBeanTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerWithFactoryBeanTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.restclient.test; import org.junit.jupiter.api.Test; @@ -49,7 +49,7 @@ class TestRestTemplateContextCustomizerWithFactoryBeanTests { } @Configuration(proxyBeanMethods = false) - @ComponentScan("org.springframework.boot.test.web.client.scan") + @ComponentScan("org.springframework.boot.test.scan") static class TestClassWithFactoryBean { @Bean diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerWithOverrideIntegrationTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerWithOverrideIntegrationTests.java similarity index 97% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerWithOverrideIntegrationTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerWithOverrideIntegrationTests.java index 6ea83651c0b..7d47ff34a51 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerWithOverrideIntegrationTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerWithOverrideIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.restclient.test; import java.io.IOException; import java.io.PrintWriter; diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/scan/SimpleFactoryBean.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/scan/SimpleFactoryBean.java similarity index 100% rename from module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/scan/SimpleFactoryBean.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/restclient/test/scan/SimpleFactoryBean.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/LocalHostUriTemplateHandlerTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/LocalHostUriTemplateHandlerTests.java similarity index 96% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/LocalHostUriTemplateHandlerTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/LocalHostUriTemplateHandlerTests.java index f25223b3d9e..f00b031d0af 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/LocalHostUriTemplateHandlerTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/LocalHostUriTemplateHandlerTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; import java.net.URI; import java.util.HashMap; @@ -22,6 +22,7 @@ import java.util.Map; import org.junit.jupiter.api.Test; +import org.springframework.boot.web.server.test.client.LocalHostUriTemplateHandler; import org.springframework.mock.env.MockEnvironment; import org.springframework.web.util.UriTemplateHandler; diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/NoRestTestClientBeanChecker.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/NoRestTestClientBeanChecker.java similarity index 96% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/NoRestTestClientBeanChecker.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/NoRestTestClientBeanChecker.java index 6c446818810..23d1d2a0791 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/NoRestTestClientBeanChecker.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/NoRestTestClientBeanChecker.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerIntegrationTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerIntegrationTests.java similarity index 92% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerIntegrationTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerIntegrationTests.java index 65ac84171ca..0e51c2f4782 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerIntegrationTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; import org.junit.jupiter.api.Test; @@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock; class RestTestClientContextCustomizerIntegrationTests { @Autowired - private RestTestClient webClient; + private RestTestClient restClient; @Autowired private RestTestClientBuilderCustomizer clientBuilderCustomizer; @@ -51,7 +51,7 @@ class RestTestClientContextCustomizerIntegrationTests { @Test void test() { then(this.clientBuilderCustomizer).should().customize(any(RestTestClient.Builder.class)); - this.webClient.get().uri("/").exchange().expectBody(String.class).isEqualTo("hello"); + this.restClient.get().uri("/").exchange().expectBody(String.class).isEqualTo("hello"); } @Configuration(proxyBeanMethods = false) diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerTests.java similarity index 94% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerTests.java index 2061c80f712..b3d9204e8a5 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; import org.junit.jupiter.api.Test; @@ -23,7 +23,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.boot.web.server.test.client.RestTestClientContextCustomizer.RestTestClientRegistrar; +import org.springframework.boot.test.web.servlet.client.RestTestClientContextCustomizer.RestTestClientRegistrar; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.test.context.MergedContextConfiguration; diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerWithCustomContextPathIntegrationTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerWithCustomContextPathIntegrationTests.java similarity index 93% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerWithCustomContextPathIntegrationTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerWithCustomContextPathIntegrationTests.java index 92af883e422..6b75158c0f2 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerWithCustomContextPathIntegrationTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerWithCustomContextPathIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; import org.junit.jupiter.api.Test; @@ -45,11 +45,11 @@ import org.springframework.web.servlet.DispatcherServlet; class RestTestClientContextCustomizerWithCustomContextPathIntegrationTests { @Autowired - private RestTestClient webClient; + private RestTestClient restClient; @Test void test() { - this.webClient.get().uri("/").exchange().expectBody(String.class).isEqualTo("hello"); + this.restClient.get().uri("/").exchange().expectBody(String.class).isEqualTo("hello"); } @Configuration(proxyBeanMethods = false) diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerWithOverridePathIntegrationTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerWithOverridePathIntegrationTests.java similarity index 92% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerWithOverridePathIntegrationTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerWithOverridePathIntegrationTests.java index cde1457c7b1..3fe41e511b4 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/RestTestClientContextCustomizerWithOverridePathIntegrationTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/RestTestClientContextCustomizerWithOverridePathIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; import org.junit.jupiter.api.Test; @@ -40,11 +40,11 @@ import static org.mockito.Mockito.mock; class RestTestClientContextCustomizerWithOverridePathIntegrationTests { @Autowired - private RestTestClient webClient; + private RestTestClient restClient; @Test void test() { - assertThat(this.webClient).isInstanceOf(CustomRestTestClient.class); + assertThat(this.restClient).isInstanceOf(CustomRestTestClient.class); } @Configuration(proxyBeanMethods = false) diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestWebMvcConfiguration.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/TestWebMvcConfiguration.java similarity index 96% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestWebMvcConfiguration.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/TestWebMvcConfiguration.java index e6f22b4186c..a83d752b289 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestWebMvcConfiguration.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/test/web/servlet/client/TestWebMvcConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.test.web.servlet.client; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory; diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java similarity index 98% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java index b3a9c8893e2..602f27243a3 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests.java @@ -23,11 +23,11 @@ import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.tomcat.reactive.TomcatReactiveWebServerFactory; import org.springframework.boot.web.context.reactive.ReactiveWebApplicationContext; import org.springframework.boot.web.server.reactive.ReactiveWebServerFactory; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java similarity index 98% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java index d36987a5953..a3b85676cd8 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/AbstractSpringBootTestWebServerWebEnvironmentTests.java @@ -21,10 +21,10 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory; import org.springframework.boot.web.server.servlet.ServletWebServerFactory; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/LocalManagementPortTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/LocalManagementPortTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/LocalManagementPortTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/LocalManagementPortTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/LocalServerPortTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/LocalServerPortTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/LocalServerPortTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/LocalServerPortTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestRandomPortEnvironmentPostProcessorTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestRandomPortEnvironmentPostProcessorTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestRandomPortEnvironmentPostProcessorTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestRandomPortEnvironmentPostProcessorTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentDefinedPortTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentDefinedPortTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentDefinedPortTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentDefinedPortTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentRandomPortTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentRandomPortTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentRandomPortTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentRandomPortTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestUserDefinedTestRestTemplateTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestUserDefinedTestRestTemplateTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestUserDefinedTestRestTemplateTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestUserDefinedTestRestTemplateTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentContextHierarchyTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentContextHierarchyTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentContextHierarchyTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentContextHierarchyTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentDefinedPortTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentDefinedPortTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentDefinedPortTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentDefinedPortTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortCustomPortTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortCustomPortTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortCustomPortTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortCustomPortTests.java diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortTests.java similarity index 100% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortTests.java rename to integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortTests.java diff --git a/module/spring-boot-devtools/build.gradle b/module/spring-boot-devtools/build.gradle index b88cef7e3a8..3bf620e23d0 100644 --- a/module/spring-boot-devtools/build.gradle +++ b/module/spring-boot-devtools/build.gradle @@ -55,8 +55,9 @@ dependencies { intTestImplementation(project(":core:spring-boot-autoconfigure")) intTestImplementation(project(":core:spring-boot-test")) intTestImplementation(project(":module:spring-boot-restclient")) - intTestImplementation(project(":test-support:spring-boot-test-support")) + intTestImplementation(project(":module:spring-boot-restclient-test")) intTestImplementation(project(":module:spring-boot-web-server-test")) + intTestImplementation(project(":test-support:spring-boot-test-support")) intTestImplementation("org.apache.httpcomponents.client5:httpclient5") intTestImplementation("net.bytebuddy:byte-buddy") diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java index 4def5b97bc4..e69dae1916a 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.springframework.boot.restclient.RestTemplateBuilder; -import org.springframework.boot.web.server.test.client.TestRestTemplate; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsWithLazyInitializationIntegrationTests.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsWithLazyInitializationIntegrationTests.java index a4fc13d8c3f..312a5fcad8e 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsWithLazyInitializationIntegrationTests.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsWithLazyInitializationIntegrationTests.java @@ -19,7 +19,7 @@ package org.springframework.boot.devtools.tests; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.springframework.boot.web.server.test.client.TestRestTemplate; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.http.HttpStatus; import static org.assertj.core.api.Assertions.assertThat; diff --git a/module/spring-boot-mustache/build.gradle b/module/spring-boot-mustache/build.gradle index d707c86aca7..ce67c600e7b 100644 --- a/module/spring-boot-mustache/build.gradle +++ b/module/spring-boot-mustache/build.gradle @@ -38,6 +38,7 @@ dependencies { testImplementation(project(":module:spring-boot-reactor-netty")) testImplementation(project(":module:spring-boot-restclient")) testImplementation(project(":module:spring-boot-reactor-netty")) + testImplementation(project(":module:spring-boot-restclient-test")) testImplementation(project(":module:spring-boot-tomcat")) testImplementation(project(":module:spring-boot-webflux-test")) testImplementation(project(":module:spring-boot-webmvc-test")) diff --git a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java index 86d62fa004d..4edcd9b165b 100644 --- a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java +++ b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java @@ -30,11 +30,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.mustache.servlet.view.MustacheView; import org.springframework.boot.mustache.servlet.view.MustacheViewResolver; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; import org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; diff --git a/module/spring-boot-restclient-test/build.gradle b/module/spring-boot-restclient-test/build.gradle index b3786fe0f59..496841603df 100644 --- a/module/spring-boot-restclient-test/build.gradle +++ b/module/spring-boot-restclient-test/build.gradle @@ -15,7 +15,9 @@ */ plugins { + id "dev.adamko.dokkatoo-html" id "java-library" + id "org.jetbrains.kotlin.jvm" id "org.springframework.boot.deployed" id "org.springframework.boot.optional-dependencies" id "org.springframework.boot.test-slice" @@ -24,12 +26,15 @@ plugins { description = "Spring Boot RestClient Test" dependencies { - api(project(":core:spring-boot")) api(project(":core:spring-boot-test-autoconfigure")) + api(project(":module:spring-boot-restclient")) optional(project(":core:spring-boot-autoconfigure")) optional(project(":module:spring-boot-jackson")) optional(project(":module:spring-boot-restclient")) + optional("org.apache.httpcomponents.client5:httpclient5") + optional("org.jetbrains.kotlin:kotlin-stdlib") + optional("org.jetbrains.kotlin:kotlin-reflect") optional("org.junit.jupiter:junit-jupiter-api") optional("org.springframework:spring-test") diff --git a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplate.java b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/TestRestTemplate.java similarity index 99% rename from module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplate.java rename to module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/TestRestTemplate.java index 8058a97e35b..fd2195bba92 100644 --- a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplate.java +++ b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/TestRestTemplate.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.restclient.test; import java.net.URI; import java.security.KeyManagementException; @@ -1006,11 +1006,10 @@ public class TestRestTemplate { } private URI applyRootUriIfNecessary(URI uri) { - UriTemplateHandler uriTemplateHandler = this.restTemplate.getUriTemplateHandler(); - if ((uriTemplateHandler instanceof RootUriTemplateHandler rootHandler) && uri.toString().startsWith("/")) { - return URI.create(rootHandler.getRootUri() + uri); + if (!uri.toString().startsWith("/")) { + return uri; } - return uri; + return URI.create(this.restTemplate.getUriTemplateHandler().expand("/") + uri.toString().substring(1)); } private URI resolveUri(RequestEntity entity) { diff --git a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizer.java b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizer.java similarity index 85% rename from module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizer.java rename to module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizer.java index 783b5f847b1..b2003820654 100644 --- a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizer.java +++ b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.restclient.test; import org.jspecify.annotations.Nullable; @@ -32,9 +32,11 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.boot.restclient.test.TestRestTemplate.HttpClientOption; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; -import org.springframework.boot.web.server.test.client.TestRestTemplate.HttpClientOption; +import org.springframework.boot.test.http.server.BaseUrl; +import org.springframework.boot.test.http.server.BaseUrlProviders; +import org.springframework.boot.test.web.servlet.client.BaseUrlUriBuilderFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ConfigurableApplicationContext; @@ -120,7 +122,6 @@ class TestRestTemplateContextCustomizer implements ContextCustomizer { registry.registerBeanDefinition(TestRestTemplate.class.getName(), new RootBeanDefinition(TestRestTemplateFactory.class)); } - } @Override @@ -144,24 +145,10 @@ class TestRestTemplateContextCustomizer implements ContextCustomizer { @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { RestTemplateBuilder builder = getRestTemplateBuilder(applicationContext); - boolean sslEnabled = isSslEnabled(applicationContext); - TestRestTemplate template = new TestRestTemplate(builder, null, null, - sslEnabled ? SSL_OPTIONS : DEFAULT_OPTIONS); - LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler(applicationContext.getEnvironment(), - sslEnabled ? "https" : "http"); - template.setUriTemplateHandler(handler); - this.template = template; - } - - private boolean isSslEnabled(ApplicationContext context) { - try { - AbstractConfigurableWebServerFactory webServerFactory = context - .getBean(AbstractConfigurableWebServerFactory.class); - return webServerFactory.getSsl() != null && webServerFactory.getSsl().isEnabled(); - } - catch (NoSuchBeanDefinitionException ex) { - return false; - } + BaseUrl baseUrl = new BaseUrlProviders(applicationContext).getBaseUrlOrDefault(); + boolean sslEnabled = baseUrl != null && baseUrl.isHttps(); + this.template = new TestRestTemplate(builder, null, null, sslEnabled ? SSL_OPTIONS : DEFAULT_OPTIONS); + this.template.setUriTemplateHandler(BaseUrlUriBuilderFactory.get(baseUrl)); } private RestTemplateBuilder getRestTemplateBuilder(ApplicationContext applicationContext) { diff --git a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerFactory.java b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerFactory.java similarity index 97% rename from module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerFactory.java rename to module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerFactory.java index 9dccb9fca39..9a9d5a44996 100644 --- a/module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplateContextCustomizerFactory.java +++ b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/TestRestTemplateContextCustomizerFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.restclient.test; import java.util.List; diff --git a/module/spring-boot-web-server-test/src/main/kotlin/org/springframework/boot/web/server/test/client/TestRestTemplateExtensions.kt b/module/spring-boot-restclient-test/src/main/kotlin/org/springframework/boot/restclient/test/TestRestTemplateExtensions.kt similarity index 99% rename from module/spring-boot-web-server-test/src/main/kotlin/org/springframework/boot/web/server/test/client/TestRestTemplateExtensions.kt rename to module/spring-boot-restclient-test/src/main/kotlin/org/springframework/boot/restclient/test/TestRestTemplateExtensions.kt index f3efb9154e2..37a45a3fdcc 100644 --- a/module/spring-boot-web-server-test/src/main/kotlin/org/springframework/boot/web/server/test/client/TestRestTemplateExtensions.kt +++ b/module/spring-boot-restclient-test/src/main/kotlin/org/springframework/boot/restclient/test/TestRestTemplateExtensions.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client +package org.springframework.boot.restclient.test import org.springframework.core.ParameterizedTypeReference import org.springframework.http.HttpEntity diff --git a/module/spring-boot-restclient-test/src/main/resources/META-INF/spring.factories b/module/spring-boot-restclient-test/src/main/resources/META-INF/spring.factories index 7f343218f08..0ece2cd2c2c 100644 --- a/module/spring-boot-restclient-test/src/main/resources/META-INF/spring.factories +++ b/module/spring-boot-restclient-test/src/main/resources/META-INF/spring.factories @@ -1,3 +1,7 @@ # Spring Test Execution Listeners org.springframework.test.context.TestExecutionListener=\ org.springframework.boot.restclient.test.autoconfigure.MockRestServiceServerResetTestExecutionListener + +# Spring Test Context Customizer Factories +org.springframework.test.context.ContextCustomizerFactory=\ +org.springframework.boot.restclient.test.TestRestTemplateContextCustomizerFactory diff --git a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateTests.java similarity index 95% rename from module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateTests.java rename to module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateTests.java index 927a028a09f..b2669b6e0eb 100644 --- a/module/spring-boot-web-server-test/src/test/java/org/springframework/boot/web/server/test/client/TestRestTemplateTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/TestRestTemplateTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.web.server.test.client; +package org.springframework.boot.restclient.test; import java.io.IOException; import java.lang.reflect.Method; @@ -36,7 +36,9 @@ import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder; import org.springframework.boot.http.client.ClientHttpRequestFactorySettings; import org.springframework.boot.http.client.HttpRedirects; import org.springframework.boot.restclient.RestTemplateBuilder; -import org.springframework.boot.web.server.test.client.TestRestTemplate.HttpClientOption; +import org.springframework.boot.restclient.test.TestRestTemplate.HttpClientOption; +import org.springframework.boot.test.http.server.BaseUrl; +import org.springframework.boot.test.web.servlet.client.BaseUrlUriBuilderFactory; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -48,7 +50,6 @@ import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.JdkClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory; -import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.http.client.MockClientHttpRequest; import org.springframework.mock.http.client.MockClientHttpResponse; import org.springframework.test.util.ReflectionTestUtils; @@ -118,16 +119,6 @@ class TestRestTemplateTests { assertThat(new TestRestTemplate(delegate).getRootUri()).isEqualTo(rootUri); } - @Test - void getRootUriRootUriSetViaLocalHostUriTemplateHandler() { - String rootUri = "https://example.com"; - TestRestTemplate template = new TestRestTemplate(); - LocalHostUriTemplateHandler templateHandler = mock(LocalHostUriTemplateHandler.class); - given(templateHandler.getRootUri()).willReturn(rootUri); - template.setUriTemplateHandler(templateHandler); - assertThat(template.getRootUri()).isEqualTo(rootUri); - } - @Test void getRootUriRootUriNotSet() { assertThat(new TestRestTemplate().getRootUri()).isEmpty(); @@ -348,8 +339,7 @@ class TestRestTemplateTests { URI absoluteUri = URI.create("http://localhost:8080/a/b/c.txt"); given(requestFactory.createRequest(eq(absoluteUri), eq(HttpMethod.GET))).willReturn(request); template.getRestTemplate().setRequestFactory(requestFactory); - LocalHostUriTemplateHandler uriTemplateHandler = new LocalHostUriTemplateHandler(new MockEnvironment()); - template.setUriTemplateHandler(uriTemplateHandler); + template.setUriTemplateHandler(BaseUrlUriBuilderFactory.get(BaseUrl.of("http://localhost:8080"))); template.exchange(entity, String.class); then(requestFactory).should().createRequest(eq(absoluteUri), eq(HttpMethod.GET)); } @@ -464,8 +454,7 @@ class TestRestTemplateTests { given(requestFactory.createRequest(eq(absoluteUri), any(HttpMethod.class))).willReturn(request); TestRestTemplate template = new TestRestTemplate(); template.getRestTemplate().setRequestFactory(requestFactory); - LocalHostUriTemplateHandler uriTemplateHandler = new LocalHostUriTemplateHandler(new MockEnvironment()); - template.setUriTemplateHandler(uriTemplateHandler); + template.setUriTemplateHandler(BaseUrlUriBuilderFactory.get(BaseUrl.of("http://localhost:8080"))); callback.doWithTestRestTemplate(template, URI.create("/a/b/c.txt?param=%7Bsomething%7D")); then(requestFactory).should().createRequest(eq(absoluteUri), any(HttpMethod.class)); } diff --git a/module/spring-boot-security/build.gradle b/module/spring-boot-security/build.gradle index 70be60af38e..65444283aad 100644 --- a/module/spring-boot-security/build.gradle +++ b/module/spring-boot-security/build.gradle @@ -35,6 +35,7 @@ dependencies { optional(project(":module:spring-boot-actuator-autoconfigure")) optional(project(":module:spring-boot-h2console")) optional(project(":module:spring-boot-reactor")) + optional(project(":module:spring-boot-restclient-test")) optional(project(":module:spring-boot-rsocket")) optional(project(":module:spring-boot-webflux")) optional(project(":module:spring-boot-webmvc")) diff --git a/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/SecurityFilterAutoConfigurationEarlyInitializationTests.java b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/SecurityFilterAutoConfigurationEarlyInitializationTests.java index 608915963e8..6ad51800156 100644 --- a/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/SecurityFilterAutoConfigurationEarlyInitializationTests.java +++ b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/SecurityFilterAutoConfigurationEarlyInitializationTests.java @@ -31,6 +31,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.boot.test.util.TestPropertyValues; @@ -38,7 +39,6 @@ import org.springframework.boot.testsupport.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.web.servlet.DirtiesUrlFactories; import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory; import org.springframework.boot.web.server.servlet.context.AnnotationConfigServletWebServerApplicationContext; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.boot.webmvc.autoconfigure.DispatcherServletAutoConfiguration; import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration; import org.springframework.context.annotation.Bean; diff --git a/module/spring-boot-web-server-test/build.gradle b/module/spring-boot-web-server-test/build.gradle index 40e24a2a2ca..cf7b52949e1 100644 --- a/module/spring-boot-web-server-test/build.gradle +++ b/module/spring-boot-web-server-test/build.gradle @@ -17,7 +17,6 @@ plugins { id "dev.adamko.dokkatoo-html" id "java-library" - id "org.jetbrains.kotlin.jvm" id "org.springframework.boot.deployed" id "org.springframework.boot.optional-dependencies" id "org.springframework.boot.test-auto-configuration" @@ -35,7 +34,6 @@ dependencies { optional(project(":module:spring-boot-web-server")) optional(project(":module:spring-boot-webclient")) optional("jakarta.servlet:jakarta.servlet-api") - optional("org.apache.httpcomponents.client5:httpclient5") optional("org.htmlunit:htmlunit") optional("org.jetbrains.kotlin:kotlin-reflect") optional("org.jetbrains.kotlin:kotlin-stdlib") diff --git a/module/spring-boot-web-server-test/src/main/resources/META-INF/spring.factories b/module/spring-boot-web-server-test/src/main/resources/META-INF/spring.factories index aa63dda60b1..e19a044d420 100644 --- a/module/spring-boot-web-server-test/src/main/resources/META-INF/spring.factories +++ b/module/spring-boot-web-server-test/src/main/resources/META-INF/spring.factories @@ -4,6 +4,4 @@ org.springframework.boot.web.server.test.SpringBootTestRandomPortEnvironmentPost # Spring Test Context Customizer Factories org.springframework.test.context.ContextCustomizerFactory=\ -org.springframework.boot.web.server.test.client.RestTestClientContextCustomizerFactory,\ -org.springframework.boot.web.server.test.client.TestRestTemplateContextCustomizerFactory,\ org.springframework.boot.web.server.test.reactor.netty.DisableReactorResourceFactoryGlobalResourcesContextCustomizerFactory diff --git a/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/reactive/context/ReactiveWebServerApplicationContextBaseUrlProvider.java b/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/reactive/context/ReactiveWebServerApplicationContextBaseUrlProvider.java index 0e80ed4964e..add708b1fe8 100644 --- a/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/reactive/context/ReactiveWebServerApplicationContextBaseUrlProvider.java +++ b/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/reactive/context/ReactiveWebServerApplicationContextBaseUrlProvider.java @@ -22,7 +22,6 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.boot.test.http.server.BaseUrl; import org.springframework.boot.test.http.server.BaseUrlProvider; import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; -import org.springframework.boot.web.server.reactive.AbstractReactiveWebServerFactory; import org.springframework.context.ApplicationContext; /** @@ -65,7 +64,7 @@ class ReactiveWebServerApplicationContextBaseUrlProvider implements BaseUrlProvi private boolean isSslEnabled(ReactiveWebServerApplicationContext context) { try { AbstractConfigurableWebServerFactory webServerFactory = context - .getBean(AbstractReactiveWebServerFactory.class); + .getBean(AbstractConfigurableWebServerFactory.class); return webServerFactory.getSsl() != null && webServerFactory.getSsl().isEnabled(); } catch (NoSuchBeanDefinitionException ex) { diff --git a/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/servlet/context/ServletWebServerApplicationContextBaseUrlProvider.java b/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/servlet/context/ServletWebServerApplicationContextBaseUrlProvider.java index 96b0a620840..5c35c1edee6 100644 --- a/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/servlet/context/ServletWebServerApplicationContextBaseUrlProvider.java +++ b/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/servlet/context/ServletWebServerApplicationContextBaseUrlProvider.java @@ -22,7 +22,6 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.boot.test.http.server.BaseUrl; import org.springframework.boot.test.http.server.BaseUrlProvider; import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; -import org.springframework.boot.web.server.reactive.AbstractReactiveWebServerFactory; import org.springframework.context.ApplicationContext; /** @@ -65,7 +64,7 @@ class ServletWebServerApplicationContextBaseUrlProvider implements BaseUrlProvid private boolean isSslEnabled(ServletWebServerApplicationContext context) { try { AbstractConfigurableWebServerFactory webServerFactory = context - .getBean(AbstractReactiveWebServerFactory.class); + .getBean(AbstractConfigurableWebServerFactory.class); return webServerFactory.getSsl() != null && webServerFactory.getSsl().isEnabled(); } catch (NoSuchBeanDefinitionException ex) { diff --git a/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/MockMvcAutoConfigurationTests.java b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/MockMvcAutoConfigurationTests.java index 22671c3c576..7f697185748 100644 --- a/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/MockMvcAutoConfigurationTests.java +++ b/module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/MockMvcAutoConfigurationTests.java @@ -22,7 +22,7 @@ import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.test.web.reactive.client.WebTestClientBuilderCustomizer; -import org.springframework.boot.web.server.test.client.RestTestClientBuilderCustomizer; +import org.springframework.boot.test.web.servlet.client.RestTestClientBuilderCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.web.reactive.server.WebTestClient; diff --git a/module/spring-boot-webmvc/build.gradle b/module/spring-boot-webmvc/build.gradle index 2229cc98efb..8196d4ea240 100644 --- a/module/spring-boot-webmvc/build.gradle +++ b/module/spring-boot-webmvc/build.gradle @@ -53,6 +53,7 @@ dependencies { testImplementation(project(":core:spring-boot-test")) testImplementation(project(":module:spring-boot-jackson")) testImplementation(project(":module:spring-boot-restclient")) + testImplementation(project(":module:spring-boot-restclient-test")) testImplementation(project(":module:spring-boot-tomcat")) testImplementation(project(":module:spring-boot-web-server-test")) testImplementation(project(":test-support:spring-boot-test-support")) diff --git a/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WelcomePageIntegrationTests.java b/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WelcomePageIntegrationTests.java index d78380df732..4cc4c9f4452 100644 --- a/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WelcomePageIntegrationTests.java +++ b/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WelcomePageIntegrationTests.java @@ -23,12 +23,12 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; import org.springframework.boot.web.server.context.WebServerApplicationContext; import org.springframework.boot.web.server.servlet.context.AnnotationConfigServletWebServerApplicationContext; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.RequestEntity; diff --git a/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/error/BasicErrorControllerIntegrationTests.java b/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/error/BasicErrorControllerIntegrationTests.java index 81ce84f26d2..568d8a1f28e 100755 --- a/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/error/BasicErrorControllerIntegrationTests.java +++ b/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/error/BasicErrorControllerIntegrationTests.java @@ -40,11 +40,11 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.error.ErrorAttributeOptions.Include; import org.springframework.boot.web.server.autoconfigure.ServerProperties; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.boot.webmvc.autoconfigure.DispatcherServletAutoConfiguration; import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration; import org.springframework.boot.webmvc.error.ErrorAttributes; diff --git a/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/error/RemappedErrorViewIntegrationTests.java b/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/error/RemappedErrorViewIntegrationTests.java index 79aa7b8ee1b..380a22d8ae3 100644 --- a/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/error/RemappedErrorViewIntegrationTests.java +++ b/module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/error/RemappedErrorViewIntegrationTests.java @@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; @@ -28,7 +29,6 @@ import org.springframework.boot.web.error.ErrorPage; import org.springframework.boot.web.error.ErrorPageRegistrar; import org.springframework.boot.web.error.ErrorPageRegistry; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.boot.webmvc.autoconfigure.DispatcherServletAutoConfiguration; import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration; import org.springframework.context.annotation.Configuration; diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/AbstractSampleActuatorCustomSecurityTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/AbstractSampleActuatorCustomSecurityTests.java index 2bda8c43022..c9a3096fa23 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/AbstractSampleActuatorCustomSecurityTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/AbstractSampleActuatorCustomSecurityTests.java @@ -20,8 +20,8 @@ import java.util.Map; import org.junit.jupiter.api.Test; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.web.server.test.client.LocalHostUriTemplateHandler; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java index 0b3c346ff1e..ca69a735f49 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java @@ -24,9 +24,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.client.LocalHostUriTemplateHandler; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; import org.springframework.http.RequestEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementPortAndPathSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementPortAndPathSampleActuatorApplicationTests.java index f7dd420d5c3..59579c2c4ee 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementPortAndPathSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementPortAndPathSampleActuatorApplicationTests.java @@ -19,11 +19,11 @@ package smoketest.actuator.customsecurity; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.LocalManagementPort; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementPortCustomServletPathSampleActuatorTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementPortCustomServletPathSampleActuatorTests.java index dfbe57f0c8a..cd4a04beb4a 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementPortCustomServletPathSampleActuatorTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/ManagementPortCustomServletPathSampleActuatorTests.java @@ -19,10 +19,10 @@ package smoketest.actuator.customsecurity; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.LocalManagementPort; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator-extension/src/test/java/smoketest/actuator/extension/SampleActuatorExtensionApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator-extension/src/test/java/smoketest/actuator/extension/SampleActuatorExtensionApplicationTests.java index 713f7ef33d0..fb066dc8beb 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-extension/src/test/java/smoketest/actuator/extension/SampleActuatorExtensionApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-extension/src/test/java/smoketest/actuator/extension/SampleActuatorExtensionApplicationTests.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.client.LocalHostUriTemplateHandler; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator-ui/src/test/java/smoketest/actuator/ui/SampleActuatorUiApplicationPortTests.java b/smoke-test/spring-boot-smoke-test-actuator-ui/src/test/java/smoketest/actuator/ui/SampleActuatorUiApplicationPortTests.java index 1d96316da53..4834599f7b5 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-ui/src/test/java/smoketest/actuator/ui/SampleActuatorUiApplicationPortTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-ui/src/test/java/smoketest/actuator/ui/SampleActuatorUiApplicationPortTests.java @@ -21,11 +21,11 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.LocalManagementPort; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator-ui/src/test/java/smoketest/actuator/ui/SampleActuatorUiApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator-ui/src/test/java/smoketest/actuator/ui/SampleActuatorUiApplicationTests.java index fec7147f319..0d1ae78300e 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-ui/src/test/java/smoketest/actuator/ui/SampleActuatorUiApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-ui/src/test/java/smoketest/actuator/ui/SampleActuatorUiApplicationTests.java @@ -22,9 +22,9 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/AbstractManagementPortAndPathSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/AbstractManagementPortAndPathSampleActuatorApplicationTests.java index 1d0f36ebbbd..fb10d544dab 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/AbstractManagementPortAndPathSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/AbstractManagementPortAndPathSampleActuatorApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.web.server.test.LocalManagementPort; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java index 1fc85405f7d..1d8e18321a5 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java @@ -24,9 +24,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.client.LocalHostUriTemplateHandler; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; import org.springframework.http.RequestEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java index 770373ebca1..6781ce18e6e 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.ActiveProfiles; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementAddressActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementAddressActuatorApplicationTests.java index b8e51a7465f..c616773b931 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementAddressActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementAddressActuatorApplicationTests.java @@ -20,11 +20,11 @@ import java.util.Map; import org.junit.jupiter.api.Test; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.LocalManagementPort; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests.java index 083c4bd1ee2..54b73ada93e 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests.java @@ -18,9 +18,9 @@ package smoketest.actuator; import org.junit.jupiter.api.Test; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.LocalManagementPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortSampleActuatorApplicationTests.java index f63312a88fa..e9b98711705 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortSampleActuatorApplicationTests.java @@ -18,9 +18,9 @@ package smoketest.actuator; import org.junit.jupiter.api.Test; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.LocalManagementPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPathSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPathSampleActuatorApplicationTests.java index e59d54b9049..17f4f038b3e 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPathSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPathSampleActuatorApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortSampleActuatorApplicationTests.java index 52b6a4ad826..02ff40e16ce 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortSampleActuatorApplicationTests.java @@ -22,12 +22,12 @@ import org.junit.jupiter.api.Test; import smoketest.actuator.ManagementPortSampleActuatorApplicationTests.CustomErrorAttributes; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.server.test.LocalManagementPort; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.boot.webmvc.error.DefaultErrorAttributes; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortWithLazyInitializationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortWithLazyInitializationTests.java index 30d945d1178..e40881cccef 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortWithLazyInitializationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementPortWithLazyInitializationTests.java @@ -18,9 +18,9 @@ package smoketest.actuator; import org.junit.jupiter.api.Test; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.LocalManagementPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/NoManagementSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/NoManagementSampleActuatorApplicationTests.java index c97b746e7ad..20cb28333d8 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/NoManagementSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/NoManagementSampleActuatorApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationIsolatedObjectMapperFalseTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationIsolatedObjectMapperFalseTests.java index 789daae928e..ce1995b001b 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationIsolatedObjectMapperFalseTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationIsolatedObjectMapperFalseTests.java @@ -20,9 +20,9 @@ import org.junit.jupiter.api.Test; import tools.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.ContextConfiguration; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationIsolatedObjectMapperTrueTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationIsolatedObjectMapperTrueTests.java index c5c86bdf5af..d7af58b4ea7 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationIsolatedObjectMapperTrueTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationIsolatedObjectMapperTrueTests.java @@ -20,9 +20,9 @@ import org.junit.jupiter.api.Test; import tools.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.ContextConfiguration; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationTests.java index 6577b55d027..e18a0698c11 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/SampleActuatorApplicationTests.java @@ -24,9 +24,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.jdbc.autoconfigure.DataSourceProperties; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ServletPathSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ServletPathSampleActuatorApplicationTests.java index 68364348677..16923c3cecf 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ServletPathSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ServletPathSampleActuatorApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ShutdownSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ShutdownSampleActuatorApplicationTests.java index b072732f5c7..8cf8885d84c 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ShutdownSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ShutdownSampleActuatorApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; diff --git a/smoke-test/spring-boot-smoke-test-devtools/src/test/java/smoketest/devtools/SampleDevToolsApplicationIntegrationTests.java b/smoke-test/spring-boot-smoke-test-devtools/src/test/java/smoketest/devtools/SampleDevToolsApplicationIntegrationTests.java index 32a67530eaf..d4771454769 100644 --- a/smoke-test/spring-boot-smoke-test-devtools/src/test/java/smoketest/devtools/SampleDevToolsApplicationIntegrationTests.java +++ b/smoke-test/spring-boot-smoke-test-devtools/src/test/java/smoketest/devtools/SampleDevToolsApplicationIntegrationTests.java @@ -19,9 +19,9 @@ package smoketest.devtools; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-hateoas/src/test/java/smoketest/hateoas/SampleHateoasApplicationTests.java b/smoke-test/spring-boot-smoke-test-hateoas/src/test/java/smoketest/hateoas/SampleHateoasApplicationTests.java index 4b7f5d20b4a..214678c12a8 100644 --- a/smoke-test/spring-boot-smoke-test-hateoas/src/test/java/smoketest/hateoas/SampleHateoasApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-hateoas/src/test/java/smoketest/hateoas/SampleHateoasApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Arrays; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-jetty-jsp/src/test/java/smoketest/jetty/jsp/SampleWebJspApplicationTests.java b/smoke-test/spring-boot-smoke-test-jetty-jsp/src/test/java/smoketest/jetty/jsp/SampleWebJspApplicationTests.java index d1ca309a1a4..f9372ea54d4 100644 --- a/smoke-test/spring-boot-smoke-test-jetty-jsp/src/test/java/smoketest/jetty/jsp/SampleWebJspApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-jetty-jsp/src/test/java/smoketest/jetty/jsp/SampleWebJspApplicationTests.java @@ -19,9 +19,9 @@ package smoketest.jetty.jsp; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-jetty-ssl/src/test/java/smoketest/jetty/ssl/SampleJettySslApplicationTests.java b/smoke-test/spring-boot-smoke-test-jetty-ssl/src/test/java/smoketest/jetty/ssl/SampleJettySslApplicationTests.java index eabdb89e803..b955f96c719 100644 --- a/smoke-test/spring-boot-smoke-test-jetty-ssl/src/test/java/smoketest/jetty/ssl/SampleJettySslApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-jetty-ssl/src/test/java/smoketest/jetty/ssl/SampleJettySslApplicationTests.java @@ -19,10 +19,10 @@ package smoketest.jetty.ssl; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-jetty/src/test/java/smoketest/jetty/SampleJettyApplicationTests.java b/smoke-test/spring-boot-smoke-test-jetty/src/test/java/smoketest/jetty/SampleJettyApplicationTests.java index fffc1c60eef..7be4b6523c3 100644 --- a/smoke-test/spring-boot-smoke-test-jetty/src/test/java/smoketest/jetty/SampleJettyApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-jetty/src/test/java/smoketest/jetty/SampleJettyApplicationTests.java @@ -21,9 +21,9 @@ import smoketest.jetty.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-oauth2-authorization-server/src/test/java/smoketest/oauth2/server/SampleOAuth2AuthorizationServerApplicationTests.java b/smoke-test/spring-boot-smoke-test-oauth2-authorization-server/src/test/java/smoketest/oauth2/server/SampleOAuth2AuthorizationServerApplicationTests.java index 12e79c4e279..906391dc39d 100644 --- a/smoke-test/spring-boot-smoke-test-oauth2-authorization-server/src/test/java/smoketest/oauth2/server/SampleOAuth2AuthorizationServerApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-oauth2-authorization-server/src/test/java/smoketest/oauth2/server/SampleOAuth2AuthorizationServerApplicationTests.java @@ -25,9 +25,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.http.client.HttpRedirects; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; diff --git a/smoke-test/spring-boot-smoke-test-oauth2-client/src/test/java/smoketest/oauth2/client/SampleOAuth2ClientApplicationTests.java b/smoke-test/spring-boot-smoke-test-oauth2-client/src/test/java/smoketest/oauth2/client/SampleOAuth2ClientApplicationTests.java index d4ce38e589f..0d587397c27 100644 --- a/smoke-test/spring-boot-smoke-test-oauth2-client/src/test/java/smoketest/oauth2/client/SampleOAuth2ClientApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-oauth2-client/src/test/java/smoketest/oauth2/client/SampleOAuth2ClientApplicationTests.java @@ -22,9 +22,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.http.client.HttpRedirects; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java b/smoke-test/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java index 68adb821341..c8eb0caca1c 100644 --- a/smoke-test/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-oauth2-resource-server/src/test/java/smoketest/oauth2/resource/SampleOauth2ResourceServerApplicationTests.java @@ -25,8 +25,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-prometheus/src/test/java/smoketest/prometheus/SamplePrometheusApplicationTests.java b/smoke-test/spring-boot-smoke-test-prometheus/src/test/java/smoketest/prometheus/SamplePrometheusApplicationTests.java index d171f10c087..ddeb782feb9 100644 --- a/smoke-test/spring-boot-smoke-test-prometheus/src/test/java/smoketest/prometheus/SamplePrometheusApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-prometheus/src/test/java/smoketest/prometheus/SamplePrometheusApplicationTests.java @@ -20,9 +20,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.micrometer.metrics.test.autoconfigure.AutoConfigureMetrics; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-quartz/src/test/java/smoketest/quartz/SampleQuartzApplicationWebTests.java b/smoke-test/spring-boot-smoke-test-quartz/src/test/java/smoketest/quartz/SampleQuartzApplicationWebTests.java index d93c65b2292..af8ba9e6564 100644 --- a/smoke-test/spring-boot-smoke-test-quartz/src/test/java/smoketest/quartz/SampleQuartzApplicationWebTests.java +++ b/smoke-test/spring-boot-smoke-test-quartz/src/test/java/smoketest/quartz/SampleQuartzApplicationWebTests.java @@ -29,11 +29,11 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-saml2-service-provider/src/test/java/smoketest/saml2/serviceprovider/SampleSaml2RelyingPartyApplicationTests.java b/smoke-test/spring-boot-smoke-test-saml2-service-provider/src/test/java/smoketest/saml2/serviceprovider/SampleSaml2RelyingPartyApplicationTests.java index cf86e10fe8a..e4c3a6f927b 100644 --- a/smoke-test/spring-boot-smoke-test-saml2-service-provider/src/test/java/smoketest/saml2/serviceprovider/SampleSaml2RelyingPartyApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-saml2-service-provider/src/test/java/smoketest/saml2/serviceprovider/SampleSaml2RelyingPartyApplicationTests.java @@ -22,9 +22,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.http.client.HttpRedirects; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-servlet/src/test/java/smoketest/servlet/SampleServletApplicationTests.java b/smoke-test/spring-boot-smoke-test-servlet/src/test/java/smoketest/servlet/SampleServletApplicationTests.java index 51b5fb2c1b0..d97c88044c6 100644 --- a/smoke-test/spring-boot-smoke-test-servlet/src/test/java/smoketest/servlet/SampleServletApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-servlet/src/test/java/smoketest/servlet/SampleServletApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Collections; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-session-data-mongodb/src/dockerTest/java/smoketest/session/mongodb/SampleSessionMongoApplicationTests.java b/smoke-test/spring-boot-smoke-test-session-data-mongodb/src/dockerTest/java/smoketest/session/mongodb/SampleSessionMongoApplicationTests.java index f8f7d3e6937..5b9dde29602 100644 --- a/smoke-test/spring-boot-smoke-test-session-data-mongodb/src/dockerTest/java/smoketest/session/mongodb/SampleSessionMongoApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-session-data-mongodb/src/dockerTest/java/smoketest/session/mongodb/SampleSessionMongoApplicationTests.java @@ -27,11 +27,11 @@ import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.testcontainers.service.connection.ServiceConnection; import org.springframework.boot.testsupport.container.TestImage; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; diff --git a/smoke-test/spring-boot-smoke-test-session-data-redis/src/dockerTest/java/smoketest/session/redis/SampleSessionRedisApplicationTests.java b/smoke-test/spring-boot-smoke-test-session-data-redis/src/dockerTest/java/smoketest/session/redis/SampleSessionRedisApplicationTests.java index 5226f96b25c..649c7dee417 100644 --- a/smoke-test/spring-boot-smoke-test-session-data-redis/src/dockerTest/java/smoketest/session/redis/SampleSessionRedisApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-session-data-redis/src/dockerTest/java/smoketest/session/redis/SampleSessionRedisApplicationTests.java @@ -27,10 +27,10 @@ import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.testcontainers.service.connection.ServiceConnection; import org.springframework.boot.testsupport.container.TestImage; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; diff --git a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/test/java/smoketest/session/hazelcast/SampleSessionHazelcastApplicationTests.java b/smoke-test/spring-boot-smoke-test-session-hazelcast/src/test/java/smoketest/session/hazelcast/SampleSessionHazelcastApplicationTests.java index 18d562919a1..ae58e3bf968 100644 --- a/smoke-test/spring-boot-smoke-test-session-hazelcast/src/test/java/smoketest/session/hazelcast/SampleSessionHazelcastApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-session-hazelcast/src/test/java/smoketest/session/hazelcast/SampleSessionHazelcastApplicationTests.java @@ -25,8 +25,8 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; diff --git a/smoke-test/spring-boot-smoke-test-session-jdbc/src/test/java/smoketest/session/SampleSessionJdbcApplicationTests.java b/smoke-test/spring-boot-smoke-test-session-jdbc/src/test/java/smoketest/session/SampleSessionJdbcApplicationTests.java index 7db4be4524f..91ee2f6e102 100644 --- a/smoke-test/spring-boot-smoke-test-session-jdbc/src/test/java/smoketest/session/SampleSessionJdbcApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-session-jdbc/src/test/java/smoketest/session/SampleSessionJdbcApplicationTests.java @@ -28,9 +28,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.http.client.ClientHttpRequestFactorySettings; import org.springframework.boot.http.client.HttpRedirects; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; diff --git a/smoke-test/spring-boot-smoke-test-test/src/test/java/smoketest/test/SampleTestApplicationWebIntegrationTests.java b/smoke-test/spring-boot-smoke-test-test/src/test/java/smoketest/test/SampleTestApplicationWebIntegrationTests.java index edb62b2df74..8f73d490c36 100644 --- a/smoke-test/spring-boot-smoke-test-test/src/test/java/smoketest/test/SampleTestApplicationWebIntegrationTests.java +++ b/smoke-test/spring-boot-smoke-test-test/src/test/java/smoketest/test/SampleTestApplicationWebIntegrationTests.java @@ -24,9 +24,9 @@ import smoketest.test.service.VehicleDetailsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureTestDatabase; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.test.context.bean.override.mockito.MockitoBean; diff --git a/smoke-test/spring-boot-smoke-test-testng/build.gradle b/smoke-test/spring-boot-smoke-test-testng/build.gradle index ee7c5d9e59b..9fdd2cfd65e 100644 --- a/smoke-test/spring-boot-smoke-test-testng/build.gradle +++ b/smoke-test/spring-boot-smoke-test-testng/build.gradle @@ -27,6 +27,7 @@ dependencies { implementation(project(":module:spring-boot-webmvc")) testImplementation(project(":module:spring-boot-restclient")) + testImplementation(project(":module:spring-boot-restclient-test")) testImplementation(project(":core:spring-boot-test")) testImplementation(project(":module:spring-boot-web-server-test")) testImplementation("org.assertj:assertj-core") diff --git a/smoke-test/spring-boot-smoke-test-testng/src/test/java/smoketest/testng/SampleTestNGApplicationTests.java b/smoke-test/spring-boot-smoke-test-testng/src/test/java/smoketest/testng/SampleTestNGApplicationTests.java index e0bb26d6347..b76e99d436d 100644 --- a/smoke-test/spring-boot-smoke-test-testng/src/test/java/smoketest/testng/SampleTestNGApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-testng/src/test/java/smoketest/testng/SampleTestNGApplicationTests.java @@ -19,9 +19,9 @@ package smoketest.testng; import org.testng.annotations.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; diff --git a/smoke-test/spring-boot-smoke-test-tomcat-jsp/src/test/java/smoketest/tomcat/jsp/SampleWebJspApplicationTests.java b/smoke-test/spring-boot-smoke-test-tomcat-jsp/src/test/java/smoketest/tomcat/jsp/SampleWebJspApplicationTests.java index 1b5cb9feac9..7468836709c 100644 --- a/smoke-test/spring-boot-smoke-test-tomcat-jsp/src/test/java/smoketest/tomcat/jsp/SampleWebJspApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-tomcat-jsp/src/test/java/smoketest/tomcat/jsp/SampleWebJspApplicationTests.java @@ -19,9 +19,9 @@ package smoketest.tomcat.jsp; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-tomcat-multi-connectors/src/test/java/smoketest/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java b/smoke-test/spring-boot-smoke-test-tomcat-multi-connectors/src/test/java/smoketest/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java index d6911b2f40e..7ddef238908 100644 --- a/smoke-test/spring-boot-smoke-test-tomcat-multi-connectors/src/test/java/smoketest/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-tomcat-multi-connectors/src/test/java/smoketest/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; import smoketest.tomcat.multiconnector.SampleTomcatTwoConnectorsApplicationTests.Ports; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.TestConfiguration; @@ -29,7 +30,6 @@ import org.springframework.boot.tomcat.TomcatWebServer; import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; import org.springframework.boot.web.server.context.WebServerInitializedEvent; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.ApplicationListener; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; diff --git a/smoke-test/spring-boot-smoke-test-tomcat-ssl/src/test/java/smoketest/tomcat/ssl/SampleTomcatSslApplicationTests.java b/smoke-test/spring-boot-smoke-test-tomcat-ssl/src/test/java/smoketest/tomcat/ssl/SampleTomcatSslApplicationTests.java index 480239bed95..83c6bf59b5c 100644 --- a/smoke-test/spring-boot-smoke-test-tomcat-ssl/src/test/java/smoketest/tomcat/ssl/SampleTomcatSslApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-tomcat-ssl/src/test/java/smoketest/tomcat/ssl/SampleTomcatSslApplicationTests.java @@ -19,10 +19,10 @@ package smoketest.tomcat.ssl; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.json.JsonContent; diff --git a/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java b/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java index ebf18e6ad97..d4ae11a5524 100644 --- a/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java @@ -24,10 +24,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.boot.webmvc.autoconfigure.DispatcherServletAutoConfiguration; import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration; import org.springframework.context.annotation.ComponentScan; diff --git a/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java b/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java index 86f149b6c04..978c9a66140 100644 --- a/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java @@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.TestConfiguration; @@ -38,7 +39,6 @@ import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.boot.tomcat.TomcatWebServer; import org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.http.HttpEntity; diff --git a/smoke-test/spring-boot-smoke-test-traditional/src/test/java/smoketest/traditional/SampleTraditionalApplicationTests.java b/smoke-test/spring-boot-smoke-test-traditional/src/test/java/smoketest/traditional/SampleTraditionalApplicationTests.java index fb048946a4f..dcd8fa0e689 100644 --- a/smoke-test/spring-boot-smoke-test-traditional/src/test/java/smoketest/traditional/SampleTraditionalApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-traditional/src/test/java/smoketest/traditional/SampleTraditionalApplicationTests.java @@ -19,9 +19,9 @@ package smoketest.traditional; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-web-freemarker/src/test/java/smoketest/freemarker/SampleWebFreeMarkerApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-freemarker/src/test/java/smoketest/freemarker/SampleWebFreeMarkerApplicationTests.java index 227f9725a3e..06ce0b01553 100644 --- a/smoke-test/spring-boot-smoke-test-web-freemarker/src/test/java/smoketest/freemarker/SampleWebFreeMarkerApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-freemarker/src/test/java/smoketest/freemarker/SampleWebFreeMarkerApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Arrays; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-web-groovy-templates/src/test/java/smoketest/groovytemplates/SampleGroovyTemplateApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-groovy-templates/src/test/java/smoketest/groovytemplates/SampleGroovyTemplateApplicationTests.java index 22488199826..a4435af9d83 100644 --- a/smoke-test/spring-boot-smoke-test-web-groovy-templates/src/test/java/smoketest/groovytemplates/SampleGroovyTemplateApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-groovy-templates/src/test/java/smoketest/groovytemplates/SampleGroovyTemplateApplicationTests.java @@ -21,10 +21,10 @@ import java.net.URI; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.util.LinkedMultiValueMap; diff --git a/smoke-test/spring-boot-smoke-test-web-jsp/src/test/java/smoketest/jsp/SampleWebJspApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-jsp/src/test/java/smoketest/jsp/SampleWebJspApplicationTests.java index 28400c7f885..c709057b99c 100644 --- a/smoke-test/spring-boot-smoke-test-web-jsp/src/test/java/smoketest/jsp/SampleWebJspApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-jsp/src/test/java/smoketest/jsp/SampleWebJspApplicationTests.java @@ -22,9 +22,9 @@ import java.util.Arrays; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; diff --git a/smoke-test/spring-boot-smoke-test-web-method-security/src/test/java/smoketest/security/method/SampleMethodSecurityApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-method-security/src/test/java/smoketest/security/method/SampleMethodSecurityApplicationTests.java index 5f6c7cf2c0d..63bac2d43a0 100644 --- a/smoke-test/spring-boot-smoke-test-web-method-security/src/test/java/smoketest/security/method/SampleMethodSecurityApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-method-security/src/test/java/smoketest/security/method/SampleMethodSecurityApplicationTests.java @@ -21,10 +21,10 @@ import java.util.Collections; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-web-mustache/src/test/java/smoketest/mustache/SampleWebMustacheApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-mustache/src/test/java/smoketest/mustache/SampleWebMustacheApplicationTests.java index 3cc90c615fc..2f094159609 100644 --- a/smoke-test/spring-boot-smoke-test-web-mustache/src/test/java/smoketest/mustache/SampleWebMustacheApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-mustache/src/test/java/smoketest/mustache/SampleWebMustacheApplicationTests.java @@ -21,9 +21,9 @@ import java.util.Arrays; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-web-secure-custom/src/test/java/smoketest/web/secure/custom/SampleWebSecureCustomApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-secure-custom/src/test/java/smoketest/web/secure/custom/SampleWebSecureCustomApplicationTests.java index f00d5ccf36d..02e49cde920 100644 --- a/smoke-test/spring-boot-smoke-test-web-secure-custom/src/test/java/smoketest/web/secure/custom/SampleWebSecureCustomApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-secure-custom/src/test/java/smoketest/web/secure/custom/SampleWebSecureCustomApplicationTests.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.http.client.HttpRedirects; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-web-secure-jdbc/src/test/java/smoketest/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-secure-jdbc/src/test/java/smoketest/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java index 4815f05f594..61c6a6182e4 100644 --- a/smoke-test/spring-boot-smoke-test-web-secure-jdbc/src/test/java/smoketest/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-secure-jdbc/src/test/java/smoketest/web/secure/jdbc/SampleWebSecureJdbcApplicationTests.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.http.client.HttpRedirects; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/AbstractErrorPageTests.java b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/AbstractErrorPageTests.java index a3183dcb664..9b8ae1751a9 100644 --- a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/AbstractErrorPageTests.java +++ b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/AbstractErrorPageTests.java @@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test; import tools.jackson.databind.JsonNode; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.server.test.client.TestRestTemplate; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; diff --git a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/AbstractUnauthenticatedErrorPageTests.java b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/AbstractUnauthenticatedErrorPageTests.java index 28b9cc8fd14..4af6ea3d9ad 100644 --- a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/AbstractUnauthenticatedErrorPageTests.java +++ b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/AbstractUnauthenticatedErrorPageTests.java @@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test; import tools.jackson.databind.JsonNode; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.server.test.client.TestRestTemplate; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/SampleWebSecureApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/SampleWebSecureApplicationTests.java index e6d5ac3c481..2ec6a7ad0dd 100644 --- a/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/SampleWebSecureApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/SampleWebSecureApplicationTests.java @@ -23,10 +23,10 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.http.client.HttpRedirects; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; diff --git a/smoke-test/spring-boot-smoke-test-web-static/src/test/java/smoketest/web/staticcontent/SampleWebStaticApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-static/src/test/java/smoketest/web/staticcontent/SampleWebStaticApplicationTests.java index 9fc285a513f..49dbdcf1d59 100644 --- a/smoke-test/spring-boot-smoke-test-web-static/src/test/java/smoketest/web/staticcontent/SampleWebStaticApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-static/src/test/java/smoketest/web/staticcontent/SampleWebStaticApplicationTests.java @@ -19,9 +19,9 @@ package smoketest.web.staticcontent; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; diff --git a/smoke-test/spring-boot-smoke-test-web-thymeleaf/src/test/java/smoketest/web/thymeleaf/SampleWebUiApplicationTests.java b/smoke-test/spring-boot-smoke-test-web-thymeleaf/src/test/java/smoketest/web/thymeleaf/SampleWebUiApplicationTests.java index e7397085ad6..29f9d9bf9a0 100644 --- a/smoke-test/spring-boot-smoke-test-web-thymeleaf/src/test/java/smoketest/web/thymeleaf/SampleWebUiApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-web-thymeleaf/src/test/java/smoketest/web/thymeleaf/SampleWebUiApplicationTests.java @@ -21,10 +21,10 @@ import java.net.URI; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.test.LocalServerPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.util.LinkedMultiValueMap; diff --git a/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorDifferentPortTests.java b/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorDifferentPortTests.java index 7d4dbe06f42..dd0a38d154e 100644 --- a/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorDifferentPortTests.java +++ b/smoke-test/spring-boot-smoke-test-webflux/src/test/java/smoketest/webflux/SampleWebFluxApplicationActuatorDifferentPortTests.java @@ -18,9 +18,9 @@ package smoketest.webflux; import org.junit.jupiter.api.Test; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.test.LocalManagementPort; -import org.springframework.boot.web.server.test.client.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java b/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java index 35702a12513..a0de6e87a3c 100644 --- a/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java +++ b/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java @@ -32,7 +32,7 @@ import org.testcontainers.images.builder.ImageFromDockerfile; import org.testcontainers.images.builder.dockerfile.DockerfileBuilder; import org.springframework.boot.restclient.RestTemplateBuilder; -import org.springframework.boot.web.server.test.client.TestRestTemplate; +import org.springframework.boot.restclient.test.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;