Search in sources :

Example 1 with CmmnModelResource

use of org.camunda.bpm.model.cmmn.util.CmmnModelResource in project camunda-cmmn-model by camunda.

the class SimpleTest method shouldGetElements.

@Test
@CmmnModelResource
public void shouldGetElements() {
    ModelElementInstance modelElementById = cmmnModelInstance.getModelElementById("Case_1");
    assertThat(modelElementById).isNotNull();
    Collection<Case> caseElements = cmmnModelInstance.getDefinitions().getCases();
    assertThat(caseElements).hasSize(1);
    Case caseElement = caseElements.iterator().next();
    assertThat(caseElement.getId()).isEqualTo("Case_1");
    assertThat(caseElement.getName()).isNull();
    CasePlanModel casePlanModel = caseElement.getCasePlanModel();
    assertThat(casePlanModel).isNotNull();
    assertThat(casePlanModel.getId()).isEqualTo("CasePlanModel_1");
    Collection<PlanItemDefinition> planItemDefinitions = casePlanModel.getPlanItemDefinitions();
    assertThat(planItemDefinitions).hasSize(1);
    PlanItemDefinition planItemDefinition = planItemDefinitions.iterator().next();
    assertThat(planItemDefinition).isInstanceOf(HumanTask.class);
    assertThat(planItemDefinition.getId()).isEqualTo("HumanTask_1");
    assertThat(planItemDefinition.getName()).isEqualTo("A HumanTask");
    Collection<PlanItem> planItems = casePlanModel.getPlanItems();
    PlanItem planItem = planItems.iterator().next();
    assertThat(planItem.getId()).isEqualTo("PI_HumanTask_1");
    assertThat(planItem.getDefinition()).isEqualTo(planItemDefinition);
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) PlanItemDefinition(org.camunda.bpm.model.cmmn.instance.PlanItemDefinition) ModelElementInstance(org.camunda.bpm.model.xml.instance.ModelElementInstance) PlanItem(org.camunda.bpm.model.cmmn.instance.PlanItem) Case(org.camunda.bpm.model.cmmn.instance.Case) CmmnModelResource(org.camunda.bpm.model.cmmn.util.CmmnModelResource) Test(org.junit.Test)

Aggregations

Case (org.camunda.bpm.model.cmmn.instance.Case)1 CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)1 PlanItem (org.camunda.bpm.model.cmmn.instance.PlanItem)1 PlanItemDefinition (org.camunda.bpm.model.cmmn.instance.PlanItemDefinition)1 CmmnModelResource (org.camunda.bpm.model.cmmn.util.CmmnModelResource)1 ModelElementInstance (org.camunda.bpm.model.xml.instance.ModelElementInstance)1 Test (org.junit.Test)1