@Test public void testCompleteTaskInCreateTaskListenerWithIdentityLinks() { // given process with user task, identity links and task create listener BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("startToEnd") .startEvent() .userTask() .camundaTaskListenerClass(TaskListener.EVENTNAME_CREATE, TaskCreateListener.class.getName()) .name("userTask") .camundaCandidateUsers(Arrays.asList(new String[]{"users1", "user2"})) .camundaCandidateGroups(Arrays.asList(new String[]{"group1", "group2"})) .endEvent().done(); testRule.deploy(modelInstance); // when process is started and user task completed in task create listener runtimeService.startProcessInstanceByKey("startToEnd"); // then task is successfully completed without an exception assertNull(taskService.createTaskQuery().singleResult()); }
public void testQueryWithoutCandidateUsers() { BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .userTask() .camundaCandidateGroups("sales") .endEvent() .done(); deployment(process); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); List<Task> tasks = taskService.createTaskQuery() .processInstanceId(processInstance.getId()) .withoutCandidateUsers() .list(); assertEquals(1, tasks.size()); }
public void testGetIdentityLinkWithTenantIdForCandidateGroup() { // given BpmnModelInstance oneTaskProcess = Bpmn.createExecutableProcess("testProcess") .startEvent() .userTask("task").camundaCandidateGroups("aGroupId") .endEvent() .done(); deploymentForTenant("tenant", oneTaskProcess); ProcessInstance tenantProcessInstance = runtimeService.createProcessInstanceByKey("testProcess") .processDefinitionTenantId("tenant") .execute(); Task tenantTask = taskService .createTaskQuery() .processInstanceId(tenantProcessInstance.getId()) .singleResult(); List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(tenantTask.getId()); assertEquals(identityLinks.size(),1); assertEquals(identityLinks.get(0).getTenantId(), "tenant"); }
public void testQueryAssignedTasksWithoutCandidateUsers() { BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .userTask() .camundaCandidateGroups("sales") .endEvent() .done(); deployment(process); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); try{ taskService.createTaskQuery() .processInstanceId(processInstance.getId()) .includeAssignedTasks() .withoutCandidateUsers() .list(); fail("exception expected"); } catch (ProcessEngineException e) {} }
public void testQueryAssignedTasksWithCandidateUsers() { BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .userTask() .camundaCandidateGroups("sales") .endEvent() .done(); deployment(process); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); try{ taskService.createTaskQuery() .processInstanceId(processInstance.getId()) .includeAssignedTasks() .withCandidateUsers() .list(); fail("exception expected"); } catch (ProcessEngineException e) {} }
@Test public void testCompleteTaskInCreateTaskListenerWithIdentityLinks() { // given process with user task, identity links and task create listener BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("startToEnd") .startEvent() .userTask() .camundaTaskListenerClass(TaskListener.EVENTNAME_CREATE, TaskCreateListener.class.getName()) .name("userTask") .camundaCandidateUsers(Arrays.asList(new String[]{"users1", "user2"})) .camundaCandidateGroups(Arrays.asList(new String[]{"group1", "group2"})) .endEvent().done(); testRule.deploy(modelInstance); // when process is started and user task completed in task create listener runtimeService.startProcessInstanceByKey("startToEnd"); // then task is successfully completed without an exception assertNull(taskService.createTaskQuery().singleResult()); }
public void testQueryWithoutCandidateUsers() { BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .userTask() .camundaCandidateGroups("sales") .endEvent() .done(); deployment(process); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); List<Task> tasks = taskService.createTaskQuery() .processInstanceId(processInstance.getId()) .withoutCandidateUsers() .list(); assertEquals(1, tasks.size()); }
public void testGetIdentityLinkWithTenantIdForCandidateGroup() { // given BpmnModelInstance oneTaskProcess = Bpmn.createExecutableProcess("testProcess") .startEvent() .userTask("task").camundaCandidateGroups("aGroupId") .endEvent() .done(); deploymentForTenant("tenant", oneTaskProcess); ProcessInstance tenantProcessInstance = runtimeService.createProcessInstanceByKey("testProcess") .processDefinitionTenantId("tenant") .execute(); Task tenantTask = taskService .createTaskQuery() .processInstanceId(tenantProcessInstance.getId()) .singleResult(); List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(tenantTask.getId()); assertEquals(identityLinks.size(),1); assertEquals(identityLinks.get(0).getTenantId(), "tenant"); }
public void testQueryAssignedTasksWithCandidateUsers() { BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .userTask() .camundaCandidateGroups("sales") .endEvent() .done(); deployment(process); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); try{ taskService.createTaskQuery() .processInstanceId(processInstance.getId()) .includeAssignedTasks() .withCandidateUsers() .list(); fail("exception expected"); } catch (ProcessEngineException e) {} }
public void testQueryAssignedTasksWithoutCandidateUsers() { BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .userTask() .camundaCandidateGroups("sales") .endEvent() .done(); deployment(process); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); try{ taskService.createTaskQuery() .processInstanceId(processInstance.getId()) .includeAssignedTasks() .withoutCandidateUsers() .list(); fail("exception expected"); } catch (ProcessEngineException e) {} }