commit
390892f11b
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2022-2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.build.architecture;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardOpenOption;
|
import java.nio.file.StandardOpenOption;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -68,8 +67,7 @@ public abstract class PackageTangleCheck extends DefaultTask {
|
||||||
File outputFile = getOutputDirectory().file("failure-report.txt").get().getAsFile();
|
File outputFile = getOutputDirectory().file("failure-report.txt").get().getAsFile();
|
||||||
outputFile.getParentFile().mkdirs();
|
outputFile.getParentFile().mkdirs();
|
||||||
if (result.hasViolation()) {
|
if (result.hasViolation()) {
|
||||||
Files.write(outputFile.toPath(), result.getFailureReport().toString().getBytes(StandardCharsets.UTF_8),
|
Files.writeString(outputFile.toPath(), result.getFailureReport().toString(), StandardOpenOption.CREATE);
|
||||||
StandardOpenOption.CREATE);
|
|
||||||
FileWriter writer = new FileWriter(outputFile);
|
FileWriter writer = new FileWriter(outputFile);
|
||||||
FileCopyUtils.copy(result.getFailureReport().toString(), writer);
|
FileCopyUtils.copy(result.getFailureReport().toString(), writer);
|
||||||
throw new GradleException("Package tangle check failed. See '" + outputFile + "' for details.");
|
throw new GradleException("Package tangle check failed. See '" + outputFile + "' for details.");
|
||||||
|
|
|
@ -132,7 +132,7 @@ class PluginXmlParser {
|
||||||
@Override
|
@Override
|
||||||
public Iterator<Node> iterator() {
|
public Iterator<Node> iterator() {
|
||||||
|
|
||||||
return new Iterator<Node>() {
|
return new Iterator<>() {
|
||||||
|
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
|
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,10 +16,12 @@
|
||||||
|
|
||||||
package org.springframework.boot.build.testing;
|
package org.springframework.boot.build.testing;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import org.gradle.api.DefaultTask;
|
||||||
import org.gradle.api.services.BuildService;
|
import org.gradle.api.services.BuildService;
|
||||||
import org.gradle.api.services.BuildServiceParameters;
|
import org.gradle.api.services.BuildServiceParameters;
|
||||||
import org.gradle.api.tasks.testing.Test;
|
import org.gradle.api.tasks.testing.Test;
|
||||||
|
@ -35,8 +37,7 @@ import org.gradle.tooling.events.OperationCompletionListener;
|
||||||
public abstract class TestResultsOverview
|
public abstract class TestResultsOverview
|
||||||
implements BuildService<BuildServiceParameters.None>, OperationCompletionListener, AutoCloseable {
|
implements BuildService<BuildServiceParameters.None>, OperationCompletionListener, AutoCloseable {
|
||||||
|
|
||||||
private final Map<Test, List<TestFailure>> testFailures = new TreeMap<>(
|
private final Map<Test, List<TestFailure>> testFailures = new TreeMap<>(Comparator.comparing(DefaultTask::getPath));
|
||||||
(one, two) -> one.getPath().compareTo(two.getPath()));
|
|
||||||
|
|
||||||
private final Object monitor = new Object();
|
private final Object monitor = new Object();
|
||||||
|
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -46,7 +46,7 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti
|
||||||
*/
|
*/
|
||||||
class ReactiveCloudFoundrySecurityService {
|
class ReactiveCloudFoundrySecurityService {
|
||||||
|
|
||||||
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
|
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {
|
||||||
};
|
};
|
||||||
|
|
||||||
private final WebClient webClient;
|
private final WebClient webClient;
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -107,7 +107,7 @@ public class WebFluxEndpointManagementContextConfiguration {
|
||||||
private boolean shouldRegisterLinksMapping(WebEndpointProperties properties, Environment environment,
|
private boolean shouldRegisterLinksMapping(WebEndpointProperties properties, Environment environment,
|
||||||
String basePath) {
|
String basePath) {
|
||||||
return properties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath)
|
return properties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath)
|
||||||
|| ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT));
|
|| ManagementPortType.get(environment) == ManagementPortType.DIFFERENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -175,8 +175,7 @@ public class WebFluxEndpointManagementContextConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void process(Encoder<?> encoder) {
|
private void process(Encoder<?> encoder) {
|
||||||
if (encoder instanceof Jackson2JsonEncoder) {
|
if (encoder instanceof Jackson2JsonEncoder jackson2JsonEncoder) {
|
||||||
Jackson2JsonEncoder jackson2JsonEncoder = (Jackson2JsonEncoder) encoder;
|
|
||||||
jackson2JsonEncoder.registerObjectMappersForType(OperationResponseBody.class, (associations) -> {
|
jackson2JsonEncoder.registerObjectMappersForType(OperationResponseBody.class, (associations) -> {
|
||||||
ObjectMapper objectMapper = this.endpointObjectMapper.get().get();
|
ObjectMapper objectMapper = this.endpointObjectMapper.get().get();
|
||||||
MEDIA_TYPES.forEach((mimeType) -> associations.put(mimeType, objectMapper));
|
MEDIA_TYPES.forEach((mimeType) -> associations.put(mimeType, objectMapper));
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -174,7 +174,7 @@ class HealthEndpointConfiguration {
|
||||||
@Override
|
@Override
|
||||||
public Iterator<NamedContributor<HealthContributor>> iterator() {
|
public Iterator<NamedContributor<HealthContributor>> iterator() {
|
||||||
Iterator<NamedContributor<ReactiveHealthContributor>> iterator = composite.iterator();
|
Iterator<NamedContributor<ReactiveHealthContributor>> iterator = composite.iterator();
|
||||||
return new Iterator<NamedContributor<HealthContributor>>() {
|
return new Iterator<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -138,14 +138,16 @@ class ReactiveCloudFoundrySecurityServiceTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fetchTokenKeysWhenSuccessfulShouldReturnListOfKeysFromUAA() throws Exception {
|
void fetchTokenKeysWhenSuccessfulShouldReturnListOfKeysFromUAA() throws Exception {
|
||||||
String tokenKeyValue = "-----BEGIN PUBLIC KEY-----\n"
|
String tokenKeyValue = """
|
||||||
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m59l2u9iDnMbrXHfqkO\n"
|
-----BEGIN PUBLIC KEY-----
|
||||||
+ "rn2dVQ3vfBJqcDuFUK03d+1PZGbVlNCqnkpIJ8syFppW8ljnWweP7+LiWpRoz0I7\n"
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m59l2u9iDnMbrXHfqkO
|
||||||
+ "fYb3d8TjhV86Y997Fl4DBrxgM6KTJOuE/uxnoDhZQ14LgOU2ckXjOzOdTsnGMKQB\n"
|
rn2dVQ3vfBJqcDuFUK03d+1PZGbVlNCqnkpIJ8syFppW8ljnWweP7+LiWpRoz0I7
|
||||||
+ "LCl0vpcXBtFLMaSbpv1ozi8h7DJyVZ6EnFQZUWGdgTMhDrmqevfx95U/16c5WBDO\n"
|
fYb3d8TjhV86Y997Fl4DBrxgM6KTJOuE/uxnoDhZQ14LgOU2ckXjOzOdTsnGMKQB
|
||||||
+ "kqwIn7Glry9n9Suxygbf8g5AzpWcusZgDLIIZ7JTUldBb8qU2a0Dl4mvLZOn4wPo\n"
|
LCl0vpcXBtFLMaSbpv1ozi8h7DJyVZ6EnFQZUWGdgTMhDrmqevfx95U/16c5WBDO
|
||||||
+ "jfj9Cw2QICsc5+Pwf21fP+hzf+1WSRHbnYv8uanRO0gZ8ekGaghM/2H6gqJbo2nI\n"
|
kqwIn7Glry9n9Suxygbf8g5AzpWcusZgDLIIZ7JTUldBb8qU2a0Dl4mvLZOn4wPo
|
||||||
+ "JwIDAQAB\n-----END PUBLIC KEY-----";
|
jfj9Cw2QICsc5+Pwf21fP+hzf+1WSRHbnYv8uanRO0gZ8ekGaghM/2H6gqJbo2nI
|
||||||
|
JwIDAQAB
|
||||||
|
-----END PUBLIC KEY-----""";
|
||||||
prepareResponse((response) -> {
|
prepareResponse((response) -> {
|
||||||
response.setBody("{\"token_endpoint\":\"/my-uaa.com\"}");
|
response.setBody("{\"token_endpoint\":\"/my-uaa.com\"}");
|
||||||
response.setHeader("Content-Type", "application/json");
|
response.setHeader("Content-Type", "application/json");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -63,23 +63,27 @@ class ReactiveTokenValidatorTests {
|
||||||
|
|
||||||
private ReactiveTokenValidator tokenValidator;
|
private ReactiveTokenValidator tokenValidator;
|
||||||
|
|
||||||
private static final String VALID_KEY = "-----BEGIN PUBLIC KEY-----\n"
|
private static final String VALID_KEY = """
|
||||||
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m59l2u9iDnMbrXHfqkO\n"
|
-----BEGIN PUBLIC KEY-----
|
||||||
+ "rn2dVQ3vfBJqcDuFUK03d+1PZGbVlNCqnkpIJ8syFppW8ljnWweP7+LiWpRoz0I7\n"
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m59l2u9iDnMbrXHfqkO
|
||||||
+ "fYb3d8TjhV86Y997Fl4DBrxgM6KTJOuE/uxnoDhZQ14LgOU2ckXjOzOdTsnGMKQB\n"
|
rn2dVQ3vfBJqcDuFUK03d+1PZGbVlNCqnkpIJ8syFppW8ljnWweP7+LiWpRoz0I7
|
||||||
+ "LCl0vpcXBtFLMaSbpv1ozi8h7DJyVZ6EnFQZUWGdgTMhDrmqevfx95U/16c5WBDO\n"
|
fYb3d8TjhV86Y997Fl4DBrxgM6KTJOuE/uxnoDhZQ14LgOU2ckXjOzOdTsnGMKQB
|
||||||
+ "kqwIn7Glry9n9Suxygbf8g5AzpWcusZgDLIIZ7JTUldBb8qU2a0Dl4mvLZOn4wPo\n"
|
LCl0vpcXBtFLMaSbpv1ozi8h7DJyVZ6EnFQZUWGdgTMhDrmqevfx95U/16c5WBDO
|
||||||
+ "jfj9Cw2QICsc5+Pwf21fP+hzf+1WSRHbnYv8uanRO0gZ8ekGaghM/2H6gqJbo2nI\n"
|
kqwIn7Glry9n9Suxygbf8g5AzpWcusZgDLIIZ7JTUldBb8qU2a0Dl4mvLZOn4wPo
|
||||||
+ "JwIDAQAB\n-----END PUBLIC KEY-----";
|
jfj9Cw2QICsc5+Pwf21fP+hzf+1WSRHbnYv8uanRO0gZ8ekGaghM/2H6gqJbo2nI
|
||||||
|
JwIDAQAB
|
||||||
|
-----END PUBLIC KEY-----""";
|
||||||
|
|
||||||
private static final String INVALID_KEY = "-----BEGIN PUBLIC KEY-----\n"
|
private static final String INVALID_KEY = """
|
||||||
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxzYuc22QSst/dS7geYYK\n"
|
-----BEGIN PUBLIC KEY-----
|
||||||
+ "5l5kLxU0tayNdixkEQ17ix+CUcUbKIsnyftZxaCYT46rQtXgCaYRdJcbB3hmyrOa\n"
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxzYuc22QSst/dS7geYYK
|
||||||
+ "vkhTpX79xJZnQmfuamMbZBqitvscxW9zRR9tBUL6vdi/0rpoUwPMEh8+Bw7CgYR0\n"
|
5l5kLxU0tayNdixkEQ17ix+CUcUbKIsnyftZxaCYT46rQtXgCaYRdJcbB3hmyrOa
|
||||||
+ "FK0DhWYBNDfe9HKcyZEv3max8Cdq18htxjEsdYO0iwzhtKRXomBWTdhD5ykd/fAC\n"
|
vkhTpX79xJZnQmfuamMbZBqitvscxW9zRR9tBUL6vdi/0rpoUwPMEh8+Bw7CgYR0
|
||||||
+ "VTr4+KEY+IeLvubHVmLUhbE5NgWXxrRpGasDqzKhCTmsa2Ysf712rl57SlH0Wz/M\n"
|
FK0DhWYBNDfe9HKcyZEv3max8Cdq18htxjEsdYO0iwzhtKRXomBWTdhD5ykd/fAC
|
||||||
+ "r3F7aM9YpErzeYLrl0GhQr9BVJxOvXcVd4kmY+XkiCcrkyS1cnghnllh+LCwQu1s\n"
|
VTr4+KEY+IeLvubHVmLUhbE5NgWXxrRpGasDqzKhCTmsa2Ysf712rl57SlH0Wz/M
|
||||||
+ "YwIDAQAB\n-----END PUBLIC KEY-----";
|
r3F7aM9YpErzeYLrl0GhQr9BVJxOvXcVd4kmY+XkiCcrkyS1cnghnllh+LCwQu1s
|
||||||
|
YwIDAQAB
|
||||||
|
-----END PUBLIC KEY-----""";
|
||||||
|
|
||||||
private static final Map<String, String> INVALID_KEYS = new ConcurrentHashMap<>();
|
private static final Map<String, String> INVALID_KEYS = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@ -256,33 +260,35 @@ class ReactiveTokenValidatorTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrivateKey getPrivateKey() throws InvalidKeySpecException, NoSuchAlgorithmException {
|
private PrivateKey getPrivateKey() throws InvalidKeySpecException, NoSuchAlgorithmException {
|
||||||
String signingKey = "-----BEGIN PRIVATE KEY-----\n"
|
String signingKey = """
|
||||||
+ "MIIEvQIBADANBgkq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xqu4qrgPIQNBvU/dDRNJVthG6c5aspEzrG8m
|
||||||
+ "4Tg4qk/03qpTy5k64DxkX1nJHu8V/hsKwq9Af7Fj/iHy2Av54BLPlBaGPwMi2bzB\n"
|
9IHgtRV9K8EOy/1O6YqrB9kNUVWf3JccdWpvqyNJAoGAORzJiQCOk4egbdcozDTo
|
||||||
+ "gYjmUomvx/fqOTQks9Rc4PIMB43p6Rdj0sh+52SKPDR2eHbwsmpuQUXnAs20BPPI\n"
|
4Tg4qk/03qpTy5k64DxkX1nJHu8V/hsKwq9Af7Fj/iHy2Av54BLPlBaGPwMi2bzB
|
||||||
+ "J/OOn5zOs8yf26os0q3+JUM=\n-----END PRIVATE KEY-----";
|
gYjmUomvx/fqOTQks9Rc4PIMB43p6Rdj0sh+52SKPDR2eHbwsmpuQUXnAs20BPPI
|
||||||
|
J/OOn5zOs8yf26os0q3+JUM=
|
||||||
|
-----END PRIVATE KEY-----""";
|
||||||
String privateKey = signingKey.replace("-----BEGIN PRIVATE KEY-----\n", "");
|
String privateKey = signingKey.replace("-----BEGIN PRIVATE KEY-----\n", "");
|
||||||
privateKey = privateKey.replace("-----END PRIVATE KEY-----", "");
|
privateKey = privateKey.replace("-----END PRIVATE KEY-----", "");
|
||||||
privateKey = privateKey.replace("\n", "");
|
privateKey = privateKey.replace("\n", "");
|
||||||
|
|
|
@ -137,14 +137,16 @@ class CloudFoundrySecurityServiceTests {
|
||||||
void fetchTokenKeysWhenSuccessfulShouldReturnListOfKeysFromUAA() {
|
void fetchTokenKeysWhenSuccessfulShouldReturnListOfKeysFromUAA() {
|
||||||
this.server.expect(requestTo(CLOUD_CONTROLLER + "/info"))
|
this.server.expect(requestTo(CLOUD_CONTROLLER + "/info"))
|
||||||
.andRespond(withSuccess("{\"token_endpoint\":\"https://my-uaa.com\"}", MediaType.APPLICATION_JSON));
|
.andRespond(withSuccess("{\"token_endpoint\":\"https://my-uaa.com\"}", MediaType.APPLICATION_JSON));
|
||||||
String tokenKeyValue = "-----BEGIN PUBLIC KEY-----\n"
|
String tokenKeyValue = """
|
||||||
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m59l2u9iDnMbrXHfqkO\n"
|
-----BEGIN PUBLIC KEY-----
|
||||||
+ "rn2dVQ3vfBJqcDuFUK03d+1PZGbVlNCqnkpIJ8syFppW8ljnWweP7+LiWpRoz0I7\n"
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m59l2u9iDnMbrXHfqkO
|
||||||
+ "fYb3d8TjhV86Y997Fl4DBrxgM6KTJOuE/uxnoDhZQ14LgOU2ckXjOzOdTsnGMKQB\n"
|
rn2dVQ3vfBJqcDuFUK03d+1PZGbVlNCqnkpIJ8syFppW8ljnWweP7+LiWpRoz0I7
|
||||||
+ "LCl0vpcXBtFLMaSbpv1ozi8h7DJyVZ6EnFQZUWGdgTMhDrmqevfx95U/16c5WBDO\n"
|
fYb3d8TjhV86Y997Fl4DBrxgM6KTJOuE/uxnoDhZQ14LgOU2ckXjOzOdTsnGMKQB
|
||||||
+ "kqwIn7Glry9n9Suxygbf8g5AzpWcusZgDLIIZ7JTUldBb8qU2a0Dl4mvLZOn4wPo\n"
|
LCl0vpcXBtFLMaSbpv1ozi8h7DJyVZ6EnFQZUWGdgTMhDrmqevfx95U/16c5WBDO
|
||||||
+ "jfj9Cw2QICsc5+Pwf21fP+hzf+1WSRHbnYv8uanRO0gZ8ekGaghM/2H6gqJbo2nI\n"
|
kqwIn7Glry9n9Suxygbf8g5AzpWcusZgDLIIZ7JTUldBb8qU2a0Dl4mvLZOn4wPo
|
||||||
+ "JwIDAQAB\n-----END PUBLIC KEY-----";
|
jfj9Cw2QICsc5+Pwf21fP+hzf+1WSRHbnYv8uanRO0gZ8ekGaghM/2H6gqJbo2nI
|
||||||
|
JwIDAQAB
|
||||||
|
-----END PUBLIC KEY-----""";
|
||||||
String responseBody = "{\"keys\" : [ {\"kid\":\"test-key\",\"value\" : \"" + tokenKeyValue.replace("\n", "\\n")
|
String responseBody = "{\"keys\" : [ {\"kid\":\"test-key\",\"value\" : \"" + tokenKeyValue.replace("\n", "\\n")
|
||||||
+ "\"} ]}";
|
+ "\"} ]}";
|
||||||
this.server.expect(requestTo(UAA_URL + "/token_keys"))
|
this.server.expect(requestTo(UAA_URL + "/token_keys"))
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -63,23 +63,27 @@ class TokenValidatorTests {
|
||||||
|
|
||||||
private TokenValidator tokenValidator;
|
private TokenValidator tokenValidator;
|
||||||
|
|
||||||
private static final String VALID_KEY = "-----BEGIN PUBLIC KEY-----\n"
|
private static final String VALID_KEY = """
|
||||||
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m59l2u9iDnMbrXHfqkO\n"
|
-----BEGIN PUBLIC KEY-----
|
||||||
+ "rn2dVQ3vfBJqcDuFUK03d+1PZGbVlNCqnkpIJ8syFppW8ljnWweP7+LiWpRoz0I7\n"
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m59l2u9iDnMbrXHfqkO
|
||||||
+ "fYb3d8TjhV86Y997Fl4DBrxgM6KTJOuE/uxnoDhZQ14LgOU2ckXjOzOdTsnGMKQB\n"
|
rn2dVQ3vfBJqcDuFUK03d+1PZGbVlNCqnkpIJ8syFppW8ljnWweP7+LiWpRoz0I7
|
||||||
+ "LCl0vpcXBtFLMaSbpv1ozi8h7DJyVZ6EnFQZUWGdgTMhDrmqevfx95U/16c5WBDO\n"
|
fYb3d8TjhV86Y997Fl4DBrxgM6KTJOuE/uxnoDhZQ14LgOU2ckXjOzOdTsnGMKQB
|
||||||
+ "kqwIn7Glry9n9Suxygbf8g5AzpWcusZgDLIIZ7JTUldBb8qU2a0Dl4mvLZOn4wPo\n"
|
LCl0vpcXBtFLMaSbpv1ozi8h7DJyVZ6EnFQZUWGdgTMhDrmqevfx95U/16c5WBDO
|
||||||
+ "jfj9Cw2QICsc5+Pwf21fP+hzf+1WSRHbnYv8uanRO0gZ8ekGaghM/2H6gqJbo2nI\n"
|
kqwIn7Glry9n9Suxygbf8g5AzpWcusZgDLIIZ7JTUldBb8qU2a0Dl4mvLZOn4wPo
|
||||||
+ "JwIDAQAB\n-----END PUBLIC KEY-----";
|
jfj9Cw2QICsc5+Pwf21fP+hzf+1WSRHbnYv8uanRO0gZ8ekGaghM/2H6gqJbo2nI
|
||||||
|
JwIDAQAB
|
||||||
|
-----END PUBLIC KEY-----""";
|
||||||
|
|
||||||
private static final String INVALID_KEY = "-----BEGIN PUBLIC KEY-----\n"
|
private static final String INVALID_KEY = """
|
||||||
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxzYuc22QSst/dS7geYYK\n"
|
-----BEGIN PUBLIC KEY-----
|
||||||
+ "5l5kLxU0tayNdixkEQ17ix+CUcUbKIsnyftZxaCYT46rQtXgCaYRdJcbB3hmyrOa\n"
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxzYuc22QSst/dS7geYYK
|
||||||
+ "vkhTpX79xJZnQmfuamMbZBqitvscxW9zRR9tBUL6vdi/0rpoUwPMEh8+Bw7CgYR0\n"
|
5l5kLxU0tayNdixkEQ17ix+CUcUbKIsnyftZxaCYT46rQtXgCaYRdJcbB3hmyrOa
|
||||||
+ "FK0DhWYBNDfe9HKcyZEv3max8Cdq18htxjEsdYO0iwzhtKRXomBWTdhD5ykd/fAC\n"
|
vkhTpX79xJZnQmfuamMbZBqitvscxW9zRR9tBUL6vdi/0rpoUwPMEh8+Bw7CgYR0
|
||||||
+ "VTr4+KEY+IeLvubHVmLUhbE5NgWXxrRpGasDqzKhCTmsa2Ysf712rl57SlH0Wz/M\n"
|
FK0DhWYBNDfe9HKcyZEv3max8Cdq18htxjEsdYO0iwzhtKRXomBWTdhD5ykd/fAC
|
||||||
+ "r3F7aM9YpErzeYLrl0GhQr9BVJxOvXcVd4kmY+XkiCcrkyS1cnghnllh+LCwQu1s\n"
|
VTr4+KEY+IeLvubHVmLUhbE5NgWXxrRpGasDqzKhCTmsa2Ysf712rl57SlH0Wz/M
|
||||||
+ "YwIDAQAB\n-----END PUBLIC KEY-----";
|
r3F7aM9YpErzeYLrl0GhQr9BVJxOvXcVd4kmY+XkiCcrkyS1cnghnllh+LCwQu1s
|
||||||
|
YwIDAQAB
|
||||||
|
-----END PUBLIC KEY-----""";
|
||||||
|
|
||||||
private static final Map<String, String> INVALID_KEYS = Collections.singletonMap("invalid-key", INVALID_KEY);
|
private static final Map<String, String> INVALID_KEYS = Collections.singletonMap("invalid-key", INVALID_KEY);
|
||||||
|
|
||||||
|
@ -198,33 +202,35 @@ class TokenValidatorTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrivateKey getPrivateKey() throws InvalidKeySpecException, NoSuchAlgorithmException {
|
private PrivateKey getPrivateKey() throws InvalidKeySpecException, NoSuchAlgorithmException {
|
||||||
String signingKey = "-----BEGIN PRIVATE KEY-----\n"
|
String signingKey = """
|
||||||
+ "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDSbn2Xa72IOcxu\n"
|
-----BEGIN PRIVATE KEY-----
|
||||||
+ "tcd+qQ6ufZ1VDe98EmpwO4VQrTd37U9kZtWU0KqeSkgnyzIWmlbyWOdbB4/v4uJa\n"
|
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDSbn2Xa72IOcxu
|
||||||
+ "lGjPQjt9hvd3xOOFXzpj33sWXgMGvGAzopMk64T+7GegOFlDXguA5TZyReM7M51O\n"
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wq9Af7Fj/iHy2Av54BLPlBaGPwMi2bzB
|
||||||
+ "J/OOn5zOs8yf26os0q3+JUM=\n-----END PRIVATE KEY-----";
|
gYjmUomvx/fqOTQks9Rc4PIMB43p6Rdj0sh+52SKPDR2eHbwsmpuQUXnAs20BPPI
|
||||||
|
J/OOn5zOs8yf26os0q3+JUM=
|
||||||
|
-----END PRIVATE KEY-----""";
|
||||||
String privateKey = signingKey.replace("-----BEGIN PRIVATE KEY-----\n", "");
|
String privateKey = signingKey.replace("-----BEGIN PRIVATE KEY-----\n", "");
|
||||||
privateKey = privateKey.replace("-----END PRIVATE KEY-----", "");
|
privateKey = privateKey.replace("-----END PRIVATE KEY-----", "");
|
||||||
privateKey = privateKey.replace("\n", "");
|
privateKey = privateKey.replace("\n", "");
|
||||||
|
|
|
@ -70,7 +70,7 @@ class MeterRegistrySpanMetricsTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void registerQueueSizeShouldCreateGauge() {
|
void registerQueueSizeShouldCreateGauge() {
|
||||||
BlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(2);
|
BlockingQueue<Integer> queue = new ArrayBlockingQueue<>(2);
|
||||||
this.sut.registerQueueSize(queue);
|
this.sut.registerQueueSize(queue);
|
||||||
assertThat(getGaugeValue("wavefront.reporter.queue.size")).isZero();
|
assertThat(getGaugeValue("wavefront.reporter.queue.size")).isZero();
|
||||||
queue.offer(1);
|
queue.offer(1);
|
||||||
|
@ -79,7 +79,7 @@ class MeterRegistrySpanMetricsTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void registerQueueRemainingCapacityShouldCreateGauge() {
|
void registerQueueRemainingCapacityShouldCreateGauge() {
|
||||||
BlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(2);
|
BlockingQueue<Integer> queue = new ArrayBlockingQueue<>(2);
|
||||||
this.sut.registerQueueRemainingCapacity(queue);
|
this.sut.registerQueueRemainingCapacity(queue);
|
||||||
assertThat(getGaugeValue("wavefront.reporter.queue.remaining_capacity")).isEqualTo(2);
|
assertThat(getGaugeValue("wavefront.reporter.queue.remaining_capacity")).isEqualTo(2);
|
||||||
queue.offer(1);
|
queue.offer(1);
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -240,10 +240,9 @@ public class JerseyEndpointResourceFactory {
|
||||||
Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT;
|
Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT;
|
||||||
return Response.status(status).build();
|
return Response.status(status).build();
|
||||||
}
|
}
|
||||||
if (!(response instanceof WebEndpointResponse)) {
|
if (!(response instanceof WebEndpointResponse<?> webEndpointResponse)) {
|
||||||
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
|
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
|
||||||
}
|
}
|
||||||
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
|
|
||||||
return Response.status(webEndpointResponse.getStatus())
|
return Response.status(webEndpointResponse.getStatus())
|
||||||
.header("Content-Type", webEndpointResponse.getContentType())
|
.header("Content-Type", webEndpointResponse.getContentType())
|
||||||
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
|
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -379,10 +379,9 @@ public abstract class AbstractWebFluxEndpointHandlerMapping extends RequestMappi
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResponseEntity<Object> toResponseEntity(Object response) {
|
private ResponseEntity<Object> toResponseEntity(Object response) {
|
||||||
if (!(response instanceof WebEndpointResponse)) {
|
if (!(response instanceof WebEndpointResponse<?> webEndpointResponse)) {
|
||||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
|
|
||||||
MediaType contentType = (webEndpointResponse.getContentType() != null)
|
MediaType contentType = (webEndpointResponse.getContentType() != null)
|
||||||
? new MediaType(webEndpointResponse.getContentType()) : null;
|
? new MediaType(webEndpointResponse.getContentType()) : null;
|
||||||
return ResponseEntity.status(webEndpointResponse.getStatus()).contentType(contentType)
|
return ResponseEntity.status(webEndpointResponse.getStatus()).contentType(contentType)
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -375,10 +375,9 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
(httpMethod != HttpMethod.GET) ? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND);
|
(httpMethod != HttpMethod.GET) ? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
if (!(result instanceof WebEndpointResponse)) {
|
if (!(result instanceof WebEndpointResponse<?> response)) {
|
||||||
return convertIfNecessary(result);
|
return convertIfNecessary(result);
|
||||||
}
|
}
|
||||||
WebEndpointResponse<?> response = (WebEndpointResponse<?>) result;
|
|
||||||
MediaType contentType = (response.getContentType() != null) ? new MediaType(response.getContentType())
|
MediaType contentType = (response.getContentType() != null) ? new MediaType(response.getContentType())
|
||||||
: null;
|
: null;
|
||||||
return ResponseEntity.status(response.getStatus()).contentType(contentType)
|
return ResponseEntity.status(response.getStatus()).contentType(contentType)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -40,7 +40,7 @@ class CompositeHealthContributorReactiveAdapter implements CompositeReactiveHeal
|
||||||
@Override
|
@Override
|
||||||
public Iterator<NamedContributor<ReactiveHealthContributor>> iterator() {
|
public Iterator<NamedContributor<ReactiveHealthContributor>> iterator() {
|
||||||
Iterator<NamedContributor<HealthContributor>> iterator = this.delegate.iterator();
|
Iterator<NamedContributor<HealthContributor>> iterator = this.delegate.iterator();
|
||||||
return new Iterator<NamedContributor<ReactiveHealthContributor>>() {
|
return new Iterator<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -95,7 +95,7 @@ class DefaultContributorRegistry<C> implements ContributorRegistry<C> {
|
||||||
@Override
|
@Override
|
||||||
public Iterator<NamedContributor<C>> iterator() {
|
public Iterator<NamedContributor<C>> iterator() {
|
||||||
Iterator<Map.Entry<String, C>> iterator = this.contributors.entrySet().iterator();
|
Iterator<Map.Entry<String, C>> iterator = this.contributors.entrySet().iterator();
|
||||||
return new Iterator<NamedContributor<C>>() {
|
return new Iterator<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -44,7 +44,7 @@ public interface NamedContributor<C> {
|
||||||
static <C> NamedContributor<C> of(String name, C contributor) {
|
static <C> NamedContributor<C> of(String name, C contributor) {
|
||||||
Assert.notNull(name, "Name must not be null");
|
Assert.notNull(name, "Name must not be null");
|
||||||
Assert.notNull(contributor, "Contributor must not be null");
|
Assert.notNull(contributor, "Contributor must not be null");
|
||||||
return new NamedContributor<C>() {
|
return new NamedContributor<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -62,7 +62,7 @@ abstract class NamedContributorsMapAdapter<V, C> implements NamedContributors<C>
|
||||||
@Override
|
@Override
|
||||||
public Iterator<NamedContributor<C>> iterator() {
|
public Iterator<NamedContributor<C>> iterator() {
|
||||||
Iterator<Entry<String, C>> iterator = this.map.entrySet().iterator();
|
Iterator<Entry<String, C>> iterator = this.map.entrySet().iterator();
|
||||||
return new Iterator<NamedContributor<C>>() {
|
return new Iterator<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -320,17 +320,14 @@ class EndpointDiscovererTests {
|
||||||
private void load(ApplicationContext parent, Class<?> configuration,
|
private void load(ApplicationContext parent, Class<?> configuration,
|
||||||
Consumer<AnnotationConfigApplicationContext> consumer) {
|
Consumer<AnnotationConfigApplicationContext> consumer) {
|
||||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||||
if (parent != null) {
|
try (context) {
|
||||||
context.setParent(parent);
|
if (parent != null) {
|
||||||
}
|
context.setParent(parent);
|
||||||
context.register(configuration);
|
}
|
||||||
context.refresh();
|
context.register(configuration);
|
||||||
try {
|
context.refresh();
|
||||||
consumer.accept(context);
|
consumer.accept(context);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
context.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -132,8 +132,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory, int acceptCount) {
|
private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory, int acceptCount) {
|
||||||
factory.addConnectorCustomizers((connector) -> {
|
factory.addConnectorCustomizers((connector) -> {
|
||||||
ProtocolHandler handler = connector.getProtocolHandler();
|
ProtocolHandler handler = connector.getProtocolHandler();
|
||||||
if (handler instanceof AbstractProtocol) {
|
if (handler instanceof AbstractProtocol<?> protocol) {
|
||||||
AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler;
|
|
||||||
protocol.setAcceptCount(acceptCount);
|
protocol.setAcceptCount(acceptCount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -156,8 +155,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
protocol.setKeepAliveTimeout(keepAliveTimeout.toMillis());
|
protocol.setKeepAliveTimeout(keepAliveTimeout.toMillis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (handler instanceof AbstractProtocol) {
|
if (handler instanceof AbstractProtocol<?> protocol) {
|
||||||
AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler;
|
|
||||||
protocol.setKeepAliveTimeout((int) keepAliveTimeout.toMillis());
|
protocol.setKeepAliveTimeout((int) keepAliveTimeout.toMillis());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -166,8 +164,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
private void customizeMaxKeepAliveRequests(ConfigurableTomcatWebServerFactory factory, int maxKeepAliveRequests) {
|
private void customizeMaxKeepAliveRequests(ConfigurableTomcatWebServerFactory factory, int maxKeepAliveRequests) {
|
||||||
factory.addConnectorCustomizers((connector) -> {
|
factory.addConnectorCustomizers((connector) -> {
|
||||||
ProtocolHandler handler = connector.getProtocolHandler();
|
ProtocolHandler handler = connector.getProtocolHandler();
|
||||||
if (handler instanceof AbstractHttp11Protocol) {
|
if (handler instanceof AbstractHttp11Protocol<?> protocol) {
|
||||||
AbstractHttp11Protocol<?> protocol = (AbstractHttp11Protocol<?>) handler;
|
|
||||||
protocol.setMaxKeepAliveRequests(maxKeepAliveRequests);
|
protocol.setMaxKeepAliveRequests(maxKeepAliveRequests);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -176,8 +173,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
private void customizeMaxConnections(ConfigurableTomcatWebServerFactory factory, int maxConnections) {
|
private void customizeMaxConnections(ConfigurableTomcatWebServerFactory factory, int maxConnections) {
|
||||||
factory.addConnectorCustomizers((connector) -> {
|
factory.addConnectorCustomizers((connector) -> {
|
||||||
ProtocolHandler handler = connector.getProtocolHandler();
|
ProtocolHandler handler = connector.getProtocolHandler();
|
||||||
if (handler instanceof AbstractProtocol) {
|
if (handler instanceof AbstractProtocol<?> protocol) {
|
||||||
AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler;
|
|
||||||
protocol.setMaxConnections(maxConnections);
|
protocol.setMaxConnections(maxConnections);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -186,8 +182,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
private void customizeConnectionTimeout(ConfigurableTomcatWebServerFactory factory, Duration connectionTimeout) {
|
private void customizeConnectionTimeout(ConfigurableTomcatWebServerFactory factory, Duration connectionTimeout) {
|
||||||
factory.addConnectorCustomizers((connector) -> {
|
factory.addConnectorCustomizers((connector) -> {
|
||||||
ProtocolHandler handler = connector.getProtocolHandler();
|
ProtocolHandler handler = connector.getProtocolHandler();
|
||||||
if (handler instanceof AbstractProtocol) {
|
if (handler instanceof AbstractProtocol<?> protocol) {
|
||||||
AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler;
|
|
||||||
protocol.setConnectionTimeout((int) connectionTimeout.toMillis());
|
protocol.setConnectionTimeout((int) connectionTimeout.toMillis());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -204,8 +199,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
private void customizeRejectIllegalHeader(ConfigurableTomcatWebServerFactory factory, boolean rejectIllegalHeader) {
|
private void customizeRejectIllegalHeader(ConfigurableTomcatWebServerFactory factory, boolean rejectIllegalHeader) {
|
||||||
factory.addConnectorCustomizers((connector) -> {
|
factory.addConnectorCustomizers((connector) -> {
|
||||||
ProtocolHandler handler = connector.getProtocolHandler();
|
ProtocolHandler handler = connector.getProtocolHandler();
|
||||||
if (handler instanceof AbstractHttp11Protocol) {
|
if (handler instanceof AbstractHttp11Protocol<?> protocol) {
|
||||||
AbstractHttp11Protocol<?> protocol = (AbstractHttp11Protocol<?>) handler;
|
|
||||||
protocol.setRejectIllegalHeader(rejectIllegalHeader);
|
protocol.setRejectIllegalHeader(rejectIllegalHeader);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -249,15 +243,14 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
CloudPlatform platform = CloudPlatform.getActive(this.environment);
|
CloudPlatform platform = CloudPlatform.getActive(this.environment);
|
||||||
return platform != null && platform.isUsingForwardHeaders();
|
return platform != null && platform.isUsingForwardHeaders();
|
||||||
}
|
}
|
||||||
return this.serverProperties.getForwardHeadersStrategy().equals(ServerProperties.ForwardHeadersStrategy.NATIVE);
|
return this.serverProperties.getForwardHeadersStrategy() == ServerProperties.ForwardHeadersStrategy.NATIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private void customizeMaxThreads(ConfigurableTomcatWebServerFactory factory, int maxThreads) {
|
private void customizeMaxThreads(ConfigurableTomcatWebServerFactory factory, int maxThreads) {
|
||||||
factory.addConnectorCustomizers((connector) -> {
|
factory.addConnectorCustomizers((connector) -> {
|
||||||
ProtocolHandler handler = connector.getProtocolHandler();
|
ProtocolHandler handler = connector.getProtocolHandler();
|
||||||
if (handler instanceof AbstractProtocol) {
|
if (handler instanceof AbstractProtocol protocol) {
|
||||||
AbstractProtocol protocol = (AbstractProtocol) handler;
|
|
||||||
protocol.setMaxThreads(maxThreads);
|
protocol.setMaxThreads(maxThreads);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -267,8 +260,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
private void customizeMinThreads(ConfigurableTomcatWebServerFactory factory, int minSpareThreads) {
|
private void customizeMinThreads(ConfigurableTomcatWebServerFactory factory, int minSpareThreads) {
|
||||||
factory.addConnectorCustomizers((connector) -> {
|
factory.addConnectorCustomizers((connector) -> {
|
||||||
ProtocolHandler handler = connector.getProtocolHandler();
|
ProtocolHandler handler = connector.getProtocolHandler();
|
||||||
if (handler instanceof AbstractProtocol) {
|
if (handler instanceof AbstractProtocol protocol) {
|
||||||
AbstractProtocol protocol = (AbstractProtocol) handler;
|
|
||||||
protocol.setMinSpareThreads(minSpareThreads);
|
protocol.setMinSpareThreads(minSpareThreads);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -279,8 +271,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
int maxHttpRequestHeaderSize) {
|
int maxHttpRequestHeaderSize) {
|
||||||
factory.addConnectorCustomizers((connector) -> {
|
factory.addConnectorCustomizers((connector) -> {
|
||||||
ProtocolHandler handler = connector.getProtocolHandler();
|
ProtocolHandler handler = connector.getProtocolHandler();
|
||||||
if (handler instanceof AbstractHttp11Protocol) {
|
if (handler instanceof AbstractHttp11Protocol protocol) {
|
||||||
AbstractHttp11Protocol protocol = (AbstractHttp11Protocol) handler;
|
|
||||||
protocol.setMaxHttpRequestHeaderSize(maxHttpRequestHeaderSize);
|
protocol.setMaxHttpRequestHeaderSize(maxHttpRequestHeaderSize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -289,8 +280,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
private void customizeMaxSwallowSize(ConfigurableTomcatWebServerFactory factory, int maxSwallowSize) {
|
private void customizeMaxSwallowSize(ConfigurableTomcatWebServerFactory factory, int maxSwallowSize) {
|
||||||
factory.addConnectorCustomizers((connector) -> {
|
factory.addConnectorCustomizers((connector) -> {
|
||||||
ProtocolHandler handler = connector.getProtocolHandler();
|
ProtocolHandler handler = connector.getProtocolHandler();
|
||||||
if (handler instanceof AbstractHttp11Protocol) {
|
if (handler instanceof AbstractHttp11Protocol<?> protocol) {
|
||||||
AbstractHttp11Protocol<?> protocol = (AbstractHttp11Protocol<?>) handler;
|
|
||||||
protocol.setMaxSwallowSize(maxSwallowSize);
|
protocol.setMaxSwallowSize(maxSwallowSize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,7 +102,7 @@ abstract class AbstractCacheAutoConfigurationTests {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
CacheManagerCustomizer<CouchbaseCacheManager> couchbaseCacheManagerCustomizer() {
|
CacheManagerCustomizer<CouchbaseCacheManager> couchbaseCacheManagerCustomizer() {
|
||||||
return new CacheManagerTestCustomizer<CouchbaseCacheManager>() {
|
return new CacheManagerTestCustomizer<>() {
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ abstract class AbstractCacheAutoConfigurationTests {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
CacheManagerCustomizer<SpringCache2kCacheManager> cache2kCacheManagerCustomizer() {
|
CacheManagerCustomizer<SpringCache2kCacheManager> cache2kCacheManagerCustomizer() {
|
||||||
return new CacheManagerTestCustomizer<SpringCache2kCacheManager>() {
|
return new CacheManagerTestCustomizer<>() {
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -523,7 +523,7 @@ class JacksonAutoConfigurationTests {
|
||||||
@Bean
|
@Bean
|
||||||
Module jacksonModule() {
|
Module jacksonModule() {
|
||||||
SimpleModule module = new SimpleModule();
|
SimpleModule module = new SimpleModule();
|
||||||
module.addSerializer(Foo.class, new JsonSerializer<Foo>() {
|
module.addSerializer(Foo.class, new JsonSerializer<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(Foo value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
|
public void serialize(Foo value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
|
||||||
|
|
|
@ -962,8 +962,7 @@ public class TestRestTemplate {
|
||||||
}
|
}
|
||||||
|
|
||||||
private URI resolveUri(RequestEntity<?> entity) {
|
private URI resolveUri(RequestEntity<?> entity) {
|
||||||
if (entity instanceof UriTemplateRequestEntity) {
|
if (entity instanceof UriTemplateRequestEntity<?> templatedUriEntity) {
|
||||||
UriTemplateRequestEntity<?> templatedUriEntity = (UriTemplateRequestEntity<?>) entity;
|
|
||||||
if (templatedUriEntity.getVars() != null) {
|
if (templatedUriEntity.getVars() != null) {
|
||||||
return this.restTemplate.getUriTemplateHandler().expand(templatedUriEntity.getUriTemplate(),
|
return this.restTemplate.getUriTemplateHandler().expand(templatedUriEntity.getUriTemplate(),
|
||||||
templatedUriEntity.getVars());
|
templatedUriEntity.getVars());
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.boot.test.mock.mockito;
|
package org.springframework.boot.test.mock.mockito;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationHandler;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -60,14 +58,7 @@ class SpyBeanWithJdkProxyTests {
|
||||||
@Bean
|
@Bean
|
||||||
ExampleRepository dateService() {
|
ExampleRepository dateService() {
|
||||||
return (ExampleRepository) Proxy.newProxyInstance(getClass().getClassLoader(),
|
return (ExampleRepository) Proxy.newProxyInstance(getClass().getClassLoader(),
|
||||||
new Class<?>[] { ExampleRepository.class }, new InvocationHandler() {
|
new Class<?>[] { ExampleRepository.class }, (proxy, method, args) -> new Example((String) args[0]));
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
|
||||||
return new Example((String) args[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -103,12 +103,9 @@ public class InspectedContent implements Content {
|
||||||
public static InspectedContent of(IOConsumer<OutputStream> writer, Inspector... inspectors) throws IOException {
|
public static InspectedContent of(IOConsumer<OutputStream> writer, Inspector... inspectors) throws IOException {
|
||||||
Assert.notNull(writer, "Writer must not be null");
|
Assert.notNull(writer, "Writer must not be null");
|
||||||
InspectingOutputStream outputStream = new InspectingOutputStream(inspectors);
|
InspectingOutputStream outputStream = new InspectingOutputStream(inspectors);
|
||||||
try {
|
try (outputStream) {
|
||||||
writer.accept(outputStream);
|
writer.accept(outputStream);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
outputStream.close();
|
|
||||||
}
|
|
||||||
return new InspectedContent(outputStream.getSize(), outputStream.getContent());
|
return new InspectedContent(outputStream.getSize(), outputStream.getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -113,7 +113,7 @@ public class NamedPipeSocket extends Socket {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <A> void read(ByteBuffer dst, A attachment, CompletionHandler<Integer, ? super A> handler) {
|
public <A> void read(ByteBuffer dst, A attachment, CompletionHandler<Integer, ? super A> handler) {
|
||||||
this.fileChannel.read(dst, 0, attachment, new CompletionHandler<Integer, A>() {
|
this.fileChannel.read(dst, 0, attachment, new CompletionHandler<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completed(Integer read, A attachment) {
|
public void completed(Integer read, A attachment) {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -83,8 +83,14 @@ class TestTarGzip {
|
||||||
buildpackToml.append("homepage = \"https://github.com/example/example-buildpack\"\n");
|
buildpackToml.append("homepage = \"https://github.com/example/example-buildpack\"\n");
|
||||||
buildpackToml.append("[[stacks]]\n");
|
buildpackToml.append("[[stacks]]\n");
|
||||||
buildpackToml.append("id = \"io.buildpacks.stacks.bionic\"\n");
|
buildpackToml.append("id = \"io.buildpacks.stacks.bionic\"\n");
|
||||||
String detectScript = "#!/usr/bin/env bash\n" + "echo \"---> detect\"\n";
|
String detectScript = """
|
||||||
String buildScript = "#!/usr/bin/env bash\n" + "echo \"---> build\"\n";
|
#!/usr/bin/env bash
|
||||||
|
echo "---> detect"
|
||||||
|
""";
|
||||||
|
String buildScript = """
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo "---> build"
|
||||||
|
""";
|
||||||
try (TarArchiveOutputStream tar = new TarArchiveOutputStream(Files.newOutputStream(archive))) {
|
try (TarArchiveOutputStream tar = new TarArchiveOutputStream(Files.newOutputStream(archive))) {
|
||||||
writeEntry(tar, "buildpack.toml", buildpackToml.toString());
|
writeEntry(tar, "buildpack.toml", buildpackToml.toString());
|
||||||
writeEntry(tar, "bin/");
|
writeEntry(tar, "bin/");
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -33,73 +33,86 @@ public class PemFileWriter {
|
||||||
|
|
||||||
private static final String EXAMPLE_SECRET_QUALIFIER = "example";
|
private static final String EXAMPLE_SECRET_QUALIFIER = "example";
|
||||||
|
|
||||||
public static final String CA_CERTIFICATE = "-----BEGIN TRUSTED CERTIFICATE-----\n"
|
public static final String CA_CERTIFICATE = """
|
||||||
+ "MIIClzCCAgACCQCPbjkRoMVEQDANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMC\n"
|
-----BEGIN TRUSTED CERTIFICATE-----
|
||||||
+ "VVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFj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GVzdEBleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
|
||||||
+ "3I9LuOHhZh9U+fCDCgPfiDdyJfDEW/P+dsOMFyMUXPrJPze2yPpOnvV8iJ5DM93u\n"
|
gYEA1YzixWEoyzrd20C2R1gjyPCoPfFLlG6UYTyT0tueNy6yjv6qbJ8lcZg7616O
|
||||||
+ "fEVhCCyzLdYu0P2P3hU2W+T3/Im9DA7FOPA2vF1SrIJ2qtUCAwEAATANBgkqhkiG\n"
|
3I9LuOHhZh9U+fCDCgPfiDdyJfDEW/P+dsOMFyMUXPrJPze2yPpOnvV8iJ5DM93u
|
||||||
+ "9w0BAQUFAAOBgQBdShkwUv78vkn1jAdtfbB+7mpV9tufVdo29j7pmotTCz3ny5fc\n"
|
fEVhCCyzLdYu0P2P3hU2W+T3/Im9DA7FOPA2vF1SrIJ2qtUCAwEAATANBgkqhkiG
|
||||||
+ "zLEfeu6JPugAR71JYbc2CqGrMneSk1zT91EH6ohIz8OR5VNvzB7N7q65Ci7OFMPl\n"
|
9w0BAQUFAAOBgQBdShkwUv78vkn1jAdtfbB+7mpV9tufVdo29j7pmotTCz3ny5fc
|
||||||
+ "ly6k3rHpMCBtHoyNFhNVfPLxGJ9VlWFKLgIAbCmL4OIQm1l6Fr1MSM38Zw==\n" + "-----END TRUSTED CERTIFICATE-----\n";
|
zLEfeu6JPugAR71JYbc2CqGrMneSk1zT91EH6ohIz8OR5VNvzB7N7q65Ci7OFMPl
|
||||||
|
ly6k3rHpMCBtHoyNFhNVfPLxGJ9VlWFKLgIAbCmL4OIQm1l6Fr1MSM38Zw==
|
||||||
|
-----END TRUSTED CERTIFICATE-----
|
||||||
|
""";
|
||||||
|
|
||||||
public static final String CA_PRIVATE_KEY = EXAMPLE_SECRET_QUALIFIER + "-----BEGIN PRIVATE KEY-----\n"
|
public static final String CA_PRIVATE_KEY = """
|
||||||
+ "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEA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FWdgDsfYpPZdL4YgpVSEvcoypRGg2suJw2omcKcY56XpkmWUqZc06QirumtnEC0P\n"
|
rBr/bN+mG7+rMEHxs5wtU47aNjUKuVVC0Qfhsf95ahvHAkEA27inSlxrwGvhvFsD
|
||||||
+ "HfnsgwJBAMVhEURrOc13FxytsQiz96atuF6H4htH79o3ndQKDXI0B/7VSd6maLjP\n"
|
FWdgDsfYpPZdL4YgpVSEvcoypRGg2suJw2omcKcY56XpkmWUqZc06QirumtnEC0P
|
||||||
+ "QaESkTTL8qldE1r8h4zH8m6zHC4fZQUCQFWJ+8bdWC2fUlBr9jVc+26Fqvf92aVo\n"
|
HfnsgwJBAMVhEURrOc13FxytsQiz96atuF6H4htH79o3ndQKDXI0B/7VSd6maLjP
|
||||||
+ "yEjVMKBamYDd7gt/9fAX4UM2KmH0m4wc89VaQoT+lSyMJ6GKiToYVFUCQEXcyoeO\n"
|
QaESkTTL8qldE1r8h4zH8m6zHC4fZQUCQFWJ+8bdWC2fUlBr9jVc+26Fqvf92aVo
|
||||||
+ "zWqtSgEX/eXQXzmMKxYnjv1O//ba3Q7UiHd/XO5j4QXAJpcB6h0h00uC5KY2d0Zy\n" + "JQ1kB1C2l6l9tyc=\n"
|
yEjVMKBamYDd7gt/9fAX4UM2KmH0m4wc89VaQoT+lSyMJ6GKiToYVFUCQEXcyoeO
|
||||||
+ "-----END PRIVATE KEY-----";
|
zWqtSgEX/eXQXzmMKxYnjv1O//ba3Q7UiHd/XO5j4QXAJpcB6h0h00uC5KY2d0Zy
|
||||||
|
JQ1kB1C2l6l9tyc=
|
||||||
|
-----END PRIVATE KEY-----""".formatted(EXAMPLE_SECRET_QUALIFIER);
|
||||||
|
|
||||||
public static final String CERTIFICATE = "-----BEGIN CERTIFICATE-----\n"
|
public static final String CERTIFICATE = """
|
||||||
+ "MIICjzCCAfgCAQEwDQYJKoZIhvcNAQEFBQAwgY8xCzAJBgNVBAYTAlVTMRMwEQYD\n"
|
-----BEGIN CERTIFICATE-----
|
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6G4BmE0B+suXHEvnLpHTj9pdX/ZzBIK\n"
|
c3RAZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM7kd2cj
|
||||||
+ "8jIZ/x8RnSduK/Ky+zm1QMYUWZtWCAgCW8WzgB69Cn/hQG8KSX3S9bqODuQAvP54\n"
|
F49wm1+OQ7Q5GE96cXueWNPr/Nwei71tf6G4BmE0B+suXHEvnLpHTj9pdX/ZzBIK
|
||||||
+ "GQJD7+4kVuNBGjFb4DaD4nvMmPtALSZf8ZCZAgMBAAEwDQYJKoZIhvcNAQEFBQAD\n"
|
8jIZ/x8RnSduK/Ky+zm1QMYUWZtWCAgCW8WzgB69Cn/hQG8KSX3S9bqODuQAvP54
|
||||||
+ "gYEAOn6X8+0VVlDjF+TvTgI0KIasA6nDm+KXe7LVtfvqWqQZH4qyd2uiwcDM3Aux\n"
|
GQJD7+4kVuNBGjFb4DaD4nvMmPtALSZf8ZCZAgMBAAEwDQYJKoZIhvcNAQEFBQAD
|
||||||
+ "a/OsPdOw0j+NqFDBd3mSMhSVgfvXdK6j9WaxY1VGXyaidLARgvn63wfzgr857sQW\n"
|
gYEAOn6X8+0VVlDjF+TvTgI0KIasA6nDm+KXe7LVtfvqWqQZH4qyd2uiwcDM3Aux
|
||||||
+ "c8eSxbwEQxwlMvVxW6Os4VhCfUQr8VrBrvPa2zs+6IlK+Ug=\n" + "-----END CERTIFICATE-----\n";
|
a/OsPdOw0j+NqFDBd3mSMhSVgfvXdK6j9WaxY1VGXyaidLARgvn63wfzgr857sQW
|
||||||
|
c8eSxbwEQxwlMvVxW6Os4VhCfUQr8VrBrvPa2zs+6IlK+Ug=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
""";
|
||||||
|
|
||||||
public static final String PRIVATE_RSA_KEY = EXAMPLE_SECRET_QUALIFIER + "-----BEGIN RSA PRIVATE KEY-----\n"
|
public static final String PRIVATE_RSA_KEY = """
|
||||||
+ "MIICXAIBAAKBgQ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
|
||||||
+ "Iz5SdCYlSFHbDNRFrwuW2QnhippqIQqC7wJAbVeyWEpM0yu5XiJqWdyB5iuG3xA2\n"
|
a/ZZVoT3AkEA2zSBMpvGPDkGbOMqbnR8UL3uijkOj+blQe1gsyu3dUa9T42O1u9h
|
||||||
+ "tW0Q0p9ozvbT+9XtRiwmweFR8uOCybw9qexURV7ntAis3cKctmP/Neq7fQJBAKGa\n"
|
Iz5SdCYlSFHbDNRFrwuW2QnhippqIQqC7wJAbVeyWEpM0yu5XiJqWdyB5iuG3xA2
|
||||||
+ "59UjutYTRIVqRJICFtR/8ii9P9sfYs1j7/KnvC0d5duMhU44VOjivW8b4Eic8F1Y\n"
|
tW0Q0p9ozvbT+9XtRiwmweFR8uOCybw9qexURV7ntAis3cKctmP/Neq7fQJBAKGa
|
||||||
+ "8bbHWILSIhFJHg0V7skCQDa8/YkRWF/3pwIZNWQr4ce4OzvYsFMkRvGRdX8B2a0p\n"
|
59UjutYTRIVqRJICFtR/8ii9P9sfYs1j7/KnvC0d5duMhU44VOjivW8b4Eic8F1Y
|
||||||
+ "wSKcVTdEdO2DhBlYddN0zG0rjq4vDMtdmldEl4BdldQ=\n" + "-----END RSA PRIVATE KEY-----\n";
|
8bbHWILSIhFJHg0V7skCQDa8/YkRWF/3pwIZNWQr4ce4OzvYsFMkRvGRdX8B2a0p
|
||||||
|
wSKcVTdEdO2DhBlYddN0zG0rjq4vDMtdmldEl4BdldQ=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
|
""".formatted(EXAMPLE_SECRET_QUALIFIER);
|
||||||
|
|
||||||
public static final String PRIVATE_EC_KEY = EXAMPLE_SECRET_QUALIFIER + "-----BEGIN EC PRIVATE KEY-----\n"
|
public static final String PRIVATE_EC_KEY = """
|
||||||
+ "MHcCAQEEIIwZkO8Zjbggzi8wwrk5rzSPzUX31gqTRhBYw4AL6w44oAoGCCqGSM49\n"
|
%s-----BEGIN EC PRIVATE KEY-----
|
||||||
+ "AwEHoUQDQgAE8y28khug747bA68M90IAMCPHAYyen+RsN6i84LORpNDUhv00QZWd\n"
|
MHcCAQEEIIwZkO8Zjbggzi8wwrk5rzSPzUX31gqTRhBYw4AL6w44oAoGCCqGSM49
|
||||||
+ "hOhjWFCQjnewR98Y8pEb1fnORll4LhHPlQ==\n" + "-----END EC PRIVATE KEY-----";
|
AwEHoUQDQgAE8y28khug747bA68M90IAMCPHAYyen+RsN6i84LORpNDUhv00QZWd
|
||||||
|
hOhjWFCQjnewR98Y8pEb1fnORll4LhHPlQ==
|
||||||
|
-----END EC PRIVATE KEY-----""".formatted(EXAMPLE_SECRET_QUALIFIER);
|
||||||
|
|
||||||
private final Path tempDir;
|
private final Path tempDir;
|
||||||
|
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -196,7 +196,7 @@ class JsonReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject readJson(InputStream in, Charset charset) throws Exception {
|
private JSONObject readJson(InputStream in, Charset charset) throws Exception {
|
||||||
try {
|
try (in) {
|
||||||
StringBuilder out = new StringBuilder();
|
StringBuilder out = new StringBuilder();
|
||||||
InputStreamReader reader = new InputStreamReader(in, charset);
|
InputStreamReader reader = new InputStreamReader(in, charset);
|
||||||
char[] buffer = new char[BUFFER_SIZE];
|
char[] buffer = new char[BUFFER_SIZE];
|
||||||
|
@ -206,9 +206,6 @@ class JsonReader {
|
||||||
}
|
}
|
||||||
return new JSONObject(out.toString());
|
return new JSONObject(out.toString());
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
in.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,7 @@ class JSON {
|
||||||
if (value instanceof Boolean) {
|
if (value instanceof Boolean) {
|
||||||
return (Boolean) value;
|
return (Boolean) value;
|
||||||
}
|
}
|
||||||
if (value instanceof String) {
|
if (value instanceof String stringValue) {
|
||||||
String stringValue = (String) value;
|
|
||||||
if ("true".equalsIgnoreCase(stringValue)) {
|
if ("true".equalsIgnoreCase(stringValue)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,8 +311,7 @@ public class JSONObject {
|
||||||
JSON.checkDouble(((Number) value).doubleValue());
|
JSON.checkDouble(((Number) value).doubleValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current instanceof JSONArray) {
|
if (current instanceof JSONArray array) {
|
||||||
JSONArray array = (JSONArray) current;
|
|
||||||
array.put(value);
|
array.put(value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -513,12 +513,9 @@ class BootZipCopyAction implements CopyAction {
|
||||||
private long size;
|
private long size;
|
||||||
|
|
||||||
CrcAndSize(InputStream inputStream) throws IOException {
|
CrcAndSize(InputStream inputStream) throws IOException {
|
||||||
try {
|
try (inputStream) {
|
||||||
load(inputStream);
|
load(inputStream);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void load(InputStream inputStream) throws IOException {
|
private void load(InputStream inputStream) throws IOException {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -128,12 +128,9 @@ public abstract class AbstractJarWriter implements LoaderClassesWriter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void writeEntry(String entryName, InputStream inputStream) throws IOException {
|
public void writeEntry(String entryName, InputStream inputStream) throws IOException {
|
||||||
try {
|
try (inputStream) {
|
||||||
writeEntry(entryName, new InputStreamEntryWriter(inputStream));
|
writeEntry(entryName, new InputStreamEntryWriter(inputStream));
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -44,8 +44,7 @@ public class DefaultLaunchScript implements LaunchScript {
|
||||||
|
|
||||||
private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("\\{\\{(\\w+)(:.*?)?\\}\\}(?!\\})");
|
private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("\\{\\{(\\w+)(:.*?)?\\}\\}(?!\\})");
|
||||||
|
|
||||||
private static final Set<String> FILE_PATH_KEYS = Collections
|
private static final Set<String> FILE_PATH_KEYS = Collections.singleton("inlinedConfScript");
|
||||||
.unmodifiableSet(Collections.singleton("inlinedConfScript"));
|
|
||||||
|
|
||||||
private final String content;
|
private final String content;
|
||||||
|
|
||||||
|
@ -68,14 +67,11 @@ public class DefaultLaunchScript implements LaunchScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String loadContent(InputStream inputStream) throws IOException {
|
private String loadContent(InputStream inputStream) throws IOException {
|
||||||
try {
|
try (inputStream) {
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
copy(inputStream, outputStream);
|
copy(inputStream, outputStream);
|
||||||
return outputStream.toString(StandardCharsets.UTF_8);
|
return outputStream.toString(StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
|
private void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -43,12 +43,9 @@ final class SizeCalculatingEntryWriter implements EntryWriter {
|
||||||
|
|
||||||
private SizeCalculatingEntryWriter(EntryWriter entryWriter) throws IOException {
|
private SizeCalculatingEntryWriter(EntryWriter entryWriter) throws IOException {
|
||||||
SizeCalculatingOutputStream outputStream = new SizeCalculatingOutputStream();
|
SizeCalculatingOutputStream outputStream = new SizeCalculatingOutputStream();
|
||||||
try {
|
try (outputStream) {
|
||||||
entryWriter.write(outputStream);
|
entryWriter.write(outputStream);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
outputStream.close();
|
|
||||||
}
|
|
||||||
this.content = outputStream.getContent();
|
this.content = outputStream.getContent();
|
||||||
this.size = outputStream.getSize();
|
this.size = outputStream.getSize();
|
||||||
}
|
}
|
||||||
|
@ -67,12 +64,9 @@ final class SizeCalculatingEntryWriter implements EntryWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
|
private void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
|
||||||
try {
|
try (inputStream) {
|
||||||
StreamUtils.copy(inputStream, outputStream);
|
StreamUtils.copy(inputStream, outputStream);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -406,7 +406,7 @@ class PropertiesLauncherTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Condition<Archive> endingWith(String value) {
|
private Condition<Archive> endingWith(String value) {
|
||||||
return new Condition<Archive>() {
|
return new Condition<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(Archive archive) {
|
public boolean matches(Archive archive) {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -130,7 +130,7 @@ class MavenBuild {
|
||||||
try {
|
try {
|
||||||
Path destination = this.temp.toPath();
|
Path destination = this.temp.toPath();
|
||||||
Path source = this.projectDir.toPath();
|
Path source = this.projectDir.toPath();
|
||||||
Files.walkFileTree(source, new SimpleFileVisitor<Path>() {
|
Files.walkFileTree(source, new SimpleFileVisitor<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
|
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -123,7 +123,7 @@ public interface BootstrapRegistry {
|
||||||
default InstanceSupplier<T> withScope(Scope scope) {
|
default InstanceSupplier<T> withScope(Scope scope) {
|
||||||
Assert.notNull(scope, "Scope must not be null");
|
Assert.notNull(scope, "Scope must not be null");
|
||||||
InstanceSupplier<T> parent = this;
|
InstanceSupplier<T> parent = this;
|
||||||
return new InstanceSupplier<T>() {
|
return new InstanceSupplier<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T get(BootstrapContext context) {
|
public T get(BootstrapContext context) {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -61,8 +61,7 @@ class NotConstructorBoundInjectionFailureAnalyzer
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isConstructorBindingConfigurationProperties(InjectionPoint injectionPoint) {
|
private boolean isConstructorBindingConfigurationProperties(InjectionPoint injectionPoint) {
|
||||||
if (injectionPoint != null && injectionPoint.getMember() instanceof Constructor) {
|
if (injectionPoint != null && injectionPoint.getMember() instanceof Constructor<?> constructor) {
|
||||||
Constructor<?> constructor = (Constructor<?>) injectionPoint.getMember();
|
|
||||||
Class<?> declaringClass = constructor.getDeclaringClass();
|
Class<?> declaringClass = constructor.getDeclaringClass();
|
||||||
MergedAnnotation<ConfigurationProperties> configurationProperties = MergedAnnotations.from(declaringClass)
|
MergedAnnotation<ConfigurationProperties> configurationProperties = MergedAnnotations.from(declaringClass)
|
||||||
.get(ConfigurationProperties.class);
|
.get(ConfigurationProperties.class);
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -18,6 +18,7 @@ package org.springframework.boot.diagnostics.analyzer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -83,7 +84,7 @@ class MutuallyExclusiveConfigurationPropertiesFailureAnalyzer
|
||||||
|
|
||||||
private void appendDetails(StringBuilder message, MutuallyExclusiveConfigurationPropertiesException cause,
|
private void appendDetails(StringBuilder message, MutuallyExclusiveConfigurationPropertiesException cause,
|
||||||
List<Descriptor> descriptors) {
|
List<Descriptor> descriptors) {
|
||||||
descriptors.sort((d1, d2) -> d1.propertyName.compareTo(d2.propertyName));
|
descriptors.sort(Comparator.comparing((descriptor) -> descriptor.propertyName));
|
||||||
message.append(String.format("The following configuration properties are mutually exclusive:%n%n"));
|
message.append(String.format("The following configuration properties are mutually exclusive:%n%n"));
|
||||||
sortedStrings(cause.getMutuallyExclusiveNames())
|
sortedStrings(cause.getMutuallyExclusiveNames())
|
||||||
.forEach((name) -> message.append(String.format("\t%s%n", name)));
|
.forEach((name) -> message.append(String.format("\t%s%n", name)));
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -26,7 +26,6 @@ import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
@ -229,9 +228,8 @@ public class ConfigTreePropertySource extends EnumerablePropertySource<Path> imp
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasHiddenPathElement(Path path) {
|
private static boolean hasHiddenPathElement(Path path) {
|
||||||
Iterator<Path> iterator = path.iterator();
|
for (Path element : path) {
|
||||||
while (iterator.hasNext()) {
|
if (element.toString().startsWith("..")) {
|
||||||
if (iterator.next().toString().startsWith("..")) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -131,12 +131,9 @@ class StaticResourceJars {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isResourcesJar(JarFile jar) throws IOException {
|
private boolean isResourcesJar(JarFile jar) throws IOException {
|
||||||
try {
|
try (jar) {
|
||||||
return jar.getName().endsWith(".jar") && (jar.getJarEntry("META-INF/resources") != null);
|
return jar.getName().endsWith(".jar") && (jar.getJarEntry("META-INF/resources") != null);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
jar.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -814,7 +814,7 @@ class ConfigDataEnvironmentPostProcessorIntegrationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Condition<ConfigurableEnvironment> matchingPropertySource(final String sourceName) {
|
private Condition<ConfigurableEnvironment> matchingPropertySource(final String sourceName) {
|
||||||
return new Condition<ConfigurableEnvironment>("environment containing property source " + sourceName) {
|
return new Condition<>("environment containing property source " + sourceName) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(ConfigurableEnvironment value) {
|
public boolean matches(ConfigurableEnvironment value) {
|
||||||
|
|
|
@ -507,7 +507,7 @@ class JavaBeanBinderTests {
|
||||||
void beanPropertiesPreferMatchingType() {
|
void beanPropertiesPreferMatchingType() {
|
||||||
// gh-16206
|
// gh-16206
|
||||||
ResolvableType type = ResolvableType.forClass(PropertyWithOverloadedSetter.class);
|
ResolvableType type = ResolvableType.forClass(PropertyWithOverloadedSetter.class);
|
||||||
Bean<PropertyWithOverloadedSetter> bean = new Bean<PropertyWithOverloadedSetter>(type, type.resolve()) {
|
Bean<PropertyWithOverloadedSetter> bean = new Bean<>(type, type.resolve()) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addProperties(Method[] declaredMethods, Field[] declaredFields) {
|
protected void addProperties(Method[] declaredMethods, Field[] declaredFields) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ class SpringConfigurationPropertySourceTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fromWhenNonEnumerableShouldReturnNonIterable() {
|
void fromWhenNonEnumerableShouldReturnNonIterable() {
|
||||||
PropertySource<?> propertySource = new PropertySource<Object>("test", new Object()) {
|
PropertySource<?> propertySource = new PropertySource<>("test", new Object()) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getProperty(String name) {
|
public Object getProperty(String name) {
|
||||||
|
@ -120,7 +120,7 @@ class SpringConfigurationPropertySourceTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fromWhenEnumerableButRestrictedShouldReturnNonIterable() {
|
void fromWhenEnumerableButRestrictedShouldReturnNonIterable() {
|
||||||
Map<String, Object> source = new LinkedHashMap<String, Object>() {
|
Map<String, Object> source = new LinkedHashMap<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -86,7 +86,7 @@ class ApplicationContextRequestMatcherTests {
|
||||||
@Test
|
@Test
|
||||||
void initializeAndMatchesAreNotCalledIfContextIsIgnored() {
|
void initializeAndMatchesAreNotCalledIfContextIsIgnored() {
|
||||||
StaticWebApplicationContext context = createWebApplicationContext();
|
StaticWebApplicationContext context = createWebApplicationContext();
|
||||||
TestApplicationContextRequestMatcher<ApplicationContext> matcher = new TestApplicationContextRequestMatcher<ApplicationContext>(
|
TestApplicationContextRequestMatcher<ApplicationContext> matcher = new TestApplicationContextRequestMatcher<>(
|
||||||
ApplicationContext.class) {
|
ApplicationContext.class) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -578,16 +578,13 @@ public abstract class AbstractReactiveWebServerFactoryTests {
|
||||||
|
|
||||||
protected final void doWithBlockedPort(BlockedPortAction action) throws Exception {
|
protected final void doWithBlockedPort(BlockedPortAction action) throws Exception {
|
||||||
ServerSocket serverSocket = new ServerSocket();
|
ServerSocket serverSocket = new ServerSocket();
|
||||||
int blockedPort = doWithRetry(() -> {
|
try (serverSocket) {
|
||||||
serverSocket.bind(null);
|
int blockedPort = doWithRetry(() -> {
|
||||||
return serverSocket.getLocalPort();
|
serverSocket.bind(null);
|
||||||
});
|
return serverSocket.getLocalPort();
|
||||||
try {
|
});
|
||||||
action.run(blockedPort);
|
action.run(blockedPort);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
serverSocket.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface BlockedPortAction {
|
public interface BlockedPortAction {
|
||||||
|
|
|
@ -1470,16 +1470,13 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||||
|
|
||||||
protected final void doWithBlockedPort(BlockedPortAction action) throws Exception {
|
protected final void doWithBlockedPort(BlockedPortAction action) throws Exception {
|
||||||
ServerSocket serverSocket = new ServerSocket();
|
ServerSocket serverSocket = new ServerSocket();
|
||||||
int blockedPort = doWithRetry(() -> {
|
try (serverSocket) {
|
||||||
serverSocket.bind(null);
|
int blockedPort = doWithRetry(() -> {
|
||||||
return serverSocket.getLocalPort();
|
serverSocket.bind(null);
|
||||||
});
|
return serverSocket.getLocalPort();
|
||||||
try {
|
});
|
||||||
action.run(blockedPort);
|
action.run(blockedPort);
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
serverSocket.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStore loadStore() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
|
private KeyStore loadStore() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -68,7 +68,7 @@ abstract class AbstractLaunchScriptIntegrationTests {
|
||||||
|
|
||||||
protected Condition<String> coloredString(AnsiColor color, String string) {
|
protected Condition<String> coloredString(AnsiColor color, String string) {
|
||||||
String colorString = ESC + "[0;" + color + "m" + string + ESC + "[0m";
|
String colorString = ESC + "[0;" + color + "m" + string + ESC + "[0m";
|
||||||
return new Condition<String>() {
|
return new Condition<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(String value) {
|
public boolean matches(String value) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -30,14 +30,7 @@ public class SampleFlywayApplication {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public CommandLineRunner runner(PersonRepository repository) {
|
public CommandLineRunner runner(PersonRepository repository) {
|
||||||
return new CommandLineRunner() {
|
return (args) -> System.err.println(repository.findAll());
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(String... args) throws Exception {
|
|
||||||
System.err.println(repository.findAll());
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -18,7 +18,6 @@ package smoketest.jersey;
|
||||||
|
|
||||||
import jakarta.ws.rs.GET;
|
import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
import org.glassfish.jersey.server.ResourceConfig;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import smoketest.jersey.AbstractJerseyManagementPortTests.ResourceConfigConfiguration;
|
import smoketest.jersey.AbstractJerseyManagementPortTests.ResourceConfigConfiguration;
|
||||||
|
|
||||||
|
@ -89,12 +88,7 @@ class AbstractJerseyManagementPortTests {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
ResourceConfigCustomizer customizer() {
|
ResourceConfigCustomizer customizer() {
|
||||||
return new ResourceConfigCustomizer() {
|
return (config) -> config.register(TestEndpoint.class);
|
||||||
@Override
|
|
||||||
public void customize(ResourceConfig config) {
|
|
||||||
config.register(TestEndpoint.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("/test")
|
@Path("/test")
|
||||||
|
|
|
@ -80,7 +80,7 @@ class SampleSessionHazelcastApplicationTests {
|
||||||
headers.set("Authorization", getBasicAuth());
|
headers.set("Authorization", getBasicAuth());
|
||||||
RequestEntity<Object> request = new RequestEntity<>(headers, HttpMethod.GET,
|
RequestEntity<Object> request = new RequestEntity<>(headers, HttpMethod.GET,
|
||||||
URI.create("/actuator/sessions?username=user"));
|
URI.create("/actuator/sessions?username=user"));
|
||||||
ParameterizedTypeReference<Map<String, Object>> stringObjectMap = new ParameterizedTypeReference<Map<String, Object>>() {
|
ParameterizedTypeReference<Map<String, Object>> stringObjectMap = new ParameterizedTypeReference<>() {
|
||||||
};
|
};
|
||||||
return this.restTemplate.exchange(request, stringObjectMap);
|
return this.restTemplate.exchange(request, stringObjectMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ class SampleSessionJdbcApplicationTests {
|
||||||
HttpHeaders headers = getHeaders(null);
|
HttpHeaders headers = getHeaders(null);
|
||||||
RequestEntity<Object> request = new RequestEntity<>(headers, HttpMethod.GET,
|
RequestEntity<Object> request = new RequestEntity<>(headers, HttpMethod.GET,
|
||||||
URI.create("/actuator/sessions?username=user"));
|
URI.create("/actuator/sessions?username=user"));
|
||||||
ParameterizedTypeReference<Map<String, Object>> stringObjectMap = new ParameterizedTypeReference<Map<String, Object>>() {
|
ParameterizedTypeReference<Map<String, Object>> stringObjectMap = new ParameterizedTypeReference<>() {
|
||||||
};
|
};
|
||||||
return this.restTemplate.exchange(request, stringObjectMap);
|
return this.restTemplate.exchange(request, stringObjectMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ class SampleSessionRedisApplicationTests {
|
||||||
|
|
||||||
private ResponseEntity<Map<String, Object>> getSessions() {
|
private ResponseEntity<Map<String, Object>> getSessions() {
|
||||||
RequestEntity<Object> request = getRequestEntity(URI.create("/actuator/sessions?username=user"));
|
RequestEntity<Object> request = getRequestEntity(URI.create("/actuator/sessions?username=user"));
|
||||||
ParameterizedTypeReference<Map<String, Object>> stringObjectMap = new ParameterizedTypeReference<Map<String, Object>>() {
|
ParameterizedTypeReference<Map<String, Object>> stringObjectMap = new ParameterizedTypeReference<>() {
|
||||||
};
|
};
|
||||||
return this.restTemplate.exchange(request, stringObjectMap);
|
return this.restTemplate.exchange(request, stringObjectMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -31,7 +31,7 @@ public class SampleGroovyTemplateApplication {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Converter<String, Message> messageConverter() {
|
public Converter<String, Message> messageConverter() {
|
||||||
return new Converter<String, Message>() {
|
return new Converter<>() {
|
||||||
@Override
|
@Override
|
||||||
public Message convert(String id) {
|
public Message convert(String id) {
|
||||||
return messageRepository().findMessage(Long.valueOf(id));
|
return messageRepository().findMessage(Long.valueOf(id));
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -31,7 +31,7 @@ public class SampleWebUiApplication {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Converter<String, Message> messageConverter() {
|
public Converter<String, Message> messageConverter() {
|
||||||
return new Converter<String, Message>() {
|
return new Converter<>() {
|
||||||
@Override
|
@Override
|
||||||
public Message convert(String id) {
|
public Message convert(String id) {
|
||||||
return messageRepository().findMessage(Long.valueOf(id));
|
return messageRepository().findMessage(Long.valueOf(id));
|
||||||
|
|
Loading…
Reference in New Issue