@Test public void sendInOnly() throws Exception { result.expectedMessageCount(1); when(amazonSWClient.startWorkflowExecution(any(StartWorkflowExecutionRequest.class))).thenReturn(new Run().withRunId("run1")); template.send("direct:start", new Processor() { public void process(Exchange exchange) throws Exception { exchange.getIn().setBody("This is my message text."); } }); assertMockEndpointsSatisfied(); Exchange resultExchange = result.getExchanges().get(0); assertEquals("This is my message text.", resultExchange.getIn().getBody()); }
public WorkflowExecution submit(Workflow workflow, WorkflowId workflowId, Optional<Object> input) { log.info(format("submit workflow: %s", workflowId)); Optional<Input> inputOptional = input.map( i -> dataConverter().toData(i)).map(Input::of); StartWorkflowExecutionRequest request = WorkflowExecutionRequestBuilder.builder().domain(domain()) .workflow(workflow).input(inputOptional) .taskList(taskList()).workflowId(workflowId).build(); log.info(format("Start workflow execution: %s", workflowId)); Run run = swf().startWorkflowExecution(request); log.info(format("Started workflow %s", run)); return new WorkflowExecution().withWorkflowId(workflowId.value()).withRunId(run.getRunId()); }
@Override public Run startWorkflowExecution(StartWorkflowExecutionRequest startWorkflowExecutionRequest) throws AmazonServiceException, AmazonClientException { return new Run().withRunId("run1"); }