@Test void testMultipleIfOneOfTheCredentialsIsNotExistsThenNotFoundExceptionComes() { when(credentialService.findByNameAndAccountId(anyString(), anyString(), any(Set.class), any())).thenReturn(Optional.empty()); Set<Credential> result = underTest.deleteMultiple(Set.of("someCredNameWhichDoesNotExists"), ACCOUNT_ID, ENVIRONMENT); verify(credentialService, times(1)).findByNameAndAccountId(anyString(), anyString(), anyCollection(), any()); verify(environmentViewService, times(0)).findAllByCredentialId(anyLong()); verify(credentialService, times(0)).save(any()); assertTrue(result.isEmpty()); }
public Set<Credential> deleteMultiple(Set<String> names, String accountId, CredentialType type) { Set<Credential> deletedOnes = new LinkedHashSet<>(); names.forEach(credentialName -> { try { deletedOnes.add(deleteByName(credentialName, accountId, type)); } catch (Exception ex) { LOGGER.debug("Could not delete Credential with name {} because: {}", credentialName, ex.getMessage()); } }); return deletedOnes; }
CredentialDeleteService extends AbstractCredentialService { public Set<Credential> deleteMultiple(Set<String> names, String accountId, CredentialType type) { Set<Credential> deletedOnes = new LinkedHashSet<>(); names.forEach(credentialName -> { try { deletedOnes.add(deleteByName(credentialName, accountId, type)); } catch (Exception ex) { LOGGER.debug("Could not delete Credential with name {} because: {}", credentialName, ex.getMessage()); } }); return deletedOnes; } }
CredentialDeleteService extends AbstractCredentialService { public Set<Credential> deleteMultiple(Set<String> names, String accountId, CredentialType type) { Set<Credential> deletedOnes = new LinkedHashSet<>(); names.forEach(credentialName -> { try { deletedOnes.add(deleteByName(credentialName, accountId, type)); } catch (Exception ex) { LOGGER.debug("Could not delete Credential with name {} because: {}", credentialName, ex.getMessage()); } }); return deletedOnes; } CredentialDeleteService(CredentialService credentialService,
            NotificationSender notificationSender,
            CloudbreakMessagesService messagesService,
            EnvironmentViewService environmentViewService,
            GrpcUmsClient grpcUmsClient,
            @Value("${environment.enabledplatforms}") Set<String> enabledPlatforms); }
CredentialDeleteService extends AbstractCredentialService { public Set<Credential> deleteMultiple(Set<String> names, String accountId, CredentialType type) { Set<Credential> deletedOnes = new LinkedHashSet<>(); names.forEach(credentialName -> { try { deletedOnes.add(deleteByName(credentialName, accountId, type)); } catch (Exception ex) { LOGGER.debug("Could not delete Credential with name {} because: {}", credentialName, ex.getMessage()); } }); return deletedOnes; } CredentialDeleteService(CredentialService credentialService,
            NotificationSender notificationSender,
            CloudbreakMessagesService messagesService,
            EnvironmentViewService environmentViewService,
            GrpcUmsClient grpcUmsClient,
            @Value("${environment.enabledplatforms}") Set<String> enabledPlatforms); Set<Credential> deleteMultiple(Set<String> names, String accountId, CredentialType type); Credential deleteByName(String name, String accountId, CredentialType type); Credential deleteByCrn(String crn, String accountId, CredentialType type); }
CredentialDeleteService extends AbstractCredentialService { public Set<Credential> deleteMultiple(Set<String> names, String accountId, CredentialType type) { Set<Credential> deletedOnes = new LinkedHashSet<>(); names.forEach(credentialName -> { try { deletedOnes.add(deleteByName(credentialName, accountId, type)); } catch (Exception ex) { LOGGER.debug("Could not delete Credential with name {} because: {}", credentialName, ex.getMessage()); } }); return deletedOnes; } CredentialDeleteService(CredentialService credentialService,
            NotificationSender notificationSender,
            CloudbreakMessagesService messagesService,
            EnvironmentViewService environmentViewService,
            GrpcUmsClient grpcUmsClient,
            @Value("${environment.enabledplatforms}") Set<String> enabledPlatforms); Set<Credential> deleteMultiple(Set<String> names, String accountId, CredentialType type); Credential deleteByName(String name, String accountId, CredentialType type); Credential deleteByCrn(String crn, String accountId, CredentialType type);  }