Java Code Examples for org.springframework.boot.actuate.health.Health#unknown()

The following examples show how to use org.springframework.boot.actuate.health.Health#unknown() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VaultNamespaceTests.java    From spring-cloud-vault with Apache License 2.0 7 votes vote down vote up
@Test
public void shouldReportReactiveHealth() {

	ReactiveVaultTemplate reactiveMarketing = new ReactiveVaultTemplate(
			this.marketingWebClientBuilder,
			() -> Mono.just(VaultToken.of(this.marketingToken)));

	Health.Builder builder = Health.unknown();

	new VaultReactiveHealthIndicator(reactiveMarketing).doHealthCheck(builder)
			.as(StepVerifier::create)
			.assertNext(actual -> assertThat(actual.getStatus()).isEqualTo(Status.UP))
			.verifyComplete();
}
 
Example 2
Source File: ZookeeperDiscoveryHealthIndicator.java    From spring-cloud-zookeeper with Apache License 2.0 6 votes vote down vote up
@Override
public Health health() {
	Health.Builder builder = Health.unknown();
	try {
		Iterable<ServiceInstance<ZookeeperInstance>> allInstances = new ZookeeperServiceInstances(
				this.curatorFramework, this.serviceDiscovery,
				this.zookeeperDependencies, this.zookeeperDiscoveryProperties);
		builder.up().withDetail("services", allInstances);
	}
	catch (Exception e) {
		log.error("Error", e);
		builder.down(e);
	}

	return builder.build();
}
 
Example 3
Source File: VaultNamespaceTests.java    From spring-cloud-vault with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldReportHealth() {

	VaultTemplate marketing = new VaultTemplate(this.maketingRestTemplate,
			new SimpleSessionManager(new TokenAuthentication(this.marketingToken)));

	Health.Builder builder = Health.unknown();
	new VaultHealthIndicator(marketing).doHealthCheck(builder);

	assertThat(builder.build().getStatus()).isEqualTo(Status.UP);
}
 
Example 4
Source File: EurekaHealthIndicator.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Override
public Health health() {
	Builder builder = Health.unknown();
	Status status = getStatus(builder);
	return builder.status(status).withDetail("applications", getApplications())
			.build();
}