use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.UsedImagesListV4Response in project cloudbreak by hortonworks.
the class UsedImagesProvider method getUsedImages.
public UsedImagesListV4Response getUsedImages(Integer thresholdInDays) {
final UsedImagesListV4Response usedImages = new UsedImagesListV4Response();
stackService.getImagesOfAliveStacks(thresholdInDays).forEach(usedImages::addImage);
return usedImages;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.UsedImagesListV4Response in project cloudbreak by hortonworks.
the class UsedImagesAction method action.
@Override
public UsedImagesTestDto action(TestContext testContext, UsedImagesTestDto testDto, CloudbreakClient client) throws Exception {
final UsedImagesListV4Response usedImages = client.getInternalClient(testContext).utilV4Endpoint().usedImages(null);
testDto.setResponse(usedImages);
return testDto;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.UsedImagesListV4Response in project cloudbreak by hortonworks.
the class UsedImagesProviderTest method testEmpty.
@Test
void testEmpty() {
when(stackService.getImagesOfAliveStacks(THRESHOLD_IN_DAYS)).thenReturn(List.of());
final UsedImagesListV4Response result = underTest.getUsedImages(THRESHOLD_IN_DAYS);
assertThat(result.getUsedImages()).isEmpty();
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.UsedImagesListV4Response in project cloudbreak by hortonworks.
the class UsedImagesProviderTest method testMultipleImages.
@Test
void testMultipleImages() {
when(stackService.getImagesOfAliveStacks(THRESHOLD_IN_DAYS)).thenReturn(List.of(createImage("aws-image"), createImage("aws-image"), createImage("azure-image")));
final UsedImagesListV4Response result = underTest.getUsedImages(THRESHOLD_IN_DAYS);
assertThat(result.getUsedImages()).hasSize(2).anyMatch(usedImage -> usedImage.getImage().getImageId().equals("aws-image") && usedImage.getNumberOfStacks() == 2).anyMatch(usedImage -> usedImage.getImage().getImageId().equals("azure-image") && usedImage.getNumberOfStacks() == 1);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.UsedImagesListV4Response in project cloudbreak by hortonworks.
the class UsedImagesProviderTest method testSingleImage.
@Test
void testSingleImage() {
when(stackService.getImagesOfAliveStacks(THRESHOLD_IN_DAYS)).thenReturn(List.of(createImage("aws-image")));
final UsedImagesListV4Response result = underTest.getUsedImages(THRESHOLD_IN_DAYS);
assertThat(result.getUsedImages()).hasSize(1).first().matches(usedImage -> usedImage.getNumberOfStacks() == 1);
}
Aggregations