mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Merge branch '2.7.x'
This commit is contained in:
commit
1621cfd578
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
@ -226,6 +226,30 @@ public final class EndpointRequest {
|
||||
return source.stream().filter(Objects::nonNull).map(this::getEndpointId).map(pathMappedEndpoints::getPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Mono<MatchResult> matches(ServerWebExchange exchange, Supplier<PathMappedEndpoints> context) {
|
||||
return this.delegate.matches(exchange);
|
||||
}
|
||||
|
||||
private List<ServerWebExchangeMatcher> getDelegateMatchers(Set<String> paths) {
|
||||
return paths.stream().map(this::getDelegateMatcher).collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
private PathPatternParserServerWebExchangeMatcher getDelegateMatcher(String path) {
|
||||
return new PathPatternParserServerWebExchangeMatcher(path + "/**");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("EndpointRequestMatcher includes=%s, excludes=%s, includeLinks=%s",
|
||||
toString(this.includes, "[*]"), toString(this.excludes, "[]"), this.includeLinks);
|
||||
}
|
||||
|
||||
private String toString(List<Object> endpoints, String emptyValue) {
|
||||
return (!endpoints.isEmpty()) ? endpoints.stream().map(this::getEndpointId).map(Object::toString)
|
||||
.collect(Collectors.joining(", ", "[", "]")) : emptyValue;
|
||||
}
|
||||
|
||||
private EndpointId getEndpointId(Object source) {
|
||||
if (source instanceof EndpointId endpointId) {
|
||||
return endpointId;
|
||||
@ -245,19 +269,6 @@ public final class EndpointRequest {
|
||||
return EndpointId.of(annotation.getString("id"));
|
||||
}
|
||||
|
||||
private List<ServerWebExchangeMatcher> getDelegateMatchers(Set<String> paths) {
|
||||
return paths.stream().map(this::getDelegateMatcher).collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
private PathPatternParserServerWebExchangeMatcher getDelegateMatcher(String path) {
|
||||
return new PathPatternParserServerWebExchangeMatcher(path + "/**");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Mono<MatchResult> matches(ServerWebExchange exchange, Supplier<PathMappedEndpoints> context) {
|
||||
return this.delegate.matches(exchange);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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.
|
||||
@ -248,6 +248,23 @@ public final class EndpointRequest {
|
||||
return source.stream().filter(Objects::nonNull).map(this::getEndpointId).map(pathMappedEndpoints::getPath);
|
||||
}
|
||||
|
||||
private List<RequestMatcher> getDelegateMatchers(RequestMatcherFactory requestMatcherFactory,
|
||||
RequestMatcherProvider matcherProvider, Set<String> paths) {
|
||||
return paths.stream().map((path) -> requestMatcherFactory.antPath(matcherProvider, path, "/**"))
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("EndpointRequestMatcher includes=%s, excludes=%s, includeLinks=%s",
|
||||
toString(this.includes, "[*]"), toString(this.excludes, "[]"), this.includeLinks);
|
||||
}
|
||||
|
||||
private String toString(List<Object> endpoints, String emptyValue) {
|
||||
return (!endpoints.isEmpty()) ? endpoints.stream().map(this::getEndpointId).map(Object::toString)
|
||||
.collect(Collectors.joining(", ", "[", "]")) : emptyValue;
|
||||
}
|
||||
|
||||
private EndpointId getEndpointId(Object source) {
|
||||
if (source instanceof EndpointId endpointId) {
|
||||
return endpointId;
|
||||
@ -267,30 +284,6 @@ public final class EndpointRequest {
|
||||
return EndpointId.of(annotation.getString("id"));
|
||||
}
|
||||
|
||||
private List<RequestMatcher> getDelegateMatchers(RequestMatcherFactory requestMatcherFactory,
|
||||
RequestMatcherProvider matcherProvider, Set<String> paths) {
|
||||
return paths.stream().map((path) -> requestMatcherFactory.antPath(matcherProvider, path, "/**"))
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (this.includes.isEmpty()) {
|
||||
sb.append("EndpointRequest [includes='[").append("*").append("]'");
|
||||
}
|
||||
else {
|
||||
sb.append("EndpointRequest [includes='")
|
||||
.append(this.includes.stream().map(this::getEndpointId).collect(Collectors.toList()))
|
||||
.append("'");
|
||||
}
|
||||
sb.append(", Excludes='")
|
||||
.append(this.excludes.stream().map(this::getEndpointId).collect(Collectors.toList())).append("'");
|
||||
sb.append(", IncludeLinks='").append(this.includeLinks).append("'");
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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.
|
||||
@ -210,6 +210,30 @@ class EndpointRequestTests {
|
||||
assertMatcher(matcher, (PathMappedEndpoints) null).doesNotMatch("/actuator/bar/");
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringWhenIncludedEndpoints() {
|
||||
ServerWebExchangeMatcher matcher = EndpointRequest.to("foo", "bar");
|
||||
assertThat(matcher).hasToString("EndpointRequestMatcher includes=[foo, bar], excludes=[], includeLinks=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringWhenEmptyIncludedEndpoints() {
|
||||
ServerWebExchangeMatcher matcher = EndpointRequest.toAnyEndpoint();
|
||||
assertThat(matcher).hasToString("EndpointRequestMatcher includes=[*], excludes=[], includeLinks=true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringWhenIncludedEndpointsClasses() {
|
||||
ServerWebExchangeMatcher matcher = EndpointRequest.to(FooEndpoint.class).excluding("bar");
|
||||
assertThat(matcher).hasToString("EndpointRequestMatcher includes=[foo], excludes=[bar], includeLinks=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringWhenIncludedExcludedEndpoints() {
|
||||
ServerWebExchangeMatcher matcher = EndpointRequest.toAnyEndpoint().excluding("bar").excludingLinks();
|
||||
assertThat(matcher).hasToString("EndpointRequestMatcher includes=[*], excludes=[bar], includeLinks=false");
|
||||
}
|
||||
|
||||
private RequestMatcherAssert assertMatcher(ServerWebExchangeMatcher matcher) {
|
||||
return assertMatcher(matcher, mockPathMappedEndpoints("/actuator"));
|
||||
}
|
||||
|
@ -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.
|
||||
@ -216,31 +216,27 @@ class EndpointRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringIncludedEndpoints() {
|
||||
void toStringWhenIncludedEndpoints() {
|
||||
RequestMatcher matcher = EndpointRequest.to("foo", "bar");
|
||||
assertThat(matcher.toString())
|
||||
.isEqualTo("EndpointRequest [includes='[foo, bar]', Excludes='[]', IncludeLinks='false']");
|
||||
assertThat(matcher).hasToString("EndpointRequestMatcher includes=[foo, bar], excludes=[], includeLinks=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringEmptyIncludedEndpoints() {
|
||||
void toStringWhenEmptyIncludedEndpoints() {
|
||||
RequestMatcher matcher = EndpointRequest.toAnyEndpoint();
|
||||
assertThat(matcher.toString())
|
||||
.isEqualTo("EndpointRequest [includes='[*]', Excludes='[]', IncludeLinks='true']");
|
||||
assertThat(matcher).hasToString("EndpointRequestMatcher includes=[*], excludes=[], includeLinks=true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringIncludedEndpointsClasses() {
|
||||
void toStringWhenIncludedEndpointsClasses() {
|
||||
RequestMatcher matcher = EndpointRequest.to(FooEndpoint.class).excluding("bar");
|
||||
assertThat(matcher.toString())
|
||||
.isEqualTo("EndpointRequest [includes='[foo]', Excludes='[bar]', IncludeLinks='false']");
|
||||
assertThat(matcher).hasToString("EndpointRequestMatcher includes=[foo], excludes=[bar], includeLinks=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringIncludedExcludedEndpoints() {
|
||||
void toStringWhenIncludedExcludedEndpoints() {
|
||||
RequestMatcher matcher = EndpointRequest.toAnyEndpoint().excluding("bar").excludingLinks();
|
||||
assertThat(matcher.toString())
|
||||
.isEqualTo("EndpointRequest [includes='[*]', Excludes='[bar]', IncludeLinks='false']");
|
||||
assertThat(matcher).hasToString("EndpointRequestMatcher includes=[*], excludes=[bar], includeLinks=false");
|
||||
}
|
||||
|
||||
private RequestMatcherAssert assertMatcher(RequestMatcher matcher) {
|
||||
|
@ -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.
|
||||
@ -64,7 +64,7 @@ class Neo4jReactiveHealthIndicatorIntegrationTests {
|
||||
|
||||
@Test
|
||||
void health() {
|
||||
Health health = this.healthIndicator.getHealth(true).block(Duration.ofSeconds(5));
|
||||
Health health = this.healthIndicator.getHealth(true).block(Duration.ofSeconds(20));
|
||||
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
||||
assertThat(health.getDetails()).containsEntry("edition", "community");
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user