use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class CaseInstanceQueryTest method testQueryByCompleted.
public void testQueryByCompleted() {
for (org.camunda.bpm.engine.repository.Deployment deployment : repositoryService.createDeploymentQuery().list()) {
repositoryService.deleteDeployment(deployment.getId(), true);
}
repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn").deploy();
for (int i = 0; i < 4; i++) {
String id = caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).businessKey(String.valueOf(i)).create().getId();
caseInstanceIds.add(id);
}
List<CaseExecution> executions = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").list();
for (CaseExecution caseExecution : executions) {
caseService.withCaseExecution(caseExecution.getId()).disable();
}
CaseInstanceQuery query = caseService.createCaseInstanceQuery();
query.completed();
verifyQueryResults(query, 4);
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class CaseExecutionQueryTest method testNullBusinessKeyForChildExecutions.
public void testNullBusinessKeyForChildExecutions() {
caseService.createCaseInstanceByKey(CASE_DEFINITION_KEY, "7890");
List<CaseExecution> executions = caseService.createCaseExecutionQuery().caseInstanceBusinessKey("7890").list();
for (CaseExecution e : executions) {
if (((CaseExecutionEntity) e).isCaseInstanceExecution()) {
assertEquals("7890", ((CaseExecutionEntity) e).getBusinessKeyWithoutCascade());
} else {
assertNull(((CaseExecutionEntity) e).getBusinessKeyWithoutCascade());
}
}
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class CaseExecutionQueryTest method testQueryByCaseExecutionId.
public void testQueryByCaseExecutionId() {
CaseExecutionQuery query = caseService.createCaseExecutionQuery();
List<CaseExecution> executions = caseService.createCaseExecutionQuery().caseDefinitionKey(CASE_DEFINITION_KEY_2).list();
for (CaseExecution execution : executions) {
query.caseExecutionId(execution.getId());
verifyQueryResults(query, 1);
}
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class TaskQueryTest method testQueryResultOrderingByCaseExecutionVariables.
@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn")
public void testQueryResultOrderingByCaseExecutionVariables() {
// given three tasks with String case instance variables
CaseInstance instance1 = caseService.createCaseInstanceByKey("oneTaskCase", Collections.<String, Object>singletonMap("var", "cValue"));
CaseInstance instance2 = caseService.createCaseInstanceByKey("oneTaskCase", Collections.<String, Object>singletonMap("var", "aValue"));
CaseInstance instance3 = caseService.createCaseInstanceByKey("oneTaskCase", Collections.<String, Object>singletonMap("var", "bValue"));
// and local case execution variables
CaseExecution caseExecution1 = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").caseInstanceId(instance1.getId()).singleResult();
caseService.withCaseExecution(caseExecution1.getId()).setVariableLocal("var", "aValue").manualStart();
CaseExecution caseExecution2 = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").caseInstanceId(instance2.getId()).singleResult();
caseService.withCaseExecution(caseExecution2.getId()).setVariableLocal("var", "bValue").manualStart();
CaseExecution caseExecution3 = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").caseInstanceId(instance3.getId()).singleResult();
caseService.withCaseExecution(caseExecution3.getId()).setVariableLocal("var", "cValue").manualStart();
// when I make a task query with ascending variable ordering by tasks variables
List<Task> tasks = taskService.createTaskQuery().caseDefinitionKey("oneTaskCase").orderByCaseExecutionVariable("var", ValueType.STRING).asc().list();
// then the tasks are ordered correctly by their local variables
assertEquals(3, tasks.size());
assertEquals(instance1.getId(), tasks.get(0).getCaseInstanceId());
assertEquals(instance2.getId(), tasks.get(1).getCaseInstanceId());
assertEquals(instance3.getId(), tasks.get(2).getCaseInstanceId());
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryScenarioTest method testTriggerTaskEntryCriterion.
@Test
@ScenarioUnderTest("triggerTaskEntryCriterion.1")
public void testTriggerTaskEntryCriterion() {
// given
// enabled human task inside a stage instance
String firstHumanTaskId = rule.caseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
// 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.isEnabled());
CaseSentryPartEntity sentryPart = createCaseSentryPartQuery().sourceCaseExecutionId(firstHumanTaskId).singleResult();
// the associated sentry part is not satisfied
assertFalse(sentryPart.isSatisfied());
// the source is null (because this sentry part
// has been migrated into 7.4)
assertNull(sentryPart.getSource());
}
Aggregations