@Test public void testGetCdhImagesForCbVersionShouldReturnsImagesWhenThereAreMultipleSupportedImagesAreAvailableForCbVersion() { ReflectionTestUtils.setField(underTest, "cbVersion", CURRENT_CB_VERSION); Versions versions = createVersions(); Image properImage1 = createImage(PROPER_IMAGE_ID); Image properImage2 = createImage(PROPER_IMAGE_ID_2); Image otherImage = createImage(OTHER_IMAGE_ID); List<Image> actual = underTest.getCdhImagesForCbVersion(versions, List.of(properImage1, otherImage, properImage2)).getAvailableImages().getCdhImages(); assertTrue(actual.contains(properImage1)); assertTrue(actual.contains(properImage2)); assertEquals(2, actual.size()); }
public ImageFilterResult getCdhImagesForCbVersion(Versions versions, List<Image> availableImages) { Set<String> imageIds = getImageIds(versions); LOGGER.debug("{} image id(s) found for Cloudbreak version: {}", imageIds.size(), cbVersion); String message = String.format("%d image id(s) found for Cloudbreak version: %s", imageIds.size(), cbVersion); List<Image> images = availableImages.stream() .filter(image -> imageIds.contains(image.getUuid())) .collect(Collectors.toList()); return new ImageFilterResult(new Images(null, images, null), message); }
VersionBasedImageFilter { public ImageFilterResult getCdhImagesForCbVersion(Versions versions, List<Image> availableImages) { Set<String> imageIds = getImageIds(versions); LOGGER.debug("{} image id(s) found for Cloudbreak version: {}", imageIds.size(), cbVersion); String message = String.format("%d image id(s) found for Cloudbreak version: %s", imageIds.size(), cbVersion); List<Image> images = availableImages.stream() .filter(image -> imageIds.contains(image.getUuid())) .collect(Collectors.toList()); return new ImageFilterResult(new Images(null, images, null), message); } }
VersionBasedImageFilter { public ImageFilterResult getCdhImagesForCbVersion(Versions versions, List<Image> availableImages) { Set<String> imageIds = getImageIds(versions); LOGGER.debug("{} image id(s) found for Cloudbreak version: {}", imageIds.size(), cbVersion); String message = String.format("%d image id(s) found for Cloudbreak version: %s", imageIds.size(), cbVersion); List<Image> images = availableImages.stream() .filter(image -> imageIds.contains(image.getUuid())) .collect(Collectors.toList()); return new ImageFilterResult(new Images(null, images, null), message); }  }
VersionBasedImageFilter { public ImageFilterResult getCdhImagesForCbVersion(Versions versions, List<Image> availableImages) { Set<String> imageIds = getImageIds(versions); LOGGER.debug("{} image id(s) found for Cloudbreak version: {}", imageIds.size(), cbVersion); String message = String.format("%d image id(s) found for Cloudbreak version: %s", imageIds.size(), cbVersion); List<Image> images = availableImages.stream() .filter(image -> imageIds.contains(image.getUuid())) .collect(Collectors.toList()); return new ImageFilterResult(new Images(null, images, null), message); }  ImageFilterResult getCdhImagesForCbVersion(Versions versions, List<Image> availableImages); }
VersionBasedImageFilter { public ImageFilterResult getCdhImagesForCbVersion(Versions versions, List<Image> availableImages) { Set<String> imageIds = getImageIds(versions); LOGGER.debug("{} image id(s) found for Cloudbreak version: {}", imageIds.size(), cbVersion); String message = String.format("%d image id(s) found for Cloudbreak version: %s", imageIds.size(), cbVersion); List<Image> images = availableImages.stream() .filter(image -> imageIds.contains(image.getUuid())) .collect(Collectors.toList()); return new ImageFilterResult(new Images(null, images, null), message); }  ImageFilterResult getCdhImagesForCbVersion(Versions versions, List<Image> availableImages);  }