Search in sources :

Example 51 with Registration

use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.

the class RegistrationDeserializerTest method test_sanitize_metadata.

@Test
public void test_sanitize_metadata() throws JsonProcessingException {
    Registration app = Registration.create("test", "http://health").metadata("PASSWORD", "qwertz123").metadata("user", "humptydumpty").build();
    String json = objectMapper.writeValueAsString(app);
    assertThat(json).doesNotContain("qwertz123");
    assertThat(json).contains("humptydumpty");
}
Also used : Registration(de.codecentric.boot.admin.server.domain.values.Registration) Test(org.junit.jupiter.api.Test)

Example 52 with Registration

use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.

the class RegistrationDeserializerTest method test_1_4_json_format.

@Test
public void test_1_4_json_format() throws Exception {
    String json = new JSONObject().put("name", "test").put("managementUrl", "http://test").put("healthUrl", "http://health").put("serviceUrl", "http://service").put("statusInfo", new JSONObject().put("status", "UNKNOWN")).toString();
    Registration value = objectMapper.readValue(json, Registration.class);
    assertThat(value.getName()).isEqualTo("test");
    assertThat(value.getManagementUrl()).isEqualTo("http://test");
    assertThat(value.getHealthUrl()).isEqualTo("http://health");
    assertThat(value.getServiceUrl()).isEqualTo("http://service");
}
Also used : JSONObject(org.json.JSONObject) Registration(de.codecentric.boot.admin.server.domain.values.Registration) Test(org.junit.jupiter.api.Test)

Example 53 with Registration

use of de.codecentric.boot.admin.server.domain.values.Registration in project spring-boot-admin by codecentric.

the class CloudFoundryHttpHeaderProviderTest method test_cloud_foundry_header.

@Test
public void test_cloud_foundry_header() {
    Registration registration = Registration.create("foo", "http://health").metadata("applicationId", "549e64cf-a478-423d-9d6d-02d803a028a8").metadata("instanceId", "0").build();
    Instance instance = Instance.create(InstanceId.of("id")).register(registration);
    assertThat(headersProvider.getHeaders(instance).get("X-CF-APP-INSTANCE")).containsOnly("549e64cf-a478-423d-9d6d-02d803a028a8:0");
}
Also used : Instance(de.codecentric.boot.admin.server.domain.entities.Instance) Registration(de.codecentric.boot.admin.server.domain.values.Registration) Test(org.junit.jupiter.api.Test)

Aggregations

Registration (de.codecentric.boot.admin.server.domain.values.Registration)53 Test (org.junit.jupiter.api.Test)46 Instance (de.codecentric.boot.admin.server.domain.entities.Instance)15 InstanceId (de.codecentric.boot.admin.server.domain.values.InstanceId)12 ServiceInstance (org.springframework.cloud.client.ServiceInstance)9 JSONObject (org.json.JSONObject)8 DefaultServiceInstance (org.springframework.cloud.client.DefaultServiceInstance)8 StatusInfo (de.codecentric.boot.admin.server.domain.values.StatusInfo)7 InstanceRepository (de.codecentric.boot.admin.server.domain.entities.InstanceRepository)6 Info (de.codecentric.boot.admin.server.domain.values.Info)6 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)6 StepVerifier (reactor.test.StepVerifier)6 EventsourcingInstanceRepository (de.codecentric.boot.admin.server.domain.entities.EventsourcingInstanceRepository)5 InstanceRegisteredEvent (de.codecentric.boot.admin.server.domain.events.InstanceRegisteredEvent)5 InstanceRegistrationUpdatedEvent (de.codecentric.boot.admin.server.domain.events.InstanceRegistrationUpdatedEvent)5 Endpoints (de.codecentric.boot.admin.server.domain.values.Endpoints)5 InMemoryEventStore (de.codecentric.boot.admin.server.eventstore.InMemoryEventStore)5 BeforeEach (org.junit.jupiter.api.BeforeEach)5 Collections.singletonMap (java.util.Collections.singletonMap)4 InstanceInfo (com.netflix.appinfo.InstanceInfo)3