Search in sources :

Example 1 with AlertDescriptor

use of com.thinkbiganalytics.alerts.spi.AlertDescriptor in project kylo by Teradata.

the class InMemoryAlertManagerTest method testAddDescriptor.

@Test
public void testAddDescriptor() {
    URI type = URI.create("urn:alert:test");
    Map<Alert.State, String> states = new HashMap<>();
    states.put(Alert.State.UNHANDLED, "application/json");
    states.put(Alert.State.HANDLED, "application/json");
    AlertDescriptor descr = new AlertDescriptor(URI.create("urn:alert:test"), "application/json", "description", true, states);
    assertThat(this.manager.addDescriptor(descr)).isTrue();
    Set<AlertDescriptor> descrSet = this.manager.getAlertDescriptors();
    assertThat(descrSet).hasSize(1).extracting("alertType").contains(type);
    assertThat(descrSet).extracting("contentType").contains("application/json");
    assertThat(descrSet).extracting("description").contains("description");
    assertThat(descrSet).extracting("respondable").contains(true);
}
Also used : AlertDescriptor(com.thinkbiganalytics.alerts.spi.AlertDescriptor) HashMap(java.util.HashMap) URI(java.net.URI) Test(org.junit.Test)

Aggregations

AlertDescriptor (com.thinkbiganalytics.alerts.spi.AlertDescriptor)1 URI (java.net.URI)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1