use of de.codecentric.boot.admin.server.domain.values.Endpoints in project spring-boot-admin by codecentric.
the class InstanceEndpointsDetectedEventMixinTest method verifySerialize.
@Test
public void verifySerialize() throws IOException {
InstanceId id = InstanceId.of("test123");
Instant timestamp = Instant.ofEpochSecond(1587751031).truncatedTo(ChronoUnit.SECONDS);
Endpoints endpoints = Endpoints.single("info", "http://localhost:8080/info").withEndpoint("health", "http://localhost:8080/health");
InstanceEndpointsDetectedEvent event = new InstanceEndpointsDetectedEvent(id, 12345678L, timestamp, endpoints);
JsonContent<InstanceEndpointsDetectedEvent> jsonContent = jsonTester.write(event);
assertThat(jsonContent).extractingJsonPathStringValue("$.instance").isEqualTo("test123");
assertThat(jsonContent).extractingJsonPathNumberValue("$.version").isEqualTo(12345678);
assertThat(jsonContent).extractingJsonPathNumberValue("$.timestamp").isEqualTo(1587751031.000000000);
assertThat(jsonContent).extractingJsonPathStringValue("$.type").isEqualTo("ENDPOINTS_DETECTED");
assertThat(jsonContent).extractingJsonPathArrayValue("$.endpoints").hasSize(2);
assertThat(jsonContent).extractingJsonPathStringValue("$.endpoints[0].id").isIn("info", "health");
assertThat(jsonContent).extractingJsonPathStringValue("$.endpoints[0].url").isIn("http://localhost:8080/info", "http://localhost:8080/health");
assertThat(jsonContent).extractingJsonPathStringValue("$.endpoints[1].id").isIn("info", "health");
assertThat(jsonContent).extractingJsonPathStringValue("$.endpoints[1].url").isIn("http://localhost:8080/info", "http://localhost:8080/health");
}
use of de.codecentric.boot.admin.server.domain.values.Endpoints in project spring-boot-admin by codecentric.
the class EndpointsMixinTest method verifySerialize.
@Test
public void verifySerialize() throws IOException {
Endpoints endpoints = Endpoints.single("info", "http://localhost:8080/info").withEndpoint("health", "http://localhost:8080/health");
JsonContent<Endpoints> jsonContent = jsonTester.write(endpoints);
assertThat(jsonContent).extractingJsonPathArrayValue("$").hasSize(2);
assertThat(jsonContent).extractingJsonPathStringValue("$[0].id").isIn("info", "health");
assertThat(jsonContent).extractingJsonPathStringValue("$[0].url").isIn("http://localhost:8080/info", "http://localhost:8080/health");
assertThat(jsonContent).extractingJsonPathStringValue("$[1].id").isIn("info", "health");
assertThat(jsonContent).extractingJsonPathStringValue("$[1].url").isIn("http://localhost:8080/info", "http://localhost:8080/health");
}
Aggregations