public void updateTask(TaskResult taskResult) { workflowExecutor.updateTask(taskResult); }
executor.updateTask(new TaskResult(task)); } catch (RuntimeException e) { logger.error("Error updating task: {} in workflow: {} in action: {} for event: {} for message: {}", taskDetails.getTaskRefName(), taskDetails.getWorkflowId(), action.getAction(), event, messageId, e);
@Test public void testCompleteTaskByTaskId() throws Exception { TaskDetails taskDetails = new TaskDetails(); taskDetails.setWorkflowId("${workflowId}"); taskDetails.setTaskId("${taskId}"); Action action = new Action(); action.setAction(Type.complete_task); action.setComplete_task(taskDetails); Object payload = new ObjectMapper().readValue("{\"workflowId\":\"workflow_1\", \"taskId\":\"task_1\"}", Object.class); Task task = new Task(); task.setTaskId("task_1"); task.setReferenceTaskName("testTask"); when(workflowExecutor.getTask(eq("task_1"))).thenReturn(task); actionProcessor.execute(action, payload, "testEvent", "testMessage"); ArgumentCaptor<TaskResult> argumentCaptor = ArgumentCaptor.forClass(TaskResult.class); verify(workflowExecutor).updateTask(argumentCaptor.capture()); assertEquals(Status.COMPLETED, argumentCaptor.getValue().getStatus()); assertEquals("testMessage", argumentCaptor.getValue().getOutputData().get("conductor.event.messageId")); assertEquals("testEvent", argumentCaptor.getValue().getOutputData().get("conductor.event.name")); assertEquals("workflow_1", argumentCaptor.getValue().getOutputData().get("workflowId")); assertEquals("task_1", argumentCaptor.getValue().getOutputData().get("taskId")); } }
@Test public void testCompleteTask() throws Exception { TaskDetails taskDetails = new TaskDetails(); taskDetails.setWorkflowId("${workflowId}"); taskDetails.setTaskRefName("testTask"); Action action = new Action(); action.setAction(Type.complete_task); action.setComplete_task(taskDetails); Object payload = new ObjectMapper().readValue("{\"workflowId\":\"workflow_1\"}", Object.class); Task task = new Task(); task.setReferenceTaskName("testTask"); Workflow workflow = new Workflow(); workflow.getTasks().add(task); when(workflowExecutor.getWorkflow(eq("workflow_1"), anyBoolean())).thenReturn(workflow); actionProcessor.execute(action, payload, "testEvent", "testMessage"); ArgumentCaptor<TaskResult> argumentCaptor = ArgumentCaptor.forClass(TaskResult.class); verify(workflowExecutor).updateTask(argumentCaptor.capture()); assertEquals(Status.COMPLETED, argumentCaptor.getValue().getStatus()); assertEquals("testMessage", argumentCaptor.getValue().getOutputData().get("conductor.event.messageId")); assertEquals("testEvent", argumentCaptor.getValue().getOutputData().get("conductor.event.name")); assertEquals("workflow_1", argumentCaptor.getValue().getOutputData().get("workflowId")); assertEquals("testTask", argumentCaptor.getValue().getOutputData().get("taskRefName")); }
completed.set(true); return null; }).when(workflowExecutor).updateTask(any());
updateTask(new TaskResult(task)); LOGGER.info("Done Executing {}/{}-{} op={}", task.getTaskType(), task.getTaskId(), task.getStatus(), task.getOutputData().toString());
assertEquals(TaskType.WAIT.name(), waitTask.getTaskType()); waitTask.setStatus(COMPLETED); workflowExecutor.updateTask(new TaskResult(waitTask));
public void updateTask(TaskResult taskResult) { workflowExecutor.updateTask(taskResult); }
executor.updateTask(new TaskResult(task)); } catch (RuntimeException e) { logger.error("Error updating task: {} in workflow: {} in action: {} for event: {} for message: {}", taskDetails.getTaskRefName(), taskDetails.getWorkflowId(), action.getAction(), event, messageId, e);
updateTask(new TaskResult(task)); LOGGER.info("Done Executing {}/{}-{} op={}", task.getTaskType(), task.getTaskId(), task.getStatus(), task.getOutputData().toString());