@Test void datahubClustersDeleteAction() { Action<?, ?> action = configureAction(() -> underTest.datahubClustersDeleteAction()); when(environmentService.findEnvironmentById(ENVIRONMENT_ID)).thenReturn(Optional.of(environment)); when(environmentService.save(environment)).thenReturn(savedEnvironment); when(environmentService.getEnvironmentDto(savedEnvironment)).thenReturn(environmentDto); action.execute(stateContext); verify(environment).setStatus(EnvironmentStatus.DATAHUB_CLUSTERS_DELETE_IN_PROGRESS); verify(eventSenderService).sendEventAndNotification(environmentDto, FLOW_TRIGGER_USER_CRN, ResourceEvent.ENVIRONMENT_DATAHUB_CLUSTERS_DELETION_STARTED); verify(eventBus).notify(selectorArgumentCaptor.capture(), eventArgumentCaptor.capture()); verify(reactorEventFactory).createEvent(headersArgumentCaptor.capture(), payloadArgumentCaptor.capture()); verifyDeleteActionSuccessEvent(DELETE_DATAHUB_CLUSTERS_EVENT); }
@Bean(name = "DATAHUB_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datahubClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATAHUB_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATAHUB_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATAHUB_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Hub clusters"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATAHUB_CLUSTERS_EVENT.selector(), envDto); } }; }
EnvClustersDeleteActions { @Bean(name = "DATAHUB_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datahubClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATAHUB_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATAHUB_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATAHUB_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Hub clusters"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATAHUB_CLUSTERS_EVENT.selector(), envDto); } }; } }
EnvClustersDeleteActions { @Bean(name = "DATAHUB_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datahubClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATAHUB_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATAHUB_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATAHUB_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Hub clusters"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATAHUB_CLUSTERS_EVENT.selector(), envDto); } }; } EnvClustersDeleteActions(EnvironmentService environmentService, EventSenderService eventService, EnvironmentMetricService metricService); }
EnvClustersDeleteActions { @Bean(name = "DATAHUB_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datahubClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATAHUB_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATAHUB_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATAHUB_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Hub clusters"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATAHUB_CLUSTERS_EVENT.selector(), envDto); } }; } EnvClustersDeleteActions(EnvironmentService environmentService, EventSenderService eventService, EnvironmentMetricService metricService); @Bean(name = "DATAHUB_CLUSTERS_DELETE_STARTED_STATE") Action<?, ?> datahubClustersDeleteAction(); @Bean(name = "DATALAKE_CLUSTERS_DELETE_STARTED_STATE") Action<?, ?> datalakeClustersDeleteAction(); @Bean(name = "ENV_CLUSTERS_DELETE_FAILED_STATE") Action<?, ?> failedAction(); }
EnvClustersDeleteActions { @Bean(name = "DATAHUB_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datahubClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATAHUB_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATAHUB_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATAHUB_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Hub clusters"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATAHUB_CLUSTERS_EVENT.selector(), envDto); } }; } EnvClustersDeleteActions(EnvironmentService environmentService, EventSenderService eventService, EnvironmentMetricService metricService); @Bean(name = "DATAHUB_CLUSTERS_DELETE_STARTED_STATE") Action<?, ?> datahubClustersDeleteAction(); @Bean(name = "DATALAKE_CLUSTERS_DELETE_STARTED_STATE") Action<?, ?> datalakeClustersDeleteAction(); @Bean(name = "ENV_CLUSTERS_DELETE_FAILED_STATE") Action<?, ?> failedAction();  }