@Test void deleteDatahubClustersForEnvironment() { PollingConfig pollingConfig = PollingConfig.builder() .withSleepTime(0) .withSleepTimeUnit(TimeUnit.SECONDS) .withTimeout(10) .withTimeoutTimeUnit(TimeUnit.SECONDS) .build(); Environment environment = new Environment(); environment.setResourceCrn(ENV_CRN); StackViewV4Response distrox1 = new StackViewV4Response(); distrox1.setCrn("crn1"); StackViewV4Response distrox2 = new StackViewV4Response(); distrox2.setCrn("crn2"); when(datahubService.list(anyString())).thenReturn( new StackViewV4Responses(Set.of(distrox1, distrox2)), new StackViewV4Responses(Set.of(distrox2)), new StackViewV4Responses(Set.of())); underTest.deleteDatahubClustersForEnvironment(pollingConfig, environment, true); ArgumentCaptor<DistroXMultiDeleteV1Request> captor = ArgumentCaptor.forClass(DistroXMultiDeleteV1Request.class); verify(datahubService).deleteMultiple(anyString(), captor.capture(), eq(true)); DistroXMultiDeleteV1Request multiDeleteRequest = captor.getValue(); assertThat(multiDeleteRequest.getCrns()).hasSameElementsAs(Set.of("crn1", "crn2")); }
public void deleteDatahubClustersForEnvironment(PollingConfig pollingConfig, Environment environment, boolean force) { Collection<StackViewV4Response> list = datahubService.list(environment.getResourceCrn()).getResponses(); LOGGER.info("Found {} Data Hub clusters for environment {}.", list.size(), environment.getName()); if (list.isEmpty()) { LOGGER.info("No Data Hub clusters found for environment."); } else { waitDatahubClustersDeletion(pollingConfig, environment, list, force); LOGGER.info("Data hub deletion finished."); } }
DatahubDeletionService { public void deleteDatahubClustersForEnvironment(PollingConfig pollingConfig, Environment environment, boolean force) { Collection<StackViewV4Response> list = datahubService.list(environment.getResourceCrn()).getResponses(); LOGGER.info("Found {} Data Hub clusters for environment {}.", list.size(), environment.getName()); if (list.isEmpty()) { LOGGER.info("No Data Hub clusters found for environment."); } else { waitDatahubClustersDeletion(pollingConfig, environment, list, force); LOGGER.info("Data hub deletion finished."); } } }
DatahubDeletionService { public void deleteDatahubClustersForEnvironment(PollingConfig pollingConfig, Environment environment, boolean force) { Collection<StackViewV4Response> list = datahubService.list(environment.getResourceCrn()).getResponses(); LOGGER.info("Found {} Data Hub clusters for environment {}.", list.size(), environment.getName()); if (list.isEmpty()) { LOGGER.info("No Data Hub clusters found for environment."); } else { waitDatahubClustersDeletion(pollingConfig, environment, list, force); LOGGER.info("Data hub deletion finished."); } } DatahubDeletionService(DatahubService datahubService); }
DatahubDeletionService { public void deleteDatahubClustersForEnvironment(PollingConfig pollingConfig, Environment environment, boolean force) { Collection<StackViewV4Response> list = datahubService.list(environment.getResourceCrn()).getResponses(); LOGGER.info("Found {} Data Hub clusters for environment {}.", list.size(), environment.getName()); if (list.isEmpty()) { LOGGER.info("No Data Hub clusters found for environment."); } else { waitDatahubClustersDeletion(pollingConfig, environment, list, force); LOGGER.info("Data hub deletion finished."); } } DatahubDeletionService(DatahubService datahubService); void deleteDatahubClustersForEnvironment(PollingConfig pollingConfig, Environment environment, boolean force); }
DatahubDeletionService { public void deleteDatahubClustersForEnvironment(PollingConfig pollingConfig, Environment environment, boolean force) { Collection<StackViewV4Response> list = datahubService.list(environment.getResourceCrn()).getResponses(); LOGGER.info("Found {} Data Hub clusters for environment {}.", list.size(), environment.getName()); if (list.isEmpty()) { LOGGER.info("No Data Hub clusters found for environment."); } else { waitDatahubClustersDeletion(pollingConfig, environment, list, force); LOGGER.info("Data hub deletion finished."); } } DatahubDeletionService(DatahubService datahubService); void deleteDatahubClustersForEnvironment(PollingConfig pollingConfig, Environment environment, boolean force);  }