use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class DefaultServiceInstanceConverterTest method should_convert_with_metadata.
@Test
public void should_convert_with_metadata() {
ServiceInstance service = new DefaultServiceInstance("test-1", "test", "localhost", 80, false);
Map<String, String> metadata = new HashMap<>();
metadata.put("health.path", "ping");
metadata.put("management.scheme", "https");
metadata.put("management.address", "127.0.0.1");
metadata.put("management.port", "1234");
metadata.put("management.context-path", "mgmt");
service.getMetadata().putAll(metadata);
Registration registration = new DefaultServiceInstanceConverter().convert(service);
assertThat(registration.getName()).isEqualTo("test");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getManagementUrl()).isEqualTo("https://127.0.0.1:1234/mgmt");
assertThat(registration.getHealthUrl()).isEqualTo("https://127.0.0.1:1234/mgmt/ping");
assertThat(registration.getMetadata()).isEqualTo(metadata);
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class DefaultServiceInstanceConverterTest method should_convert_service_with_uri.
@Test
public void should_convert_service_with_uri() {
ServiceInstance service = new TestServiceInstance("test", URI.create("http://localhost/test"), Collections.emptyMap());
Registration registration = new DefaultServiceInstanceConverter().convert(service);
assertThat(registration.getName()).isEqualTo("test");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost/test");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost/test/actuator");
assertThat(registration.getHealthUrl()).isEqualTo("http://localhost/test/actuator/health");
assertThat(registration.getMetadata()).isEmpty();
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class DefaultServiceInstanceConverterTest method should_convert_with_defaults.
@Test
public void should_convert_with_defaults() {
ServiceInstance service = new DefaultServiceInstance("test-1", "test", "localhost", 80, false);
Registration registration = new DefaultServiceInstanceConverter().convert(service);
assertThat(registration.getName()).isEqualTo("test");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost:80");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost:80/actuator");
assertThat(registration.getHealthUrl()).isEqualTo("http://localhost:80/actuator/health");
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class DefaultServiceInstanceConverterTest method should_convert_service_with_uri_and_custom_defaults.
@Test
public void should_convert_service_with_uri_and_custom_defaults() {
DefaultServiceInstanceConverter converter = new DefaultServiceInstanceConverter();
converter.setHealthEndpointPath("ping");
converter.setManagementContextPath("mgmt");
ServiceInstance service = new TestServiceInstance("test", URI.create("http://localhost/test"), Collections.emptyMap());
Registration registration = converter.convert(service);
assertThat(registration.getName()).isEqualTo("test");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost/test");
assertThat(registration.getManagementUrl()).isEqualTo("http://localhost/test/mgmt");
assertThat(registration.getHealthUrl()).isEqualTo("http://localhost/test/mgmt/ping");
}
use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.
the class DefaultServiceInstanceConverterTest method should_convert_service_with_uri_and_metadata_different_port.
@Test
public void should_convert_service_with_uri_and_metadata_different_port() {
Map<String, String> metadata = new HashMap<>();
metadata.put("health.path", "ping");
metadata.put("management.context-path", "mgmt");
metadata.put("management.port", "1234");
metadata.put("management.address", "127.0.0.1");
ServiceInstance service = new TestServiceInstance("test", URI.create("http://localhost/test"), metadata);
Registration registration = new DefaultServiceInstanceConverter().convert(service);
assertThat(registration.getName()).isEqualTo("test");
assertThat(registration.getServiceUrl()).isEqualTo("http://localhost/test");
assertThat(registration.getManagementUrl()).isEqualTo("http://127.0.0.1:1234/mgmt");
assertThat(registration.getHealthUrl()).isEqualTo("http://127.0.0.1:1234/mgmt/ping");
assertThat(registration.getMetadata()).isEqualTo(metadata);
}
Aggregations