Search in sources :

Example 1 with ProcessBuilder

use of io.camunda.zeebe.model.bpmn.builder.ProcessBuilder in project zeebe by camunda.

the class CoordinatesGenerationTest method shouldPlaceManyBranchesForExclusiveGateway.

@Test
public void shouldPlaceManyBranchesForExclusiveGateway() {
    final ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).exclusiveGateway("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();
    final Bounds userTaskBounds = findBpmnShape(USER_TASK_ID).getBounds();
    assertShapeCoordinates(userTaskBounds, 286, 78);
    final Bounds endEventBounds = findBpmnShape(END_EVENT_ID).getBounds();
    assertShapeCoordinates(endEventBounds, 286, 208);
    final Bounds serviceTaskBounds = findBpmnShape(SERVICE_TASK_ID).getBounds();
    assertShapeCoordinates(serviceTaskBounds, 286, 294);
    final Bounds sendTaskBounds = findBpmnShape(SEND_TASK_ID).getBounds();
    assertShapeCoordinates(sendTaskBounds, 286, 424);
    final Collection<Waypoint> sequenceFlowWaypoints = findBpmnEdge("s1").getWaypoints();
    final 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(io.camunda.zeebe.model.bpmn.builder.ProcessBuilder) Bounds(io.camunda.zeebe.model.bpmn.instance.dc.Bounds) Waypoint(io.camunda.zeebe.model.bpmn.instance.di.Waypoint) Test(org.junit.Test)

Example 2 with ProcessBuilder

use of io.camunda.zeebe.model.bpmn.builder.ProcessBuilder in project zeebe by camunda.

the class CoordinatesGenerationTest method shouldPlaceFollowingFlowNodeForSubProcess.

@Test
public void shouldPlaceFollowingFlowNodeForSubProcess() {
    final ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).subProcess(SUB_PROCESS_ID).boundaryEvent("boundary").sequenceFlowId(SEQUENCE_FLOW_ID).endEvent(END_EVENT_ID).moveToActivity(SUB_PROCESS_ID).endEvent().done();
    final Bounds endEventBounds = findBpmnShape(END_EVENT_ID).getBounds();
    assertShapeCoordinates(endEventBounds, 391.5, 268);
    final Collection<Waypoint> sequenceFlowWaypoints = findBpmnEdge(SEQUENCE_FLOW_ID).getWaypoints();
    final Iterator<Waypoint> iterator = sequenceFlowWaypoints.iterator();
    Waypoint waypoint = iterator.next();
    assertWaypointCoordinates(waypoint, 361, 236);
    while (iterator.hasNext()) {
        waypoint = iterator.next();
    }
    assertWaypointCoordinates(waypoint, 391.5, 286);
}
Also used : ProcessBuilder(io.camunda.zeebe.model.bpmn.builder.ProcessBuilder) Bounds(io.camunda.zeebe.model.bpmn.instance.dc.Bounds) Waypoint(io.camunda.zeebe.model.bpmn.instance.di.Waypoint) Test(org.junit.Test)

Example 3 with ProcessBuilder

use of io.camunda.zeebe.model.bpmn.builder.ProcessBuilder in project zeebe by camunda.

the class CoordinatesGenerationTest method shouldPlaceServiceTask.

@Test
public void shouldPlaceServiceTask() {
    final ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).sequenceFlowId(SEQUENCE_FLOW_ID).serviceTask(SERVICE_TASK_ID).done();
    final Bounds serviceTaskBounds = findBpmnShape(SERVICE_TASK_ID).getBounds();
    assertShapeCoordinates(serviceTaskBounds, 186, 78);
    final Collection<Waypoint> sequenceFlowWaypoints = findBpmnEdge(SEQUENCE_FLOW_ID).getWaypoints();
    final Iterator<Waypoint> iterator = sequenceFlowWaypoints.iterator();
    Waypoint waypoint = iterator.next();
    assertWaypointCoordinates(waypoint, 136, 118);
    while (iterator.hasNext()) {
        waypoint = iterator.next();
    }
    assertWaypointCoordinates(waypoint, 186, 118);
}
Also used : ProcessBuilder(io.camunda.zeebe.model.bpmn.builder.ProcessBuilder) Bounds(io.camunda.zeebe.model.bpmn.instance.dc.Bounds) Waypoint(io.camunda.zeebe.model.bpmn.instance.di.Waypoint) Test(org.junit.Test)

Example 4 with ProcessBuilder

use of io.camunda.zeebe.model.bpmn.builder.ProcessBuilder in project zeebe by camunda.

the class CoordinatesGenerationTest method shouldAdjustSubProcessWidth.

@Test
public void shouldAdjustSubProcessWidth() {
    final ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent("innerStartEvent").parallelGateway("innerParallelGateway").userTask("innerUserTask").endEvent("innerEndEvent").subProcessDone().done();
    final Bounds subProcessBounds = findBpmnShape(SUB_PROCESS_ID).getBounds();
    assertThat(subProcessBounds.getWidth()).isEqualTo(472);
}
Also used : ProcessBuilder(io.camunda.zeebe.model.bpmn.builder.ProcessBuilder) Bounds(io.camunda.zeebe.model.bpmn.instance.dc.Bounds) Test(org.junit.Test)

Example 5 with ProcessBuilder

use of io.camunda.zeebe.model.bpmn.builder.ProcessBuilder in project zeebe by camunda.

the class CoordinatesGenerationTest method shouldPlaceBusinessRuleTask.

@Test
public void shouldPlaceBusinessRuleTask() {
    final ProcessBuilder builder = Bpmn.createExecutableProcess();
    instance = builder.startEvent(START_EVENT_ID).sequenceFlowId(SEQUENCE_FLOW_ID).businessRuleTask(TASK_ID).done();
    final Bounds businessRuleTaskBounds = findBpmnShape(TASK_ID).getBounds();
    assertShapeCoordinates(businessRuleTaskBounds, 186, 78);
    final Collection<Waypoint> sequenceFlowWaypoints = findBpmnEdge(SEQUENCE_FLOW_ID).getWaypoints();
    final Iterator<Waypoint> iterator = sequenceFlowWaypoints.iterator();
    Waypoint waypoint = iterator.next();
    assertWaypointCoordinates(waypoint, 136, 118);
    while (iterator.hasNext()) {
        waypoint = iterator.next();
    }
    assertWaypointCoordinates(waypoint, 186, 118);
}
Also used : ProcessBuilder(io.camunda.zeebe.model.bpmn.builder.ProcessBuilder) Bounds(io.camunda.zeebe.model.bpmn.instance.dc.Bounds) Waypoint(io.camunda.zeebe.model.bpmn.instance.di.Waypoint) Test(org.junit.Test)

Aggregations

ProcessBuilder (io.camunda.zeebe.model.bpmn.builder.ProcessBuilder)288 Test (org.junit.Test)240 Bounds (io.camunda.zeebe.model.bpmn.instance.dc.Bounds)135 Waypoint (io.camunda.zeebe.model.bpmn.instance.di.Waypoint)90 BpmnShape (io.camunda.zeebe.model.bpmn.instance.bpmndi.BpmnShape)63 BpmnModelInstance (io.camunda.zeebe.model.bpmn.BpmnModelInstance)39 Bpmn (io.camunda.zeebe.model.bpmn.Bpmn)33 EngineRule (io.camunda.zeebe.engine.util.EngineRule)24 RecordingExporter (io.camunda.zeebe.test.util.record.RecordingExporter)24 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)24 Rule (org.junit.Rule)24 MessageSubscriptionIntent (io.camunda.zeebe.protocol.record.intent.MessageSubscriptionIntent)23 Map (java.util.Map)23 ProcessInstanceIntent (io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent)21 BpmnElementType (io.camunda.zeebe.protocol.record.value.BpmnElementType)21 Assertions.tuple (org.assertj.core.api.Assertions.tuple)18 BpmnEdge (io.camunda.zeebe.model.bpmn.instance.bpmndi.BpmnEdge)15 StartEventBuilder (io.camunda.zeebe.model.bpmn.builder.StartEventBuilder)12 JobIntent (io.camunda.zeebe.protocol.record.intent.JobIntent)12 BrokerClassRuleHelper (io.camunda.zeebe.test.util.BrokerClassRuleHelper)12