Search in sources :

Example 51 with CaseExecution

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));
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Test(org.junit.Test)

Example 52 with CaseExecution

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;
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution)

Example 53 with CaseExecution

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());
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 54 with CaseExecution

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());
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 55 with CaseExecution

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;
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution)

Aggregations

CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)280 Deployment (org.camunda.bpm.engine.test.Deployment)246 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)61 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)48 Task (org.camunda.bpm.engine.task.Task)28 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)27 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)18 Test (org.junit.Test)17 HashMap (java.util.HashMap)13 HistoricCaseActivityInstance (org.camunda.bpm.engine.history.HistoricCaseActivityInstance)11 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)11 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)9 VariableMap (org.camunda.bpm.engine.variable.VariableMap)7 DelegateCaseExecution (org.camunda.bpm.engine.delegate.DelegateCaseExecution)6 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)4 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)4 VariableMapImpl (org.camunda.bpm.engine.variable.impl.VariableMapImpl)3 ArrayList (java.util.ArrayList)2 CaseService (org.camunda.bpm.engine.CaseService)2