use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class ModelElementTypeAssert method extendsType.
public ModelElementTypeAssert extendsType(ModelElementType baseType) {
isNotNull();
ModelElementType actualBaseType = actual.getBaseType();
if (!actualBaseType.equals(baseType)) {
failWithMessage("Expected element type <%s> to extend type <%s> but extends <%s>", typeName, actualBaseType.getTypeName(), baseType.getTypeName());
}
return this;
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class ModelTest method testGetType.
@Test
public void testGetType() {
ModelElementType flyingAnimalType = model.getType(FlyingAnimal.class);
assertThat(flyingAnimalType.getInstanceType()).isEqualTo(FlyingAnimal.class);
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class ModelElementInstanceTest method TestElementType.
@Test
public void TestElementType() {
ModelElementType birdType = modelInstance.getModel().getType(Bird.class);
assertThat(tweety.getElementType()).isEqualTo(birdType);
assertThat(donald.getElementType()).isEqualTo(birdType);
assertThat(daisy.getElementType()).isEqualTo(birdType);
assertThat(hedwig.getElementType()).isEqualTo(birdType);
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class UnknownAnimalTest method testAddUnknownAnimal.
@Test
public void testAddUnknownAnimal() {
ModelInstanceImpl modelInstanceImpl = (ModelInstanceImpl) modelInstance;
ModelElementType unknownAnimalType = modelInstanceImpl.registerGenericType(MODEL_NAMESPACE, "unknownAnimal");
ModelElementType animalsType = modelInstance.getModel().getType(Animals.class);
ModelElementType animalType = modelInstance.getModel().getType(Animal.class);
ModelElementInstance unknownAnimal = modelInstance.newInstance(unknownAnimalType);
assertThat(unknownAnimal).isNotNull();
unknownAnimal.setAttributeValue("id", "new-animal", true);
unknownAnimal.setAttributeValue("gender", "Unknown");
unknownAnimal.setAttributeValue("species", "unknown");
ModelElementInstance animals = modelInstance.getModelElementsByType(animalsType).iterator().next();
List<ModelElementInstance> childElementsByType = new ArrayList<ModelElementInstance>(animals.getChildElementsByType(animalType));
animals.insertElementAfter(unknownAnimal, childElementsByType.get(2));
assertThat(animals.getChildElementsByType(unknownAnimalType)).hasSize(3);
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class AttributeTest method copyModelInstance.
@Before
@SuppressWarnings("unchecked")
public void copyModelInstance() {
modelInstance = cloneModelInstance();
tweety = modelInstance.getModelElementById("tweety");
ModelElementType animalType = modelInstance.getModel().getType(Animal.class);
idAttribute = (Attribute<String>) animalType.getAttribute("id");
nameAttribute = (Attribute<String>) animalType.getAttribute("name");
fatherAttribute = (Attribute<String>) animalType.getAttribute("father");
}
Aggregations