use of org.camunda.bpm.model.cmmn.instance.CasePlanModel in project camunda-cmmn-model by camunda.
the class CreateModelTest method createCaseWithOneHumanTask.
@Test
public void createCaseWithOneHumanTask() {
// create process
Case caseInstance = createElement(definitions, "case-with-one-human-task", Case.class);
// create case plan model
CasePlanModel casePlanModel = createElement(caseInstance, "casePlanModel_1", CasePlanModel.class);
// create elements
HumanTask humanTask = createElement(casePlanModel, "HumanTask_1", HumanTask.class);
// create a plan item
PlanItem planItem = createElement(casePlanModel, "PlanItem_1", PlanItem.class);
// set definition to human task
planItem.setDefinition(humanTask);
}
use of org.camunda.bpm.model.cmmn.instance.CasePlanModel in project camunda-cmmn-model by camunda.
the class GenerateIdTest method shouldNotGenerateIdsOnRead.
@Test
public void shouldNotGenerateIdsOnRead() {
CmmnModelInstance modelInstance = Cmmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.cmmn"));
Definitions definitions = modelInstance.getDefinitions();
assertThat(definitions.getId()).isNull();
Case caseElement = modelInstance.getModelElementsByType(Case.class).iterator().next();
assertThat(caseElement.getId()).isNull();
CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
assertThat(casePlanModel.getId()).isNull();
HumanTask humanTask = modelInstance.getModelElementsByType(HumanTask.class).iterator().next();
assertThat(humanTask.getId()).isNull();
}
use of org.camunda.bpm.model.cmmn.instance.CasePlanModel 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);
}
use of org.camunda.bpm.model.cmmn.instance.CasePlanModel in project camunda-cmmn-model by camunda.
the class Cmmn10Test method shouldNotAbleToAddCmmn10Element.
@Test
public void shouldNotAbleToAddCmmn10Element() {
CmmnModelInstance modelInstance = Cmmn.readModelFromStream(Cmmn10Test.class.getResourceAsStream("Cmmn11Test.cmmn"));
CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
Event event = modelInstance.newInstance(Event.class);
casePlanModel.getPlanItemDefinitions().add(event);
try {
Cmmn.writeModelToStream(System.out, modelInstance);
fail("cannot save cmmn 1.1 model");
} catch (Exception e) {
// expected exception
}
}
use of org.camunda.bpm.model.cmmn.instance.CasePlanModel in project camunda-cmmn-model by camunda.
the class Cmmn10Test method shouldReturnCmmn11Namespace.
@Test
public void shouldReturnCmmn11Namespace() {
CmmnModelInstance modelInstance = getCmmnModelInstance();
CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
assertThat(casePlanModel.getElementType().getTypeNamespace()).isEqualTo(CmmnModelConstants.CMMN11_NS);
}
Aggregations