Search in sources :

Example 6 with TestModelParser

use of org.camunda.bpm.model.xml.testmodel.TestModelParser in project camunda-xml-model by camunda.

the class ReferenceTest method createModel.

public static Object[] createModel() {
    TestModelParser modelParser = new TestModelParser();
    ModelInstance modelInstance = modelParser.getEmptyModel();
    Animals animals = modelInstance.newInstance(Animals.class);
    modelInstance.setDocumentElement(animals);
    Bird tweety = createBird(modelInstance, "tweety", Gender.Female);
    Bird daffy = createBird(modelInstance, "daffy", Gender.Male);
    Bird daisy = createBird(modelInstance, "daisy", Gender.Female);
    createBird(modelInstance, "plucky", Gender.Male);
    createBird(modelInstance, "birdo", Gender.Female);
    tweety.setFather(daffy);
    tweety.setMother(daisy);
    tweety.getFlightPartnerRefs().add(daffy);
    return new Object[] { "created", modelInstance, modelParser };
}
Also used : ModelInstance(org.camunda.bpm.model.xml.ModelInstance) TestModelParser(org.camunda.bpm.model.xml.testmodel.TestModelParser)

Example 7 with TestModelParser

use of org.camunda.bpm.model.xml.testmodel.TestModelParser in project camunda-xml-model by camunda.

the class ModelValidationTest method parseModel.

@Before
public void parseModel() {
    TestModelParser modelParser = new TestModelParser();
    String testXml = "org/camunda/bpm/model/xml/testmodel/instance/UnknownAnimalTest.xml";
    InputStream testXmlAsStream = this.getClass().getClassLoader().getResourceAsStream(testXml);
    modelInstance = modelParser.parseModelFromStream(testXmlAsStream);
}
Also used : InputStream(java.io.InputStream) TestModelParser(org.camunda.bpm.model.xml.testmodel.TestModelParser) Before(org.junit.Before)

Example 8 with TestModelParser

use of org.camunda.bpm.model.xml.testmodel.TestModelParser in project camunda-xml-model by camunda.

the class DomTest method createModel.

private static Object[] createModel() {
    TestModelParser modelParser = new TestModelParser();
    ModelInstance modelInstance = modelParser.getEmptyModel();
    Animals animals = modelInstance.newInstance(Animals.class);
    modelInstance.setDocumentElement(animals);
    Description description = modelInstance.newInstance(Description.class);
    description.getDomElement().addCDataSection("CDATA <test>");
    animals.addChildElement(description);
    return new Object[] { "created", modelInstance, modelParser };
}
Also used : ModelInstance(org.camunda.bpm.model.xml.ModelInstance) Animals(org.camunda.bpm.model.xml.testmodel.instance.Animals) Description(org.camunda.bpm.model.xml.testmodel.instance.Description) TestModelParser(org.camunda.bpm.model.xml.testmodel.TestModelParser)

Example 9 with TestModelParser

use of org.camunda.bpm.model.xml.testmodel.TestModelParser in project camunda-xml-model by camunda.

the class ModelElementInstanceTest method createModel.

private static Object[] createModel() {
    TestModelParser modelParser = new TestModelParser();
    ModelInstance modelInstance = modelParser.getEmptyModel();
    Animals animals = modelInstance.newInstance(Animals.class);
    modelInstance.setDocumentElement(animals);
    createBird(modelInstance, "tweety", Gender.Female);
    Bird donald = createBird(modelInstance, "donald", Gender.Male);
    Bird daisy = createBird(modelInstance, "daisy", Gender.Female);
    Bird hedwig = createBird(modelInstance, "hedwig", Gender.Male);
    donald.setTextContent("some text content");
    daisy.setTextContent("\n        some text content with outer line breaks\n    ");
    hedwig.setTextContent("\n        some text content with inner\n        line breaks\n    ");
    return new Object[] { "created", modelInstance, modelParser };
}
Also used : ModelInstance(org.camunda.bpm.model.xml.ModelInstance) Animals(org.camunda.bpm.model.xml.testmodel.instance.Animals) Bird(org.camunda.bpm.model.xml.testmodel.instance.Bird) TestModelParser(org.camunda.bpm.model.xml.testmodel.TestModelParser)

Example 10 with TestModelParser

use of org.camunda.bpm.model.xml.testmodel.TestModelParser in project camunda-xml-model by camunda.

the class ModelElementTypeTest method getTypes.

@Before
public void getTypes() {
    TestModelParser modelParser = new TestModelParser();
    modelInstance = modelParser.getEmptyModel();
    model = modelInstance.getModel();
    animalsType = model.getType(Animals.class);
    animalType = model.getType(Animal.class);
    flyingAnimalType = model.getType(FlyingAnimal.class);
    birdType = model.getType(Bird.class);
}
Also used : TestModelParser(org.camunda.bpm.model.xml.testmodel.TestModelParser) Before(org.junit.Before)

Aggregations

TestModelParser (org.camunda.bpm.model.xml.testmodel.TestModelParser)11 ModelInstance (org.camunda.bpm.model.xml.ModelInstance)8 Animals (org.camunda.bpm.model.xml.testmodel.instance.Animals)3 Before (org.junit.Before)3 InputStream (java.io.InputStream)2 Bird (org.camunda.bpm.model.xml.testmodel.instance.Bird)1 Description (org.camunda.bpm.model.xml.testmodel.instance.Description)1