65 changed files with 16373 additions and 82 deletions
@ -0,0 +1,56 @@
@@ -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 @@
@@ -0,0 +1,4 @@
|
||||
{ |
||||
"groups": [], |
||||
"properties": [] |
||||
} |
||||
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointWebIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointWebIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointWebIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointWebIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java
@ -0,0 +1,80 @@
@@ -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
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyWebEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyWebEndpointIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyWebEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyWebEndpointIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/WebFluxEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/WebFluxEndpointIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/WebFluxEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/WebFluxEndpointIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/MvcWebEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/MvcWebEndpointIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/MvcWebEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/MvcWebEndpointIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/env/EnvironmentEndpointWebIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/env/EnvironmentEndpointWebIntegrationTests.java
vendored
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/env/EnvironmentEndpointWebIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/env/EnvironmentEndpointWebIntegrationTests.java
vendored
@ -0,0 +1,92 @@
@@ -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; |
||||
} |
||||
|
||||
} |
||||
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointWebIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/ThreadDumpEndpointWebIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/management/ThreadDumpEndpointWebIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/ThreadDumpEndpointWebIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/management/ThreadDumpEndpointWebIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusScrapeEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusScrapeEndpointIntegrationTests.java
0
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusScrapeEndpointIntegrationTests.java → spring-boot-project/spring-boot-actuator-integration-tests/src/test/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusScrapeEndpointIntegrationTests.java
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
0
spring-boot-project/spring-boot-actuator/src/testFixtures/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java → spring-boot-project/spring-boot-actuator-integration-tests/src/testFixtures/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java
0
spring-boot-project/spring-boot-actuator/src/testFixtures/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java → spring-boot-project/spring-boot-actuator-integration-tests/src/testFixtures/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java
6
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProvider.java → spring-boot-project/spring-boot-webflux/src/main/java/org/springframework/boot/webflux/actuate/mappings/DispatcherHandlersMappingDescriptionProvider.java
6
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProvider.java → spring-boot-project/spring-boot-webflux/src/main/java/org/springframework/boot/webflux/actuate/mappings/DispatcherHandlersMappingDescriptionProvider.java
4
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProviderTests.java → spring-boot-project/spring-boot-webflux/src/test/java/org/springframework/boot/webflux/actuate/mappings/DispatcherHandlersMappingDescriptionProviderTests.java
4
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/reactive/DispatcherHandlersMappingDescriptionProviderTests.java → spring-boot-project/spring-boot-webflux/src/test/java/org/springframework/boot/webflux/actuate/mappings/DispatcherHandlersMappingDescriptionProviderTests.java
6
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletsMappingDescriptionProvider.java → spring-boot-project/spring-boot-webmvc/src/main/java/org/springframework/boot/webmvc/actuate/mappings/DispatcherServletsMappingDescriptionProvider.java
6
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletsMappingDescriptionProvider.java → spring-boot-project/spring-boot-webmvc/src/main/java/org/springframework/boot/webmvc/actuate/mappings/DispatcherServletsMappingDescriptionProvider.java
@ -0,0 +1,20 @@
@@ -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; |
||||
4
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletsMappingDescriptionProviderTests.java → spring-boot-project/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/actuate/mappings/DispatcherServletsMappingDescriptionProviderTests.java
4
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletsMappingDescriptionProviderTests.java → spring-boot-project/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/actuate/mappings/DispatcherServletsMappingDescriptionProviderTests.java
Loading…
Reference in new issue