Search in sources :

Example 86 with CaseExecutionQuery

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

the class CaseExecutionQueryTest method testQueryByShortVariableValueNotEquals.

public void testQueryByShortVariableValueNotEquals() {
    caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariable("aShortValue", (short) 123).create();
    CaseExecutionQuery query = caseService.createCaseExecutionQuery();
    query.variableValueNotEquals("aShortValue", (short) 124);
    verifyQueryResults(query, 1);
}
Also used : CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery)

Example 87 with CaseExecutionQuery

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

the class CaseExecutionQueryTest method testQueryBySerializableCaseInstanceVariableValueEquals.

public void testQueryBySerializableCaseInstanceVariableValueEquals() {
    List<String> serializable = new ArrayList<String>();
    serializable.add("one");
    serializable.add("two");
    serializable.add("three");
    caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariable("aSerializableValue", serializable).create();
    CaseExecutionQuery query = caseService.createCaseExecutionQuery();
    try {
        query.caseInstanceVariableValueEquals("aSerializableValue", serializable).list();
        fail();
    } catch (ProcessEngineException e) {
    }
}
Also used : ArrayList(java.util.ArrayList) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery)

Example 88 with CaseExecutionQuery

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

the class CaseExecutionQueryTest method testQueryByStringVariableValueNotEquals.

public void testQueryByStringVariableValueNotEquals() {
    caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariable("aStringValue", "abc").create();
    CaseExecutionQuery query = caseService.createCaseExecutionQuery();
    query.variableValueNotEquals("aStringValue", "abd");
    verifyQueryResults(query, 1);
}
Also used : CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery)

Example 89 with CaseExecutionQuery

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

the class CaseExecutionQueryTest method testQueryByByteArrayVariableValueEquals.

public void testQueryByByteArrayVariableValueEquals() {
    byte[] bytes = "somebytes".getBytes();
    caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariable("aByteArrayValue", bytes).create();
    CaseExecutionQuery query = caseService.createCaseExecutionQuery();
    try {
        query.variableValueEquals("aByteArrayValue", bytes).list();
        fail();
    } catch (ProcessEngineException e) {
    }
}
Also used : ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery)

Example 90 with CaseExecutionQuery

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

the class RepetitionRuleTest method testRepeatStageWithoutEntryCriteriaWhenCompleting.

@Deployment(resources = "org/camunda/bpm/engine/test/cmmn/repetition/RepetitionRuleTest.testRepeatStageWithoutEntryCriteria.cmmn")
public void testRepeatStageWithoutEntryCriteriaWhenCompleting() {
    // given
    String caseInstanceId = createCaseInstanceByKey(CASE_ID, Variables.createVariables().putValue("repeating", true)).getId();
    CaseExecutionQuery stageQuery = caseService.createCaseExecutionQuery().activityId("PI_Stage_1");
    assertEquals(1, stageQuery.count());
    CaseExecution activeStageCaseExecution = stageQuery.active().singleResult();
    assertNotNull(activeStageCaseExecution);
    CaseExecution humanTaskCaseExecution = queryCaseExecutionByActivityId("PI_HumanTask_1");
    // when (1)
    complete(humanTaskCaseExecution.getId());
    // then (1)
    stageQuery = caseService.createCaseExecutionQuery().activityId("PI_Stage_1");
    assertEquals(1, stageQuery.count());
    activeStageCaseExecution = stageQuery.active().singleResult();
    assertNotNull(activeStageCaseExecution);
    humanTaskCaseExecution = queryCaseExecutionByActivityId("PI_HumanTask_1");
    // when (2)
    caseService.setVariable(caseInstanceId, "repeating", false);
    complete(humanTaskCaseExecution.getId());
    // then (3)
    CaseExecutionQuery query = caseService.createCaseExecutionQuery();
    assertEquals(1, query.count());
    assertEquals(caseInstanceId, query.singleResult().getId());
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)226 Deployment (org.camunda.bpm.engine.test.Deployment)70 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)47 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)24 NotValidException (org.camunda.bpm.engine.exception.NotValidException)24 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)16 ArrayList (java.util.ArrayList)14 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)13 Date (java.util.Date)12 Task (org.camunda.bpm.engine.task.Task)10 VariableMap (org.camunda.bpm.engine.variable.VariableMap)9 HashMap (java.util.HashMap)8 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)4 CaseInstanceQuery (org.camunda.bpm.engine.runtime.CaseInstanceQuery)4 CaseService (org.camunda.bpm.engine.CaseService)2 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)2 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)2 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)2 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 CaseExecutionDto (org.camunda.bpm.engine.rest.dto.runtime.CaseExecutionDto)1