org.springframework.cloud.client.discovery.health.reactive.ReactiveDiscoveryClientHealthIndicator Java Examples

The following examples show how to use org.springframework.cloud.client.discovery.health.reactive.ReactiveDiscoveryClientHealthIndicator. 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: CloudFoundryReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-cloudfoundry with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldUseCustomServiceDiscovery() {
	contextRunner
			.withConfiguration(AutoConfigurations
					.of(ReactiveCommonsClientAutoConfiguration.class))
			.withUserConfiguration(
					CustomCloudFoundryReactiveDiscoveryClientConfiguration.class)
			.run(context -> {
				assertThat(context)
						.hasSingleBean(CloudFoundryReactiveHeartbeatSender.class);
				assertThat(context).getBeans(ReactiveDiscoveryClient.class)
						.hasSize(2);
				assertThat(context).hasBean("nativeCloudFoundryDiscoveryClient");
				assertThat(context)
						.hasSingleBean(ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #2
Source File: CloudFoundryReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-cloudfoundry with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldUseAppServiceDiscovery() {
	contextRunner
			.withConfiguration(AutoConfigurations
					.of(ReactiveCommonsClientAutoConfiguration.class))
			.withPropertyValues("spring.cloud.cloudfoundry.discovery.use-dns=true",
					"spring.cloud.cloudfoundry.discovery.use-container-ip=false")
			.run(context -> {
				assertThat(context)
						.hasSingleBean(CloudFoundryReactiveHeartbeatSender.class);
				assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class);
				assertThat(context).hasBean("appServiceReactiveDiscoveryClient");
				assertThat(context)
						.hasSingleBean(ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #3
Source File: CloudFoundryReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-cloudfoundry with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldUseDnsDiscovery() {
	contextRunner
			.withConfiguration(AutoConfigurations
					.of(ReactiveCommonsClientAutoConfiguration.class))
			.withPropertyValues("spring.cloud.cloudfoundry.discovery.use-dns=true",
					"spring.cloud.cloudfoundry.discovery.use-container-ip=true")
			.run(context -> {
				assertThat(context)
						.hasSingleBean(CloudFoundryReactiveHeartbeatSender.class);
				assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class);
				assertThat(context).hasBean("dnsBasedReactiveDiscoveryClient");
				assertThat(context)
						.hasSingleBean(ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #4
Source File: CloudFoundryReactiveDiscoveryClientConfiguration.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnClass(
		name = "org.springframework.boot.actuate.health.ReactiveHealthIndicator")
@ConditionalOnDiscoveryHealthIndicatorEnabled
public ReactiveDiscoveryClientHealthIndicator cloudFoundryReactiveDiscoveryClientHealthIndicator(
		CloudFoundryNativeReactiveDiscoveryClient client,
		DiscoveryClientHealthIndicatorProperties properties) {
	return new ReactiveDiscoveryClientHealthIndicator(client, properties);
}
 
Example #5
Source File: EurekaReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenReactiveDiscoveryDisabled() {
	contextRunner.withPropertyValues("spring.cloud.discovery.reactive.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #6
Source File: EurekaReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenEurekaClientDisabled() {
	contextRunner.withPropertyValues("eureka.client.enabled=false").run(context -> {
		assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
		assertThat(context)
				.doesNotHaveBean(ReactiveDiscoveryClientHealthIndicator.class);
	});
}
 
Example #7
Source File: EurekaReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Test
public void worksWithoutWebflux() {
	contextRunner
			.withClassLoader(
					new FilteredClassLoader("org.springframework.web.reactive"))
			.run(context -> {
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #8
Source File: EurekaReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Test
public void worksWithoutActuator() {
	contextRunner
			.withClassLoader(
					new FilteredClassLoader("org.springframework.boot.actuate"))
			.run(context -> {
				assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #9
Source File: ConsulReactiveDiscoveryClientConfiguration.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnClass(
		name = "org.springframework.boot.actuate.health.ReactiveHealthIndicator")
@ConditionalOnDiscoveryHealthIndicatorEnabled
public ReactiveDiscoveryClientHealthIndicator consulReactiveDiscoveryClientHealthIndicator(
		ConsulReactiveDiscoveryClient client,
		DiscoveryClientHealthIndicatorProperties properties) {
	return new ReactiveDiscoveryClientHealthIndicator(client, properties);
}
 
Example #10
Source File: ConsulReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldWorkWithDefaults() {
	contextRunner.run(context -> {
		assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class);
		assertThat(context)
				.hasSingleBean(ReactiveDiscoveryClientHealthIndicator.class);
	});
}
 
Example #11
Source File: ConsulReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenDiscoveryDisabled() {
	contextRunner.withPropertyValues("spring.cloud.discovery.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean("consulReactiveDiscoveryClient");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #12
Source File: ConsulReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenReactiveDiscoveryDisabled() {
	contextRunner.withPropertyValues("spring.cloud.discovery.reactive.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean("consulReactiveDiscoveryClient");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #13
Source File: ConsulReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenConsulDisabled() {
	contextRunner.withPropertyValues("spring.cloud.consul.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean("consulReactiveDiscoveryClient");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #14
Source File: ConsulReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenConsulDiscoveryDisabled() {
	contextRunner.withPropertyValues("spring.cloud.consul.discovery.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean("consulReactiveDiscoveryClient");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #15
Source File: ConsulReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
@Test
public void worksWithoutWebflux() {
	contextRunner
			.withClassLoader(
					new FilteredClassLoader("org.springframework.web.reactive"))
			.run(context -> {
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #16
Source File: ConsulReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
@Test
public void worksWithoutActuator() {
	contextRunner
			.withClassLoader(
					new FilteredClassLoader("org.springframework.boot.actuate"))
			.run(context -> {
				assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #17
Source File: EurekaReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenDiscoveryDisabled() {
	contextRunner.withPropertyValues("spring.cloud.discovery.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #18
Source File: CloudFoundryReactiveDiscoveryClientConfiguration.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnClass(
		name = "org.springframework.boot.actuate.health.ReactiveHealthIndicator")
@ConditionalOnDiscoveryHealthIndicatorEnabled
public ReactiveDiscoveryClientHealthIndicator cloudFoundryReactiveDiscoveryClientHealthIndicator(
		SimpleDnsBasedReactiveDiscoveryClient client,
		DiscoveryClientHealthIndicatorProperties properties) {
	return new ReactiveDiscoveryClientHealthIndicator(client, properties);
}
 
Example #19
Source File: CloudFoundryReactiveDiscoveryClientConfiguration.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnClass(
		name = "org.springframework.boot.actuate.health.ReactiveHealthIndicator")
@ConditionalOnDiscoveryHealthIndicatorEnabled
public ReactiveDiscoveryClientHealthIndicator cloudFoundryReactiveDiscoveryClientHealthIndicator(
		CloudFoundryAppServiceReactiveDiscoveryClient client,
		DiscoveryClientHealthIndicatorProperties properties) {
	return new ReactiveDiscoveryClientHealthIndicator(client, properties);
}
 
Example #20
Source File: CloudFoundryReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientsWhenDiscoveryDisabled() {
	contextRunner.withPropertyValues("spring.cloud.discovery.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean("cloudFoundryHeartbeatSender");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #21
Source File: CloudFoundryReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientsWhenReactiveDiscoveryDisabled() {
	contextRunner.withPropertyValues("spring.cloud.discovery.reactive.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean("cloudFoundryHeartbeatSender");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #22
Source File: CloudFoundryReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientsWhenCloudFoundryDiscoveryDisabled() {
	contextRunner
			.withPropertyValues("spring.cloud.cloudfoundry.discovery.enabled=false")
			.run(context -> {
				assertThat(context).doesNotHaveBean("cloudFoundryHeartbeatSender");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #23
Source File: CloudFoundryReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldUseNativeDiscovery() {
	contextRunner
			.withConfiguration(AutoConfigurations
					.of(ReactiveCommonsClientAutoConfiguration.class))
			.run(context -> {
				assertThat(context)
						.hasSingleBean(CloudFoundryReactiveHeartbeatSender.class);
				assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class);
				assertThat(context).hasBean("nativeCloudFoundryDiscoveryClient");
				assertThat(context)
						.hasSingleBean(ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #24
Source File: CloudFoundryReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Test
public void worksWithoutWebflux() {
	contextRunner
			.withClassLoader(
					new FilteredClassLoader("org.springframework.web.reactive"))
			.run(context -> {
				assertThat(context)
						.doesNotHaveBean(CloudFoundryReactiveHeartbeatSender.class);
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #25
Source File: CloudFoundryReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Test
public void worksWithoutActuator() {
	contextRunner
			.withClassLoader(
					new FilteredClassLoader("org.springframework.boot.actuate"))
			.run(context -> {
				assertThat(context)
						.hasSingleBean(CloudFoundryReactiveHeartbeatSender.class);
				assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #26
Source File: ZookeeperReactiveDiscoveryClientConfigurationTests.java    From spring-cloud-zookeeper with Apache License 2.0 5 votes vote down vote up
@Test
public void worksWithoutWebflux() {
	contextRunner
			.withClassLoader(
					new FilteredClassLoader("org.springframework.web.reactive"))
			.run(context -> {
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #27
Source File: KubernetesReactiveDiscoveryClientAutoConfigurationTests.java    From spring-cloud-kubernetes with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldWorkWithDefaults() {
	contextRunner.run(context -> {
		assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class);
		assertThat(context)
				.hasSingleBean(ReactiveDiscoveryClientHealthIndicator.class);
	});
}
 
Example #28
Source File: KubernetesReactiveDiscoveryClientAutoConfigurationTests.java    From spring-cloud-kubernetes with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenDiscoveryDisabled() {
	contextRunner.withPropertyValues("spring.cloud.discovery.enabled=false")
			.run(context -> {
				assertThat(context)
						.doesNotHaveBean("kubernetesReactiveDiscoveryClient");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #29
Source File: KubernetesReactiveDiscoveryClientAutoConfigurationTests.java    From spring-cloud-kubernetes with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenReactiveDiscoveryDisabled() {
	contextRunner.withPropertyValues("spring.cloud.discovery.reactive.enabled=false")
			.run(context -> {
				assertThat(context)
						.doesNotHaveBean("kubernetesReactiveDiscoveryClient");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}
 
Example #30
Source File: KubernetesReactiveDiscoveryClientAutoConfigurationTests.java    From spring-cloud-kubernetes with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotHaveDiscoveryClientWhenKubernetesDisabled() {
	contextRunner.withPropertyValues("spring.cloud.kubernetes.enabled=false")
			.run(context -> {
				assertThat(context)
						.doesNotHaveBean("kubernetesReactiveDiscoveryClient");
				assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class);
				assertThat(context).doesNotHaveBean(
						ReactiveDiscoveryClientHealthIndicator.class);
			});
}