Search in sources :

Example 26 with ProcessBuilder

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

the class CoordinatesGenerationTest method shouldPlaceFollowingFlowNodeProperlyForTask.

@Test
public void shouldPlaceFollowingFlowNodeProperlyForTask() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).userTask(USER_TASK_ID).boundaryEvent("boundary").sequenceFlowId(SEQUENCE_FLOW_ID).endEvent(END_EVENT_ID).moveToActivity(USER_TASK_ID).endEvent().done();
    Bounds endEventBounds = findBpmnShape(END_EVENT_ID).getBounds();
    assertShapeCoordinates(endEventBounds, 266.5, 208);
    Collection<Waypoint> sequenceFlowWaypoints = findBpmnEdge(SEQUENCE_FLOW_ID).getWaypoints();
    Iterator<Waypoint> iterator = sequenceFlowWaypoints.iterator();
    Waypoint waypoint = iterator.next();
    assertWaypointCoordinates(waypoint, 236, 176);
    while (iterator.hasNext()) {
        waypoint = iterator.next();
    }
    assertWaypointCoordinates(waypoint, 266.5, 226);
}
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)

Example 27 with ProcessBuilder

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

the class CoordinatesGenerationTest method shouldPlaceCompensation.

@Test
public void shouldPlaceCompensation() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent().userTask("task").boundaryEvent("boundary").compensateEventDefinition().compensateEventDefinitionDone().compensationStart().userTask("compensate").name("compensate").compensationDone().userTask("task2").boundaryEvent("boundary2").compensateEventDefinition().compensateEventDefinitionDone().compensationStart().userTask("compensate2").name("compensate2").compensationDone().endEvent("theend").done();
    Bounds compensationBounds = findBpmnShape("compensate").getBounds();
    assertShapeCoordinates(compensationBounds, 266.5, 186);
    Bounds compensation2Bounds = findBpmnShape("compensate2").getBounds();
    assertShapeCoordinates(compensation2Bounds, 416.5, 186);
}
Also used : ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) Test(org.junit.Test)

Example 28 with ProcessBuilder

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

the class DiGeneratorForFlowNodesTest method shouldGenerateShapeForBlankSubProcess.

@Test
public void shouldGenerateShapeForBlankSubProcess() {
    // given
    ProcessBuilder processBuilder = Bpmn.createExecutableProcess();
    // when
    instance = processBuilder.startEvent(START_EVENT_ID).subProcess(SUB_PROCESS_ID).endEvent(END_EVENT_ID).done();
    // then
    Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class);
    assertEquals(3, allShapes.size());
    BpmnShape bpmnShapeSubProcess = findBpmnShape(SUB_PROCESS_ID);
    assertNotNull(bpmnShapeSubProcess);
    assertSubProcessSize(bpmnShapeSubProcess);
    assertTrue(bpmnShapeSubProcess.isExpanded());
}
Also used : BpmnShape(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape) ProcessBuilder(org.camunda.bpm.model.bpmn.builder.ProcessBuilder) Test(org.junit.Test)

Example 29 with ProcessBuilder

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

the class DiGeneratorForSequenceFlowsTest method shouldGenerateEdgesWhenUsingConnectTo.

@Test
public void shouldGenerateEdgesWhenUsingConnectTo() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).sequenceFlowId("s1").exclusiveGateway("gateway").sequenceFlowId("s2").userTask(USER_TASK_ID).sequenceFlowId("s3").endEvent(END_EVENT_ID).moveToNode(USER_TASK_ID).sequenceFlowId("s4").connectTo("gateway").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 30 with ProcessBuilder

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

the class DiGeneratorForSequenceFlowsTest method shouldGenerateEdgesWhenUsingMoveToActivity.

@Test
public void shouldGenerateEdgesWhenUsingMoveToActivity() {
    ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).sequenceFlowId("s1").exclusiveGateway().sequenceFlowId("s2").userTask(USER_TASK_ID).sequenceFlowId("s3").endEvent("e1").moveToActivity(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)

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