use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class AlarmCallbackConfigurationServiceImplTest method testCreate.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void testCreate() throws Exception {
final CreateAlarmCallbackRequest request = CreateAlarmCallbackRequest.create("", "", Collections.emptyMap());
final String streamId = "54e3deadbeefdeadbeefaffe";
final String userId = "someuser";
final AlarmCallbackConfiguration alarmCallbackConfiguration = this.alarmCallbackConfigurationService.create(streamId, request, userId);
assertNotNull(alarmCallbackConfiguration);
assertEquals(alarmCallbackConfiguration.getStreamId(), streamId);
assertEquals("Create should not save the object", 0, alarmCallbackConfigurationService.count());
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class AlarmCallbackHistoryServiceImplTest method testSaveForDummyError.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
@ShouldMatchDataSet
@IgnorePropertyValue(properties = { "created_at", "_id" })
public void testSaveForDummyError() throws Exception {
final Date createdAt = DateTime.parse("2015-07-20T09:49:02.503Z").toDate();
final AlarmCallbackConfiguration alarmCallbackConfiguration = mockAlarmCallbackConfiguration(createdAt);
final Alert alert = mockAlert();
final AlertCondition alertCondition = mockAlertCondition();
final String errorMessage = "Dummy Error Message";
final AlarmCallbackHistory error = this.alarmCallbackHistoryService.error(alarmCallbackConfiguration, alert, alertCondition, errorMessage);
this.alarmCallbackHistoryService.save(error);
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class AlarmCallbackHistoryServiceImplTest method testSaveForDummySuccess.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
@ShouldMatchDataSet
@IgnorePropertyValue(properties = { "created_at", "_id" })
public void testSaveForDummySuccess() throws Exception {
final Date createdAt = DateTime.parse("2015-07-20T09:49:02.503Z").toDate();
final AlarmCallbackConfiguration alarmCallbackConfiguration = mockAlarmCallbackConfiguration(createdAt);
final Alert alert = mockAlert();
final AlertCondition alertCondition = mockAlertCondition();
final AlarmCallbackHistory success = this.alarmCallbackHistoryService.success(alarmCallbackConfiguration, alert, alertCondition);
this.alarmCallbackHistoryService.save(success);
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class AlertServiceImplTest method loadRecentOfStreamLimitResults.
@Test
@UsingDataSet(locations = "multiple-alerts.json")
public void loadRecentOfStreamLimitResults() throws Exception {
final List<Alert> alerts = alertService.loadRecentOfStream(STREAM_ID, new DateTime(0L, DateTimeZone.UTC), 1);
assertThat(alerts.size()).isEqualTo(1);
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class AlertServiceImplTest method loadRecentOfStreamsIsEmptyIfNoStreams.
@Test
@UsingDataSet(locations = "multiple-alerts.json")
public void loadRecentOfStreamsIsEmptyIfNoStreams() throws Exception {
final List<Alert> alerts = alertService.loadRecentOfStreams(ImmutableList.of(), new DateTime(0L, DateTimeZone.UTC), 300);
assertThat(alerts.size()).isEqualTo(0);
}
Aggregations