use of org.camunda.bpm.model.xml.ModelInstance 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 };
}
use of org.camunda.bpm.model.xml.ModelInstance 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 };
}
use of org.camunda.bpm.model.xml.ModelInstance 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 };
}
use of org.camunda.bpm.model.xml.ModelInstance in project camunda-xml-model by camunda.
the class TestModelInstanceTest method testClone.
@Test
public void testClone() throws Exception {
ModelInstance modelInstance = new TestModelParser().getEmptyModel();
Animals animals = modelInstance.newInstance(Animals.class);
modelInstance.setDocumentElement(animals);
Animal animal = modelInstance.newInstance(Bird.class);
animal.setId("TestId");
animals.addChildElement(animal);
ModelInstance cloneInstance = modelInstance.clone();
getFirstAnimal(cloneInstance).setId("TestId2");
assertThat(getFirstAnimal(modelInstance).getId(), is(equalTo("TestId")));
assertThat(getFirstAnimal(cloneInstance).getId(), is(equalTo("TestId2")));
}
use of org.camunda.bpm.model.xml.ModelInstance in project camunda-xml-model by camunda.
the class TestModelTest method parseModel.
protected static Object[] parseModel(Class<?> test) {
TestModelParser modelParser = new TestModelParser();
String testXml = test.getSimpleName() + ".xml";
InputStream testXmlAsStream = test.getResourceAsStream(testXml);
ModelInstance modelInstance = modelParser.parseModelFromStream(testXmlAsStream);
return new Object[] { "parsed", modelInstance, modelParser };
}
Aggregations