Search in sources :

Example 61 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryByIntegerVariableValueLessThanOrEquals.

public void testQueryByIntegerVariableValueLessThanOrEquals() {
    caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariable("anIntegerValue", 456).create();
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    query.variableValueLessThanOrEqual("anIntegerValue", 457);
    verifyQueryResults(query, 1);
    query = caseService.createCaseInstanceQuery();
    query.variableValueLessThanOrEqual("anIntegerValue", 456);
    verifyQueryResults(query, 1);
}
Also used : CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 62 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryBySubProcessInstanceId.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCase.cmmn", "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testQueryBySubProcessInstanceId() {
    String superCaseInstanceId = caseService.createCaseInstanceByKey("oneProcessTaskCase").getId();
    String subProcessInstanceId = runtimeService.createProcessInstanceQuery().superCaseInstanceId(superCaseInstanceId).singleResult().getId();
    CaseInstanceQuery query = caseService.createCaseInstanceQuery().subProcessInstanceId(subProcessInstanceId);
    verifyQueryResults(query, 1);
    CaseInstance caseInstance = query.singleResult();
    assertEquals(superCaseInstanceId, caseInstance.getId());
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 63 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryByByteArrayVariableValueLessThanOrEqual.

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

Example 64 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryByStringVariableValueLike.

public void testQueryByStringVariableValueLike() {
    caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariable("aStringValue", "abc").create();
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    query.variableValueLike("aStringValue", "ab%");
    verifyQueryResults(query, 1);
    query = caseService.createCaseInstanceQuery();
    query.variableValueLike("aStringValue", "%bc");
    verifyQueryResults(query, 1);
    query = caseService.createCaseInstanceQuery();
    query.variableValueLike("aStringValue", "%b%");
    verifyQueryResults(query, 1);
}
Also used : CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 65 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryByInvalidCaseDefinitionId.

public void testQueryByInvalidCaseDefinitionId() {
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    query.caseDefinitionId("invalid");
    verifyQueryResults(query, 0);
    try {
        query.caseDefinitionId(null);
        fail();
    } catch (NotValidException e) {
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Aggregations

CaseInstanceQuery (org.camunda.bpm.engine.runtime.CaseInstanceQuery)123 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)21 Deployment (org.camunda.bpm.engine.test.Deployment)10 NotValidException (org.camunda.bpm.engine.exception.NotValidException)9 ArrayList (java.util.ArrayList)8 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)8 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)7 Date (java.util.Date)6 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)4 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)3 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 CaseInstanceDto (org.camunda.bpm.engine.rest.dto.runtime.CaseInstanceDto)1 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)1