Search in sources :

Example 11 with Application

use of de.codecentric.boot.admin.client.registration.Application in project spring-boot-admin by codecentric.

the class ApplicationTest method test_equals_hashCode.

@Test
public void test_equals_hashCode() {
    Application a1 = Application.create("foo").withHealthUrl("healthUrl").withManagementUrl("mgmt").withServiceUrl("svc").build();
    Application a2 = Application.create("foo").withHealthUrl("healthUrl").withManagementUrl("mgmt").withServiceUrl("svc").build();
    assertThat(a1, is(a2));
    assertThat(a1.hashCode(), is(a2.hashCode()));
    Application a3 = Application.create("foo").withHealthUrl("healthUrl2").withManagementUrl("mgmt").withServiceUrl("svc").build();
    assertThat(a1, not(is(a3)));
    assertThat(a2, not(is(a3)));
}
Also used : Application(de.codecentric.boot.admin.client.registration.Application) Test(org.junit.Test)

Example 12 with Application

use of de.codecentric.boot.admin.client.registration.Application in project spring-boot-admin by codecentric.

the class DefaultApplicationFactoryTest method test_servletPath.

@Test
public void test_servletPath() {
    server.setServletPath("app");
    server.setContextPath("srv");
    publishApplicationReadyEvent(factory, 80, null);
    Application app = factory.createApplication();
    assertThat(app.getManagementUrl(), is("http://" + getHostname() + ":80/srv/app"));
    assertThat(app.getHealthUrl(), is("http://" + getHostname() + ":80/srv/app/health"));
    assertThat(app.getServiceUrl(), is("http://" + getHostname() + ":80/srv"));
}
Also used : SpringApplication(org.springframework.boot.SpringApplication) Application(de.codecentric.boot.admin.client.registration.Application) Test(org.junit.Test)

Example 13 with Application

use of de.codecentric.boot.admin.client.registration.Application in project spring-boot-admin by codecentric.

the class DefaultApplicationFactoryTest method test_default.

@Test
public void test_default() {
    publishApplicationReadyEvent(factory, 8080, null);
    Application app = factory.createApplication();
    assertThat(app.getManagementUrl(), is("http://" + getHostname() + ":8080"));
    assertThat(app.getHealthUrl(), is("http://" + getHostname() + ":8080/health"));
    assertThat(app.getServiceUrl(), is("http://" + getHostname() + ":8080"));
}
Also used : SpringApplication(org.springframework.boot.SpringApplication) Application(de.codecentric.boot.admin.client.registration.Application) Test(org.junit.Test)

Example 14 with Application

use of de.codecentric.boot.admin.client.registration.Application in project spring-boot-admin by codecentric.

the class DefaultApplicationFactoryTest method test_preferIpAddress_managementaddress_missing.

@Test
public void test_preferIpAddress_managementaddress_missing() {
    client.setPreferIp(true);
    publishApplicationReadyEvent(factory, 8080, 8081);
    Application app = factory.createApplication();
    assertTrue(app.getManagementUrl().matches("http://\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}:8081"));
}
Also used : SpringApplication(org.springframework.boot.SpringApplication) Application(de.codecentric.boot.admin.client.registration.Application) Test(org.junit.Test)

Aggregations

Application (de.codecentric.boot.admin.client.registration.Application)14 Test (org.junit.Test)14 SpringApplication (org.springframework.boot.SpringApplication)12 Ssl (org.springframework.boot.context.embedded.Ssl)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DocumentContext (com.jayway.jsonpath.DocumentContext)1 DefaultApplicationFactory (de.codecentric.boot.admin.client.registration.DefaultApplicationFactory)1