Java Code Examples for org.camunda.bpm.model.dmn.DmnModelInstance#getModelElementsByType()

The following examples show how to use org.camunda.bpm.model.dmn.DmnModelInstance#getModelElementsByType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XlsxDeploymentTest.java    From camunda-dmn-xlsx with Apache License 2.0 6 votes vote down vote up
@Test
public void testXlsxDeploymentWithMetaData() {
  // when
  deployment = rule.getRepositoryService()
    .createDeployment()
    .addClasspathResource("test1.xlsx")
    .addClasspathResource("test1.xlsx.yaml")
    .deploy()
    .getId();

  // then
  DecisionDefinition decisionDefinition = rule.getRepositoryService().createDecisionDefinitionQuery().singleResult();
  assertThat(decisionDefinition).isNotNull();

  DmnModelInstance dmnModel = rule.getRepositoryService().getDmnModelInstance(decisionDefinition.getId());
  Collection<DecisionTable> decisionTables = dmnModel.getModelElementsByType(DecisionTable.class);
  assertThat(decisionTables).hasSize(1);

  DecisionTable decisionTable = decisionTables.iterator().next();
  assertThat(decisionTable.getInputs()).hasSize(1);
  assertThat(decisionTable.getOutputs()).hasSize(1);

}
 
Example 2
Source File: DmnModelElementInstanceCmdTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Deployment(resources = "org/camunda/bpm/engine/test/repository/one.dmn")
public void testRepositoryService() {
  String decisionDefinitionId = repositoryService
    .createDecisionDefinitionQuery()
    .decisionDefinitionKey(DECISION_KEY)
    .singleResult()
    .getId();

  DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId);
  assertNotNull(modelInstance);

  Collection<Decision> decisions = modelInstance.getModelElementsByType(Decision.class);
  assertEquals(1, decisions.size());

  Collection<DecisionTable> decisionTables = modelInstance.getModelElementsByType(DecisionTable.class);
  assertEquals(1, decisionTables.size());

  Collection<Input> inputs = modelInstance.getModelElementsByType(Input.class);
  assertEquals(1, inputs.size());

  Collection<Output> outputs = modelInstance.getModelElementsByType(Output.class);
  assertEquals(1, outputs.size());

  Collection<Rule> rules = modelInstance.getModelElementsByType(Rule.class);
  assertEquals(2, rules.size());
}