Search in sources :

Example 46 with DecisionDefinitionQuery

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

the class DecisionDefinitionQueryTest method queryByVersion.

@Test
public void queryByVersion() {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    query.decisionDefinitionVersion(2);
    verifyQueryResults(query, 1);
    query.decisionDefinitionVersion(1);
    verifyQueryResults(query, 3);
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) Test(org.junit.Test)

Example 47 with DecisionDefinitionQuery

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

the class DecisionDefinitionQueryTest method queryByInvalidVersion.

@Test
public void queryByInvalidVersion() {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    query.decisionDefinitionVersion(3);
    verifyQueryResults(query, 0);
    try {
        query.decisionDefinitionVersion(-1);
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
    try {
        query.decisionDefinitionVersion(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 48 with DecisionDefinitionQuery

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

the class RepositoryServiceTest method testGetDecisionDefinition.

@Deployment(resources = { "org/camunda/bpm/engine/test/repository/one.dmn" })
public void testGetDecisionDefinition() {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    DecisionDefinition decisionDefinition = query.singleResult();
    String decisionDefinitionId = decisionDefinition.getId();
    DecisionDefinition definition = repositoryService.getDecisionDefinition(decisionDefinitionId);
    assertNotNull(definition);
    assertEquals(decisionDefinitionId, definition.getId());
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 49 with DecisionDefinitionQuery

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

the class RepositoryServiceTest method testGetDecisionModel.

@Deployment(resources = { "org/camunda/bpm/engine/test/repository/one.dmn" })
public void testGetDecisionModel() throws Exception {
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
    DecisionDefinition decisionDefinition = query.singleResult();
    String decisionDefinitionId = decisionDefinition.getId();
    InputStream decisionModel = repositoryService.getDecisionModel(decisionDefinitionId);
    assertNotNull(decisionModel);
    byte[] readInputStream = IoUtil.readInputStream(decisionModel, "decisionModel");
    String model = new String(readInputStream, "UTF-8");
    assertTrue(model.contains("<decision id=\"one\" name=\"One\">"));
    IoUtil.closeSilently(decisionModel);
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) InputStream(java.io.InputStream) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Deployment(org.camunda.bpm.engine.test.Deployment)

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