@Test public void deleteFailedDistroXesAreAttached() { when(environmentResourceDeletionService.getAttachedDistroXClusterNames(eq(environment))).thenReturn(Set.of("notempty")); assertThrows(BadRequestException.class, () -> environmentDeletionService.delete(environment, TestConstants.USER, false, false)); verify(reactorFlowManager, never()).triggerDeleteFlow(eq(environment), eq(TestConstants.USER), eq(false)); }
public Environment delete(Environment environment, String userCrn, boolean cascading, boolean forced) { MDCBuilder.buildMdcContext(environment); validateDeletion(environment, cascading); LOGGER.debug("Deleting environment with name: {}", environment.getName()); environmentJobService.unschedule(environment); if (cascading) { reactorFlowManager.triggerCascadingDeleteFlow(environment, userCrn, forced); } else { checkIsEnvironmentDeletable(environment); reactorFlowManager.triggerDeleteFlow(environment, userCrn, forced); } return environment; }
EnvironmentDeletionService { public Environment delete(Environment environment, String userCrn, boolean cascading, boolean forced) { MDCBuilder.buildMdcContext(environment); validateDeletion(environment, cascading); LOGGER.debug("Deleting environment with name: {}", environment.getName()); environmentJobService.unschedule(environment); if (cascading) { reactorFlowManager.triggerCascadingDeleteFlow(environment, userCrn, forced); } else { checkIsEnvironmentDeletable(environment); reactorFlowManager.triggerDeleteFlow(environment, userCrn, forced); } return environment; } }
EnvironmentDeletionService { public Environment delete(Environment environment, String userCrn, boolean cascading, boolean forced) { MDCBuilder.buildMdcContext(environment); validateDeletion(environment, cascading); LOGGER.debug("Deleting environment with name: {}", environment.getName()); environmentJobService.unschedule(environment); if (cascading) { reactorFlowManager.triggerCascadingDeleteFlow(environment, userCrn, forced); } else { checkIsEnvironmentDeletable(environment); reactorFlowManager.triggerDeleteFlow(environment, userCrn, forced); } return environment; } EnvironmentDeletionService(EnvironmentService environmentService, EnvironmentDtoConverter environmentDtoConverter,
            EnvironmentReactorFlowManager reactorFlowManager, EnvironmentResourceDeletionService environmentResourceDeletionService,
            EnvironmentJobService environmentJobService); }
EnvironmentDeletionService { public Environment delete(Environment environment, String userCrn, boolean cascading, boolean forced) { MDCBuilder.buildMdcContext(environment); validateDeletion(environment, cascading); LOGGER.debug("Deleting environment with name: {}", environment.getName()); environmentJobService.unschedule(environment); if (cascading) { reactorFlowManager.triggerCascadingDeleteFlow(environment, userCrn, forced); } else { checkIsEnvironmentDeletable(environment); reactorFlowManager.triggerDeleteFlow(environment, userCrn, forced); } return environment; } EnvironmentDeletionService(EnvironmentService environmentService, EnvironmentDtoConverter environmentDtoConverter,
            EnvironmentReactorFlowManager reactorFlowManager, EnvironmentResourceDeletionService environmentResourceDeletionService,
            EnvironmentJobService environmentJobService); EnvironmentDto deleteByNameAndAccountId(String environmentName, String accountId, String actualUserCrn,
        boolean cascading, boolean forced); EnvironmentDto deleteByCrnAndAccountId(String crn, String accountId, String actualUserCrn,
        boolean cascading, boolean forced); Environment delete(Environment environment, String userCrn,
        boolean cascading, boolean forced); List<EnvironmentDto> deleteMultipleByNames(Set<String> environmentNames, String accountId, String actualUserCrn,
        boolean cascading, boolean forced); List<EnvironmentDto> deleteMultipleByCrns(Set<String> crns, String accountId, String actualUserCrn,
        boolean cascading, boolean forced); }
EnvironmentDeletionService { public Environment delete(Environment environment, String userCrn, boolean cascading, boolean forced) { MDCBuilder.buildMdcContext(environment); validateDeletion(environment, cascading); LOGGER.debug("Deleting environment with name: {}", environment.getName()); environmentJobService.unschedule(environment); if (cascading) { reactorFlowManager.triggerCascadingDeleteFlow(environment, userCrn, forced); } else { checkIsEnvironmentDeletable(environment); reactorFlowManager.triggerDeleteFlow(environment, userCrn, forced); } return environment; } EnvironmentDeletionService(EnvironmentService environmentService, EnvironmentDtoConverter environmentDtoConverter,
            EnvironmentReactorFlowManager reactorFlowManager, EnvironmentResourceDeletionService environmentResourceDeletionService,
            EnvironmentJobService environmentJobService); EnvironmentDto deleteByNameAndAccountId(String environmentName, String accountId, String actualUserCrn,
        boolean cascading, boolean forced); EnvironmentDto deleteByCrnAndAccountId(String crn, String accountId, String actualUserCrn,
        boolean cascading, boolean forced); Environment delete(Environment environment, String userCrn,
        boolean cascading, boolean forced); List<EnvironmentDto> deleteMultipleByNames(Set<String> environmentNames, String accountId, String actualUserCrn,
        boolean cascading, boolean forced); List<EnvironmentDto> deleteMultipleByCrns(Set<String> crns, String accountId, String actualUserCrn,
        boolean cascading, boolean forced);  }