@Test void testListSdxClustersWhenInvalidEnvironmentNameProvidedShouldThrowBadRequest() { String crn = "crsdfadsfdsf sadasf3-df81ae585e10"; assertThrows(BadRequestException.class, () -> underTest.listSdx(crn, "envir")); }
public List<SdxCluster> listSdx(String userCrn, String envName) { String accountIdFromCrn = getAccountIdFromCrn(userCrn); if (envName != null) { LOGGER.info("Listing SDX clusters by environment name {}", envName); return sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNull(accountIdFromCrn, envName); } else { return sdxClusterRepository.findByAccountIdAndDeletedIsNull(accountIdFromCrn); } }
SdxService implements ResourceIdProvider, ResourceBasedCrnProvider { public List<SdxCluster> listSdx(String userCrn, String envName) { String accountIdFromCrn = getAccountIdFromCrn(userCrn); if (envName != null) { LOGGER.info("Listing SDX clusters by environment name {}", envName); return sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNull(accountIdFromCrn, envName); } else { return sdxClusterRepository.findByAccountIdAndDeletedIsNull(accountIdFromCrn); } } }
SdxService implements ResourceIdProvider, ResourceBasedCrnProvider { public List<SdxCluster> listSdx(String userCrn, String envName) { String accountIdFromCrn = getAccountIdFromCrn(userCrn); if (envName != null) { LOGGER.info("Listing SDX clusters by environment name {}", envName); return sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNull(accountIdFromCrn, envName); } else { return sdxClusterRepository.findByAccountIdAndDeletedIsNull(accountIdFromCrn); } }  }
SdxService implements ResourceIdProvider, ResourceBasedCrnProvider { public List<SdxCluster> listSdx(String userCrn, String envName) { String accountIdFromCrn = getAccountIdFromCrn(userCrn); if (envName != null) { LOGGER.info("Listing SDX clusters by environment name {}", envName); return sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNull(accountIdFromCrn, envName); } else { return sdxClusterRepository.findByAccountIdAndDeletedIsNull(accountIdFromCrn); } }  String getStackCrnByClusterCrn(String crn); Set<Long> findByResourceIdsAndStatuses(Set<Long> resourceIds, Set<DatalakeStatusEnum> statuses); SdxCluster getById(Long id); StackV4Response getDetail(String name, Set<String> entries, String accountId); SdxCluster getByCrn(String userCrn, String clusterCrn); SdxCluster getByNameInAccount(String userCrn, String name); Pair<SdxCluster, FlowIdentifier> createSdx(final String userCrn, final String name, final SdxClusterRequest sdxClusterRequest,
            final StackV4Request internalStackV4Request); FlowIdentifier sync(String name, String accountId); void syncByCrn(String userCrn, String crn); @Override Long getResourceIdByResourceCrn(String resourceCrn); @Override Long getResourceIdByResourceName(String resourceName); List<SdxCluster> listSdxByEnvCrn(String userCrn, String envCrn); List<SdxCluster> listSdxByEnvCrn(String envCrn); List<SdxCluster> listSdx(String userCrn, String envName); FlowIdentifier deleteSdxByClusterCrn(String userCrn, String clusterCrn, boolean forced); FlowIdentifier deleteSdx(String userCrn, String name, boolean forced); void updateRuntimeVersionFromStackResponse(SdxCluster sdxCluster, StackV4Response stackV4Response); String getAccountIdFromCrn(String crnStr); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceNames); @Override List<String> getResourceCrnsInAccount(); @Override Optional<String> getEnvironmentCrnByResourceCrn(String resourceCrn); @Override AuthorizationResourceType getResourceType(); SdxCluster save(SdxCluster sdxCluster); }
SdxService implements ResourceIdProvider, ResourceBasedCrnProvider { public List<SdxCluster> listSdx(String userCrn, String envName) { String accountIdFromCrn = getAccountIdFromCrn(userCrn); if (envName != null) { LOGGER.info("Listing SDX clusters by environment name {}", envName); return sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNull(accountIdFromCrn, envName); } else { return sdxClusterRepository.findByAccountIdAndDeletedIsNull(accountIdFromCrn); } }  String getStackCrnByClusterCrn(String crn); Set<Long> findByResourceIdsAndStatuses(Set<Long> resourceIds, Set<DatalakeStatusEnum> statuses); SdxCluster getById(Long id); StackV4Response getDetail(String name, Set<String> entries, String accountId); SdxCluster getByCrn(String userCrn, String clusterCrn); SdxCluster getByNameInAccount(String userCrn, String name); Pair<SdxCluster, FlowIdentifier> createSdx(final String userCrn, final String name, final SdxClusterRequest sdxClusterRequest,
            final StackV4Request internalStackV4Request); FlowIdentifier sync(String name, String accountId); void syncByCrn(String userCrn, String crn); @Override Long getResourceIdByResourceCrn(String resourceCrn); @Override Long getResourceIdByResourceName(String resourceName); List<SdxCluster> listSdxByEnvCrn(String userCrn, String envCrn); List<SdxCluster> listSdxByEnvCrn(String envCrn); List<SdxCluster> listSdx(String userCrn, String envName); FlowIdentifier deleteSdxByClusterCrn(String userCrn, String clusterCrn, boolean forced); FlowIdentifier deleteSdx(String userCrn, String name, boolean forced); void updateRuntimeVersionFromStackResponse(SdxCluster sdxCluster, StackV4Response stackV4Response); String getAccountIdFromCrn(String crnStr); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceNames); @Override List<String> getResourceCrnsInAccount(); @Override Optional<String> getEnvironmentCrnByResourceCrn(String resourceCrn); @Override AuthorizationResourceType getResourceType(); SdxCluster save(SdxCluster sdxCluster);  }