use of org.camunda.bpm.model.xml.Model in project camunda-xml-model by camunda.
the class ModelElementTypeAssert method isPartOfModel.
public ModelElementTypeAssert isPartOfModel(Model model) {
isNotNull();
Model actualModel = actual.getModel();
if (!model.equals(actualModel)) {
failWithMessage("Expected element type <%s> to be part of model <%s> but was part of <%s>", typeName, model.getModelName(), actualModel.getModelName());
}
return this;
}
use of org.camunda.bpm.model.xml.Model in project camunda-xml-model by camunda.
the class ModelBuilderTest method shouldSetModelName.
@Test
public void shouldSetModelName() {
Model model = ModelBuilder.createInstance(MODEL_NAME).build();
assertThat(model.getModelName()).isEqualTo(MODEL_NAME);
}
use of org.camunda.bpm.model.xml.Model in project camunda-xml-model by camunda.
the class ModelElementInstanceImpl method getChildElementsByType.
public Collection<ModelElementInstance> getChildElementsByType(ModelElementType childElementType) {
List<ModelElementInstance> instances = new ArrayList<ModelElementInstance>();
for (ModelElementType extendingType : childElementType.getExtendingTypes()) {
instances.addAll(getChildElementsByType(extendingType));
}
Model model = modelInstance.getModel();
String alternativeNamespace = model.getAlternativeNamespace(childElementType.getTypeNamespace());
List<DomElement> elements = domElement.getChildElementsByNameNs(asSet(childElementType.getTypeNamespace(), alternativeNamespace), childElementType.getTypeName());
instances.addAll(ModelUtil.getModelElementCollection(elements, modelInstance));
return instances;
}
use of org.camunda.bpm.model.xml.Model in project camunda-bpmn-model by camunda.
the class ModelTest method testBaseTypeCalculation.
@Test
public void testBaseTypeCalculation() {
BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel();
Model model = bpmnModelInstance.getModel();
Collection<ModelElementType> allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(StartEvent.class));
assertThat(allBaseTypes).hasSize(5);
allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(MessageEventDefinition.class));
assertThat(allBaseTypes).hasSize(3);
allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(BaseElement.class));
assertThat(allBaseTypes).hasSize(0);
}
use of org.camunda.bpm.model.xml.Model in project camunda-bpmn-model by camunda.
the class ModelTest method testExtendingTypeCalculation.
@Test
public void testExtendingTypeCalculation() {
BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel();
Model model = bpmnModelInstance.getModel();
List<ModelElementType> baseInstanceTypes = new ArrayList<ModelElementType>();
baseInstanceTypes.add(model.getType(Event.class));
baseInstanceTypes.add(model.getType(CatchEvent.class));
baseInstanceTypes.add(model.getType(ExtensionElements.class));
baseInstanceTypes.add(model.getType(EventDefinition.class));
Collection<ModelElementType> allExtendingTypes = ModelUtil.calculateAllExtendingTypes(bpmnModelInstance.getModel(), baseInstanceTypes);
assertThat(allExtendingTypes).hasSize(17);
}
Aggregations