@Test public void testRestartFlowNoRestartActionNoFlowChainId() throws TransactionExecutionException { ReflectionTestUtils.setField(underTest, "flowChainHandler", flowChainHandler); FlowLog flowLog = createFlowLog(null); Payload payload = new TestPayload(STACK_ID); flowLog.setPayload(JsonWriter.objectToJson(payload)); when(flowLogService.findFirstByFlowIdOrderByCreatedDesc(FLOW_ID)).thenReturn(Optional.of(flowLog)); when(applicationFlowInformation.getRestartableFlows()).thenReturn(List.of(HelloWorldFlowConfig.class)); HelloWorldFlowConfig helloWorldFlowConfig = new HelloWorldFlowConfig(); setUpFlowConfigCreateFlow(helloWorldFlowConfig); List<FlowConfiguration<?>> flowConfigs = Lists.newArrayList(helloWorldFlowConfig); ReflectionTestUtils.setField(underTest, "flowConfigs", flowConfigs); underTest.restartFlow(FLOW_ID); verify(flowChainHandler, never()).restoreFlowChain(FLOW_CHAIN_ID); verify(flowLogService, times(1)).terminate(STACK_ID, FLOW_ID); verify(defaultRestartAction, never()).restart(any(), any(), any(), any()); }
public void restartFlow(String flowId) { FlowLog flowLog = flowLogService.findFirstByFlowIdOrderByCreatedDesc(flowId).orElseThrow(() -> new FlowNotFoundException(flowId)); restartFlow(flowLog); }
Flow2Handler implements Consumer<Event<? extends Payload>> { public void restartFlow(String flowId) { FlowLog flowLog = flowLogService.findFirstByFlowIdOrderByCreatedDesc(flowId).orElseThrow(() -> new FlowNotFoundException(flowId)); restartFlow(flowLog); } }
Flow2Handler implements Consumer<Event<? extends Payload>> { public void restartFlow(String flowId) { FlowLog flowLog = flowLogService.findFirstByFlowIdOrderByCreatedDesc(flowId).orElseThrow(() -> new FlowNotFoundException(flowId)); restartFlow(flowLog); }  }
Flow2Handler implements Consumer<Event<? extends Payload>> { public void restartFlow(String flowId) { FlowLog flowLog = flowLogService.findFirstByFlowIdOrderByCreatedDesc(flowId).orElseThrow(() -> new FlowNotFoundException(flowId)); restartFlow(flowLog); }  @Override void accept(Event<? extends Payload> event); void cancelFlow(Long stackId, String flowId); void restartFlow(String flowId); void restartFlow(FlowLog flowLog); }
Flow2Handler implements Consumer<Event<? extends Payload>> { public void restartFlow(String flowId) { FlowLog flowLog = flowLogService.findFirstByFlowIdOrderByCreatedDesc(flowId).orElseThrow(() -> new FlowNotFoundException(flowId)); restartFlow(flowLog); }  @Override void accept(Event<? extends Payload> event); void cancelFlow(Long stackId, String flowId); void restartFlow(String flowId); void restartFlow(FlowLog flowLog); static final String FLOW_ID; static final String FLOW_CHAIN_ID; static final String FLOW_FINAL; static final String FLOW_CANCEL; }