@Test void externalDatabaseCreation() { StackEvent stackEventPayload = new StackEvent(ACTION_PAYLOAD_SELECTOR, STACK_ID); when(stateContext.getMessageHeader(MessageFactory.HEADERS.DATA.name())).thenReturn(stackEventPayload); Action<?, ?> action = configureAction(underTest::externalDatabaseCreation); action.execute(stateContext); verifyNoMoreInteractions(stackUpdaterService); verify(eventBus).notify(selectorArgumentCaptor.capture(), eventArgumentCaptor.capture()); assertThat(selectorArgumentCaptor.getValue()).isEqualTo("CreateExternalDatabaseRequest"); }
@Bean(name = "WAIT_FOR_EXTERNAL_DATABASE_STATE") public Action<?, ?> externalDatabaseCreation() { return new AbstractExternalDatabaseCreationAction<>(StackEvent.class) { @Override protected void doExecute(ExternalDatabaseContext context, StackEvent payload, Map<Object, Object> variables) { sendEvent(context); } @Override protected Selectable createRequest(ExternalDatabaseContext context) { Stack stack = context.getStack(); return new CreateExternalDatabaseRequest(stack.getId(), "CreateExternalDatabaseRequest", stack.getName(), stack.getResourceCrn(), stack); } }; }
ExternalDatabaseCreationActions { @Bean(name = "WAIT_FOR_EXTERNAL_DATABASE_STATE") public Action<?, ?> externalDatabaseCreation() { return new AbstractExternalDatabaseCreationAction<>(StackEvent.class) { @Override protected void doExecute(ExternalDatabaseContext context, StackEvent payload, Map<Object, Object> variables) { sendEvent(context); } @Override protected Selectable createRequest(ExternalDatabaseContext context) { Stack stack = context.getStack(); return new CreateExternalDatabaseRequest(stack.getId(), "CreateExternalDatabaseRequest", stack.getName(), stack.getResourceCrn(), stack); } }; } }
ExternalDatabaseCreationActions { @Bean(name = "WAIT_FOR_EXTERNAL_DATABASE_STATE") public Action<?, ?> externalDatabaseCreation() { return new AbstractExternalDatabaseCreationAction<>(StackEvent.class) { @Override protected void doExecute(ExternalDatabaseContext context, StackEvent payload, Map<Object, Object> variables) { sendEvent(context); } @Override protected Selectable createRequest(ExternalDatabaseContext context) { Stack stack = context.getStack(); return new CreateExternalDatabaseRequest(stack.getId(), "CreateExternalDatabaseRequest", stack.getName(), stack.getResourceCrn(), stack); } }; }  }
ExternalDatabaseCreationActions { @Bean(name = "WAIT_FOR_EXTERNAL_DATABASE_STATE") public Action<?, ?> externalDatabaseCreation() { return new AbstractExternalDatabaseCreationAction<>(StackEvent.class) { @Override protected void doExecute(ExternalDatabaseContext context, StackEvent payload, Map<Object, Object> variables) { sendEvent(context); } @Override protected Selectable createRequest(ExternalDatabaseContext context) { Stack stack = context.getStack(); return new CreateExternalDatabaseRequest(stack.getId(), "CreateExternalDatabaseRequest", stack.getName(), stack.getResourceCrn(), stack); } }; }  @Bean(name = "WAIT_FOR_EXTERNAL_DATABASE_STATE") Action<?, ?> externalDatabaseCreation(); @Bean(name = "EXTERNAL_DATABASE_CREATION_FINISHED_STATE") Action<?, ?> externalDatabaseCreationFinishedAction(); @Bean(name = "EXTERNAL_DATABASE_CREATION_FAILED_STATE") Action<?, ?> externalDatabaseCreationFailureAction(); }
ExternalDatabaseCreationActions { @Bean(name = "WAIT_FOR_EXTERNAL_DATABASE_STATE") public Action<?, ?> externalDatabaseCreation() { return new AbstractExternalDatabaseCreationAction<>(StackEvent.class) { @Override protected void doExecute(ExternalDatabaseContext context, StackEvent payload, Map<Object, Object> variables) { sendEvent(context); } @Override protected Selectable createRequest(ExternalDatabaseContext context) { Stack stack = context.getStack(); return new CreateExternalDatabaseRequest(stack.getId(), "CreateExternalDatabaseRequest", stack.getName(), stack.getResourceCrn(), stack); } }; }  @Bean(name = "WAIT_FOR_EXTERNAL_DATABASE_STATE") Action<?, ?> externalDatabaseCreation(); @Bean(name = "EXTERNAL_DATABASE_CREATION_FINISHED_STATE") Action<?, ?> externalDatabaseCreationFinishedAction(); @Bean(name = "EXTERNAL_DATABASE_CREATION_FAILED_STATE") Action<?, ?> externalDatabaseCreationFailureAction();  }