Search in sources :

Example 1 with AlarmCallbackError

use of org.graylog2.rest.models.alarmcallbacks.AlarmCallbackError in project graylog2-server by Graylog2.

the class AlarmCallbackHistoryServiceImplTest method testError.

@Test
public void testError() throws Exception {
    final AlarmCallbackConfiguration alarmCallbackConfiguration = mockAlarmCallbackConfiguration(new Date());
    final Alert alert = mockAlert();
    final AlertCondition alertCondition = mockAlertCondition();
    final String errorMessage = "Dummy Error Message";
    final AlarmCallbackHistory alarmCallbackHistory = this.alarmCallbackHistoryService.error(alarmCallbackConfiguration, alert, alertCondition, errorMessage);
    verifyAlarmCallbackHistory(alarmCallbackHistory, alert, alertCondition);
    assertThat(alarmCallbackHistory.result()).isNotNull().isInstanceOf(AlarmCallbackError.class);
    assertThat(alarmCallbackHistory.result().type()).isEqualTo("error");
    final AlarmCallbackError result = (AlarmCallbackError) alarmCallbackHistory.result();
    assertThat(result.error()).isEqualTo(errorMessage);
}
Also used : AlarmCallbackError(org.graylog2.rest.models.alarmcallbacks.AlarmCallbackError) AlertCondition(org.graylog2.plugin.alarms.AlertCondition) Alert(org.graylog2.alerts.Alert) Date(java.util.Date) MongoDBServiceTest(org.graylog2.database.MongoDBServiceTest) Test(org.junit.Test)

Aggregations

Date (java.util.Date)1 Alert (org.graylog2.alerts.Alert)1 MongoDBServiceTest (org.graylog2.database.MongoDBServiceTest)1 AlertCondition (org.graylog2.plugin.alarms.AlertCondition)1 AlarmCallbackError (org.graylog2.rest.models.alarmcallbacks.AlarmCallbackError)1 Test (org.junit.Test)1