Formatting
This commit is contained in:
@@ -68,8 +68,8 @@ public class CachesEndpoint {
|
||||
new CacheDescriptor(entry.getTarget()));
|
||||
});
|
||||
Map<String, CacheManagerDescriptor> cacheManagerDescriptors = new LinkedHashMap<>();
|
||||
descriptors.forEach((name, entries) ->
|
||||
cacheManagerDescriptors.put(name, new CacheManagerDescriptor(entries)));
|
||||
descriptors.forEach((name, entries) -> cacheManagerDescriptors.put(name,
|
||||
new CacheManagerDescriptor(entries)));
|
||||
return new CachesReport(cacheManagerDescriptors);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,10 @@ public class CompositeHealthIndicator implements HealthIndicator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link CompositeHealthIndicator} from the specified
|
||||
* indicators.
|
||||
* Create a new {@link CompositeHealthIndicator} from the specified indicators.
|
||||
* @param healthAggregator the health aggregator
|
||||
* @param indicators a map of {@link HealthIndicator HealthIndicators} with
|
||||
* the key being used as an indicator name.
|
||||
* @param indicators a map of {@link HealthIndicator HealthIndicators} with the key
|
||||
* being used as an indicator name.
|
||||
* @deprecated since 2.1.0 in favour of
|
||||
* {@link #CompositeHealthIndicator(HealthAggregator, HealthIndicatorRegistry)}
|
||||
*/
|
||||
@@ -60,8 +59,8 @@ public class CompositeHealthIndicator implements HealthIndicator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link CompositeHealthIndicator} from the indicators in the
|
||||
* given {@code registry}.
|
||||
* Create a new {@link CompositeHealthIndicator} from the indicators in the given
|
||||
* {@code registry}.
|
||||
* @param healthAggregator the health aggregator
|
||||
* @param registry the registry of {@link HealthIndicator HealthIndicators}.
|
||||
*/
|
||||
@@ -72,12 +71,11 @@ public class CompositeHealthIndicator implements HealthIndicator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given {@code healthIndicator}, associating it with the given
|
||||
* {@code name}.
|
||||
* Adds the given {@code healthIndicator}, associating it with the given {@code name}.
|
||||
* @param name the name of the indicator
|
||||
* @param indicator the indicator
|
||||
* @throws IllegalStateException if an indicator with the given {@code name}
|
||||
* is already registered.
|
||||
* @throws IllegalStateException if an indicator with the given {@code name} is
|
||||
* already registered.
|
||||
* @deprecated since 2.1.0 in favour of
|
||||
* {@link HealthIndicatorRegistry#register(String, HealthIndicator)}
|
||||
*/
|
||||
|
||||
@@ -57,8 +57,8 @@ public class CompositeHealthIndicatorFactory {
|
||||
Assert.notNull(healthIndicators, "HealthIndicators must not be null");
|
||||
HealthIndicatorRegistryFactory factory = new HealthIndicatorRegistryFactory(
|
||||
this.healthIndicatorNameFactory);
|
||||
return new CompositeHealthIndicator(
|
||||
healthAggregator, factory.createHealthIndicatorRegistry(healthIndicators));
|
||||
return new CompositeHealthIndicator(healthAggregator,
|
||||
factory.createHealthIndicatorRegistry(healthIndicators));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
|
||||
* @param name the name of the health indicator
|
||||
* @param indicator the health indicator to add
|
||||
* @return this instance
|
||||
* @throws IllegalStateException if an indicator with the given {@code name}
|
||||
* is already registered.
|
||||
* @throws IllegalStateException if an indicator with the given {@code name} is
|
||||
* already registered.
|
||||
* @deprecated since 2.1.0 in favour of
|
||||
* {@link ReactiveHealthIndicatorRegistry#register(String, ReactiveHealthIndicator)}
|
||||
*/
|
||||
|
||||
@@ -43,10 +43,9 @@ public class DefaultHealthIndicatorRegistry implements HealthIndicatorRegistry {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link DefaultHealthIndicatorRegistry} from the specified
|
||||
* indicators.
|
||||
* @param healthIndicators a map of {@link HealthIndicator}s with the key
|
||||
* being used as an indicator name.
|
||||
* Create a new {@link DefaultHealthIndicatorRegistry} from the specified indicators.
|
||||
* @param healthIndicators a map of {@link HealthIndicator}s with the key being used
|
||||
* as an indicator name.
|
||||
*/
|
||||
public DefaultHealthIndicatorRegistry(Map<String, HealthIndicator> healthIndicators) {
|
||||
Assert.notNull(healthIndicators, "HealthIndicators must not be null");
|
||||
|
||||
@@ -46,8 +46,8 @@ public class DefaultReactiveHealthIndicatorRegistry
|
||||
/**
|
||||
* Create a new {@link DefaultReactiveHealthIndicatorRegistry} from the specified
|
||||
* indicators.
|
||||
* @param healthIndicators a map of {@link HealthIndicator}s with the key
|
||||
* being used as an indicator name.
|
||||
* @param healthIndicators a map of {@link HealthIndicator}s with the key being used
|
||||
* as an indicator name.
|
||||
*/
|
||||
public DefaultReactiveHealthIndicatorRegistry(
|
||||
Map<String, ReactiveHealthIndicator> healthIndicators) {
|
||||
|
||||
@@ -65,8 +65,8 @@ public class HealthEndpointWebExtension {
|
||||
public WebEndpointResponse<Health> healthForComponentInstance(
|
||||
SecurityContext securityContext, @Selector String component,
|
||||
@Selector String instance) {
|
||||
Supplier<Health> health = () -> this.delegate.healthForComponentInstance(
|
||||
component, instance);
|
||||
Supplier<Health> health = () -> this.delegate
|
||||
.healthForComponentInstance(component, instance);
|
||||
return this.responseMapper.mapDetails(health, securityContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,36 +31,35 @@ import java.util.Map;
|
||||
public interface HealthIndicatorRegistry {
|
||||
|
||||
/**
|
||||
* Registers the given {@link HealthIndicator}, associating it with the
|
||||
* given {@code name}.
|
||||
* Registers the given {@link HealthIndicator}, associating it with the given
|
||||
* {@code name}.
|
||||
* @param name the name of the indicator
|
||||
* @param healthIndicator the indicator
|
||||
* @throws IllegalStateException if an indicator with the given {@code name}
|
||||
* is already registered.
|
||||
* @throws IllegalStateException if an indicator with the given {@code name} is
|
||||
* already registered.
|
||||
*/
|
||||
void register(String name, HealthIndicator healthIndicator);
|
||||
|
||||
/**
|
||||
* Unregisters the {@link HealthIndicator} previously registered with the
|
||||
* given {@code name}.
|
||||
* Unregisters the {@link HealthIndicator} previously registered with the given
|
||||
* {@code name}.
|
||||
* @param name the name of the indicator
|
||||
* @return the unregistered indicator, or {@code null} if no indicator was
|
||||
* found in the registry for the given {@code name}.
|
||||
* @return the unregistered indicator, or {@code null} if no indicator was found in
|
||||
* the registry for the given {@code name}.
|
||||
*/
|
||||
HealthIndicator unregister(String name);
|
||||
|
||||
/**
|
||||
* Returns the {@link HealthIndicator} registered with the given {@code name}.
|
||||
* @param name the name of the indicator
|
||||
* @return the health indicator, or {@code null} if no indicator was
|
||||
* registered with the given {@code name}.
|
||||
* @return the health indicator, or {@code null} if no indicator was registered with
|
||||
* the given {@code name}.
|
||||
*/
|
||||
HealthIndicator get(String name);
|
||||
|
||||
/**
|
||||
* Returns a snapshot of the registered health indicators and their names.
|
||||
* The contents of the map do not reflect subsequent changes to the
|
||||
* registry.
|
||||
* Returns a snapshot of the registered health indicators and their names. The
|
||||
* contents of the map do not reflect subsequent changes to the registry.
|
||||
* @return the snapshot of registered health indicators
|
||||
*/
|
||||
Map<String, HealthIndicator> getAll();
|
||||
|
||||
@@ -41,10 +41,8 @@ public class HealthIndicatorRegistryFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link HealthIndicatorRegistry} based on the specified health
|
||||
* indicators.
|
||||
* @param healthIndicators the {@link HealthIndicator} instances mapped by
|
||||
* name
|
||||
* Create a {@link HealthIndicatorRegistry} based on the specified health indicators.
|
||||
* @param healthIndicators the {@link HealthIndicator} instances mapped by name
|
||||
* @return a {@link HealthIndicator} that delegates to the specified
|
||||
* {@code healthIndicators}.
|
||||
*/
|
||||
|
||||
@@ -31,12 +31,12 @@ import java.util.Map;
|
||||
public interface ReactiveHealthIndicatorRegistry {
|
||||
|
||||
/**
|
||||
* Registers the given {@link ReactiveHealthIndicator}, associating it with the
|
||||
* given {@code name}.
|
||||
* Registers the given {@link ReactiveHealthIndicator}, associating it with the given
|
||||
* {@code name}.
|
||||
* @param name the name of the indicator
|
||||
* @param healthIndicator the indicator
|
||||
* @throws IllegalStateException if an indicator with the given {@code name}
|
||||
* is already registered.
|
||||
* @throws IllegalStateException if an indicator with the given {@code name} is
|
||||
* already registered.
|
||||
*/
|
||||
void register(String name, ReactiveHealthIndicator healthIndicator);
|
||||
|
||||
@@ -44,23 +44,22 @@ public interface ReactiveHealthIndicatorRegistry {
|
||||
* Unregisters the {@link ReactiveHealthIndicator} previously registered with the
|
||||
* given {@code name}.
|
||||
* @param name the name of the indicator
|
||||
* @return the unregistered indicator, or {@code null} if no indicator was
|
||||
* found in the registry for the given {@code name}.
|
||||
* @return the unregistered indicator, or {@code null} if no indicator was found in
|
||||
* the registry for the given {@code name}.
|
||||
*/
|
||||
ReactiveHealthIndicator unregister(String name);
|
||||
|
||||
/**
|
||||
* Returns the {@link ReactiveHealthIndicator} registered with the given {@code name}.
|
||||
* @param name the name of the indicator
|
||||
* @return the health indicator, or {@code null} if no indicator was
|
||||
* registered with the given {@code name}.
|
||||
* @return the health indicator, or {@code null} if no indicator was registered with
|
||||
* the given {@code name}.
|
||||
*/
|
||||
ReactiveHealthIndicator get(String name);
|
||||
|
||||
/**
|
||||
* Returns a snapshot of the registered health indicators and their names.
|
||||
* The contents of the map do not reflect subsequent changes to the
|
||||
* registry.
|
||||
* Returns a snapshot of the registered health indicators and their names. The
|
||||
* contents of the map do not reflect subsequent changes to the registry.
|
||||
* @return the snapshot of registered health indicators
|
||||
*/
|
||||
Map<String, ReactiveHealthIndicator> getAll();
|
||||
|
||||
@@ -45,7 +45,7 @@ public class CompositeReactiveHealthIndicatorTests {
|
||||
public void singleIndicator() {
|
||||
CompositeReactiveHealthIndicator indicator = new CompositeReactiveHealthIndicator(
|
||||
this.healthAggregator, new DefaultReactiveHealthIndicatorRegistry(
|
||||
Collections.singletonMap("test", () -> Mono.just(HEALTHY))));
|
||||
Collections.singletonMap("test", () -> Mono.just(HEALTHY))));
|
||||
StepVerifier.create(indicator.health()).consumeNextWith((h) -> {
|
||||
assertThat(h.getStatus()).isEqualTo(Status.UP);
|
||||
assertThat(h.getDetails()).containsOnlyKeys("test");
|
||||
@@ -64,9 +64,9 @@ public class CompositeReactiveHealthIndicatorTests {
|
||||
new DefaultReactiveHealthIndicatorRegistry(indicators));
|
||||
StepVerifier.withVirtualTime(indicator::health).expectSubscription()
|
||||
.thenAwait(Duration.ofMillis(10000)).consumeNextWith((h) -> {
|
||||
assertThat(h.getStatus()).isEqualTo(Status.UP);
|
||||
assertThat(h.getDetails()).hasSize(50);
|
||||
}).verifyComplete();
|
||||
assertThat(h.getStatus()).isEqualTo(Status.UP);
|
||||
assertThat(h.getDetails()).hasSize(50);
|
||||
}).verifyComplete();
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class CompositeReactiveHealthIndicatorTests {
|
||||
CompositeReactiveHealthIndicator indicator = new CompositeReactiveHealthIndicator(
|
||||
this.healthAggregator,
|
||||
new DefaultReactiveHealthIndicatorRegistry(indicators))
|
||||
.timeoutStrategy(100, UNKNOWN_HEALTH);
|
||||
.timeoutStrategy(100, UNKNOWN_HEALTH);
|
||||
StepVerifier.create(indicator.health()).consumeNextWith((h) -> {
|
||||
assertThat(h.getStatus()).isEqualTo(Status.UP);
|
||||
assertThat(h.getDetails()).containsOnlyKeys("slow", "fast");
|
||||
@@ -95,14 +95,14 @@ public class CompositeReactiveHealthIndicatorTests {
|
||||
CompositeReactiveHealthIndicator indicator = new CompositeReactiveHealthIndicator(
|
||||
this.healthAggregator,
|
||||
new DefaultReactiveHealthIndicatorRegistry(indicators))
|
||||
.timeoutStrategy(20000, null);
|
||||
.timeoutStrategy(20000, null);
|
||||
StepVerifier.withVirtualTime(indicator::health).expectSubscription()
|
||||
.thenAwait(Duration.ofMillis(10000)).consumeNextWith((h) -> {
|
||||
assertThat(h.getStatus()).isEqualTo(Status.UP);
|
||||
assertThat(h.getDetails()).containsOnlyKeys("slow", "fast");
|
||||
assertThat(h.getDetails().get("slow")).isEqualTo(HEALTHY);
|
||||
assertThat(h.getDetails().get("fast")).isEqualTo(HEALTHY);
|
||||
}).verifyComplete();
|
||||
assertThat(h.getStatus()).isEqualTo(Status.UP);
|
||||
assertThat(h.getDetails()).containsOnlyKeys("slow", "fast");
|
||||
assertThat(h.getDetails().get("slow")).isEqualTo(HEALTHY);
|
||||
assertThat(h.getDetails().get("fast")).isEqualTo(HEALTHY);
|
||||
}).verifyComplete();
|
||||
}
|
||||
|
||||
static class TimeoutHealth implements ReactiveHealthIndicator {
|
||||
|
||||
@@ -47,10 +47,10 @@ public class DefaultReactiveHealthIndicatorRegistryTests {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
given(this.one.health()).willReturn(Mono.just(
|
||||
new Health.Builder().unknown().withDetail("1", "1").build()));
|
||||
given(this.two.health()).willReturn(Mono.just(
|
||||
new Health.Builder().unknown().withDetail("2", "2").build()));
|
||||
given(this.one.health()).willReturn(
|
||||
Mono.just(new Health.Builder().unknown().withDetail("1", "1").build()));
|
||||
given(this.two.health()).willReturn(
|
||||
Mono.just(new Health.Builder().unknown().withDetail("2", "2").build()));
|
||||
this.registry = new DefaultReactiveHealthIndicatorRegistry();
|
||||
}
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@ public class HealthEndpointTests {
|
||||
|
||||
@Test
|
||||
public void statusForComponentIsExposed() {
|
||||
HealthEndpoint endpoint = new HealthEndpoint(createHealthIndicator(
|
||||
Collections.singletonMap("test", one)));
|
||||
HealthEndpoint endpoint = new HealthEndpoint(
|
||||
createHealthIndicator(Collections.singletonMap("test", one)));
|
||||
Health health = endpoint.healthForComponent("test");
|
||||
assertThat(health).isNotNull();
|
||||
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
||||
@@ -69,8 +69,8 @@ public class HealthEndpointTests {
|
||||
|
||||
@Test
|
||||
public void statusForUnknownComponentReturnNull() {
|
||||
HealthEndpoint endpoint = new HealthEndpoint(createHealthIndicator(
|
||||
Collections.emptyMap()));
|
||||
HealthEndpoint endpoint = new HealthEndpoint(
|
||||
createHealthIndicator(Collections.emptyMap()));
|
||||
Health health = endpoint.healthForComponent("does-not-exist");
|
||||
assertThat(health).isNull();
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class HealthEndpointTests {
|
||||
public void statusForComponentInstanceIsExposed() {
|
||||
CompositeHealthIndicator compositeIndicator = new CompositeHealthIndicator(
|
||||
new OrderedHealthAggregator(), new DefaultHealthIndicatorRegistry(
|
||||
Collections.singletonMap("sub", () -> Health.down().build())));
|
||||
Collections.singletonMap("sub", () -> Health.down().build())));
|
||||
HealthEndpoint endpoint = new HealthEndpoint(createHealthIndicator(
|
||||
Collections.singletonMap("test", compositeIndicator)));
|
||||
Health health = endpoint.healthForComponentInstance("test", "sub");
|
||||
@@ -92,7 +92,7 @@ public class HealthEndpointTests {
|
||||
public void statusForUnknownComponentInstanceReturnNull() {
|
||||
CompositeHealthIndicator compositeIndicator = new CompositeHealthIndicator(
|
||||
new OrderedHealthAggregator(), new DefaultHealthIndicatorRegistry(
|
||||
Collections.singletonMap("sub", () -> Health.down().build())));
|
||||
Collections.singletonMap("sub", () -> Health.down().build())));
|
||||
HealthEndpoint endpoint = new HealthEndpoint(createHealthIndicator(
|
||||
Collections.singletonMap("test", compositeIndicator)));
|
||||
Health health = endpoint.healthForComponentInstance("test", "does-not-exist");
|
||||
|
||||
@@ -56,9 +56,9 @@ public class HealthEndpointWebIntegrationTests {
|
||||
registry.register("charlie", () -> Health.down().build());
|
||||
try {
|
||||
client.get().uri("/actuator/health").exchange().expectStatus()
|
||||
.isEqualTo(HttpStatus.SERVICE_UNAVAILABLE).expectBody().jsonPath("status")
|
||||
.isEqualTo("DOWN").jsonPath("details.alpha.status").isEqualTo("UP")
|
||||
.jsonPath("details.bravo.status").isEqualTo("UP")
|
||||
.isEqualTo(HttpStatus.SERVICE_UNAVAILABLE).expectBody()
|
||||
.jsonPath("status").isEqualTo("DOWN").jsonPath("details.alpha.status")
|
||||
.isEqualTo("UP").jsonPath("details.bravo.status").isEqualTo("UP")
|
||||
.jsonPath("details.charlie.status").isEqualTo("DOWN");
|
||||
}
|
||||
finally {
|
||||
@@ -71,9 +71,10 @@ public class HealthEndpointWebIntegrationTests {
|
||||
HealthIndicatorRegistry registry = context.getBean(HealthIndicatorRegistry.class);
|
||||
HealthIndicator bravo = registry.unregister("bravo");
|
||||
try {
|
||||
client.get().uri("/actuator/health").exchange().expectStatus().isOk().expectBody()
|
||||
.jsonPath("status").isEqualTo("UP").jsonPath("details.alpha.status")
|
||||
.isEqualTo("UP").jsonPath("details.bravo.status").doesNotExist();
|
||||
client.get().uri("/actuator/health").exchange().expectStatus().isOk()
|
||||
.expectBody().jsonPath("status").isEqualTo("UP")
|
||||
.jsonPath("details.alpha.status").isEqualTo("UP")
|
||||
.jsonPath("details.bravo.status").doesNotExist();
|
||||
}
|
||||
finally {
|
||||
registry.register("bravo", bravo);
|
||||
|
||||
@@ -62,7 +62,8 @@ public class HealthWebEndpointResponseMapperTests {
|
||||
|
||||
@Test
|
||||
public void mapDetailsWithUnauthorizedUserDoesNotInvokeSupplier() {
|
||||
HealthWebEndpointResponseMapper mapper = createMapper(ShowDetails.WHEN_AUTHORIZED);
|
||||
HealthWebEndpointResponseMapper mapper = createMapper(
|
||||
ShowDetails.WHEN_AUTHORIZED);
|
||||
Supplier<Health> supplier = mockSupplier();
|
||||
SecurityContext securityContext = mockSecurityContext("USER");
|
||||
WebEndpointResponse<Health> response = mapper.mapDetails(supplier,
|
||||
@@ -75,13 +76,15 @@ public class HealthWebEndpointResponseMapperTests {
|
||||
|
||||
@Test
|
||||
public void mapDetailsWithAuthorizedUserInvokeSupplier() {
|
||||
HealthWebEndpointResponseMapper mapper = createMapper(ShowDetails.WHEN_AUTHORIZED);
|
||||
HealthWebEndpointResponseMapper mapper = createMapper(
|
||||
ShowDetails.WHEN_AUTHORIZED);
|
||||
Supplier<Health> supplier = mockSupplier();
|
||||
given(supplier.get()).willReturn(Health.down().build());
|
||||
SecurityContext securityContext = mockSecurityContext("ACTUATOR");
|
||||
WebEndpointResponse<Health> response = mapper.mapDetails(supplier,
|
||||
securityContext);
|
||||
assertThat(response.getStatus()).isEqualTo(HttpStatus.SERVICE_UNAVAILABLE.value());
|
||||
assertThat(response.getStatus())
|
||||
.isEqualTo(HttpStatus.SERVICE_UNAVAILABLE.value());
|
||||
assertThat(response.getBody().getStatus()).isEqualTo(Status.DOWN);
|
||||
verify(supplier).get();
|
||||
verify(securityContext).isUserInRole("ACTUATOR");
|
||||
@@ -108,12 +111,12 @@ public class HealthWebEndpointResponseMapperTests {
|
||||
private SecurityContext mockSecurityContext(String... roles) {
|
||||
List<String> associatedRoles = Arrays.asList(roles);
|
||||
SecurityContext securityContext = mock(SecurityContext.class);
|
||||
given(securityContext.getPrincipal())
|
||||
.willReturn(mock(Principal.class));
|
||||
given(securityContext.isUserInRole(anyString())).will((Answer<Boolean>) invocation -> {
|
||||
String expectedRole = invocation.getArgument(0);
|
||||
return associatedRoles.contains(expectedRole);
|
||||
});
|
||||
given(securityContext.getPrincipal()).willReturn(mock(Principal.class));
|
||||
given(securityContext.isUserInRole(anyString()))
|
||||
.will((Answer<Boolean>) invocation -> {
|
||||
String expectedRole = invocation.getArgument(0);
|
||||
return associatedRoles.contains(expectedRole);
|
||||
});
|
||||
return securityContext;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,16 +39,18 @@ public class ReactiveHealthIndicatorRegistryFactoryTests {
|
||||
|
||||
@Test
|
||||
public void defaultHealthIndicatorNameFactory() {
|
||||
ReactiveHealthIndicatorRegistry registry = this.factory.createReactiveHealthIndicatorRegistry(
|
||||
Collections.singletonMap("myHealthIndicator", () -> Mono.just(UP)), null);
|
||||
ReactiveHealthIndicatorRegistry registry = this.factory
|
||||
.createReactiveHealthIndicatorRegistry(Collections
|
||||
.singletonMap("myHealthIndicator", () -> Mono.just(UP)), null);
|
||||
assertThat(registry.getAll()).containsOnlyKeys("my");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void healthIndicatorIsAdapted() {
|
||||
ReactiveHealthIndicatorRegistry registry = this.factory.createReactiveHealthIndicatorRegistry(
|
||||
Collections.singletonMap("test", () -> Mono.just(UP)),
|
||||
Collections.singletonMap("regular", () -> DOWN));
|
||||
ReactiveHealthIndicatorRegistry registry = this.factory
|
||||
.createReactiveHealthIndicatorRegistry(
|
||||
Collections.singletonMap("test", () -> Mono.just(UP)),
|
||||
Collections.singletonMap("regular", () -> DOWN));
|
||||
assertThat(registry.getAll()).containsOnlyKeys("test", "regular");
|
||||
StepVerifier.create(registry.get("regular").health()).consumeNextWith((h) -> {
|
||||
assertThat(h.getStatus()).isEqualTo(Status.DOWN);
|
||||
|
||||
Reference in New Issue
Block a user