Search in sources :

Example 1 with ReactiveHealthContributorRegistry

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

the class HealthEndpointAutoConfigurationTests method runCreatesReactiveHealthContributorRegistryContainingAdaptedBeans.

@Test
void runCreatesReactiveHealthContributorRegistryContainingAdaptedBeans() {
    this.reactiveContextRunner.run((context) -> {
        ReactiveHealthContributorRegistry registry = context.getBean(ReactiveHealthContributorRegistry.class);
        Object[] names = registry.stream().map(NamedContributor::getName).toArray();
        assertThat(names).containsExactlyInAnyOrder("simple", "additional", "reactive", "ping");
    });
}
Also used : ReactiveHealthContributorRegistry(org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry) DefaultReactiveHealthContributorRegistry(org.springframework.boot.actuate.health.DefaultReactiveHealthContributorRegistry) Test(org.junit.jupiter.api.Test)

Example 2 with ReactiveHealthContributorRegistry

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

the class AutoConfiguredReactiveHealthContributorRegistryTests method registerContributorWithGroupNameThrowsException.

@Test
void registerContributorWithGroupNameThrowsException() {
    ReactiveHealthContributorRegistry registry = new AutoConfiguredReactiveHealthContributorRegistry(Collections.emptyMap(), Arrays.asList("spring", "boot"));
    assertThatIllegalStateException().isThrownBy(() -> registry.registerContributor("spring", mock(ReactiveHealthContributor.class))).withMessage("ReactiveHealthContributor with name \"spring\" clashes with group");
}
Also used : ReactiveHealthContributor(org.springframework.boot.actuate.health.ReactiveHealthContributor) ReactiveHealthContributorRegistry(org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry) Test(org.junit.jupiter.api.Test)

Example 3 with ReactiveHealthContributorRegistry

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

the class HealthEndpointAutoConfigurationTests method runWhenHasReactiveHealthContributorRegistryBeanDoesNotCreateAdditionalReactiveHealthContributorRegistry.

@Test
void runWhenHasReactiveHealthContributorRegistryBeanDoesNotCreateAdditionalReactiveHealthContributorRegistry() {
    this.reactiveContextRunner.withUserConfiguration(ReactiveHealthContributorRegistryConfiguration.class).run((context) -> {
        ReactiveHealthContributorRegistry registry = context.getBean(ReactiveHealthContributorRegistry.class);
        Object[] names = registry.stream().map(NamedContributor::getName).toArray();
        assertThat(names).isEmpty();
    });
}
Also used : ReactiveHealthContributorRegistry(org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry) DefaultReactiveHealthContributorRegistry(org.springframework.boot.actuate.health.DefaultReactiveHealthContributorRegistry) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 ReactiveHealthContributorRegistry (org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry)3 DefaultReactiveHealthContributorRegistry (org.springframework.boot.actuate.health.DefaultReactiveHealthContributorRegistry)2 ReactiveHealthContributor (org.springframework.boot.actuate.health.ReactiveHealthContributor)1