public void execute(ProcessEngine engine, string scenarioName) { CaseService caseService = engine.CaseService; CaseInstance caseInstance = caseService.createCaseInstanceByKey("case", scenarioName); string caseInstanceId = caseInstance.Id; CaseExecutionQuery query = caseService.createCaseExecutionQuery().caseInstanceId(caseInstanceId); string firstHumanTaskId = query.activityId("PI_HumanTask_1").singleResult().Id; caseService.manuallyStartCaseExecution(firstHumanTaskId); caseService.completeCaseExecution(firstHumanTaskId); string secondHumanTaskId = query.activityId("PI_HumanTask_2").singleResult().Id; caseService.manuallyStartCaseExecution(secondHumanTaskId); caseService.completeCaseExecution(secondHumanTaskId); }
public virtual void testTriggerTaskEntryCriterion() { // given // enabled human task inside a stage instance string firstHumanTaskId = rule.caseExecutionQuery().activityId("PI_HumanTask_1").singleResult().Id; // when // start and complete human task caseService.manuallyStartCaseExecution(firstHumanTaskId); caseService.completeCaseExecution(firstHumanTaskId); // then // entry criterion of the second human task inside the stage instance // will be triggered CaseExecution secondHumanTask = rule.caseExecutionQuery().activityId("PI_HumanTask_2").singleResult(); // ... and the task is enabled assertTrue(secondHumanTask.Enabled); CaseSentryPartEntity sentryPart = createCaseSentryPartQuery().sourceCaseExecutionId(firstHumanTaskId).singleResult(); // the associated sentry part is not satisfied assertFalse(sentryPart.Satisfied); // the source is null (because this sentry part // has been migrated into 7.4) assertNull(sentryPart.Source); }