Search in sources :

Example 41 with DecisionDefinitionQuery

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

the class DecisionDefinitionQueryTest method testInvalidUsageOfLatest.

public void testInvalidUsageOfLatest() {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    try {
        query.decisionDefinitionId("test").latestVersion().list();
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
    try {
        query.decisionDefinitionName("test").latestVersion().list();
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
    try {
        query.decisionDefinitionNameLike("test").latestVersion().list();
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
    try {
        query.decisionDefinitionVersion(1).latestVersion().list();
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
    try {
        query.deploymentId("test").latestVersion().list();
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery)

Example 42 with DecisionDefinitionQuery

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

the class DecisionDefinitionQueryTest method queryByInvalidDeploymentId.

@Test
public void queryByInvalidDeploymentId() {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    query.deploymentId("invalid");
    verifyQueryResults(query, 0);
    try {
        query.deploymentId(null);
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) Test(org.junit.Test)

Example 43 with DecisionDefinitionQuery

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

the class DecisionDefinitionQueryTest method queryByInvalidName.

@Test
public void queryByInvalidName() {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    query.decisionDefinitionName("invalid");
    verifyQueryResults(query, 0);
    try {
        query.decisionDefinitionName(null);
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) Test(org.junit.Test)

Example 44 with DecisionDefinitionQuery

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

the class DecisionDefinitionQueryTest method queryByResourceNameLike.

@Test
public void queryByResourceNameLike() {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    query.decisionDefinitionResourceNameLike("%ree%");
    verifyQueryResults(query, 1);
    query.decisionDefinitionResourceNameLike("%ee\\_%");
    verifyQueryResults(query, 1);
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) Test(org.junit.Test)

Example 45 with DecisionDefinitionQuery

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

the class DecisionDefinitionQueryTest method querySorting.

@Test
public void querySorting() {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    // asc
    query.orderByDecisionDefinitionId().asc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDeploymentId().asc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionKey().asc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionVersion().asc();
    verifyQueryResults(query, 4);
    // desc
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionId().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDeploymentId().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionKey().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    query.orderByDecisionDefinitionVersion().desc();
    verifyQueryResults(query, 4);
    query = repositoryService.createDecisionDefinitionQuery();
    // Typical use decision
    query.orderByDecisionDefinitionKey().asc().orderByDecisionDefinitionVersion().desc();
    List<DecisionDefinition> decisionDefinitions = query.list();
    assertEquals(4, decisionDefinitions.size());
    assertEquals("one", decisionDefinitions.get(0).getKey());
    assertEquals(2, decisionDefinitions.get(0).getVersion());
    assertEquals("one", decisionDefinitions.get(1).getKey());
    assertEquals(1, decisionDefinitions.get(1).getVersion());
    assertEquals("two", decisionDefinitions.get(2).getKey());
    assertEquals(1, decisionDefinitions.get(2).getVersion());
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test)

Aggregations

DecisionDefinitionQuery (org.camunda.bpm.engine.repository.DecisionDefinitionQuery)49 Test (org.junit.Test)23 NotValidException (org.camunda.bpm.engine.exception.NotValidException)10 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)10 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 DecisionDefinitionQueryDto (org.camunda.bpm.engine.rest.dto.repository.DecisionDefinitionQueryDto)2 Deployment (org.camunda.bpm.engine.test.Deployment)2 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 DecisionDefinitionDto (org.camunda.bpm.engine.rest.dto.repository.DecisionDefinitionDto)1