public void claim(long taskId, String userId) { executor.execute(new ClaimTaskCommand(taskId, userId)); }
public Void execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; doCallbackUserOperation(userId, context, true); groupIds = doUserGroupCallbackOperation(userId, null, context); context.set("local:groups", groupIds); context.getTaskInstanceService().claim(taskId, userId); return null; }
@Override public void claim(long taskId, String user, String deploymentId) { taskService.execute(deploymentId, new CompositeCommand<Void>(new StartTaskCommand(taskId, user), new ClaimTaskCommand(taskId, user))); }
@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 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)); }
@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)); }