Search in sources :

Example 41 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryByStringVariableValueNotEquals.

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

Example 42 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryByCompleted.

public void testQueryByCompleted() {
    for (org.camunda.bpm.engine.repository.Deployment deployment : repositoryService.createDeploymentQuery().list()) {
        repositoryService.deleteDeployment(deployment.getId(), true);
    }
    repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn").deploy();
    for (int i = 0; i < 4; i++) {
        String id = caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).businessKey(String.valueOf(i)).create().getId();
        caseInstanceIds.add(id);
    }
    List<CaseExecution> executions = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").list();
    for (CaseExecution caseExecution : executions) {
        caseService.withCaseExecution(caseExecution.getId()).disable();
    }
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    query.completed();
    verifyQueryResults(query, 4);
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 43 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryByDateVariableValueNotEquals.

public void testQueryByDateVariableValueNotEquals() {
    Date now = new Date();
    caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariable("aDateValue", now).create();
    Date before = new Date(now.getTime() - 100000);
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    query.variableValueNotEquals("aDateValue", before);
    verifyQueryResults(query, 1);
}
Also used : CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery) Date(java.util.Date)

Example 44 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryByInvalidCaseInstanceId.

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

Example 45 with CaseInstanceQuery

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

the class CaseInstanceQueryTest method testQueryByByteArrayVariableValueLessThan.

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

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