use of org.graylog2.rest.models.system.contentpacks.responses.ContentPackList in project graylog2-server by Graylog2.
the class ContentPackResourceTest method listAndLatest.
@Test
public void listAndLatest() throws Exception {
final ContentPack contentPack = objectMapper.readValue(CONTENT_PACK, ContentPack.class);
final Set<ContentPack> contentPacks = Collections.singleton(contentPack);
final Map<ModelId, Map<Integer, ContentPackMetadata>> metaDataMap = Collections.emptyMap();
final ContentPackList expectedList = ContentPackList.create(contentPacks.size(), contentPacks, metaDataMap);
when(contentPackPersistenceService.loadAll()).thenReturn(Collections.singleton(contentPack));
final ContentPackList contentPackList = contentPackResource.listContentPacks();
verify(contentPackPersistenceService, times(1)).loadAll();
assertThat(contentPackList).isEqualTo(expectedList);
when(contentPackPersistenceService.loadAllLatest()).thenReturn(Collections.singleton(contentPack));
final ContentPackList contentPackLatest = contentPackResource.listLatestContentPacks();
verify(contentPackPersistenceService, times(1)).loadAll();
assertThat(contentPackLatest).isEqualTo(expectedList);
}
Aggregations