use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class ContentPackInstallationPersistenceServiceTest method findByIdWithInvalidId.
@Test
@MongoDBFixtures("ContentPackInstallationPersistenceServiceTest.json")
public void findByIdWithInvalidId() {
final Optional<ContentPackInstallation> contentPacks = persistenceService.findById(new ObjectId("0000000000000000deadbeef"));
assertThat(contentPacks).isEmpty();
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class ContentPackInstallationPersistenceServiceTest method findByContentPackId.
@Test
@MongoDBFixtures("ContentPackInstallationPersistenceServiceTest.json")
public void findByContentPackId() {
final ModelId id = ModelId.of("4e3d7025-881e-6870-da03-cafebabe0001");
final Set<ContentPackInstallation> contentPacks = persistenceService.findByContentPackId(id);
assertThat(contentPacks).hasSize(2).allSatisfy(contentPackInstallation -> assertThat(contentPackInstallation.contentPackId()).isEqualTo(id)).anySatisfy(contentPackInstallation -> assertThat(contentPackInstallation.id()).isEqualTo(new ObjectId("5b4c935b4b900a0000000001"))).anySatisfy(contentPackInstallation -> assertThat(contentPackInstallation.id()).isEqualTo(new ObjectId("5b4c935b4b900a0000000002")));
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class ContentPackInstallationPersistenceServiceTest method deleteByIdWithInvalidId.
@Test
@MongoDBFixtures("ContentPackInstallationPersistenceServiceTest.json")
public void deleteByIdWithInvalidId() {
final int deletedContentPacks = persistenceService.deleteById(new ObjectId("0000000000000000deadbeef"));
final Set<ContentPackInstallation> contentPacks = persistenceService.loadAll();
assertThat(deletedContentPacks).isEqualTo(0);
assertThat(contentPacks).hasSize(4);
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class ContentPackInstallationPersistenceServiceTest method findById.
@Test
@MongoDBFixtures("ContentPackInstallationPersistenceServiceTest.json")
public void findById() {
final ObjectId objectId = new ObjectId("5b4c935b4b900a0000000001");
final Optional<ContentPackInstallation> contentPacks = persistenceService.findById(objectId);
assertThat(contentPacks).isPresent().get().satisfies(contentPackInstallation -> assertThat(contentPackInstallation.id()).isEqualTo(objectId));
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class ContentPackInstallationPersistenceServiceTest method findByContentPackIdAndRevision.
@Test
@MongoDBFixtures("ContentPackInstallationPersistenceServiceTest.json")
public void findByContentPackIdAndRevision() {
final ModelId id = ModelId.of("4e3d7025-881e-6870-da03-cafebabe0001");
final Set<ContentPackInstallation> contentPack = persistenceService.findByContentPackIdAndRevision(id, 1);
assertThat(contentPack).hasSize(1).anySatisfy(c -> assertThat(c.contentPackId()).isEqualTo(id));
}
Aggregations