Search in sources :

Example 1 with ShouldMatchDataSet

use of com.lordofthejars.nosqlunit.annotation.ShouldMatchDataSet 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);
}
Also used : AlertCondition(org.graylog2.plugin.alarms.AlertCondition) Alert(org.graylog2.alerts.Alert) Date(java.util.Date) UsingDataSet(com.lordofthejars.nosqlunit.annotation.UsingDataSet) MongoDBServiceTest(org.graylog2.database.MongoDBServiceTest) Test(org.junit.Test) IgnorePropertyValue(com.lordofthejars.nosqlunit.annotation.IgnorePropertyValue) ShouldMatchDataSet(com.lordofthejars.nosqlunit.annotation.ShouldMatchDataSet)

Example 2 with ShouldMatchDataSet

use of com.lordofthejars.nosqlunit.annotation.ShouldMatchDataSet 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);
}
Also used : AlertCondition(org.graylog2.plugin.alarms.AlertCondition) Alert(org.graylog2.alerts.Alert) Date(java.util.Date) UsingDataSet(com.lordofthejars.nosqlunit.annotation.UsingDataSet) MongoDBServiceTest(org.graylog2.database.MongoDBServiceTest) Test(org.junit.Test) IgnorePropertyValue(com.lordofthejars.nosqlunit.annotation.IgnorePropertyValue) ShouldMatchDataSet(com.lordofthejars.nosqlunit.annotation.ShouldMatchDataSet)

Aggregations

IgnorePropertyValue (com.lordofthejars.nosqlunit.annotation.IgnorePropertyValue)2 ShouldMatchDataSet (com.lordofthejars.nosqlunit.annotation.ShouldMatchDataSet)2 UsingDataSet (com.lordofthejars.nosqlunit.annotation.UsingDataSet)2 Date (java.util.Date)2 Alert (org.graylog2.alerts.Alert)2 MongoDBServiceTest (org.graylog2.database.MongoDBServiceTest)2 AlertCondition (org.graylog2.plugin.alarms.AlertCondition)2 Test (org.junit.Test)2