@Test public void testGetImagesWhenLatestDevVersionDoesntExistInCatalogShouldReturnWithReleasedVersionIfExists() throws Exception { setupImageCatalogProvider(CUSTOM_IMAGE_CATALOG_URL, DEV_CATALOG_FILE); ImageCatalog imageCatalog = getImageCatalog(); Set<String> vMImageUUIDs = Set.of("cab28152-f5e1-43e1-5107-9e7bbed33eef"); Set<String> defaultVMImageUUIDs = Set.of("cab28152-f5e1-43e1-5107-9e7bbed33eef"); Set<String> supportedVersions = Set.of("2.1.0-dev.2"); PrefixMatchImages prefixMatchImages = new PrefixMatchImages(vMImageUUIDs, defaultVMImageUUIDs, supportedVersions); when(prefixMatcherService.prefixMatchForCBVersion(any(), any())).thenReturn(prefixMatchImages); StatedImages images = underTest.getImages( new ImageFilter(imageCatalog, Collections.singleton("aws"), "2.6.0-dev.132", true, ImmutableSet.of("amazonlinux", "centos7"), null)); boolean match = images.getImages().getBaseImages().stream() .anyMatch(img -> "cab28152-f5e1-43e1-5107-9e7bbed33eef".equals(img.getUuid())); assertTrue("Result doesn't contain the required base image with id.", match); }
public StatedImages getImages(Long workspaceId, String name, String provider) throws CloudbreakImageCatalogException { return getImages(workspaceId, name, ImmutableSet.of(provider)); }
ImageCatalogService extends AbstractWorkspaceAwareResourceService<ImageCatalog> implements ResourceBasedCrnProvider { public StatedImages getImages(Long workspaceId, String name, String provider) throws CloudbreakImageCatalogException { return getImages(workspaceId, name, ImmutableSet.of(provider)); } }
ImageCatalogService extends AbstractWorkspaceAwareResourceService<ImageCatalog> implements ResourceBasedCrnProvider { public StatedImages getImages(Long workspaceId, String name, String provider) throws CloudbreakImageCatalogException { return getImages(workspaceId, name, ImmutableSet.of(provider)); }  }
ImageCatalogService extends AbstractWorkspaceAwareResourceService<ImageCatalog> implements ResourceBasedCrnProvider { public StatedImages getImages(Long workspaceId, String name, String provider) throws CloudbreakImageCatalogException { return getImages(workspaceId, name, ImmutableSet.of(provider)); }  @Override Set<ImageCatalog> findAllByWorkspaceId(Long workspaceId); ImageCatalog delete(NameOrCrn imageCatalogNameOrCrn, Long workspaceId); @Override Set<ImageCatalog> findAllByWorkspace(Workspace workspace); ImageCatalog createForLoggedInUser(ImageCatalog imageCatalog, Long workspaceId, String accountId, String creator); ImageCatalog get(NameOrCrn imageCatalogNameOrCrn, Long workspaceId); ImageCatalog findByResourceCrn(String resourceCrn); Images getImagesByCatalogName(Long workspaceId, String catalogName, String stackName, String platform); Images getImagesFromDefault(Long workspaceId, String stackName, String platform, Set<String> operatingSystems); StatedImages getStatedImagesFilteredByOperatingSystems(ImageFilter imageFilter, Predicate<Image> imageFilterPredicate); StatedImage getLatestBaseImageDefaultPreferred(ImageFilter imageFilter, Predicate<Image> imageFilterPredicate); StatedImage getImagePrewarmedDefaultPreferred(ImageFilter imageFilter, Predicate<Image> imageFilterPredicate); StatedImages getImages(Long workspaceId, String name, String provider); StatedImages getImages(Long workspaceId, String name, Set<String> providers); StatedImage getImage(String imageId); StatedImage getImage(String catalogUrl, String catalogName, String imageId); StatedImage getImageByCatalogName(Long workspaceId, String imageId, String catalogName); ImageCatalog delete(Long workspaceId, String name); Set<ImageCatalog> deleteMultiple(Long workspaceId, Set<String> names); ImageCatalog get(Long workspaceId, String name); boolean isEnvDefault(String name); ImageCatalog update(Long workspaceId, ImageCatalog source); StatedImages getImages(ImageFilter imageFilter); Images propagateImagesIfRequested(Long workspaceId, String name, Boolean withImages); boolean baseImageEnabled(); @Nonnull ImageCatalog getDefaultImageCatalog(User user); String getDefaultImageCatalogName(User user); String getImageDefaultCatalogUrl(User user); @Override WorkspaceResourceRepository<ImageCatalog, Long> repository(); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceNames); @Override List<String> getResourceCrnsInAccount(); List<ImageCatalog> getDefaultImageCatalogs(); @Override AuthorizationResourceType getResourceType(); }
ImageCatalogService extends AbstractWorkspaceAwareResourceService<ImageCatalog> implements ResourceBasedCrnProvider { public StatedImages getImages(Long workspaceId, String name, String provider) throws CloudbreakImageCatalogException { return getImages(workspaceId, name, ImmutableSet.of(provider)); }  @Override Set<ImageCatalog> findAllByWorkspaceId(Long workspaceId); ImageCatalog delete(NameOrCrn imageCatalogNameOrCrn, Long workspaceId); @Override Set<ImageCatalog> findAllByWorkspace(Workspace workspace); ImageCatalog createForLoggedInUser(ImageCatalog imageCatalog, Long workspaceId, String accountId, String creator); ImageCatalog get(NameOrCrn imageCatalogNameOrCrn, Long workspaceId); ImageCatalog findByResourceCrn(String resourceCrn); Images getImagesByCatalogName(Long workspaceId, String catalogName, String stackName, String platform); Images getImagesFromDefault(Long workspaceId, String stackName, String platform, Set<String> operatingSystems); StatedImages getStatedImagesFilteredByOperatingSystems(ImageFilter imageFilter, Predicate<Image> imageFilterPredicate); StatedImage getLatestBaseImageDefaultPreferred(ImageFilter imageFilter, Predicate<Image> imageFilterPredicate); StatedImage getImagePrewarmedDefaultPreferred(ImageFilter imageFilter, Predicate<Image> imageFilterPredicate); StatedImages getImages(Long workspaceId, String name, String provider); StatedImages getImages(Long workspaceId, String name, Set<String> providers); StatedImage getImage(String imageId); StatedImage getImage(String catalogUrl, String catalogName, String imageId); StatedImage getImageByCatalogName(Long workspaceId, String imageId, String catalogName); ImageCatalog delete(Long workspaceId, String name); Set<ImageCatalog> deleteMultiple(Long workspaceId, Set<String> names); ImageCatalog get(Long workspaceId, String name); boolean isEnvDefault(String name); ImageCatalog update(Long workspaceId, ImageCatalog source); StatedImages getImages(ImageFilter imageFilter); Images propagateImagesIfRequested(Long workspaceId, String name, Boolean withImages); boolean baseImageEnabled(); @Nonnull ImageCatalog getDefaultImageCatalog(User user); String getDefaultImageCatalogName(User user); String getImageDefaultCatalogUrl(User user); @Override WorkspaceResourceRepository<ImageCatalog, Long> repository(); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceNames); @Override List<String> getResourceCrnsInAccount(); List<ImageCatalog> getDefaultImageCatalogs(); @Override AuthorizationResourceType getResourceType(); static final String UNDEFINED; static final String CDP_DEFAULT_CATALOG_NAME; }