use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class AlertServiceImplTest method loadRecentOfStreamsFiltersByStream.
@Test
@UsingDataSet(locations = "multiple-alerts.json")
public void loadRecentOfStreamsFiltersByStream() throws Exception {
final List<Alert> alerts = alertService.loadRecentOfStreams(ImmutableList.of("5666df42bee80072613ce14d", "5666df42bee80072613ce14f"), new DateTime(0L, DateTimeZone.UTC), 300);
assertThat(alerts.size()).isEqualTo(2);
assertThat(alerts.get(0).getStreamId()).isNotEqualTo(STREAM_ID);
assertThat(alerts.get(1).getStreamId()).isNotEqualTo(STREAM_ID);
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class UserServiceImplTest method testSave.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void testSave() throws Exception {
final User user = userService.create();
user.setName("TEST");
user.setFullName("TEST");
user.setEmail("test@example.com");
user.setTimeZone(DateTimeZone.UTC);
user.setPassword("TEST");
user.setPermissions(Collections.<String>emptyList());
final String id = userService.save(user);
final DBObject query = BasicDBObjectBuilder.start("_id", new ObjectId(id)).get();
final DBObject dbObject = mongoConnection.getDatabase().getCollection(UserImpl.COLLECTION_NAME).findOne(query);
assertThat(dbObject.get("username")).isEqualTo("TEST");
assertThat(dbObject.get("full_name")).isEqualTo("TEST");
assertThat(dbObject.get("email")).isEqualTo("test@example.com");
assertThat(dbObject.get("timezone")).isEqualTo("UTC");
assertThat((String) dbObject.get("password")).isNotEmpty();
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class UserServiceImplTest method testLoad.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testLoad() throws Exception {
final User user = userService.load("user1");
assertThat(user).isNotNull();
assertThat(user.getName()).isEqualTo("user1");
assertThat(user.getEmail()).isEqualTo("user1@example.com");
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method searchForAllMessages.
@Test
@UsingDataSet(locations = "searchForExistingKeyword.json")
public void searchForAllMessages() {
final ValidatableResponse result = doSearchFor("*");
final JsonPath response = result.statusCode(200).extract().jsonPath();
assertThat(response.getInt("total_results")).isEqualTo(2);
assertThat(response.getList("messages")).hasSize(2);
assertThat(response.getList("used_indices")).hasSize(1);
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method searchForExistingKeywordOutsideOfTimeRange.
@Test
@UsingDataSet(locations = "searchForExistingKeyword.json")
public void searchForExistingKeywordOutsideOfTimeRange() {
final ValidatableResponse result = doSearchFor("Testmessage", "2015-06-14T11:32:16.827Z", "2015-06-15T11:32:16.827Z");
final JsonPath response = result.statusCode(200).extract().jsonPath();
assertThat(response.getInt("total_results")).isEqualTo(0);
assertThat(response.getList("messages")).isEmpty();
assertThat(response.getList("used_indices")).hasSize(1);
}
Aggregations