Search in sources :

Example 66 with CaseInstance

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

the class AutoCompleteTest method testNested.

@Deployment
public void testNested() {
    // given
    // a deployed case definition
    CaseExecutionQuery executionQuery = caseService.createCaseExecutionQuery();
    // when
    String caseInstanceId = createCaseInstanceByKey(CASE_DEFINITION_KEY).getId();
    // then
    CaseInstance caseInstance = caseService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();
    assertNotNull(caseInstance);
    assertTrue(caseInstance.isCompleted());
    // stage, humanTask1, humanTask2, humanTask3 are not available
    assertNull(executionQuery.activityId("PI_Stage_1").singleResult());
    assertNull(executionQuery.activityId("PI_HumanTask_1").singleResult());
    assertNull(executionQuery.activityId("PI_HumanTask_2").singleResult());
    assertNull(executionQuery.activityId("PI_HumanTask_3").singleResult());
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 67 with CaseInstance

use of org.camunda.bpm.engine.runtime.CaseInstance 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());
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery) CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 68 with CaseInstance

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

the class DmnDecisionTaskTest method testCallDecisionAsExpressionStartsWithHash.

@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/decisiontask/DmnDecisionTaskTest.testCallDecisionAsExpressionStartsWithHash.cmmn", DECISION_OKAY_DMN })
public void testCallDecisionAsExpressionStartsWithHash() {
    // given
    CaseInstance caseInstance = createCaseInstanceByKey(CASE_KEY, Variables.createVariables().putValue("testDecision", "testDecision"));
    // then
    assertNull(queryCaseExecutionByActivityId(DECISION_TASK));
    assertEquals("okay", getDecisionResult(caseInstance));
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 69 with CaseInstance

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

the class DmnDecisionTaskTest method testIgnoreNonBlockingFlag.

@Deployment(resources = { CMMN_CALL_DECISION_CONSTANT, DECISION_OKAY_DMN })
public void testIgnoreNonBlockingFlag() {
    // given
    CaseInstance caseInstance = createCaseInstanceByKey(CASE_KEY);
    // then
    assertNull(queryCaseExecutionByActivityId(DECISION_TASK));
    assertEquals("okay", getDecisionResult(caseInstance));
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 70 with CaseInstance

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

the class DmnDecisionTaskTest method testCallDecisionAsExpressionStartsWithDollar.

@Deployment(resources = { CMMN_CALL_DECISION_EXPRESSION, DECISION_OKAY_DMN })
public void testCallDecisionAsExpressionStartsWithDollar() {
    // given
    CaseInstance caseInstance = createCaseInstanceByKey(CASE_KEY, Variables.createVariables().putValue("testDecision", "testDecision"));
    // then
    assertNull(queryCaseExecutionByActivityId(DECISION_TASK));
    assertEquals("okay", getDecisionResult(caseInstance));
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)183 Deployment (org.camunda.bpm.engine.test.Deployment)149 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)62 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)23 Test (org.junit.Test)21 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)18 Task (org.camunda.bpm.engine.task.Task)18 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)16 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)13 VariableInstanceQuery (org.camunda.bpm.engine.runtime.VariableInstanceQuery)10 HashMap (java.util.HashMap)9 CaseInstanceQuery (org.camunda.bpm.engine.runtime.CaseInstanceQuery)9 ArrayList (java.util.ArrayList)6 CaseService (org.camunda.bpm.engine.CaseService)6 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)6 Date (java.util.Date)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)5 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)5 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)5 VariableMap (org.camunda.bpm.engine.variable.VariableMap)5