use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseInstanceCmdsTenantCheckTest method manuallyStartCaseExecutionDisabledTenantCheck.
@Test
public void manuallyStartCaseExecutionDisabledTenantCheck() {
identityService.setAuthentication("user", null, null);
processEngineConfiguration.setTenantCheckEnabled(false);
caseService.manuallyStartCaseExecution(caseExecutionId);
identityService.clearAuthentication();
CaseExecution caseExecution = getCaseExecution();
assertThat(caseExecution.isActive(), is(true));
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionTaskTest method createCaseInstance.
protected CaseInstance createCaseInstance(String caseDefinitionKey, String tenantId) {
CaseInstance caseInstance = caseService.withCaseDefinitionByKey(caseDefinitionKey).caseDefinitionTenantId(tenantId).create();
CaseExecution caseExecution = caseService.createCaseExecutionQuery().activityId(DECISION_TASK_ID).tenantIdIn(tenantId).singleResult();
caseService.withCaseExecution(caseExecution.getId()).setVariable("status", "gold").manualStart();
return caseInstance;
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class MigrationCallActivityTest method testCallCmmnCaseParallelMultiInstance.
@Test
public void testCallCmmnCaseParallelMultiInstance() {
// given
BpmnModelInstance model = modify(CallActivityModels.oneCmmnCallActivityProcess("oneTaskCase")).activityBuilder("callActivity").multiInstance().parallel().cardinality("1").done();
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("callActivity#multiInstanceBody", "callActivity#multiInstanceBody").mapActivities("callActivity", "callActivity").build();
// when
ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child(null).scope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("callActivity#multiInstanceBody")).child("callActivity").concurrent().noScope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("callActivity")).done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).beginMiBody("callActivity").activity("callActivity", testHelper.getSingleActivityInstanceBeforeMigration("callActivity").getId()).done());
// and the link between calling and called instance is maintained correctly
testHelper.assertSuperExecutionOfCaseInstance(rule.getCaseService().createCaseInstanceQuery().caseDefinitionKey("oneTaskCase").singleResult().getId(), testHelper.getSingleExecutionIdForActivityAfterMigration("callActivity"));
// and it is possible to complete the called case instance
CaseExecution caseExecution = rule.getCaseService().createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
testHelper.completeTask("PI_HumanTask_1");
// and the calling process instance
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(processInstance.getId());
// and close the called case instance
rule.getCaseService().withCaseExecution(caseExecution.getCaseInstanceId()).close();
testHelper.assertCaseEnded(caseExecution.getCaseInstanceId());
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class MigrationCallActivityTest method testCallCmmnCaseSimpleMigration.
@Test
public void testCallCmmnCaseSimpleMigration() {
// given
BpmnModelInstance model = CallActivityModels.oneCmmnCallActivityProcess("oneTaskCase");
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("callActivity", "callActivity").build();
// when
ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child("callActivity").scope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("callActivity")).done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).activity("callActivity", testHelper.getSingleActivityInstanceBeforeMigration("callActivity").getId()).done());
// and it is possible to complete the called case instance
CaseExecution caseExecution = rule.getCaseService().createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
testHelper.completeTask("PI_HumanTask_1");
// and the calling process instance
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(processInstance.getId());
// and close the called case instance
rule.getCaseService().withCaseExecution(caseExecution.getCaseInstanceId()).close();
testHelper.assertCaseEnded(caseExecution.getCaseInstanceId());
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class CaseExecutionQueryImpl method executeList.
public List<CaseExecution> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
ensureVariablesInitialized();
List<CaseExecution> result = commandContext.getCaseExecutionManager().findCaseExecutionsByQueryCriteria(this, page);
for (CaseExecution caseExecution : result) {
CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;
// initializes the name, type and description
// of the activity on current case execution
caseExecutionEntity.getActivity();
}
return result;
}
Aggregations