public void complete(long taskId, String userId, Map<String, Object> data) { executor.execute(new CompositeCommand<Void>( new CompleteTaskCommand(taskId, userId, data), new ProcessSubTaskCommand(taskId, userId, data), new CancelDeadlineCommand(taskId, true, true))); }
public Void execute(Context cntxt ) { TaskContext context = (TaskContext) cntxt; doCallbackUserOperation(userId, context, true); groupIds = doUserGroupCallbackOperation(userId, null, context); context.set("local:groups", groupIds);
@Test public void testRestExecuteCommandProcessTaskProcessing() { setupTaskMocks(this, FOR_PROCESS_TASKS); JaxbCommandsRequest cmdsRequest = new JaxbCommandsRequest(new ClaimTaskCommand(TASK_ID, USER)); this.execute(cmdsRequest); cmdsRequest = new JaxbCommandsRequest(new CompleteTaskCommand(TASK_ID, USER, null)); this.execute(cmdsRequest); // verify verify(userTaskServiceMock, times(2)).execute(any(String.class), any(TaskCommand.class)); }
/** * When doing operations with a non-process (independent) task, * the injected (non-runtime engine) taskService should be used. */ @Test public void testRestExecuteCommandIndependentTaskProcessing() { setupTaskMocks(this, FOR_INDEPENDENT_TASKS); JaxbCommandsRequest cmdsRequest = new JaxbCommandsRequest(new ClaimTaskCommand(TASK_ID, USER)); this.execute(cmdsRequest); cmdsRequest = new JaxbCommandsRequest(new CompleteTaskCommand(TASK_ID, USER, null)); this.execute(cmdsRequest); // verify verify(userTaskServiceMock, times(2)).execute(any(String.class), any(TaskCommand.class)); }
@Test public void testJmsProcessTaskProcessing() { setupTaskMocks(this, FOR_PROCESS_TASKS); String [] userPass = { USER, PASSWORD }; JaxbCommandsRequest cmdsRequest = new JaxbCommandsRequest(new ClaimTaskCommand(TASK_ID, USER)); cmdsRequest.setUserPass(userPass); this.jmsProcessJaxbCommandsRequest(cmdsRequest); cmdsRequest = new JaxbCommandsRequest(new CompleteTaskCommand(TASK_ID, USER, null)); cmdsRequest.setUserPass(userPass); this.jmsProcessJaxbCommandsRequest(cmdsRequest); // verify verify(userTaskServiceMock, times(2)).execute(any(String.class), any(TaskCommand.class)); }
@Test public void testJmsIndependentTaskProcessing() { setupTaskMocks(this, FOR_INDEPENDENT_TASKS); String [] userPass = { USER, PASSWORD }; JaxbCommandsRequest cmdsRequest = new JaxbCommandsRequest(new ClaimTaskCommand(TASK_ID, USER)); cmdsRequest.setUserPass(userPass); this.jmsProcessJaxbCommandsRequest(cmdsRequest); cmdsRequest = new JaxbCommandsRequest(new CompleteTaskCommand(TASK_ID, USER, null)); cmdsRequest.setUserPass(userPass); this.jmsProcessJaxbCommandsRequest(cmdsRequest); // verify verify(userTaskServiceMock, times(2)).execute(any(String.class), any(TaskCommand.class)); }