@Test public void testRestUrlIndependentTaskProcessing() throws URISyntaxException { setupTaskMocks(this, FOR_INDEPENDENT_TASKS); String oper = "claim"; doReturn(new String("http://localhost:8080/test/rest/task/" + TASK_ID + "/" + oper)).when(httpRequestMock).getRequestURI(); this.doTaskOperation(TASK_ID, oper); oper = "complete"; doReturn(new String("http://localhost:8080/test/rest/task/" + TASK_ID + "/" + oper)).when(httpRequestMock).getRequestURI(); this.doTaskOperation(TASK_ID, oper); verify(userTaskServiceMock, times(2)).execute(any(String.class), any(TaskCommand.class)); }
@Test public void testRestUrlProcessTaskProcessing() throws Exception { setupTaskMocks(this, FOR_PROCESS_TASKS); String oper = "claim"; doReturn(new String("http://localhost:8080/test/rest/task/" + TASK_ID + "/" + oper)).when(httpRequestMock).getRequestURI(); this.doTaskOperation(TASK_ID, oper); oper = "complete"; doReturn(new String("http://localhost:8080/test/rest/task/" + TASK_ID + "/" + oper)).when(httpRequestMock).getRequestURI(); this.doTaskOperation(TASK_ID, oper); // verify verify(userTaskServiceMock, times(2)).execute(any(String.class), any(TaskCommand.class)); }
Task task = userTaskService.execute(containerId, new GetUserTaskCommand(registry.getIdentityProvider().getName(), taskId)); if (task == null) { throw new IllegalStateException("No task with id " + taskId + " found");
@Override public void claim(long taskId, String user, String deploymentId) { taskService.execute(deploymentId, new CompositeCommand<Void>(new StartTaskCommand(taskId, user), new ClaimTaskCommand(taskId, user))); }
@Before public void prepare() { super.prepare(); userTaskService.execute(GROUP_ID +":" + ARTIFACT_ID +":" + VERSION, new CleanUpCommand()); } @Override
@Before public void prepare() { super.prepare(); userTaskService.execute(GROUP_ID +":" + ARTIFACT_ID +":" + VERSION, new CleanUpCommand()); } @Override
}).when(userTaskServiceMock).execute(any(String.class), any(ExecuteAndSerializeCommand.class)); assertNotNull(result.getContentMap()); assertEquals("test value", result.getContentMap().get("test")); verify(userTaskServiceMock, times(1)).execute(any(String.class), any(ExecuteAndSerializeCommand.class)); verify(contentMarshallerContext, times(1)).getClassloader(); verify(contentMarshallerContext, times(1)).getEnvironment();
@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)); }
doReturn(taskSumList).when(userTaskServiceMock).execute(any(String.class), any(GetTasksOwnedCommand.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)); }
public String getTaskRenderedForm(String renderer, String containerId, long taskId) { String resolvedContainerId = registry.getContainerId(containerId, new ByTaskIdContainerLocator(taskId)); Task task = userTaskService.execute(resolvedContainerId, new GetUserTaskCommand(registry.getIdentityProvider().getName(), taskId)); if (task == null) { throw new TaskNotFoundException("No task with id " + taskId + " found");