use of com.ecwid.consul.v1.agent.model.Service in project spring-cloud-consul by spring-cloud.
the class ConsulAutoServiceRegistrationManagementServiceTests method contextLoads.
@Test
public void contextLoads() {
Response<Map<String, Service>> response = consul.getAgentServices();
Map<String, Service> services = response.getValue();
Service service = services.get("myTestService-EE-0-management");
assertNotNull("service was null", service);
assertEquals("service port is not 0", 0, service.getPort().intValue());
assertEquals("service id was wrong", "myTestService-EE-0-management", service.getId());
assertEquals("service name was wrong", "myTestService-EE-management", service.getService());
assertFalse("service address must not be empty", StringUtils.isEmpty(service.getAddress()));
assertEquals("service address must equals hostname from discovery properties", discoveryProperties.getHostname(), service.getAddress());
}
use of com.ecwid.consul.v1.agent.model.Service in project spring-cloud-consul by spring-cloud.
the class ConsulAutoServiceRegistrationDefaultPortTests method contextLoads.
@Test
public void contextLoads() {
Response<Map<String, Service>> response = consul.getAgentServices();
Map<String, Service> services = response.getValue();
Service service = services.get("myTestService2-DD");
assertNotNull("service was null", service);
assertNotEquals("service port is 0", 0, service.getPort().intValue());
}
use of com.ecwid.consul.v1.agent.model.Service in project spring-cloud-consul by spring-cloud.
the class ConsulAutoServiceDeRegistrationDisabledTests method checkService.
private void checkService(final boolean expected) {
final Response<Map<String, Service>> response = consul.getAgentServices();
final Map<String, Service> services = response.getValue();
final Service service = services.get("myTestNotDeRegisteredService-D");
if (expected) {
assertNotNull("service was not registered", service);
} else {
assertNull("service was registered", service);
}
}
use of com.ecwid.consul.v1.agent.model.Service in project spring-cloud-consul by spring-cloud.
the class ConsulAutoServiceRegistrationCustomizedServiceNameTests method contextLoads.
@Test
public void contextLoads() {
Response<Map<String, Service>> response = consul.getAgentServices();
Map<String, Service> services = response.getValue();
Service service = services.get("myTestService1-CC");
assertNotNull("service was null", service);
assertNotEquals("service port is 0", 0, service.getPort().intValue());
assertEquals("service id was wrong", "myTestService1-CC", service.getId());
assertEquals("service name was wrong", "myprefix-myTestService-CC", service.getService());
}
use of com.ecwid.consul.v1.agent.model.Service in project spring-cloud-consul by spring-cloud.
the class TtlSchedulerTests method should_send_a_check_before_ttl_for_all_services.
@Test
public void should_send_a_check_before_ttl_for_all_services() throws InterruptedException {
// Wait for TTL to expired (TTL is set to 2 seconds)
Thread.sleep(2100);
Check serviceCheck = getCheckForService("ttlScheduler");
assertThat(serviceCheck).isNotNull();
assertThat(serviceCheck.getStatus()).isEqualTo(PASSING).as("Service check is in wrong state");
Check serviceManagementCheck = getCheckForService("ttlScheduler-management");
assertThat(serviceManagementCheck).isNotNull();
assertThat(serviceManagementCheck.getStatus()).isEqualTo(PASSING).as("Service management check is in wrong state");
}
Aggregations