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);
}
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
}
}
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());
}
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);
}
Aggregations