use of org.camunda.bpm.model.bpmn.instance.Definitions in project camunda-bpmn-model by camunda.
the class GenerateIdTest method shouldNotGenerateIdsOnRead.
@Test
public void shouldNotGenerateIdsOnRead() {
BpmnModelInstance modelInstance = Bpmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.bpmn"));
Definitions definitions = modelInstance.getDefinitions();
assertThat(definitions.getId()).isNull();
Process process = modelInstance.getModelElementsByType(Process.class).iterator().next();
assertThat(process.getId()).isNull();
StartEvent startEvent = modelInstance.getModelElementsByType(StartEvent.class).iterator().next();
assertThat(startEvent.getId()).isNull();
UserTask userTask = modelInstance.getModelElementsByType(UserTask.class).iterator().next();
assertThat(userTask.getId()).isNull();
}
use of org.camunda.bpm.model.bpmn.instance.Definitions in project camunda-bpmn-model by camunda.
the class Bpmn method createProcess.
public static ProcessBuilder createProcess() {
BpmnModelInstance modelInstance = INSTANCE.doCreateEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setTargetNamespace(BPMN20_NS);
definitions.getDomElement().registerNamespace("camunda", CAMUNDA_NS);
modelInstance.setDefinitions(definitions);
Process process = modelInstance.newInstance(Process.class);
definitions.addChildElement(process);
BpmnDiagram bpmnDiagram = modelInstance.newInstance(BpmnDiagram.class);
BpmnPlane bpmnPlane = modelInstance.newInstance(BpmnPlane.class);
bpmnPlane.setBpmnElement(process);
bpmnDiagram.addChildElement(bpmnPlane);
definitions.addChildElement(bpmnDiagram);
return process.builder();
}
use of org.camunda.bpm.model.bpmn.instance.Definitions in project camunda-bpmn-model by camunda.
the class GenerateIdTest method shouldGenerateIdsOnCreate.
@Test
public void shouldGenerateIdsOnCreate() {
BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
assertThat(definitions.getId()).isNotNull();
Process process = modelInstance.newInstance(Process.class);
assertThat(process.getId()).isNotNull();
StartEvent startEvent = modelInstance.newInstance(StartEvent.class);
assertThat(startEvent.getId()).isNotNull();
UserTask userTask = modelInstance.newInstance(UserTask.class);
assertThat(userTask.getId()).isNotNull();
}
use of org.camunda.bpm.model.bpmn.instance.Definitions in project camunda-bpmn-model by camunda.
the class BpmnModelInstanceTest method testClone.
@Test
public void testClone() throws Exception {
BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setId("TestId");
modelInstance.setDefinitions(definitions);
BpmnModelInstance cloneInstance = modelInstance.clone();
cloneInstance.getDefinitions().setId("TestId2");
assertThat(modelInstance.getDefinitions().getId(), is(equalTo("TestId")));
assertThat(cloneInstance.getDefinitions().getId(), is(equalTo("TestId2")));
}
Aggregations