use of de.codecentric.boot.admin.client.registration.Application in project spring-boot-admin by codecentric.
the class ApplicationTest method test_json_format.
@Test
public void test_json_format() throws JsonProcessingException, IOException {
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().build();
Application app = Application.create("test").withHealthUrl("http://health").withServiceUrl("http://service").withManagementUrl("http://management").build();
DocumentContext json = JsonPath.parse(objectMapper.writeValueAsString(app));
assertThat((String) json.read("$.name")).isEqualTo("test");
assertThat((String) json.read("$.serviceUrl")).isEqualTo("http://service");
assertThat((String) json.read("$.managementUrl")).isEqualTo("http://management");
assertThat((String) json.read("$.healthUrl")).isEqualTo("http://health");
}
use of de.codecentric.boot.admin.client.registration.Application in project spring-boot-admin by codecentric.
the class DefaultApplicationFactoryTest method test_mgmtPortPath.
@Test
public void test_mgmtPortPath() {
management.setContextPath("/admin");
DefaultApplicationFactory factory = new DefaultApplicationFactory(client, management, server, "/alive");
publishApplicationReadyEvent(factory, 8080, 8081);
Application app = factory.createApplication();
assertThat(app.getManagementUrl(), is("http://" + getHostname() + ":8081/admin"));
assertThat(app.getHealthUrl(), is("http://" + getHostname() + ":8081/admin/alive"));
assertThat(app.getServiceUrl(), is("http://" + getHostname() + ":8080"));
}
use of de.codecentric.boot.admin.client.registration.Application in project spring-boot-admin by codecentric.
the class DefaultApplicationFactoryTest method test_contextPath_mgmtPortPath.
@Test
public void test_contextPath_mgmtPortPath() {
server.setContextPath("app");
management.setContextPath("/admin");
publishApplicationReadyEvent(factory, 8080, 8081);
Application app = factory.createApplication();
assertThat(app.getManagementUrl(), is("http://" + getHostname() + ":8081/admin"));
assertThat(app.getHealthUrl(), is("http://" + getHostname() + ":8081/admin/health"));
assertThat(app.getServiceUrl(), is("http://" + getHostname() + ":8080/app"));
}
use of de.codecentric.boot.admin.client.registration.Application in project spring-boot-admin by codecentric.
the class DefaultApplicationFactoryTest method test_ssl_managment.
@Test
public void test_ssl_managment() {
management.setSsl(new Ssl());
management.getSsl().setEnabled(true);
publishApplicationReadyEvent(factory, 8080, 9090);
Application app = factory.createApplication();
assertThat(app.getManagementUrl(), is("https://" + getHostname() + ":9090"));
assertThat(app.getHealthUrl(), is("https://" + getHostname() + ":9090/health"));
assertThat(app.getServiceUrl(), is("http://" + getHostname() + ":8080"));
}
use of de.codecentric.boot.admin.client.registration.Application in project spring-boot-admin by codecentric.
the class DefaultApplicationFactoryTest method test_preferIpAddress_serveraddress_missing.
@Test
public void test_preferIpAddress_serveraddress_missing() {
client.setPreferIp(true);
publishApplicationReadyEvent(factory, 8080, null);
Application app = factory.createApplication();
assertTrue(app.getServiceUrl().matches("http://\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}:8080"));
}
Aggregations