@Test void datalakeClustersDeleteActionFailure() { Action<?, ?> action = configureAction(() -> underTest.datalakeClustersDeleteAction()); when(environmentService.findEnvironmentById(ENVIRONMENT_ID)).thenThrow(new UnsupportedOperationException(MESSAGE)); when(failureEvent.event()).thenReturn(FAILURE_EVENT); action.execute(stateContext); verify(environmentService, never()).save(any(Environment.class)); verify(environmentService, never()).getEnvironmentDto(any(Environment.class)); verify(eventSenderService, never()).sendEventAndNotification(any(EnvironmentDto.class), anyString(), any(ResourceEvent.class)); verify(eventBus).notify(selectorArgumentCaptor.capture(), eventArgumentCaptor.capture()); verify(reactorEventFactory).createEvent(headersArgumentCaptor.capture(), payloadArgumentCaptor.capture()); verifyFailureEvent(); }
@Bean(name = "DATALAKE_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datalakeClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATALAKE_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATALAKE_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATALAKE_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Lake clustesr"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATALAKE_CLUSTERS_EVENT.selector(), envDto); } }; }
EnvClustersDeleteActions { @Bean(name = "DATALAKE_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datalakeClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATALAKE_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATALAKE_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATALAKE_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Lake clustesr"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATALAKE_CLUSTERS_EVENT.selector(), envDto); } }; } }
EnvClustersDeleteActions { @Bean(name = "DATALAKE_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datalakeClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATALAKE_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATALAKE_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATALAKE_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Lake clustesr"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATALAKE_CLUSTERS_EVENT.selector(), envDto); } }; } EnvClustersDeleteActions(EnvironmentService environmentService, EventSenderService eventService, EnvironmentMetricService metricService); }
EnvClustersDeleteActions { @Bean(name = "DATALAKE_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datalakeClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATALAKE_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATALAKE_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATALAKE_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Lake clustesr"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATALAKE_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 = "DATALAKE_CLUSTERS_DELETE_STARTED_STATE") public Action<?, ?> datalakeClustersDeleteAction() { return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) { @Override protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) { EnvironmentStatus environmentStatus = EnvironmentStatus.DATALAKE_CLUSTERS_DELETE_IN_PROGRESS; ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATALAKE_CLUSTERS_DELETION_STARTED; EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATALAKE_CLUSTERS_DELETE_STARTED_STATE; String logDeleteState = "Data Lake clustesr"; EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState); sendEvent(context, DELETE_DATALAKE_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();  }