use of de.codecentric.boot.admin.model.StatusInfo in project spring-boot-admin by codecentric.
the class PagerdutyNotifierTest method test_onApplicationEvent_trigger.
@Test
public void test_onApplicationEvent_trigger() {
StatusInfo infoDown = StatusInfo.ofDown();
StatusInfo infoUp = StatusInfo.ofUp();
notifier.notify(new ClientApplicationStatusChangedEvent(Application.create("App").withId("-id-").withHealthUrl("http://health").build(), infoUp, infoDown));
Map<String, Object> expected = new HashMap<String, Object>();
expected.put("service_key", "--service--");
expected.put("incident_key", "App/-id-");
expected.put("event_type", "trigger");
expected.put("description", "App/-id- is DOWN");
expected.put("client", "TestClient");
expected.put("client_url", URI.create("http://localhost"));
Map<String, Object> details = new HashMap<String, Object>();
details.put("from", infoUp);
details.put("to", infoDown);
expected.put("details", details);
Map<String, Object> context = new HashMap<String, Object>();
context.put("type", "link");
context.put("href", "http://health");
context.put("text", "Application health-endpoint");
expected.put("contexts", Arrays.asList(context));
verify(restTemplate).postForEntity(eq(PagerdutyNotifier.DEFAULT_URI), eq(expected), eq(Void.class));
}
Aggregations