use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class ClusterConfigServiceImplTest method getReturnsNullOnNonExistingConfig.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void getReturnsNullOnNonExistingConfig() throws Exception {
final DBCollection collection = mongoConnection.getDatabase().getCollection(COLLECTION_NAME);
assertThat(collection.count()).isEqualTo(0L);
assertThat(clusterConfigService.get(CustomConfig.class)).isNull();
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class DashboardServiceImplTest method testCreate.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void testCreate() throws Exception {
final String title = "Dashboard Title";
final String description = "This is the dashboard description";
final String creatorUserId = "foobar";
final DateTime createdAt = Tools.nowUTC();
final Dashboard dashboard = dashboardService.create(title, description, creatorUserId, createdAt);
assertNotNull(dashboard);
assertEquals(title, dashboard.getTitle());
assertEquals(description, dashboard.getDescription());
assertNotNull(dashboard.getId());
assertEquals(0, dashboardService.count());
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class LdapSettingsServiceImplTest method loadReturnsNullIfDatabaseHasMoreThanOneEntry.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void loadReturnsNullIfDatabaseHasMoreThanOneEntry() throws Exception {
final DBCollection collection = mongoRule.getMongoConnection().getDatabase().getCollection("ldap_settings");
collection.insert(new BasicDBObject("foo", "bar"), new BasicDBObject("quux", "baz"));
assertThat(ldapSettingsService.load()).isNull();
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class LdapSettingsServiceImplTest method loadReturnsLdapSettings.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void loadReturnsLdapSettings() throws Exception {
final LdapSettings ldapSettings = ldapSettingsService.load();
assertThat(ldapSettings).isNotNull();
assertThat(ldapSettings.getId()).isEqualTo("54e3deadbeefdeadbeefaffe");
assertThat(ldapSettings.getUri()).isEqualTo(URI.create("ldap://localhost:389"));
assertThat(ldapSettings.getSystemPassword()).isEqualTo("password");
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class LdapSettingsServiceImplTest method deleteRemovesAllLdapSettings.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void deleteRemovesAllLdapSettings() throws Exception {
final DBCollection collection = mongoRule.getMongoConnection().getDatabase().getCollection("ldap_settings");
assertThat(collection.count()).isEqualTo(1L);
ldapSettingsService.delete();
assertThat(collection.count()).isEqualTo(0);
}
Aggregations