Search in sources :

Example 61 with CaseExecution

use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.

the class CaseTaskTest method testActivityType.

/**
 * Changed process definition as we prove activity type
 */
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCaseWithManualActivation.cmmn" })
public void testActivityType() {
    // given
    createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
    // when
    CaseExecution caseTask = queryCaseExecutionByActivityId(CASE_TASK);
    // then
    assertEquals("caseTask", caseTask.getActivityType());
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 62 with CaseExecution

use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.

the class CaseTaskTest method testInputDifferentBusinessKey.

/**
 * variable passed in manual activation - change process definition
 */
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputDifferentBusinessKey.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputDifferentBusinessKey() {
    // given
    String businessKey = "myBusinessKey";
    String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, businessKey).getId();
    String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
    // when
    caseService.withCaseExecution(caseTaskId).setVariable("myOwnBusinessKey", "myOwnBusinessKey").manualStart();
    // then
    CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
    assertNotNull(subCaseInstance);
    String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
    CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
    assertEquals(caseTaskId, superCaseExecutionId);
    assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
    assertEquals("myOwnBusinessKey", subCaseInstance.getBusinessKey());
    // complete ////////////////////////////////////////////////////////
    terminate(subCaseInstance.getId());
    close(subCaseInstance.getId());
    assertCaseEnded(subCaseInstance.getId());
    terminate(caseTaskId);
    close(superCaseInstanceId);
    assertCaseEnded(superCaseInstanceId);
}
Also used : CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 63 with CaseExecution

use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.

the class CaseTaskTest method testResumeCaseTask.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testResumeCaseTask() {
    // given
    String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
    String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
    suspend(caseTaskId);
    CaseInstance subCaseInstance = queryOneTaskCaseInstance();
    assertTrue(subCaseInstance.isActive());
    // when
    resume(caseTaskId);
    // then
    CaseExecution caseTask = queryCaseExecutionByActivityId(CASE_TASK);
    assertTrue(caseTask.isActive());
    subCaseInstance = queryOneTaskCaseInstance();
    assertTrue(subCaseInstance.isActive());
    // complete ////////////////////////////////////////////////////////
    String subCaseInstanceId = queryOneTaskCaseInstance().getId();
    terminate(subCaseInstanceId);
    close(subCaseInstanceId);
    assertCaseEnded(subCaseInstanceId);
    terminate(caseTaskId);
    close(superCaseInstanceId);
    assertCaseEnded(superCaseInstanceId);
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 64 with CaseExecution

use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.

the class CaseTaskTest method testNotBlockingCaseTask.

/**
 * assert on default behaviour - remove manual activation
 */
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testNotBlockingCaseTask.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testNotBlockingCaseTask() {
    // given
    String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
    // then
    CaseInstance subCaseInstance = queryOneTaskCaseInstance();
    assertNotNull(subCaseInstance);
    CaseExecution caseTask = queryCaseExecutionByActivityId(CASE_TASK);
    assertNull(caseTask);
    CaseInstance superCaseInstance = caseService.createCaseInstanceQuery().caseDefinitionKey(ONE_CASE_TASK_CASE).singleResult();
    assertNotNull(superCaseInstance);
    assertTrue(superCaseInstance.isCompleted());
    // complete ////////////////////////////////////////////////////////
    close(superCaseInstanceId);
    assertCaseEnded(superCaseInstanceId);
    terminate(subCaseInstance.getId());
    close(subCaseInstance.getId());
    assertProcessEnded(subCaseInstance.getId());
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 65 with CaseExecution

use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.

the class CaseTaskTest method testCallCaseByVersion.

/**
 * assertions on completion - take manual activation out
 */
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testCallCaseByVersion.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCallCaseByVersion() {
    // given
    String bpmnResourceName = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn";
    String secondDeploymentId = repositoryService.createDeployment().addClasspathResource(bpmnResourceName).deploy().getId();
    String thirdDeploymentId = repositoryService.createDeployment().addClasspathResource(bpmnResourceName).deploy().getId();
    assertEquals(4, repositoryService.createCaseDefinitionQuery().count());
    String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
    String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
    String caseDefinitionIdInSecondDeployment = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(ONE_TASK_CASE).deploymentId(secondDeploymentId).singleResult().getId();
    // then
    CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
    assertNotNull(subCaseInstance);
    String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
    CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
    assertEquals(caseTaskId, superCaseExecutionId);
    assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
    assertEquals(caseDefinitionIdInSecondDeployment, subCaseInstance.getCaseDefinitionId());
    // complete ////////////////////////////////////////////////////////
    terminate(subCaseInstance.getId());
    close(subCaseInstance.getId());
    assertCaseEnded(subCaseInstance.getId());
    terminate(caseTaskId);
    close(superCaseInstanceId);
    assertCaseEnded(superCaseInstanceId);
    repositoryService.deleteDeployment(secondDeploymentId, true);
    repositoryService.deleteDeployment(thirdDeploymentId, true);
}
Also used : CaseExecutionEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity) CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) Deployment(org.camunda.bpm.engine.test.Deployment)

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