Search in sources :

Example 6 with ModelElementType

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;
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType)

Example 7 with ModelElementType

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);
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) Test(org.junit.Test)

Example 8 with ModelElementType

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);
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) Test(org.junit.Test) TestModelTest(org.camunda.bpm.model.xml.testmodel.TestModelTest)

Example 9 with ModelElementType

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);
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) ModelElementInstance(org.camunda.bpm.model.xml.instance.ModelElementInstance) ArrayList(java.util.ArrayList) ModelInstanceImpl(org.camunda.bpm.model.xml.impl.ModelInstanceImpl) Test(org.junit.Test)

Example 10 with ModelElementType

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");
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) Before(org.junit.Before)

Aggregations

ModelElementType (org.camunda.bpm.model.xml.type.ModelElementType)34 Test (org.junit.Test)11 ArrayList (java.util.ArrayList)9 ModelElementInstance (org.camunda.bpm.model.xml.instance.ModelElementInstance)8 Model (org.camunda.bpm.model.xml.Model)3 TestModelTest (org.camunda.bpm.model.xml.testmodel.TestModelTest)3 ModelException (org.camunda.bpm.model.xml.ModelException)2 ModelInstanceImpl (org.camunda.bpm.model.xml.impl.ModelInstanceImpl)2 ModelElementTypeImpl (org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl)2 DomElement (org.camunda.bpm.model.xml.instance.DomElement)2 Before (org.junit.Before)2 PlanItemDefinition (org.camunda.bpm.model.cmmn.instance.PlanItemDefinition)1 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)1 ModelBuildOperation (org.camunda.bpm.model.xml.impl.ModelBuildOperation)1 QName (org.camunda.bpm.model.xml.impl.util.QName)1 AnimalTest (org.camunda.bpm.model.xml.testmodel.instance.AnimalTest)1 Attribute (org.camunda.bpm.model.xml.type.attribute.Attribute)1 Reference (org.camunda.bpm.model.xml.type.reference.Reference)1