Search in sources :

Example 1 with ReactiveHealthEndpointWebExtension

use of org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension in project spring-boot by spring-projects.

the class HealthEndpointAutoConfigurationTests method runWhenHasReactiveHealthEndpointWebExtensionBeanDoesNotCreateExtraReactiveHealthEndpointWebExtension.

@Test
void runWhenHasReactiveHealthEndpointWebExtensionBeanDoesNotCreateExtraReactiveHealthEndpointWebExtension() {
    this.reactiveContextRunner.withUserConfiguration(ReactiveHealthEndpointWebExtensionConfiguration.class).run((context) -> {
        ReactiveHealthEndpointWebExtension webExtension = context.getBean(ReactiveHealthEndpointWebExtension.class);
        Mono<WebEndpointResponse<? extends HealthComponent>> response = webExtension.health(ApiVersion.V3, WebServerNamespace.SERVER, SecurityContext.NONE, true, "simple");
        assertThat(response).isNull();
    });
}
Also used : HealthComponent(org.springframework.boot.actuate.health.HealthComponent) WebEndpointResponse(org.springframework.boot.actuate.endpoint.web.WebEndpointResponse) ReactiveHealthEndpointWebExtension(org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension) Test(org.junit.jupiter.api.Test)

Example 2 with ReactiveHealthEndpointWebExtension

use of org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension in project spring-boot by spring-projects.

the class HealthEndpointAutoConfigurationTests method runCreatesReactiveHealthEndpointWebExtension.

@Test
void runCreatesReactiveHealthEndpointWebExtension() {
    this.reactiveContextRunner.run((context) -> {
        ReactiveHealthEndpointWebExtension webExtension = context.getBean(ReactiveHealthEndpointWebExtension.class);
        Mono<WebEndpointResponse<? extends HealthComponent>> response = webExtension.health(ApiVersion.V3, WebServerNamespace.SERVER, SecurityContext.NONE, true, "simple");
        Health health = (Health) (response.block().getBody());
        assertThat(health.getDetails()).containsEntry("counter", 42);
    });
}
Also used : HealthComponent(org.springframework.boot.actuate.health.HealthComponent) Health(org.springframework.boot.actuate.health.Health) WebEndpointResponse(org.springframework.boot.actuate.endpoint.web.WebEndpointResponse) ReactiveHealthEndpointWebExtension(org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 WebEndpointResponse (org.springframework.boot.actuate.endpoint.web.WebEndpointResponse)2 HealthComponent (org.springframework.boot.actuate.health.HealthComponent)2 ReactiveHealthEndpointWebExtension (org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension)2 Health (org.springframework.boot.actuate.health.Health)1