use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class AutoCompleteTest method testManualActivationDisabled.
@Deployment
public void testManualActivationDisabled() {
// given
// a deployed case definition
// when (1)
String caseInstanceId = createCaseInstanceByKey(CASE_DEFINITION_KEY).getId();
// then (1)
CaseInstanceQuery instanceQuery = caseService.createCaseInstanceQuery().caseInstanceId(caseInstanceId);
CaseInstance caseInstance = instanceQuery.singleResult();
assertNotNull(caseInstance);
assertTrue(caseInstance.isActive());
CaseExecutionQuery executionQuery = caseService.createCaseExecutionQuery();
String humanTask2Id = executionQuery.activityId("PI_HumanTask_2").singleResult().getId();
// when (2)
caseService.completeCaseExecution(humanTask2Id);
// then (2)
caseInstance = instanceQuery.singleResult();
assertNotNull(caseInstance);
assertTrue(caseInstance.isCompleted());
// humanTask1 and humanTask2 are not available
assertNull(executionQuery.activityId("PI_HumanTask_1").singleResult());
assertNull(executionQuery.activityId("PI_HumanTask_2").singleResult());
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class AutoCompleteTest method testRequiredEnabled.
@Deployment
public void testRequiredEnabled() {
// given
// a deployed case definition
CaseExecutionQuery executionQuery = caseService.createCaseExecutionQuery();
CaseInstanceQuery instanceQuery = caseService.createCaseInstanceQuery();
// when (1)
String caseInstanceId = createCaseInstanceByKey(CASE_DEFINITION_KEY).getId();
// then (1)
CaseInstance caseInstance = instanceQuery.caseInstanceId(caseInstanceId).singleResult();
assertNotNull(caseInstance);
assertTrue(caseInstance.isActive());
String humanTask1Id = executionQuery.activityId("PI_HumanTask_1").singleResult().getId();
manualStart(humanTask1Id);
// when (2)
complete(humanTask1Id);
// then (2)
caseInstance = instanceQuery.singleResult();
assertNotNull(caseInstance);
assertTrue(caseInstance.isActive());
String humanTask2Id = executionQuery.activityId("PI_HumanTask_2").singleResult().getId();
manualStart(humanTask2Id);
// when (3)
complete(humanTask2Id);
// then (3)
caseInstance = instanceQuery.singleResult();
assertNotNull(caseInstance);
assertTrue(caseInstance.isCompleted());
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class AutoCompleteTest method testTerminate.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/stage/AutoCompleteTest.testRequiredEnabled.cmmn" })
public void testTerminate() {
// given
// a deployed case definition
String caseInstanceId = createCaseInstanceByKey(CASE_DEFINITION_KEY).getId();
CaseExecutionQuery executionQuery = caseService.createCaseExecutionQuery();
CaseInstanceQuery instanceQuery = caseService.createCaseInstanceQuery().caseInstanceId(caseInstanceId);
String humanTask2Id = executionQuery.activityId("PI_HumanTask_2").singleResult().getId();
manualStart(humanTask2Id);
// when
terminate(humanTask2Id);
// then
CaseInstance caseInstance = instanceQuery.singleResult();
assertNotNull(caseInstance);
assertTrue(caseInstance.isCompleted());
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class CaseInstanceRestServiceImpl method queryCaseInstancesCount.
public CountResultDto queryCaseInstancesCount(CaseInstanceQueryDto queryDto) {
ProcessEngine engine = getProcessEngine();
queryDto.setObjectMapper(getObjectMapper());
CaseInstanceQuery query = queryDto.toQuery(engine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
use of org.camunda.bpm.engine.runtime.CaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCallActivityTest method testCaseRefTenantIdExpression.
public void testCaseRefTenantIdExpression() {
BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().camundaCaseRef("Case_1").camundaCaseTenantId("${'" + TENANT_ONE + "'}").endEvent().done();
deploymentForTenant(TENANT_ONE, CMMN);
deployment(callingProcess);
runtimeService.startProcessInstanceByKey("callingProcess");
CaseInstanceQuery query = caseService.createCaseInstanceQuery().caseDefinitionKey("Case_1");
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
Aggregations