org.camunda.bpm.engine.task.TaskQuery Java Examples
The following examples show how to use
org.camunda.bpm.engine.task.TaskQuery.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"}) public void testQueryBySerializableCaseInstanceVariableValueNotEquals() { String caseDefinitionId = getCaseDefinitionId(); List<String> serializable = new ArrayList<String>(); serializable.add("one"); serializable.add("two"); serializable.add("three"); caseService .withCaseDefinition(caseDefinitionId) .setVariable("aSerializableValue", serializable) .create(); TaskQuery query = taskService.createTaskQuery(); try { query.caseInstanceVariableValueNotEquals("aSerializableValue", serializable).list(); fail(); } catch (ProcessEngineException e) {} }
Example #2
Source File: MultiTenancySignalReceiveCmdTenantCheckTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void sendSignalToStartAndIntermediateCatchEventDisabledTenantCheck() { testRule.deployForTenant(TENANT_ONE, SIGNAL_START_PROCESS, SIGNAL_CATCH_PROCESS); testRule.deployForTenant(TENANT_TWO, SIGNAL_START_PROCESS, SIGNAL_CATCH_PROCESS); engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_ONE).execute(); engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_TWO).execute(); engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false); engineRule.getIdentityService().setAuthentication("user", null, null); engineRule.getRuntimeService().createSignalEvent("signal").send(); TaskQuery query = engineRule.getTaskService().createTaskQuery(); assertThat(query.count(), is(4L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), is(2L)); }
Example #3
Source File: TaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"}) public void testQueryByByteArrayCaseInstanceVariableValueGreaterThan() { String caseDefinitionId = getCaseDefinitionId(); byte[] bytes = "somebytes".getBytes(); caseService .withCaseDefinition(caseDefinitionId) .setVariable("aByteArrayValue", bytes) .create(); TaskQuery query = taskService.createTaskQuery(); try { query.caseInstanceVariableValueGreaterThan("aByteArrayValue", bytes).list(); fail(); } catch (ProcessEngineException e) {} }
Example #4
Source File: BoundaryTimerEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testMultipleOutgoingSequenceFlows() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("interruptingTimer"); Job job = managementService.createJobQuery().singleResult(); assertNotNull(job); managementService.executeJob(job.getId()); TaskQuery taskQuery = taskService.createTaskQuery(); assertEquals(2, taskQuery.count()); List<Task> tasks = taskQuery.list(); for (Task task : tasks) { taskService.complete(task.getId()); } assertProcessEnded(pi.getId()); }
Example #5
Source File: TaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testQueryByParentTaskId() { String parentTaskId = "parentTask"; Task parent = taskService.newTask(parentTaskId); taskService.saveTask(parent); Task sub1 = taskService.newTask("subTask1"); sub1.setParentTaskId(parentTaskId); taskService.saveTask(sub1); Task sub2 = taskService.newTask("subTask2"); sub2.setParentTaskId(parentTaskId); taskService.saveTask(sub2); TaskQuery query = taskService.createTaskQuery().taskParentTaskId(parentTaskId); verifyQueryResults(query, 2); taskService.deleteTask(parentTaskId, true); }
Example #6
Source File: TaskRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public List<TaskDto> queryTasks(TaskQueryDto queryDto, Integer firstResult, Integer maxResults) { ProcessEngine engine = getProcessEngine(); queryDto.setObjectMapper(getObjectMapper()); TaskQuery query = queryDto.toQuery(engine); List<Task> matchingTasks = executeTaskQuery(firstResult, maxResults, query); List<TaskDto> tasks = new ArrayList<TaskDto>(); for (Task task : matchingTasks) { TaskDto returnTask = TaskDto.fromEntity(task); tasks.add(returnTask); } return tasks; }
Example #7
Source File: MultiTenancyProcessInstanceSuspensionStateTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void suspendAndActivateProcessInstancesIncludingUserTasksForAllTenants() { // given activated user tasks TaskQuery query = engineRule.getTaskService().createTaskQuery(); assertThat(query.active().count(), is(3L)); assertThat(query.suspended().count(), is(0L)); // first suspend engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); assertThat(query.active().count(), is(0L)); assertThat(query.suspended().count(), is(3L)); // then activate engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .activate(); assertThat(query.active().count(), is(3L)); assertThat(query.suspended().count(), is(0L)); }
Example #8
Source File: FilterTaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testExtendingTaskQueryListWithCandidateGroups() { TaskQuery query = taskService.createTaskQuery(); List<String> candidateGroups = new ArrayList<String>(); candidateGroups.add("accounting"); query.taskCandidateGroupIn(candidateGroups); saveQuery(query); List<Task> tasks = filterService.list(filter.getId()); assertEquals(1, tasks.size()); tasks = filterService.list(filter.getId(), query); assertEquals(1, tasks.size()); TaskQuery extendingQuery = taskService.createTaskQuery(); extendingQuery .orderByTaskCreateTime() .asc(); tasks = filterService.list(filter.getId(), extendingQuery); assertEquals(1, tasks.size()); }
Example #9
Source File: FilterTaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
/** * CAM-6363 * * Verify that search by name returns case insensitive results */ public void testTaskQueryLookupByNameCaseInsensitive() { TaskQuery query = taskService.createTaskQuery(); query.taskName("task 1"); saveQuery(query); List<Task> tasks = filterService.list(filter.getId()); assertNotNull(tasks); assertThat(tasks.size(),is(1)); query = taskService.createTaskQuery(); query.taskName("tASk 2"); saveQuery(query); tasks = filterService.list(filter.getId()); assertNotNull(tasks); assertThat(tasks.size(),is(1)); }
Example #10
Source File: HistoricActivityInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
/** * https://app.camunda.com/jira/browse/CAM-1537 */ @Deployment public void testHistoricActivityInstanceGatewayEndTimes() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("gatewayEndTimes"); TaskQuery query = taskService.createTaskQuery().orderByTaskName().asc(); List<Task> tasks = query.list(); taskService.complete(tasks.get(0).getId()); taskService.complete(tasks.get(1).getId()); // process instance should have finished assertNotNull(historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult().getEndTime()); // gateways should have end timestamps assertNotNull(historyService.createHistoricActivityInstanceQuery().activityId("Gateway_0").singleResult().getEndTime()); // there exists two historic activity instances for "Gateway_1" (parallel join) HistoricActivityInstanceQuery historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("Gateway_1"); assertEquals(2, historicActivityInstanceQuery.count()); // they should have an end timestamp assertNotNull(historicActivityInstanceQuery.list().get(0).getEndTime()); assertNotNull(historicActivityInstanceQuery.list().get(1).getEndTime()); }
Example #11
Source File: FilterTaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) public void testStringVariable() { // given runtimeService.startProcessInstanceByKey("oneTaskProcess", Variables.createVariables().putValue("stringVariable", "aVariableValue")); TaskQuery query = taskService.createTaskQuery() .processVariableValueEquals("stringVariable", "aVariableValue"); Filter filter = filterService.newTaskFilter("filter"); filter.setQuery(query); // when filterService.saveFilter(filter); // then assertThat(filterService.count(filter.getId()), is(1L)); }
Example #12
Source File: IntermediateConditionalEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment public void testFalseCondition() { //given process with intermediate conditional event ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery(); Task task = taskQuery.processInstanceId(procInst.getId()).singleResult(); assertNotNull(task); assertEquals(TASK_BEFORE_CONDITION, task.getName()); //when task before condition is completed taskService.complete(task.getId()); //then next wait state is on conditional event, since condition is false //and a condition event subscription is create Execution execution = runtimeService.createExecutionQuery() .processInstanceId(procInst.getId()) .activityId(CONDITIONAL_EVENT) .singleResult(); assertNotNull(execution); assertEquals(1, conditionEventSubscriptionQuery.list().size()); }
Example #13
Source File: MultiTenancyJobCmdsTenantCheckTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testExecuteJobWithAuthenticatedTenant() { String noFailProcessInstanceId = engineRule.getRuntimeService() .startProcessInstanceByKey("noFail") .getId(); TaskQuery taskQuery = engineRule.getTaskService() .createTaskQuery() .processInstanceId(noFailProcessInstanceId); assertEquals(1, taskQuery.list().size()); String timerJobId = managementService.createJobQuery() .processInstanceId(noFailProcessInstanceId) .singleResult() .getId(); identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE)); managementService.executeJob(timerJobId); // then assertEquals(0, taskQuery.list().size()); }
Example #14
Source File: BoundaryConditionalEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment public void testCleanUpConditionalEventSubscriptions() { //given process with boundary conditional event ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId()); Task task = taskQuery.singleResult(); assertEquals(1, conditionEventSubscriptionQuery.list().size()); //when task is completed taskService.complete(task.getId()); //then conditional subscription should be deleted tasksAfterVariableIsSet = taskQuery.list(); assertEquals(1, tasksAfterVariableIsSet.size()); assertEquals(0, conditionEventSubscriptionQuery.list().size()); }
Example #15
Source File: BoundaryTimerNonInterruptingEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment @Test public void testMultipleOutgoingSequenceFlows() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("nonInterruptingTimer"); Job job = managementService.createJobQuery().singleResult(); assertNotNull(job); managementService.executeJob(job.getId()); TaskQuery taskQuery = taskService.createTaskQuery(); assertEquals(3, taskQuery.count()); List<Task> tasks = taskQuery.list(); for (Task task : tasks) { taskService.complete(task.getId()); } testHelper.assertProcessEnded(pi.getId()); }
Example #16
Source File: TaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"}) public void testQueryBySerializableCaseInstanceVariableLessThanOrEqual() { String caseDefinitionId = getCaseDefinitionId(); List<String> serializable = new ArrayList<String>(); serializable.add("one"); serializable.add("two"); serializable.add("three"); caseService .withCaseDefinition(caseDefinitionId) .setVariable("aSerializableValue", serializable) .create(); TaskQuery query = taskService.createTaskQuery(); try { query.caseInstanceVariableValueLessThanOrEquals("aSerializableValue", serializable).list(); fail(); } catch (ProcessEngineException e) {} }
Example #17
Source File: ProcessIntegrationTest.java From camunda-bpm-mail with Apache License 2.0 | 6 votes |
@Deployment(resources = "processes/printProcess.bpmn") @Test public void processPrintMail() throws Exception { processApplication.startService(engineRule.getProcessEngine()); TaskQuery taskQuery = taskService.createTaskQuery().taskName("print it"); // wait for first mail while(taskQuery.count() == 0) { Thread.sleep(500); } List<Task> tasks = taskQuery.list(); assertThat(tasks).isNotEmpty(); for (Task task : tasks) { taskService.complete(task.getId()); } waitForAsyncJobs(); assertThat(runtimeService.createProcessInstanceQuery().list()).isEmpty(); }
Example #18
Source File: TaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"}) public void testQueryByByteArrayCaseInstanceVariableValueGreaterThanOrEqual() { String caseDefinitionId = getCaseDefinitionId(); byte[] bytes = "somebytes".getBytes(); caseService .withCaseDefinition(caseDefinitionId) .setVariable("aByteArrayValue", bytes) .create(); TaskQuery query = taskService.createTaskQuery(); try { query.caseInstanceVariableValueGreaterThanOrEquals("aByteArrayValue", bytes).list(); fail(); } catch (ProcessEngineException e) {} }
Example #19
Source File: MixedConditionalEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testNonInterruptingSetVariableOnInputMapping() { final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY) .startEvent() .userTask(TASK_BEFORE_CONDITION_ID) .name(TASK_BEFORE_CONDITION) .userTask(TASK_WITH_CONDITION_ID) .camundaInputParameter(VARIABLE_NAME, "1") .name(TASK_WITH_CONDITION) .endEvent() .done(); deployMixedProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, false); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId()); //when task before is completed taskService.complete(taskQuery.singleResult().getId()); //then conditional boundary event should not triggered also not conditional start event //since variable is only local tasksAfterVariableIsSet = taskQuery.list(); assertEquals(TASK_WITH_CONDITION, tasksAfterVariableIsSet.get(0).getName()); }
Example #20
Source File: TaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"}) public void testQueryByCaseInstanceBusinessKeyLike() { String caseDefinitionId = getCaseDefinitionId(); String businessKey = "aBusiness_Key"; caseService .withCaseDefinition(caseDefinitionId) .businessKey(businessKey) .create(); TaskQuery query = taskService.createTaskQuery(); query.caseInstanceBusinessKeyLike("aBus%"); verifyQueryResults(query, 1); query.caseInstanceBusinessKeyLike("%siness\\_Key"); verifyQueryResults(query, 1); query.caseInstanceBusinessKeyLike("%sines%"); verifyQueryResults(query, 1); query.caseInstanceBusinessKeyLike("%sines%"); verifyQueryResults(query, 1); }
Example #21
Source File: CallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/orderProcess.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/callactivity/checkCreditProcess.bpmn20.xml" }) public void testOrderProcessWithCallActivity() { // After the process has started, the 'verify credit history' task should be active ProcessInstance pi = runtimeService.startProcessInstanceByKey("orderProcess"); TaskQuery taskQuery = taskService.createTaskQuery(); Task verifyCreditTask = taskQuery.singleResult(); assertEquals("Verify credit history", verifyCreditTask.getName()); // Verify with Query API ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult(); assertNotNull(subProcessInstance); assertEquals(pi.getId(), runtimeService.createProcessInstanceQuery().subProcessInstanceId(subProcessInstance.getId()).singleResult().getId()); // Completing the task with approval, will end the subprocess and continue the original process taskService.complete(verifyCreditTask.getId(), CollectionUtil.singletonMap("creditApproved", true)); Task prepareAndShipTask = taskQuery.singleResult(); assertEquals("Prepare and Ship", prepareAndShipTask.getName()); }
Example #22
Source File: FilterTaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
/** * See CAM-9613 */ @Deployment(resources = {"org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) public void FAILING_testDateVariable() { // given Date date = new Date(); runtimeService.startProcessInstanceByKey("oneTaskProcess", Variables.createVariables().putValue("dateVariable", date)); TaskQuery query = taskService.createTaskQuery() .processVariableValueEquals("dateVariable", date); Filter filter = filterService.newTaskFilter("filter"); filter.setQuery(query); // when filterService.saveFilter(filter); // then assertThat(filterService.count(filter.getId()), is(1L)); }
Example #23
Source File: TaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"}) public void testQueryByBooleanCaseInstanceVariableValueGreaterThanOrEqual() { String caseDefinitionId = getCaseDefinitionId(); caseService .withCaseDefinition(caseDefinitionId) .setVariable("aBooleanValue", true) .create(); TaskQuery query = taskService.createTaskQuery(); try { query.caseInstanceVariableValueGreaterThanOrEquals("aBooleanValue", false).list(); fail(); } catch (ProcessEngineException e) {} }
Example #24
Source File: FilterTaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testExtendTaskQueryWithCandidateGroupInAndCandidateGroup() { // create an query with candidate group in and save it as a filter TaskQueryImpl candidateGroupInQuery = (TaskQueryImpl)taskService.createTaskQuery().taskCandidateGroupIn(Arrays.asList("testGroup", "testGroup2")); assertEquals(2, candidateGroupInQuery.getCandidateGroups().size()); assertEquals("testGroup", candidateGroupInQuery.getCandidateGroups().get(0)); assertEquals("testGroup2", candidateGroupInQuery.getCandidateGroups().get(1)); Filter candidateGroupInFilter = filterService.newTaskFilter("Groups filter"); candidateGroupInFilter.setQuery(candidateGroupInQuery); // create a query with candidate group // and save it as filter TaskQuery candidateGroupQuery = taskService.createTaskQuery().taskCandidateGroup("testGroup2"); // extend candidate group in filter by query with candidate group Filter extendedFilter = candidateGroupInFilter.extend(candidateGroupQuery); TaskQueryImpl extendedQuery = extendedFilter.getQuery(); assertEquals(1, extendedQuery.getCandidateGroups().size()); assertEquals("testGroup2", extendedQuery.getCandidateGroups().get(0)); }
Example #25
Source File: TaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testExtendingTaskQueryList_TaskDefinitionKeyIn() { // given String taskDefinitionKey = "assigneApprover"; TaskQuery query = taskService.createTaskQuery(); TaskQuery extendingQuery = taskService .createTaskQuery() .taskDefinitionKeyIn(taskDefinitionKey); // when TaskQuery result = ((TaskQueryImpl)query).extend(extendingQuery); // then String[] key = ((TaskQueryImpl) result).getKeys(); assertEquals(1, key.length); assertEquals(taskDefinitionKey, key[0]); }
Example #26
Source File: TaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"}) public void testQueryByNullCaseInstanceVariableValueGreaterThan() { String caseDefinitionId = getCaseDefinitionId(); caseService .withCaseDefinition(caseDefinitionId) .setVariable("aNullValue", null) .create(); TaskQuery query = taskService.createTaskQuery(); try { query.caseInstanceVariableValueGreaterThan("aNullValue", null).list(); fail(); } catch (ProcessEngineException e) {} }
Example #27
Source File: TaskQueryImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public TaskQuery followUpBeforeOrNotExistent(Date followUpDate) { this.followUpBefore = followUpDate; this.followUpNullAccepted = true; expressions.remove("followUpBeforeOrNotExistent"); return this; }
Example #28
Source File: MultiTenancySignalReceiveTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void sendSignalToStartAndIntermediateCatchEventForTenant() { testRule.deployForTenant(TENANT_ONE, SIGNAL_START_PROCESS, SIGNAL_CATCH_PROCESS); testRule.deployForTenant(TENANT_TWO, SIGNAL_START_PROCESS, SIGNAL_CATCH_PROCESS); engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_ONE).execute(); engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_TWO).execute(); engineRule.getRuntimeService().createSignalEvent("signal").tenantId(TENANT_ONE).send(); engineRule.getRuntimeService().createSignalEvent("signal").tenantId(TENANT_TWO).send(); TaskQuery query = engineRule.getTaskService().createTaskQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), is(2L)); }
Example #29
Source File: CallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/bpmn/callactivity/CallActivity.testCallSimpleSubProcessWithHashExpressions.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/callactivity/simpleSubProcess.bpmn20.xml"}) public void testCallSimpleSubProcessWithHashExpressions() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callSimpleSubProcess"); // one task in the subprocess should be active after starting the process // instance TaskQuery taskQuery = taskService.createTaskQuery(); Task taskBeforeSubProcess = taskQuery.singleResult(); assertEquals("Task before subprocess", taskBeforeSubProcess.getName()); // Completing the task continues the process which leads to calling the // subprocess. The sub process we want to call is passed in as a variable // into this task taskService.setVariable(taskBeforeSubProcess.getId(), "simpleSubProcessExpression", "simpleSubProcess"); taskService.complete(taskBeforeSubProcess.getId()); Task taskInSubProcess = taskQuery.singleResult(); assertEquals("Task in subprocess", taskInSubProcess.getName()); // Completing the task in the subprocess, finishes the subprocess taskService.complete(taskInSubProcess.getId()); Task taskAfterSubProcess = taskQuery.singleResult(); assertEquals("Task after subprocess", taskAfterSubProcess.getName()); // Completing this task end the process instance taskService.complete(taskAfterSubProcess.getId()); assertProcessEnded(processInstance.getId()); }
Example #30
Source File: BoundaryConditionalEventTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testNonInterruptingSetVariableInInputMapping() { final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY) .startEvent().userTask().name(TASK_BEFORE_CONDITION) .serviceTask(TASK_WITH_CONDITION_ID) .camundaInputParameter(VARIABLE_NAME, "1") .camundaExpression(TRUE_CONDITION) .userTask().name(TASK_AFTER_SERVICE_TASK) .endEvent().done(); deployConditionalBoundaryEventProcess(modelInstance, TASK_WITH_CONDITION_ID, false); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId()); Task task = taskQuery.singleResult(); assertNotNull(task); assertEquals(TASK_BEFORE_CONDITION, task.getName()); //when task before service task is completed taskService.complete(task.getId()); // then the variable is set in an input mapping // -> non interrupting conditional event is not triggered tasksAfterVariableIsSet = taskQuery.list(); assertEquals(TASK_AFTER_SERVICE_TASK, tasksAfterVariableIsSet.get(0).getName()); }