parent
4c1f67d7fc
commit
aac9d64797
|
|
@ -61,6 +61,7 @@ include "spring-boot-project:spring-boot-actuator"
|
|||
include "spring-boot-project:spring-boot-actuator-autoconfigure"
|
||||
include "spring-boot-project:spring-boot-actuator-autoconfigure-all"
|
||||
include "spring-boot-project:spring-boot-actuator-docs"
|
||||
include "spring-boot-project:spring-boot-actuator-integration-tests"
|
||||
include "spring-boot-project:spring-boot-amqp"
|
||||
include "spring-boot-project:spring-boot-artemis"
|
||||
include "spring-boot-project:spring-boot-autoconfigure"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import io.micrometer.core.instrument.MeterRegistry;
|
|||
import io.micrometer.core.instrument.binder.tomcat.TomcatMetrics;
|
||||
import org.apache.catalina.Manager;
|
||||
|
||||
import org.springframework.boot.actuate.metrics.web.tomcat.TomcatMetricsBinder;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
|
@ -29,6 +28,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.metrics.autoconfigure.CompositeMeterRegistryAutoConfiguration;
|
||||
import org.springframework.boot.tomcat.TomcatWebServer;
|
||||
import org.springframework.boot.tomcat.actuate.metrics.TomcatMetricsBinder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ import org.springframework.beans.factory.ObjectProvider;
|
|||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingsEndpoint;
|
||||
import org.springframework.boot.actuate.web.mappings.reactive.DispatcherHandlersMappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.DispatcherServletsMappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.FiltersMappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.ServletsMappingDescriptionProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
|
|
@ -30,6 +28,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
|
||||
import org.springframework.boot.webflux.actuate.mappings.DispatcherHandlersMappingDescriptionProvider;
|
||||
import org.springframework.boot.webmvc.actuate.mappings.DispatcherServletsMappingDescriptionProvider;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ import org.apache.tomcat.util.modeler.Registry;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.actuate.metrics.web.tomcat.TomcatMetricsBinder;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.context.event.ApplicationStartedEvent;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
||||
import org.springframework.boot.tomcat.TomcatWebServer;
|
||||
import org.springframework.boot.tomcat.actuate.metrics.TomcatMetricsBinder;
|
||||
import org.springframework.boot.tomcat.autoconfigure.reactive.TomcatReactiveWebServerAutoConfiguration;
|
||||
import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration;
|
||||
import org.springframework.boot.tomcat.reactive.TomcatReactiveWebServerFactory;
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
|||
import org.springframework.boot.actuate.docs.AbstractEndpointDocumentationTests;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingsEndpoint;
|
||||
import org.springframework.boot.actuate.web.mappings.reactive.DispatcherHandlersMappingDescriptionProvider;
|
||||
import org.springframework.boot.reactor.netty.NettyReactiveWebServerFactory;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.web.server.test.LocalServerPort;
|
||||
import org.springframework.boot.webflux.actuate.mappings.DispatcherHandlersMappingDescriptionProvider;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
|||
import org.springframework.boot.actuate.docs.AbstractEndpointDocumentationTests;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingsEndpoint;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.DispatcherServletsMappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.FiltersMappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.ServletsMappingDescriptionProvider;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.server.test.LocalServerPort;
|
||||
import org.springframework.boot.webmvc.actuate.mappings.DispatcherServletsMappingDescriptionProvider;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "java-test-fixtures"
|
||||
}
|
||||
|
||||
description = "Spring Boot Actuator Integration Tests"
|
||||
|
||||
|
||||
dependencies {
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-actuator"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-http-converter"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-jackson"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-jersey"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-tomcat"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-webflux"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-webmvc"))
|
||||
testFixturesImplementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
|
||||
testImplementation(project(":spring-boot-project:spring-boot-actuator"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-http-converter"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-jackson"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-jersey"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tomcat"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-web-server"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-webflux"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-webmvc"))
|
||||
testImplementation("io.micrometer:micrometer-registry-prometheus")
|
||||
testImplementation("io.prometheus:prometheus-metrics-exposition-formats")
|
||||
testImplementation("net.minidev:json-smart")
|
||||
testImplementation("org.springframework.security:spring-security-web")
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"groups": [],
|
||||
"properties": []
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.endpoint.web.annotation;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.endpoint.invoke.ParameterValueMapper;
|
||||
import org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper;
|
||||
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
|
||||
import org.springframework.boot.actuate.endpoint.web.PathMapper;
|
||||
import org.springframework.boot.tomcat.TomcatEmbeddedWebappClassLoader;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Base configuration shared by tests.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
AbstractWebEndpointIntegrationTests.EndpointDelegate endpointDelegate() {
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
if (classLoader instanceof TomcatEmbeddedWebappClassLoader) {
|
||||
Thread.currentThread().setContextClassLoader(classLoader.getParent());
|
||||
}
|
||||
try {
|
||||
return mock(AbstractWebEndpointIntegrationTests.EndpointDelegate.class);
|
||||
}
|
||||
finally {
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
EndpointMediaTypes endpointMediaTypes() {
|
||||
List<String> mediaTypes = Arrays.asList("application/vnd.test+json", "application/json");
|
||||
return new EndpointMediaTypes(mediaTypes, mediaTypes);
|
||||
}
|
||||
|
||||
@Bean
|
||||
WebEndpointDiscoverer webEndpointDiscoverer(EndpointMediaTypes endpointMediaTypes,
|
||||
ApplicationContext applicationContext, ObjectProvider<PathMapper> pathMappers) {
|
||||
ParameterValueMapper parameterMapper = new ConversionServiceParameterValueMapper(
|
||||
DefaultConversionService.getSharedInstance());
|
||||
return new WebEndpointDiscoverer(applicationContext, parameterMapper, endpointMediaTypes,
|
||||
pathMappers.orderedStream().toList(), Collections.emptyList(), Collections.emptyList(),
|
||||
Collections.emptyList(), Collections.emptyList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
||||
return new PropertySourcesPlaceholderConfigurer();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.health;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.SecurityContext;
|
||||
|
||||
/**
|
||||
* Test implementation of {@link HealthEndpointGroups}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
class TestHealthEndpointGroup implements HealthEndpointGroup {
|
||||
|
||||
private final StatusAggregator statusAggregator = new SimpleStatusAggregator();
|
||||
|
||||
private final HttpCodeStatusMapper httpCodeStatusMapper = new SimpleHttpCodeStatusMapper();
|
||||
|
||||
private final Predicate<String> memberPredicate;
|
||||
|
||||
private Boolean showComponents;
|
||||
|
||||
private boolean showDetails = true;
|
||||
|
||||
private AdditionalHealthEndpointPath additionalPath;
|
||||
|
||||
TestHealthEndpointGroup() {
|
||||
this((name) -> true);
|
||||
}
|
||||
|
||||
TestHealthEndpointGroup(Predicate<String> memberPredicate) {
|
||||
this.memberPredicate = memberPredicate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(String name) {
|
||||
return this.memberPredicate.test(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showComponents(SecurityContext securityContext) {
|
||||
return (this.showComponents != null) ? this.showComponents : this.showDetails;
|
||||
}
|
||||
|
||||
void setShowComponents(Boolean showComponents) {
|
||||
this.showComponents = showComponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDetails(SecurityContext securityContext) {
|
||||
return this.showDetails;
|
||||
}
|
||||
|
||||
void setShowDetails(boolean includeDetails) {
|
||||
this.showDetails = includeDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusAggregator getStatusAggregator() {
|
||||
return this.statusAggregator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpCodeStatusMapper getHttpCodeStatusMapper() {
|
||||
return this.httpCodeStatusMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdditionalHealthEndpointPath getAdditionalPath() {
|
||||
return this.additionalPath;
|
||||
}
|
||||
|
||||
void setAdditionalPath(AdditionalHealthEndpointPath additionalPath) {
|
||||
this.additionalPath = additionalPath;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -30,10 +30,6 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import org.springframework.boot.actuate.web.mappings.MappingsEndpoint.ApplicationMappingsDescriptor;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingsEndpoint.ContextMappingsDescriptor;
|
||||
import org.springframework.boot.actuate.web.mappings.reactive.DispatcherHandlerMappingDescription;
|
||||
import org.springframework.boot.actuate.web.mappings.reactive.DispatcherHandlersMappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.DispatcherServletMappingDescription;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.DispatcherServletsMappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.FilterRegistrationMappingDescription;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.FiltersMappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.ServletRegistrationMappingDescription;
|
||||
|
|
@ -42,6 +38,10 @@ import org.springframework.boot.test.context.runner.ReactiveWebApplicationContex
|
|||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
||||
import org.springframework.boot.web.context.servlet.AnnotationConfigServletWebApplicationContext;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.boot.webflux.actuate.mappings.DispatcherHandlerMappingDescription;
|
||||
import org.springframework.boot.webflux.actuate.mappings.DispatcherHandlersMappingDescriptionProvider;
|
||||
import org.springframework.boot.webmvc.actuate.mappings.DispatcherServletMappingDescription;
|
||||
import org.springframework.boot.webmvc.actuate.mappings.DispatcherServletsMappingDescriptionProvider;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -69,13 +69,13 @@ import static org.springframework.web.reactive.function.server.RequestPredicates
|
|||
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
|
||||
|
||||
/**
|
||||
* Tests for {@link MappingsEndpoint}.
|
||||
* Integration tests for {@link MappingsEndpoint}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Stephane Nicoll
|
||||
* @author Xiong Tang
|
||||
*/
|
||||
class MappingsEndpointTests {
|
||||
class MappingsEndpointIntegrationTests {
|
||||
|
||||
@Test
|
||||
void servletWebMappings() {
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "java-test-fixtures"
|
||||
id "org.springframework.boot.configuration-properties"
|
||||
id "org.springframework.boot.optional-dependencies"
|
||||
id "org.springframework.boot.deployed"
|
||||
|
|
@ -29,12 +28,8 @@ dependencies {
|
|||
|
||||
optional(project(":spring-boot-project:spring-boot-http-converter"))
|
||||
optional(project(":spring-boot-project:spring-boot-jsonb"))
|
||||
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
optional(project(":spring-boot-project:spring-boot-tomcat"))
|
||||
optional(project(":spring-boot-project:spring-boot-undertow"))
|
||||
optional(project(":spring-boot-project:spring-boot-validation"))
|
||||
optional(project(":spring-boot-project:spring-boot-webflux"))
|
||||
optional(project(":spring-boot-project:spring-boot-webmvc"))
|
||||
optional(project(":spring-boot-project:spring-boot-web-server"))
|
||||
optional("com.fasterxml.jackson.core:jackson-databind")
|
||||
optional("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
|
||||
optional("com.github.ben-manes.caffeine:caffeine")
|
||||
|
|
@ -68,22 +63,9 @@ dependencies {
|
|||
optional("org.springframework.security:spring-security-core")
|
||||
optional("org.springframework.security:spring-security-web")
|
||||
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-http-converter"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-jackson"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-jersey"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-tomcat"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-webflux"))
|
||||
testFixturesImplementation(project(":spring-boot-project:spring-boot-webmvc"))
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-jackson"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-jersey"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-jsonb"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation("com.squareup.okhttp3:mockwebserver")
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import org.springframework.boot.actuate.endpoint.invoke.ParameterValueMapper;
|
|||
import org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper;
|
||||
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
|
||||
import org.springframework.boot.actuate.endpoint.web.PathMapper;
|
||||
import org.springframework.boot.tomcat.TomcatEmbeddedWebappClassLoader;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -43,17 +42,8 @@ import static org.mockito.Mockito.mock;
|
|||
class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
AbstractWebEndpointIntegrationTests.EndpointDelegate endpointDelegate() {
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
if (classLoader instanceof TomcatEmbeddedWebappClassLoader) {
|
||||
Thread.currentThread().setContextClassLoader(classLoader.getParent());
|
||||
}
|
||||
try {
|
||||
return mock(AbstractWebEndpointIntegrationTests.EndpointDelegate.class);
|
||||
}
|
||||
finally {
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
}
|
||||
EndpointDelegate endpointDelegate() {
|
||||
return mock(EndpointDelegate.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
@ -77,4 +67,14 @@ class BaseConfiguration {
|
|||
return new PropertySourcesPlaceholderConfigurer();
|
||||
}
|
||||
|
||||
interface EndpointDelegate {
|
||||
|
||||
void write();
|
||||
|
||||
void write(String foo, String bar);
|
||||
|
||||
void delete();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ dependencies {
|
|||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator")))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator-integration-tests")))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
|
||||
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ dependencies {
|
|||
testImplementation(project(":spring-boot-project:spring-boot-rsocket"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator")))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator-integration-tests")))
|
||||
testImplementation("org.springframework:spring-web")
|
||||
|
||||
testRuntimeOnly(project(":spring-boot-project:spring-boot-reactor-netty"))
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ dependencies {
|
|||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator")))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator-integration-tests")))
|
||||
testImplementation("com.fasterxml.jackson.core:jackson-databind")
|
||||
testImplementation("io.micrometer:micrometer-registry-atlas")
|
||||
testImplementation("io.micrometer:micrometer-registry-new-relic")
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ dependencies {
|
|||
testImplementation(project(":spring-boot-project:spring-boot-liquibase"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator")))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator-integration-tests")))
|
||||
testImplementation("net.minidev:json-smart")
|
||||
testImplementation("org.springframework:spring-web")
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ dependencies {
|
|||
testImplementation(project(":spring-boot-project:spring-boot-tomcat"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-webflux"))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator")))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-actuator-integration-tests")))
|
||||
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-web-server")))
|
||||
testImplementation("net.minidev:json-smart")
|
||||
testImplementation("io.projectreactor:reactor-test")
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ dependencies {
|
|||
}
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
optional("io.micrometer:micrometer-core")
|
||||
optional("org.apache.tomcat.embed:tomcat-embed-jasper")
|
||||
optional("org.apache.tomcat.embed:tomcat-embed-websocket") {
|
||||
exclude group: "org.apache.tomcat", module: "tomcat-annotations-api"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.metrics.web.tomcat;
|
||||
package org.springframework.boot.tomcat.actuate.metrics;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ import org.springframework.context.ApplicationListener;
|
|||
* Binds {@link TomcatMetrics} in response to the {@link ApplicationStartedEvent}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.1.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class TomcatMetricsBinder implements ApplicationListener<ApplicationStartedEvent>, DisposableBean {
|
||||
|
||||
|
|
@ -15,6 +15,6 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Actuator support for Tomcat metrics.
|
||||
* Tomcat metrics.
|
||||
*/
|
||||
package org.springframework.boot.actuate.metrics.web.tomcat;
|
||||
package org.springframework.boot.tomcat.actuate.metrics;
|
||||
|
|
@ -19,6 +19,8 @@ package org.springframework.boot.actuate.metrics.web.tomcat;
|
|||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.tomcat.actuate.metrics.TomcatMetricsBinder;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
|
|
@ -32,6 +32,7 @@ dependencies {
|
|||
implementation(project(":spring-boot-project:spring-boot-http-codec"))
|
||||
implementation(project(":spring-boot-project:spring-boot-web-server"))
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-actuator"))
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
optional(project(":spring-boot-project:spring-boot-validation"))
|
||||
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.reactive;
|
||||
package org.springframework.boot.webflux.actuate.mappings;
|
||||
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
import org.springframework.web.reactive.DispatcherHandler;
|
||||
|
||||
/**
|
||||
* A description of a mapping known to a {@link DispatcherServlet}.
|
||||
* A description of a mapping known to a {@link DispatcherHandler}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class DispatcherHandlerMappingDescription {
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.reactive;
|
||||
package org.springframework.boot.webflux.actuate.mappings;
|
||||
|
||||
import org.springframework.boot.actuate.web.mappings.HandlerMethodDescription;
|
||||
import org.springframework.web.reactive.DispatcherHandler;
|
||||
|
|
@ -23,7 +23,7 @@ import org.springframework.web.reactive.DispatcherHandler;
|
|||
* Details of a {@link DispatcherHandler} mapping.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class DispatcherHandlerMappingDetails {
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.reactive;
|
||||
package org.springframework.boot.webflux.actuate.mappings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -32,7 +32,7 @@ import org.springframework.aot.hint.RuntimeHints;
|
|||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.boot.actuate.web.mappings.HandlerMethodDescription;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.reactive.DispatcherHandlersMappingDescriptionProvider.DispatcherHandlersMappingDescriptionProviderRuntimeHints;
|
||||
import org.springframework.boot.webflux.actuate.mappings.DispatcherHandlersMappingDescriptionProvider.DispatcherHandlersMappingDescriptionProviderRuntimeHints;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.ImportRuntimeHints;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
|
@ -55,7 +55,7 @@ import org.springframework.web.util.pattern.PathPattern;
|
|||
* HandlerMappings} that are known to a {@link DispatcherHandler}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@ImportRuntimeHints(DispatcherHandlersMappingDescriptionProviderRuntimeHints.class)
|
||||
public class DispatcherHandlersMappingDescriptionProvider implements MappingDescriptionProvider {
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.reactive;
|
||||
package org.springframework.boot.webflux.actuate.mappings;
|
||||
|
||||
import org.springframework.web.reactive.function.server.HandlerFunction;
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ import org.springframework.web.reactive.function.server.HandlerFunction;
|
|||
* Description of a {@link HandlerFunction}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class HandlerFunctionDescription {
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.reactive;
|
||||
package org.springframework.boot.webflux.actuate.mappings;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
|
@ -31,7 +31,7 @@ import org.springframework.web.util.pattern.PathPattern;
|
|||
* Description of the conditions of a {@link RequestMappingInfo}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class RequestMappingConditionsDescription {
|
||||
|
||||
|
|
@ -17,4 +17,4 @@
|
|||
/**
|
||||
* Actuator reactive request mappings support.
|
||||
*/
|
||||
package org.springframework.boot.actuate.web.mappings.reactive;
|
||||
package org.springframework.boot.webflux.actuate.mappings;
|
||||
|
|
@ -14,14 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.reactive;
|
||||
package org.springframework.boot.webflux.actuate.mappings;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
|
||||
import org.springframework.boot.actuate.web.mappings.reactive.DispatcherHandlersMappingDescriptionProvider.DispatcherHandlersMappingDescriptionProviderRuntimeHints;
|
||||
import org.springframework.boot.webflux.actuate.mappings.DispatcherHandlersMappingDescriptionProvider.DispatcherHandlersMappingDescriptionProviderRuntimeHints;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
@ -34,7 +34,10 @@ dependencies {
|
|||
|
||||
implementation(project(":spring-boot-project:spring-boot-http-converter"))
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-actuator"))
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
optional(project(":spring-boot-project:spring-boot-tomcat"))
|
||||
optional(project(":spring-boot-project:spring-boot-undertow"))
|
||||
optional(project(":spring-boot-project:spring-boot-validation"))
|
||||
optional(project(":spring-boot-project:spring-boot-web-server"))
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.servlet;
|
||||
package org.springframework.boot.webmvc.actuate.mappings;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.servlet;
|
||||
package org.springframework.boot.webmvc.actuate.mappings;
|
||||
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ import org.springframework.web.servlet.DispatcherServlet;
|
|||
* A description of a mapping known to a {@link DispatcherServlet}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class DispatcherServletMappingDescription {
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.servlet;
|
||||
package org.springframework.boot.webmvc.actuate.mappings;
|
||||
|
||||
import org.springframework.boot.actuate.web.mappings.HandlerMethodDescription;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
|
@ -24,7 +24,7 @@ import org.springframework.web.servlet.DispatcherServlet;
|
|||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Xiong Tang
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class DispatcherServletMappingDetails {
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.servlet;
|
||||
package org.springframework.boot.webmvc.actuate.mappings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
@ -34,8 +34,8 @@ import org.springframework.aot.hint.RuntimeHints;
|
|||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.boot.actuate.web.mappings.HandlerMethodDescription;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingDescriptionProvider;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.DispatcherServletsMappingDescriptionProvider.DispatcherServletsMappingDescriptionProviderRuntimeHints;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.boot.webmvc.actuate.mappings.DispatcherServletsMappingDescriptionProvider.DispatcherServletsMappingDescriptionProviderRuntimeHints;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.ImportRuntimeHints;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
|
@ -61,7 +61,7 @@ import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMappi
|
|||
* @author Andy Wilkinson
|
||||
* @author Stephane Nicoll
|
||||
* @author Xiong Tang
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@ImportRuntimeHints(DispatcherServletsMappingDescriptionProviderRuntimeHints.class)
|
||||
public class DispatcherServletsMappingDescriptionProvider implements MappingDescriptionProvider {
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.servlet;
|
||||
package org.springframework.boot.webmvc.actuate.mappings;
|
||||
|
||||
import org.springframework.web.servlet.function.HandlerFunction;
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ import org.springframework.web.servlet.function.HandlerFunction;
|
|||
* Description of a {@link HandlerFunction}.
|
||||
*
|
||||
* @author Xiong Tang
|
||||
* @since 3.5.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class HandlerFunctionDescription {
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.servlet;
|
||||
package org.springframework.boot.webmvc.actuate.mappings;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
|
@ -28,7 +28,7 @@ import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
|||
* Description of the conditions of a {@link RequestMappingInfo}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class RequestMappingConditionsDescription {
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Actuator request mappings support for Spring MVC.
|
||||
*/
|
||||
package org.springframework.boot.webmvc.actuate.mappings;
|
||||
|
|
@ -14,14 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.web.mappings.servlet;
|
||||
package org.springframework.boot.webmvc.actuate.mappings;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
|
||||
import org.springframework.boot.actuate.web.mappings.servlet.DispatcherServletsMappingDescriptionProvider.DispatcherServletsMappingDescriptionProviderRuntimeHints;
|
||||
import org.springframework.boot.webmvc.actuate.mappings.DispatcherServletsMappingDescriptionProvider.DispatcherServletsMappingDescriptionProviderRuntimeHints;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
Loading…
Reference in New Issue