Merge branch '2.7.x' into 3.0.x

This commit is contained in:
Phillip Webb
2023-02-21 23:15:40 -08:00
1890 changed files with 27173 additions and 21952 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -82,16 +82,17 @@ class EmbeddedServerContainerInvocationContextProvider
@Override
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) {
EmbeddedServletContainerTest annotation = context.getRequiredTestClass()
.getAnnotation(EmbeddedServletContainerTest.class);
return CONTAINERS.stream().map((container) -> getApplication(annotation, container))
.flatMap((builder) -> provideTestTemplateInvocationContexts(annotation, builder));
.getAnnotation(EmbeddedServletContainerTest.class);
return CONTAINERS.stream()
.map((container) -> getApplication(annotation, container))
.flatMap((builder) -> provideTestTemplateInvocationContexts(annotation, builder));
}
private Stream<EmbeddedServletContainerInvocationContext> provideTestTemplateInvocationContexts(
EmbeddedServletContainerTest annotation, Application application) {
return Stream.of(annotation.launchers())
.map((launcherClass) -> getAbstractApplicationLauncher(application, launcherClass))
.map((launcher) -> provideTestTemplateInvocationContext(application, launcher));
.map((launcherClass) -> getAbstractApplicationLauncher(application, launcherClass))
.map((launcher) -> provideTestTemplateInvocationContext(application, launcher));
}
private EmbeddedServletContainerInvocationContext provideTestTemplateInvocationContext(Application application,
@@ -186,8 +187,8 @@ class EmbeddedServerContainerInvocationContextProvider
@Override
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) {
RestTemplate rest = new RestTemplate(new HttpComponentsClientHttpRequestFactory(HttpClients.custom()
.setRetryStrategy(new DefaultHttpRequestRetryStrategy(10, TimeValue.of(1, TimeUnit.SECONDS)))
.build()));
.setRetryStrategy(new DefaultHttpRequestRetryStrategy(10, TimeValue.of(1, TimeUnit.SECONDS)))
.build()));
rest.setErrorHandler(new ResponseErrorHandler() {
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 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.
@@ -68,7 +68,7 @@ class EmbeddedServletContainerJarPackagingIntegrationTests {
@TestTemplate
void applicationClassesAreNotAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest
.getForEntity("/BOOT-INF/classes/com/example/ResourceHandlingApplication.class", String.class);
.getForEntity("/BOOT-INF/classes/com/example/ResourceHandlingApplication.class", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -76,7 +76,7 @@ class EmbeddedServletContainerWarDevelopmentIntegrationTests {
ResponseEntity<String> entity = rest.getForEntity("/resourcePaths", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(readLines(entity.getBody()))
.noneMatch((resourcePath) -> resourcePath.startsWith("/org/springframework/boot/loader"));
.noneMatch((resourcePath) -> resourcePath.startsWith("/org/springframework/boot/loader"));
}
private List<String> readLines(String input) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -74,7 +74,7 @@ class EmbeddedServletContainerWarPackagingIntegrationTests {
@TestTemplate
void applicationClassesAreNotAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest
.getForEntity("/WEB-INF/classes/com/example/ResourceHandlingApplication.class", String.class);
.getForEntity("/WEB-INF/classes/com/example/ResourceHandlingApplication.class", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}
@@ -98,14 +98,14 @@ class EmbeddedServletContainerWarPackagingIntegrationTests {
ResponseEntity<String> entity = rest.getForEntity("/resourcePaths", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(readLines(entity.getBody()))
.noneMatch((resourcePath) -> resourcePath.startsWith("/org/springframework/boot/loader"));
.noneMatch((resourcePath) -> resourcePath.startsWith("/org/springframework/boot/loader"));
}
@TestTemplate
void conditionalOnWarDeploymentBeanIsNotAvailableForEmbeddedServer(RestTemplate rest) {
assertThat(rest.getForEntity("/always", String.class).getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(rest.getForEntity("/conditionalOnWar", String.class).getStatusCode())
.isEqualTo(HttpStatus.NOT_FOUND);
.isEqualTo(HttpStatus.NOT_FOUND);
}
private List<String> readLines(String input) {