@Test public void testGetAllAvailableViewInWorkspaceGivenAttributeIsNullWhenWithSdxReady() { Set<BlueprintView> blueprintViews = Set.of(getBlueprintView("bp1", null)); when(blueprintViewRepository.findAllByNotDeletedInWorkspace(1L)).thenReturn(blueprintViews); Set<BlueprintView> result = underTest.getAllAvailableViewInWorkspaceAndFilterBySdxReady(1L, true); assertEquals(1, result.size()); assertTrue(result.stream().map(BlueprintView::getName).collect(Collectors.toSet()).contains("bp1")); }
public Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx) { User user = getLoggedInUser(); Workspace workspace = getWorkspaceService().get(workspaceId, user); updateDefaultBlueprintCollection(workspace); Set<BlueprintView> allByNotDeletedInWorkspace = blueprintViewRepository.findAllByNotDeletedInWorkspace(workspaceId); allByNotDeletedInWorkspace = allByNotDeletedInWorkspace.stream() .filter(b -> blueprintListFilters.isDistroXDisplayed(b)).collect(Collectors.toSet()); if (withSdx) { return allByNotDeletedInWorkspace; } return allByNotDeletedInWorkspace.stream() .filter(it -> !blueprintListFilters.isDatalakeBlueprint(it)).collect(Collectors.toSet()); }
BlueprintService extends AbstractWorkspaceAwareResourceService<Blueprint> implements ResourceBasedCrnProvider { public Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx) { User user = getLoggedInUser(); Workspace workspace = getWorkspaceService().get(workspaceId, user); updateDefaultBlueprintCollection(workspace); Set<BlueprintView> allByNotDeletedInWorkspace = blueprintViewRepository.findAllByNotDeletedInWorkspace(workspaceId); allByNotDeletedInWorkspace = allByNotDeletedInWorkspace.stream() .filter(b -> blueprintListFilters.isDistroXDisplayed(b)).collect(Collectors.toSet()); if (withSdx) { return allByNotDeletedInWorkspace; } return allByNotDeletedInWorkspace.stream() .filter(it -> !blueprintListFilters.isDatalakeBlueprint(it)).collect(Collectors.toSet()); } }
BlueprintService extends AbstractWorkspaceAwareResourceService<Blueprint> implements ResourceBasedCrnProvider { public Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx) { User user = getLoggedInUser(); Workspace workspace = getWorkspaceService().get(workspaceId, user); updateDefaultBlueprintCollection(workspace); Set<BlueprintView> allByNotDeletedInWorkspace = blueprintViewRepository.findAllByNotDeletedInWorkspace(workspaceId); allByNotDeletedInWorkspace = allByNotDeletedInWorkspace.stream() .filter(b -> blueprintListFilters.isDistroXDisplayed(b)).collect(Collectors.toSet()); if (withSdx) { return allByNotDeletedInWorkspace; } return allByNotDeletedInWorkspace.stream() .filter(it -> !blueprintListFilters.isDatalakeBlueprint(it)).collect(Collectors.toSet()); }  }
BlueprintService extends AbstractWorkspaceAwareResourceService<Blueprint> implements ResourceBasedCrnProvider { public Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx) { User user = getLoggedInUser(); Workspace workspace = getWorkspaceService().get(workspaceId, user); updateDefaultBlueprintCollection(workspace); Set<BlueprintView> allByNotDeletedInWorkspace = blueprintViewRepository.findAllByNotDeletedInWorkspace(workspaceId); allByNotDeletedInWorkspace = allByNotDeletedInWorkspace.stream() .filter(b -> blueprintListFilters.isDistroXDisplayed(b)).collect(Collectors.toSet()); if (withSdx) { return allByNotDeletedInWorkspace; } return allByNotDeletedInWorkspace.stream() .filter(it -> !blueprintListFilters.isDatalakeBlueprint(it)).collect(Collectors.toSet()); }  Blueprint get(Long id); Blueprint createForLoggedInUser(Blueprint blueprint, Long workspaceId, String accountId, String creator); Blueprint deleteByWorkspace(NameOrCrn nameOrCrn, Long workspaceId); Blueprint getByWorkspace(@NotNull NameOrCrn nameOrCrn, Long workspaceId); void decorateWithCrn(Blueprint bp, String accountId, String creator); PlatformRecommendation getRecommendation(Long workspaceId, String blueprintName, String credentialName,
            String region, String platformVariant, String availabilityZone, CdpResourceType cdpResourceType); PlatformRecommendation getRecommendationByCredentialCrn(Long workspaceId, String blueprintName, String credentialCrn,
            String region, String platformVariant, String availabilityZone, CdpResourceType cdpResourceType); AutoscaleRecommendation getAutoscaleRecommendation(Long workspaceId, String blueprintName); ScaleRecommendation getScaleRecommendation(Long workspaceId, String blueprintName); @Override Set<Blueprint> findAllByWorkspace(Workspace workspace); @Override Set<Blueprint> findAllByWorkspaceId(Long workspaceId); Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx); Set<Blueprint> getAllAvailableInWorkspace(Workspace workspace); Blueprint getByNameForWorkspaceAndLoadDefaultsIfNecessary(String name, Workspace workspace); void updateDefaultBlueprintCollection(Long workspaceId); boolean isDatalakeBlueprint(Blueprint blueprint); boolean isClouderaManagerTemplate(Blueprint blueprint); String getBlueprintVariant(Blueprint blueprint); @Override Blueprint getByNameForWorkspace(String name, Workspace workspace); @Override Blueprint delete(Blueprint blueprint); @Override WorkspaceResourceRepository<Blueprint, Long> repository(); Map<String, String> queryCustomParametersMap(String name, Long workspaceId); Set<ConfigQueryEntry> queryFileSystemParameters(String blueprintName, String clusterName,
            String baseLocation, String fileSystemType, String accountName, boolean attachedCluster,
            boolean secure, Long workspaceId); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnsInAccount(); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceNames); Blueprint getByResourceCrn(String resourceCrn); @Override AuthorizationResourceType getResourceType(); BlueprintStatusView getStatusViewByResourceCrn(String resourceCrn); }
BlueprintService extends AbstractWorkspaceAwareResourceService<Blueprint> implements ResourceBasedCrnProvider { public Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx) { User user = getLoggedInUser(); Workspace workspace = getWorkspaceService().get(workspaceId, user); updateDefaultBlueprintCollection(workspace); Set<BlueprintView> allByNotDeletedInWorkspace = blueprintViewRepository.findAllByNotDeletedInWorkspace(workspaceId); allByNotDeletedInWorkspace = allByNotDeletedInWorkspace.stream() .filter(b -> blueprintListFilters.isDistroXDisplayed(b)).collect(Collectors.toSet()); if (withSdx) { return allByNotDeletedInWorkspace; } return allByNotDeletedInWorkspace.stream() .filter(it -> !blueprintListFilters.isDatalakeBlueprint(it)).collect(Collectors.toSet()); }  Blueprint get(Long id); Blueprint createForLoggedInUser(Blueprint blueprint, Long workspaceId, String accountId, String creator); Blueprint deleteByWorkspace(NameOrCrn nameOrCrn, Long workspaceId); Blueprint getByWorkspace(@NotNull NameOrCrn nameOrCrn, Long workspaceId); void decorateWithCrn(Blueprint bp, String accountId, String creator); PlatformRecommendation getRecommendation(Long workspaceId, String blueprintName, String credentialName,
            String region, String platformVariant, String availabilityZone, CdpResourceType cdpResourceType); PlatformRecommendation getRecommendationByCredentialCrn(Long workspaceId, String blueprintName, String credentialCrn,
            String region, String platformVariant, String availabilityZone, CdpResourceType cdpResourceType); AutoscaleRecommendation getAutoscaleRecommendation(Long workspaceId, String blueprintName); ScaleRecommendation getScaleRecommendation(Long workspaceId, String blueprintName); @Override Set<Blueprint> findAllByWorkspace(Workspace workspace); @Override Set<Blueprint> findAllByWorkspaceId(Long workspaceId); Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx); Set<Blueprint> getAllAvailableInWorkspace(Workspace workspace); Blueprint getByNameForWorkspaceAndLoadDefaultsIfNecessary(String name, Workspace workspace); void updateDefaultBlueprintCollection(Long workspaceId); boolean isDatalakeBlueprint(Blueprint blueprint); boolean isClouderaManagerTemplate(Blueprint blueprint); String getBlueprintVariant(Blueprint blueprint); @Override Blueprint getByNameForWorkspace(String name, Workspace workspace); @Override Blueprint delete(Blueprint blueprint); @Override WorkspaceResourceRepository<Blueprint, Long> repository(); Map<String, String> queryCustomParametersMap(String name, Long workspaceId); Set<ConfigQueryEntry> queryFileSystemParameters(String blueprintName, String clusterName,
            String baseLocation, String fileSystemType, String accountName, boolean attachedCluster,
            boolean secure, Long workspaceId); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnsInAccount(); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceNames); Blueprint getByResourceCrn(String resourceCrn); @Override AuthorizationResourceType getResourceType(); BlueprintStatusView getStatusViewByResourceCrn(String resourceCrn);  }