Search in sources :

Example 1 with ConsulServiceInstance

use of org.springframework.cloud.consul.discovery.ConsulServiceInstance in project spring-cloud-consul by spring-cloud.

the class TestConsulDiscoveryClientBootstrapConfiguration method consulDiscoveryClient.

@Bean
public ConsulDiscoveryClient consulDiscoveryClient(ConsulDiscoveryProperties properties) {
    ConsulDiscoveryClient client = mock(ConsulDiscoveryClient.class);
    ConsulServiceInstance instance = new ConsulServiceInstance("configserver1", "configserver", properties.getHostname(), properties.getPort(), false);
    instance.setHealthService(mock(HealthService.class));
    given(client.getInstances("configserver")).willReturn(Arrays.asList(instance));
    return client;
}
Also used : ConsulServiceInstance(org.springframework.cloud.consul.discovery.ConsulServiceInstance) ConsulDiscoveryClient(org.springframework.cloud.consul.discovery.ConsulDiscoveryClient) HealthService(com.ecwid.consul.v1.health.model.HealthService) Bean(org.springframework.context.annotation.Bean)

Aggregations

HealthService (com.ecwid.consul.v1.health.model.HealthService)1 ConsulDiscoveryClient (org.springframework.cloud.consul.discovery.ConsulDiscoveryClient)1 ConsulServiceInstance (org.springframework.cloud.consul.discovery.ConsulServiceInstance)1 Bean (org.springframework.context.annotation.Bean)1