Search in sources :

Example 16 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class CaseDefinitionQueryTest method testQueryByDeploymentId.

public void testQueryByDeploymentId() {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
    query.deploymentId(deploymentOneId);
    verifyQueryResults(query, 2);
}
Also used : CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 17 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class CaseDefinitionQueryTest method testQuerySorting.

public void testQuerySorting() {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
    // asc
    query.orderByCaseDefinitionId().asc();
    verifyQueryResults(query, 4);
    query = repositoryService.createCaseDefinitionQuery();
    query.orderByDeploymentId().asc();
    verifyQueryResults(query, 4);
    query = repositoryService.createCaseDefinitionQuery();
    query.orderByCaseDefinitionKey().asc();
    verifyQueryResults(query, 4);
    query = repositoryService.createCaseDefinitionQuery();
    query.orderByCaseDefinitionVersion().asc();
    verifyQueryResults(query, 4);
    // desc
    query = repositoryService.createCaseDefinitionQuery();
    query.orderByCaseDefinitionId().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createCaseDefinitionQuery();
    query.orderByDeploymentId().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createCaseDefinitionQuery();
    query.orderByCaseDefinitionKey().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createCaseDefinitionQuery();
    query.orderByCaseDefinitionVersion().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createCaseDefinitionQuery();
    // Typical use case
    query.orderByCaseDefinitionKey().asc().orderByCaseDefinitionVersion().desc();
    List<CaseDefinition> caseDefinitions = query.list();
    assertEquals(4, caseDefinitions.size());
    assertEquals("one", caseDefinitions.get(0).getKey());
    assertEquals(2, caseDefinitions.get(0).getVersion());
    assertEquals("one", caseDefinitions.get(1).getKey());
    assertEquals(1, caseDefinitions.get(1).getVersion());
    assertEquals("two", caseDefinitions.get(2).getKey());
    assertEquals(1, caseDefinitions.get(2).getVersion());
}
Also used : CaseDefinition(org.camunda.bpm.engine.repository.CaseDefinition) CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 18 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class CaseDefinitionQueryTest method testQueryByInvalidCategoryLike.

public void testQueryByInvalidCategoryLike() {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
    query.caseDefinitionCategoryLike("invalid");
    verifyQueryResults(query, 0);
    try {
        query.caseDefinitionCategoryLike(null);
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 19 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class CaseDefinitionQueryTest method testQueryByNameLike.

public void testQueryByNameLike() {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
    query.caseDefinitionNameLike("%w%");
    verifyQueryResults(query, 1);
    query.caseDefinitionNameLike("%z\\_");
    verifyQueryResults(query, 1);
}
Also used : CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 20 with CaseDefinitionQuery

use of org.camunda.bpm.engine.repository.CaseDefinitionQuery in project camunda-bpm-platform by camunda.

the class CaseDefinitionQueryTest method testQueryByInvalidNameLike.

public void testQueryByInvalidNameLike() {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
    query.caseDefinitionNameLike("%invalid%");
    verifyQueryResults(query, 0);
    try {
        query.caseDefinitionNameLike(null);
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Aggregations

CaseDefinitionQuery (org.camunda.bpm.engine.repository.CaseDefinitionQuery)47 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)12 NotValidException (org.camunda.bpm.engine.exception.NotValidException)10 Response (com.jayway.restassured.response.Response)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 User (org.camunda.bpm.engine.identity.User)2 UserQuery (org.camunda.bpm.engine.identity.UserQuery)2 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)2 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)2 CaseDefinitionQueryDto (org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionQueryDto)2 Deployment (org.camunda.bpm.engine.test.Deployment)2 Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 InputStream (java.io.InputStream)1 LinkedHashMap (java.util.LinkedHashMap)1 ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)1 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)1