org.camunda.bpm.engine.runtime.CaseExecution Java Examples
The following examples show how to use
org.camunda.bpm.engine.runtime.CaseExecution.
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: SentryVariableOnPartEntryCriteriaTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testMoreVariableOnPart.cmmn"}) public void testMultipleVariableOnParts() { String caseInstanceId = caseService.createCaseInstanceByKey("Case_1").getId(); caseService.setVariable(caseInstanceId, "variable_1", "aVariable"); CaseExecution firstHumanTask = queryCaseExecutionByActivityId("HumanTask_1"); // sentry would not be satisfied as the variable has to updated and deleted as well assertFalse(firstHumanTask.isEnabled()); caseService.setVariable(caseInstanceId, "variable_1", "bVariable"); firstHumanTask = queryCaseExecutionByActivityId("HumanTask_1"); // sentry would not be satisfied as the variable has to deleted assertFalse(firstHumanTask.isEnabled()); caseService.removeVariable(caseInstanceId, "variable_1"); firstHumanTask = queryCaseExecutionByActivityId("HumanTask_1"); assertTrue(firstHumanTask.isEnabled()); }
Example #2
Source File: CaseServiceProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={ "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCase.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testStart() { // given String caseInstanceId = createCaseInstance(DEFINITION_KEY).getId(); ProcessInstance processInstance; // then processInstance = queryProcessInstance(); assertNotNull(processInstance); assertEquals(caseInstanceId, processInstance.getCaseInstanceId()); CaseExecution processTask = queryCaseExecutionByActivityId(PROCESS_TASK_KEY); assertTrue(processTask.isActive()); }
Example #3
Source File: VariableListenerTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testVariableListenerByExpression() { SimpleBean simpleBean = new SimpleBean(); beans.put("bean", simpleBean); caseService .withCaseDefinitionByKey("case") .create(); CaseExecution taskExecution = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult(); assertNotNull(taskExecution); // when i create a variable on the human task caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute(); // then the listener is invoked assertTrue(simpleBean.wasInvoked()); }
Example #4
Source File: CaseServiceProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={ "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCaseWithManualActivation.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testManualStart() { // given String caseInstanceId = createCaseInstance(DEFINITION_KEY).getId(); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK_KEY).getId(); ProcessInstance processInstance = queryProcessInstance(); assertNull(processInstance); // when caseService .withCaseExecution(processTaskId) .manualStart(); // then processInstance = queryProcessInstance(); assertNotNull(processInstance); assertEquals(caseInstanceId, processInstance.getCaseInstanceId()); CaseExecution processTask = queryCaseExecutionByActivityId(PROCESS_TASK_KEY); assertTrue(processTask.isActive()); }
Example #5
Source File: CaseExecutionRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public List<CaseExecutionDto> queryCaseExecutions(CaseExecutionQueryDto queryDto, Integer firstResult, Integer maxResults) { ProcessEngine engine = getProcessEngine(); queryDto.setObjectMapper(getObjectMapper()); CaseExecutionQuery query = queryDto.toQuery(engine); List<CaseExecution> matchingExecutions; if (firstResult != null || maxResults != null) { matchingExecutions = executePaginatedQuery(query, firstResult, maxResults); } else { matchingExecutions = query.list(); } List<CaseExecutionDto> executionResults = new ArrayList<CaseExecutionDto>(); for (CaseExecution execution : matchingExecutions) { CaseExecutionDto resultExecution = CaseExecutionDto.fromCaseExecution(execution); executionResults.add(resultExecution); } return executionResults; }
Example #6
Source File: CaseExecutionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testQueryByDisabled() { List<CaseExecution> caseExecutions= caseService .createCaseExecutionQuery() .caseDefinitionKey(CASE_DEFINITION_KEY_2) .activityId("PI_HumanTask_1") .list(); for (CaseExecution caseExecution : caseExecutions) { caseService .withCaseExecution(caseExecution.getId()) .disable(); } CaseExecutionQuery query = caseService.createCaseExecutionQuery(); query.disabled(); verifyQueryResults(query, 1); }
Example #7
Source File: SentryVariableOnPartEntryCriteriaTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testSameVariableOnPartAsEntryAndExitCriteria.cmmn"}) public void testSameVariableOnPartAsEntryAndExitCriteria() { caseService.createCaseInstanceByKey("Case_1").getId(); CaseExecution stageExecution = queryCaseExecutionByActivityId("Stage_1"); caseService.setVariable(stageExecution.getId(), "value", 99); CaseExecution humanTask = queryCaseExecutionByActivityId("HumanTask_1"); // exit criteria not satisfied due to the variable 'value' must be greater than 100 assertTrue(humanTask.isEnabled()); manualStart(humanTask.getId()); caseService.setVariable(stageExecution.getId(), "value", 101); stageExecution = queryCaseExecutionByActivityId("Stage_1"); assertNull(stageExecution); }
Example #8
Source File: HistoricCaseActivityInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricCaseActivityInstanceTest.oneStageAndOneTaskCaseWithManualActivation.cmmn"}) public void testDisabledHistoricActivityInstancesStayDisabledOnComplete() { // given createCaseInstance(); CaseExecution humanTask = queryCaseExecutionByActivityId("PI_HumanTask_3"); assertTrue(humanTask.isEnabled()); CaseExecution stageExecution = queryCaseExecutionByActivityId("PI_Stage_1"); disable(stageExecution.getId()); stageExecution = queryCaseExecutionByActivityId("PI_Stage_1"); assertTrue(stageExecution.isDisabled()); // when CaseExecution casePlanExecution = queryCaseExecutionByActivityId("CasePlanModel_1"); complete(casePlanExecution.getId()); // then make sure disabled executions stay disabled HistoricCaseActivityInstance stageInstance = historyService.createHistoricCaseActivityInstanceQuery().caseActivityId("PI_Stage_1").singleResult(); HistoricCaseActivityInstance taskInstance = historyService.createHistoricCaseActivityInstanceQuery().caseActivityId("PI_HumanTask_3").singleResult(); assertTrue(stageInstance.isDisabled()); assertTrue(taskInstance.isTerminated()); }
Example #9
Source File: RepetitionRuleTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testAutoCompleteStage() { // given String caseInstanceId = createCaseInstance().getId(); String humanTask1 = queryCaseExecutionByActivityId("PI_HumanTask_1").getId(); // when complete(humanTask1); // then CaseExecution stage = queryCaseExecutionByActivityId("PI_Stage_1"); assertNull(stage); CaseInstance caseInstance = (CaseInstance) queryCaseExecutionById(caseInstanceId); assertTrue(caseInstance.isCompleted()); }
Example #10
Source File: SentryVariableOnPartEntryCriteriaTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testNotAffectedSentriesInMultipleStageScopes.cmmn"}) public void testNotAffectedSentriesInMultipleStageScopes() { caseService.createCaseInstanceByKey("Case_1").getId(); String stageExecution1_Id = queryCaseExecutionByActivityId("Stage_1").getId(); caseService.setVariable(stageExecution1_Id, "value", 99); CaseExecution humanTask1 = queryCaseExecutionByActivityId("HumanTask_1"); // if part is not satisfied assertFalse(humanTask1.isEnabled()); CaseExecution humanTask2 = queryCaseExecutionByActivityId("HumanTask_2"); // if part is not satisfied assertFalse(humanTask2.isEnabled()); // Evaluates the sentry's IfPart alone caseService.setVariable(stageExecution1_Id, "value", 101); humanTask1 = queryCaseExecutionByActivityId("HumanTask_1"); assertTrue(humanTask1.isEnabled()); humanTask2 = queryCaseExecutionByActivityId("HumanTask_2"); assertTrue(humanTask2.isEnabled()); }
Example #11
Source File: VariableListenerTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testListenerOnParentScope() { caseService .withCaseDefinitionByKey("case") .create(); CaseExecution taskExecution = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult(); assertNotNull(taskExecution); // when i set a variable on a deeper scope caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute(); // then the listener is invoked assertEquals(1, LogVariableListener.getInvocations().size()); DelegateVariableInstanceSpec .fromCaseExecution(taskExecution) .event(VariableListener.CREATE) .name("aTaskVariable") .value("aTaskValue") .matches(LogVariableListener.getInvocations().get(0)); LogVariableListener.reset(); }
Example #12
Source File: SentryVariableOnPartEntryCriteriaTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testMultipleOnPartsInStage.cmmn"}) public void testMultipleOnPartsInStages() { String caseInstanceId = caseService.createCaseInstanceByKey("Case_1").getId(); caseService.setVariable(caseInstanceId, "variable_1", 101); CaseExecution humanTask3 = queryCaseExecutionByActivityId("HumanTask_3"); assertTrue(humanTask3.isEnabled()); CaseExecution humanTask2 = queryCaseExecutionByActivityId("HumanTask_2"); // Not enabled as the sentry waits for human task 1 to complete assertFalse(humanTask2.isEnabled()); CaseExecution humanTask1 = queryCaseExecutionByActivityId("HumanTask_1"); manualStart(humanTask1.getId()); complete(humanTask1.getId()); humanTask2 = queryCaseExecutionByActivityId("HumanTask_2"); assertTrue(humanTask2.isEnabled()); }
Example #13
Source File: SentryVariableOnPartExitCriteriaTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/sentry/SentryVariableOnPartExitCriteriaTest.testExitTaskWithVariableOnPart.cmmn"}) public void testExitTaskWithVariableOnPartSatisfied() { // given createCaseInstance(); CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1"); String firstHumanTaskId = firstHumanTask.getId(); assertTrue(firstHumanTask.isActive()); CaseExecution secondHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_2"); String secondHumanTaskId = secondHumanTask.getId(); assertTrue(secondHumanTask.isActive()); // when caseService .withCaseExecution(firstHumanTaskId) .setVariable("variable_1", 100) .complete(); // then firstHumanTask = queryCaseExecutionById(firstHumanTaskId); assertNull(firstHumanTask); secondHumanTask = queryCaseExecutionById(secondHumanTaskId); assertNull(secondHumanTask); }
Example #14
Source File: CaseServiceProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={ "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCase.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testCompleteProcessInstanceShouldCompleteProcessTask() { // given createCaseInstance(DEFINITION_KEY); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK_KEY).getId(); String taskId = queryTask().getId(); // when taskService.complete(taskId); // then CaseExecution processTask = queryCaseExecutionByActivityId(PROCESS_TASK_KEY); assertNull(processTask); CaseInstance caseInstance = caseService .createCaseInstanceQuery() .singleResult(); assertNotNull(caseInstance); assertTrue(caseInstance.isCompleted()); }
Example #15
Source File: RepetitionRuleTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testRepeatStage() { // given createCaseInstance(); String firstHumanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId(); // when complete(firstHumanTaskId); // then CaseExecutionQuery query = caseService .createCaseExecutionQuery() .activityId("PI_Stage_1"); assertEquals(2, query.count()); CaseExecution originInstance = query.active().singleResult(); assertNotNull(originInstance); CaseExecution repetitionInstance = query.available().singleResult(); assertNotNull(repetitionInstance); }
Example #16
Source File: CaseServiceProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={ "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCase.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testTerminate() { // given createCaseInstance(DEFINITION_KEY); CaseExecution processTask = queryCaseExecutionByActivityId(PROCESS_TASK_KEY); assertTrue(processTask.isActive()); // when caseService .withCaseExecution(processTask.getId()) .terminate(); processTask = queryCaseExecutionByActivityId(PROCESS_TASK_KEY); assertNull(processTask); }
Example #17
Source File: CaseExecutionQueryVariableIgnoreCaseTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testCaseInstanceVariableNameAndValueNotEqualsIgnoreCase() { // given // when List<CaseExecution> neq = queryNameValueIgnoreCase().caseInstanceVariableValueNotEquals(VARIABLE_NAME, VARIABLE_VALUE).list(); List<CaseExecution> neqNameLC = queryNameValueIgnoreCase().caseInstanceVariableValueNotEquals(VARIABLE_NAME_LC, VARIABLE_VALUE).list(); List<CaseExecution> neqValueLC = queryNameValueIgnoreCase().caseInstanceVariableValueNotEquals(VARIABLE_NAME, VARIABLE_VALUE_LC).list(); List<CaseExecution> neqValueNE = queryNameValueIgnoreCase().caseInstanceVariableValueNotEquals(VARIABLE_NAME, VARIABLE_VALUE_NE).list(); List<CaseExecution> neqNameValueLC = queryNameValueIgnoreCase().caseInstanceVariableValueNotEquals(VARIABLE_NAME_LC, VARIABLE_VALUE_LC).list(); List<CaseExecution> neqNameLCValueNE = queryNameValueIgnoreCase().caseInstanceVariableValueNotEquals(VARIABLE_NAME_LC, VARIABLE_VALUE_NE).list(); // then assertThat(neq).isEmpty(); assertThat(neqNameLC).isEmpty(); assertThat(neqValueLC).isEmpty(); assertThatListContainsOnlyExpectedElements(neqValueNE, instance); assertThat(neqNameValueLC).isEmpty(); assertThatListContainsOnlyExpectedElements(neqNameLCValueNE, instance); }
Example #18
Source File: RequiredRuleTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = "org/camunda/bpm/engine/test/cmmn/required/RequiredRuleTest.testDefaultVariableBasedRule.cmmn") public void testDefaultRequiredRuleEvaluatesToTrue() { CaseInstance caseInstance = caseService.createCaseInstanceByKey("case", Collections.<String, Object>singletonMap("required", true)); CaseExecution taskExecution = caseService .createCaseExecutionQuery() .activityId("PI_HumanTask_1") .singleResult(); assertNotNull(taskExecution); assertTrue(taskExecution.isRequired()); try { caseService.completeCaseExecution(caseInstance.getId()); fail("completing the containing stage should not be allowed"); } catch (NotAllowedException e) { // happy path } }
Example #19
Source File: CaseServiceProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={ "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskWithManualActivationAndOneHumanTaskCase.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testReenableADisabledProcessTask() { // given createCaseInstance(DEFINITION_KEY); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK_KEY).getId(); ProcessInstance processInstance = queryProcessInstance(); assertNull(processInstance); caseService .withCaseExecution(processTaskId) .disable(); // when caseService .withCaseExecution(processTaskId) .reenable(); // then CaseExecution processTask = queryCaseExecutionByActivityId(PROCESS_TASK_KEY); assertTrue(processTask.isEnabled()); }
Example #20
Source File: CaseServiceCaseInstanceTest.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 testTerminateActiveCaseInstanceNonFluent() { // given: String caseDefinitionId = repositoryService .createCaseDefinitionQuery() .singleResult() .getId(); String caseInstanceId = caseService .withCaseDefinition(caseDefinitionId) .create() .getId(); assertNotNull(queryCaseExecutionByActivityId("CasePlanModel_1")); CaseExecution taskExecution = queryCaseExecutionByActivityId("PI_HumanTask_1"); assertTrue(taskExecution.isActive()); caseService.terminateCaseExecution(caseInstanceId); CaseExecution caseInstance = queryCaseExecutionByActivityId("CasePlanModel_1"); assertTrue(caseInstance.isTerminated()); assertNull(queryCaseExecutionByActivityId("PI_HumanTask_1")); }
Example #21
Source File: CaseServiceHumanTaskTest.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 testTerminateNonFluent() { // given: // a deployed case definition String caseDefinitionId = repositoryService .createCaseDefinitionQuery() .singleResult() .getId(); caseService .withCaseDefinition(caseDefinitionId) .create(); CaseExecution taskExecution = queryCaseExecutionByActivityId("PI_HumanTask_1"); // when caseService.terminateCaseExecution(taskExecution.getId()); // then taskExecution = queryCaseExecutionByActivityId("PI_HumanTask_1"); assertNull(taskExecution); }
Example #22
Source File: ProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testProcessInstanceCompletesInOneGo.cmmn", "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testProcessInstanceCompletesInOneGo.bpmn20.xml" }) public void testProcessInstanceCompletesInOneGo() { // given String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE).getId(); // then ProcessInstance processInstance = queryProcessInstance(); assertNull(processInstance); CaseExecution processTask = queryCaseExecutionByActivityId(PROCESS_TASK); assertNull(processTask); CaseInstance caseInstance = caseService .createCaseInstanceQuery() .singleResult(); assertNotNull(caseInstance); assertTrue(caseInstance.isCompleted()); // complete //////////////////////////////////////////////////////// close(caseInstanceId); assertCaseEnded(caseInstanceId); }
Example #23
Source File: CaseTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** * variable passed in manual activation - change process definition */ @Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputDifferentBusinessKey.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testInputDifferentBusinessKey() { // given String businessKey = "myBusinessKey"; String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, businessKey).getId(); String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId(); // when caseService .withCaseExecution(caseTaskId) .setVariable("myOwnBusinessKey", "myOwnBusinessKey") .manualStart(); // then CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance(); assertNotNull(subCaseInstance); String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId(); CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId); assertEquals(caseTaskId, superCaseExecutionId); assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId()); assertEquals("myOwnBusinessKey", subCaseInstance.getBusinessKey()); // complete //////////////////////////////////////////////////////// terminate(subCaseInstance.getId()); close(subCaseInstance.getId()); assertCaseEnded(subCaseInstance.getId()); terminate(caseTaskId); close(superCaseInstanceId); assertCaseEnded(superCaseInstanceId); }
Example #24
Source File: RepetitionRuleTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment public void testAutoCompleteStageAutoActivationRepeatableTask() { // given String caseInstanceId = createCaseInstance().getId(); String stageId = queryCaseExecutionByActivityId("PI_Stage_1").getId(); // then (1) CaseExecutionQuery query = caseService .createCaseExecutionQuery() .activityId("PI_HumanTask_1"); assertEquals(1, query.count()); assertEquals(1, query.active().count()); String activeTaskId = query.singleResult().getId(); // when (2) // completing active task complete(activeTaskId); // then (2) query = caseService .createCaseExecutionQuery() .activityId("PI_HumanTask_1"); assertEquals(1, query.count()); assertEquals(1, query.active().count()); CaseExecution stage = queryCaseExecutionByActivityId("PI_Stage_1"); assertNotNull(stage); assertTrue(stage.isActive()); CaseInstance caseInstance = (CaseInstance) queryCaseExecutionById(caseInstanceId); assertTrue(caseInstance.isActive()); }
Example #25
Source File: SentryVariableOnPartEntryCriteriaTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testStagesScope.cmmn"}) public void testStageLocalScope() { caseService.createCaseInstanceByKey("Case_1").getId(); String stageExecution1_Id = queryCaseExecutionByActivityId("Stage_1").getId(); String stageExecution2_Id = queryCaseExecutionByActivityId("Stage_2").getId(); // variable set to stage 1 scope, so that sentries in stage 2 and in case model should not be triggered caseService.setVariableLocal(stageExecution1_Id, "variable_1", "aVariable"); CaseExecution humanTask1 = queryCaseExecutionByActivityId("HumanTask_1"); assertTrue(humanTask1.isEnabled()); CaseExecution humanTask2 = queryCaseExecutionByActivityId("HumanTask_2"); assertFalse(humanTask2.isEnabled()); CaseExecution humanTask3 = queryCaseExecutionByActivityId("HumanTask_3"); assertFalse(humanTask3.isEnabled()); // variable set to stage 2 scope, so that sentries in the scope of case model should not be triggered caseService.setVariableLocal(stageExecution2_Id, "variable_1", "aVariable"); humanTask2 = queryCaseExecutionByActivityId("HumanTask_2"); assertTrue(humanTask2.isEnabled()); humanTask3 = queryCaseExecutionByActivityId("HumanTask_3"); assertFalse(humanTask3.isEnabled()); }
Example #26
Source File: SentryVariableOnPartEntryCriteriaTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testSimpleVariableOnPart.cmmn"}) public void testVariableCreate() { String caseInstanceId = caseService.createCaseInstanceByKey("Case_1").getId(); CaseExecution firstHumanTask = queryCaseExecutionByActivityId("HumanTask_1"); assertFalse(firstHumanTask.isEnabled()); caseService.setVariable(caseInstanceId, "variable_1", "aVariable"); firstHumanTask = queryCaseExecutionByActivityId("HumanTask_1"); assertTrue(firstHumanTask.isEnabled()); }
Example #27
Source File: ManualActivationRuleTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** * CAM-3170 */ @Deployment(resources = "org/camunda/bpm/engine/test/cmmn/activation/ManualActivationRuleTest.testVariableBasedRule.cmmn") public void testManualActivationRuleEvaluatesToFalse() { caseService.createCaseInstanceByKey("case", Collections.<String, Object>singletonMap("manualActivation", false)); CaseExecution taskExecution = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult(); assertNotNull(taskExecution); assertFalse(taskExecution.isEnabled()); assertTrue(taskExecution.isActive()); }
Example #28
Source File: CaseTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** * default behaviour of manual activation changed - remove manual activation * change definition of oneTaskCase in order to allow suspension state */ @Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn" }) public void testSuspendSubCaseInstance() { // given String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId(); String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId(); String subCaseInstanceId = queryOneTaskCaseInstance().getId(); // when suspend(subCaseInstanceId); // then CmmnExecution subCaseInstance = (CmmnExecution) queryOneTaskCaseInstance(); assertNotNull(subCaseInstance); assertTrue(subCaseInstance.isSuspended()); CaseExecution caseTask = queryCaseExecutionByActivityId(CASE_TASK); assertNotNull(caseTask); assertTrue(caseTask.isActive()); // complete //////////////////////////////////////////////////////// close(subCaseInstanceId); assertCaseEnded(subCaseInstanceId); terminate(caseTaskId); close(superCaseInstanceId); assertCaseEnded(superCaseInstanceId); }
Example #29
Source File: VariableListenerTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment public void testVariableListenerByDelegateExpression() { beans.put("listener", new LogVariableListener()); caseService .withCaseDefinitionByKey("case") .create(); CaseExecution taskExecution = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult(); assertNotNull(taskExecution); // when i create a variable on the human task caseService.withCaseExecution(taskExecution.getId()).setVariableLocal("aTaskVariable", "aTaskValue").execute(); // then the listener is invoked assertEquals(1, LogVariableListener.getInvocations().size()); DelegateVariableInstanceSpec .fromCaseExecution(taskExecution) .event(VariableListener.CREATE) .name("aTaskVariable") .value("aTaskValue") .matches(LogVariableListener.getInvocations().get(0)); LogVariableListener.reset(); }
Example #30
Source File: SentryExitCriteriaTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/sentry/SentryExitCriteriaTest.testExitTask.cmmn"}) public void testExitTask() { // given String caseInstanceId = createCaseInstance().getId(); CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1"); String firstHumanTaskId = firstHumanTask.getId(); assertTrue(firstHumanTask.isActive()); CaseExecution secondHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_2"); String secondHumanTaskId = secondHumanTask.getId(); assertTrue(secondHumanTask.isActive()); assertNull(caseService.getVariable(caseInstanceId, "exit")); // (1) when complete(firstHumanTaskId); // (2) then secondHumanTask = queryCaseExecutionById(secondHumanTaskId); assertNull(secondHumanTask); Object exitVariable = caseService.getVariable(caseInstanceId, "exit"); assertNotNull(exitVariable); assertTrue((Boolean) exitVariable); }