Search in sources :

Example 16 with ProcessBuilder

use of org.camunda.bpm.model.bpmn.builder.ProcessBuilder in project camunda-bpmn-model by camunda.

the class CoordinatesGenerationTest method shouldPlaceStartEventWithinSubProcess.

public void shouldPlaceStartEventWithinSubProcess() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent("innerStartEvent").done();
    Bounds startEventBounds = findBpmnShape("innerStartEvent").getBounds();
    assertShapeCoordinates(startEventBounds, 236, 100);
}
Also used : ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds)

Example 17 with ProcessBuilder

use of org.camunda.bpm.model.bpmn.builder.ProcessBuilder in project camunda-bpmn-model by camunda.

the class CoordinatesGenerationTest method shouldAdjustSubProcessHeightWithEmbeddedProcess.

@Test
public void shouldAdjustSubProcessHeightWithEmbeddedProcess() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent("innerStartEvent").subProcess().embeddedSubProcess().startEvent().exclusiveGateway("id").userTask().moveToNode("id").endEvent().subProcessDone().endEvent("innerEndEvent").subProcessDone().endEvent().done();
    Bounds subProcessBounds = findBpmnShape(SUB_PROCESS_ID).getBounds();
    assertThat(subProcessBounds.getY()).isEqualTo(-32);
    assertThat(subProcessBounds.getHeight()).isEqualTo(376);
}
Also used : ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) Test(org.junit.Test)

Example 18 with ProcessBuilder

use of org.camunda.bpm.model.bpmn.builder.ProcessBuilder in project camunda-bpmn-model by camunda.

the class DiGeneratorForFlowNodesTest method shouldGenerateShapeForThrowingIntermediateEvent.

@Test
public void shouldGenerateShapeForThrowingIntermediateEvent() {
    // given
    ProcessBuilder processBuilder = Bpmn.createExecutableProcess();
    // when
    instance = processBuilder.startEvent(START_EVENT_ID).intermediateThrowEvent("inter").endEvent(END_EVENT_ID).done();
    // then
    Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class);
    assertEquals(3, allShapes.size());
    assertEventShapeProperties("inter");
}
Also used : BpmnShape(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape) ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Test(org.junit.Test)

Example 19 with ProcessBuilder

use of org.camunda.bpm.model.bpmn.builder.ProcessBuilder in project camunda-bpmn-model by camunda.

the class DiGeneratorForSequenceFlowsTest method shouldGenerateEdgesWhenUsingMoveToNode.

@Test
public void shouldGenerateEdgesWhenUsingMoveToNode() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).sequenceFlowId("s1").exclusiveGateway().sequenceFlowId("s2").userTask(USER_TASK_ID).sequenceFlowId("s3").endEvent("e1").moveToNode(USER_TASK_ID).sequenceFlowId("s4").endEvent("e2").done();
    Collection<BpmnEdge> allEdges = instance.getModelElementsByType(BpmnEdge.class);
    assertEquals(4, allEdges.size());
    assertBpmnEdgeExists("s1");
    assertBpmnEdgeExists("s2");
    assertBpmnEdgeExists("s3");
    assertBpmnEdgeExists("s4");
}
Also used : ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) BpmnEdge(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnEdge) Test(org.junit.Test)

Example 20 with ProcessBuilder

use of org.camunda.bpm.model.bpmn.builder.ProcessBuilder in project camunda-bpmn-model by camunda.

the class CoordinatesGenerationTest method shouldPlaceManyBranchesForEventBasedGateway.

@Test
public void shouldPlaceManyBranchesForEventBasedGateway() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).eventBasedGateway().id("id").userTask(USER_TASK_ID).moveToNode("id").endEvent(END_EVENT_ID).moveToNode("id").serviceTask(SERVICE_TASK_ID).moveToNode("id").sequenceFlowId("s1").sendTask(SEND_TASK_ID).done();
    Bounds userTaskBounds = findBpmnShape(USER_TASK_ID).getBounds();
    assertShapeCoordinates(userTaskBounds, 286, 78);
    Bounds endEventBounds = findBpmnShape(END_EVENT_ID).getBounds();
    assertShapeCoordinates(endEventBounds, 286, 208);
    Bounds serviceTaskBounds = findBpmnShape(SERVICE_TASK_ID).getBounds();
    assertShapeCoordinates(serviceTaskBounds, 286, 294);
    Bounds sendTaskBounds = findBpmnShape(SEND_TASK_ID).getBounds();
    assertShapeCoordinates(sendTaskBounds, 286, 424);
    Collection<Waypoint> sequenceFlowWaypoints = findBpmnEdge("s1").getWaypoints();
    Iterator<Waypoint> iterator = sequenceFlowWaypoints.iterator();
    Waypoint waypoint = iterator.next();
    assertWaypointCoordinates(waypoint, 211, 143);
    while (iterator.hasNext()) {
        waypoint = iterator.next();
    }
    assertWaypointCoordinates(waypoint, 286, 464);
}
Also used : ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) Waypoint(org.camunda.bpm.model.bpmn.instance.di.Waypoint) Test(org.junit.Test)

Aggregations

ProcessBuilder (org.camunda.bpm.model.bpmn.builder.ProcessBuilder)71 Test (org.junit.Test)70 Bounds (org.camunda.bpm.model.bpmn.instance.dc.Bounds)45 Waypoint (org.camunda.bpm.model.bpmn.instance.di.Waypoint)30 BpmnShape (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape)21 BpmnEdge (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnEdge)5