org.camunda.bpm.model.bpmn.builder.ProcessBuilder Java Examples
The following examples show how to use
org.camunda.bpm.model.bpmn.builder.ProcessBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForEndEvent() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .endEvent(END_EVENT_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(2, allShapes.size()); assertEventShapeProperties(END_EVENT_ID); }
Example #2
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForCallActivity() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .callActivity(CALL_ACTIVITY_ID) .endEvent(END_EVENT_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(3, allShapes.size()); assertTaskShapeProperties(CALL_ACTIVITY_ID); }
Example #3
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForUserTask() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .userTask(USER_TASK_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(2, allShapes.size()); assertTaskShapeProperties(USER_TASK_ID); }
Example #4
Source File: CoordinatesGenerationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldPlaceBoundaryEventForTask() { 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 boundaryEventBounds = findBpmnShape("boundary").getBounds(); assertShapeCoordinates(boundaryEventBounds, 218, 140); }
Example #5
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForExclusiveGateway() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .exclusiveGateway("or") .endEvent(END_EVENT_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(3, allShapes.size()); assertGatewayShapeProperties("or"); BpmnShape bpmnShape = findBpmnShape("or"); assertTrue(bpmnShape.isMarkerVisible()); }
Example #6
Source File: ExecutionListenerTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected BpmnModelInstance createModelWithCatchInEventSubprocessAndListener(String eventName) { ProcessBuilder processBuilder = Bpmn.createExecutableProcess(PROCESS_KEY); BpmnModelInstance model = processBuilder .startEvent() .userTask("userTask1") .serviceTask("throw") .camundaExecutionListenerClass(eventName, ThrowBPMNErrorDelegate.class.getName()) .camundaExpression("${true}") .userTask("afterService") .endEvent() .done(); processBuilder.eventSubProcess() .startEvent("errorEvent").error(ERROR_CODE) .userTask("afterCatch") .endEvent(); return model; }
Example #7
Source File: DiGeneratorForSequenceFlowsTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateEdgeForSequenceFlow() { ProcessBuilder builder = Bpmn.createExecutableProcess(); instance = builder .startEvent(START_EVENT_ID) .sequenceFlowId(SEQUENCE_FLOW_ID) .endEvent(END_EVENT_ID) .done(); Collection<BpmnEdge> allEdges = instance.getModelElementsByType(BpmnEdge.class); assertEquals(1, allEdges.size()); assertBpmnEdgeExists(SEQUENCE_FLOW_ID); }
Example #8
Source File: Bpmn.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
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(); }
Example #9
Source File: ExecutionListenerTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testThrowBpmnErrorInStartListenerOfStartEventAndEventSubprocessWithCatch() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(PROCESS_KEY); BpmnModelInstance model = processBuilder .startEvent() .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_START, ThrowBPMNErrorDelegate.class.getName()) .userTask("afterListener") .endEvent() .done(); processBuilder.eventSubProcess() .startEvent("errorEvent").error(ERROR_CODE) .userTask("afterCatch") .endEvent(); testHelper.deploy(model); // when the listeners are invoked runtimeService.startProcessInstanceByKey(PROCESS_KEY); // then verifyErrorGotCaught(); }
Example #10
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForEndEvent() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .endEvent(END_EVENT_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(2, allShapes.size()); assertEventShapeProperties(END_EVENT_ID); }
Example #11
Source File: CoordinatesGenerationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldAdjustSubProcessWidthWithEmbeddedSubProcess() { ProcessBuilder builder = Bpmn.createExecutableProcess(); instance = builder .startEvent(START_EVENT_ID) .subProcess(SUB_PROCESS_ID) .embeddedSubProcess() .startEvent("innerStartEvent") .subProcess("innerSubProcess") .embeddedSubProcess() .startEvent() .userTask() .userTask() .endEvent() .subProcessDone() .endEvent("innerEndEvent") .subProcessDone() .done(); Bounds subProcessBounds = findBpmnShape(SUB_PROCESS_ID).getBounds(); assertThat(subProcessBounds.getWidth()).isEqualTo(794); }
Example #12
Source File: DiGeneratorForSequenceFlowsTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@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"); }
Example #13
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForBusinessRuleTask() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .businessRuleTask(TASK_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(2, allShapes.size()); assertTaskShapeProperties(TASK_ID); }
Example #14
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForEventBasedGateway() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .eventBasedGateway() .id("eventBased") .endEvent(END_EVENT_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(3, allShapes.size()); assertGatewayShapeProperties("eventBased"); }
Example #15
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@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()); }
Example #16
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForInclusiveGateway() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .inclusiveGateway("inclusive") .endEvent(END_EVENT_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(3, allShapes.size()); assertGatewayShapeProperties("inclusive"); }
Example #17
Source File: CoordinatesGenerationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldPlaceBoundaryEventForSubProcess() { 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(); Bounds boundaryEventBounds = findBpmnShape("boundary").getBounds(); assertShapeCoordinates(boundaryEventBounds, 343, 200); }
Example #18
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForBoundaryIntermediateEvent() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .userTask(USER_TASK_ID) .endEvent(END_EVENT_ID) .moveToActivity(USER_TASK_ID) .boundaryEvent(BOUNDARY_ID) .conditionalEventDefinition(CONDITION_ID) .condition(TEST_CONDITION) .conditionalEventDefinitionDone() .endEvent() .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(5, allShapes.size()); assertEventShapeProperties(BOUNDARY_ID); }
Example #19
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForCallActivity() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .callActivity(CALL_ACTIVITY_ID) .endEvent(END_EVENT_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(3, allShapes.size()); assertTaskShapeProperties(CALL_ACTIVITY_ID); }
Example #20
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForScriptTask() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .scriptTask(TASK_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(2, allShapes.size()); assertTaskShapeProperties(TASK_ID); }
Example #21
Source File: DiGeneratorForSequenceFlowsTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateEdgeForSequenceFlow() { ProcessBuilder builder = Bpmn.createExecutableProcess(); instance = builder .startEvent(START_EVENT_ID) .sequenceFlowId(SEQUENCE_FLOW_ID) .endEvent(END_EVENT_ID) .done(); Collection<BpmnEdge> allEdges = instance.getModelElementsByType(BpmnEdge.class); assertEquals(1, allEdges.size()); assertBpmnEdgeExists(SEQUENCE_FLOW_ID); }
Example #22
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForReceiveTask() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .receiveTask(TASK_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(2, allShapes.size()); assertTaskShapeProperties(TASK_ID); }
Example #23
Source File: DiGeneratorForSequenceFlowsTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@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"); }
Example #24
Source File: CoordinatesGenerationTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldPlaceBoundaryEventForTask() { 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 boundaryEventBounds = findBpmnShape("boundary").getBounds(); assertShapeCoordinates(boundaryEventBounds, 218, 140); }
Example #25
Source File: DiGeneratorForFlowNodesTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldGenerateShapeForSendTask() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder .startEvent(START_EVENT_ID) .sendTask(SEND_TASK_ID) .done(); // then Collection<BpmnShape> allShapes = instance.getModelElementsByType(BpmnShape.class); assertEquals(2, allShapes.size()); assertTaskShapeProperties(SEND_TASK_ID); }
Example #26
Source File: CoordinatesGenerationTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldPlaceTwoBoundaryEventsForTask() { ProcessBuilder builder = Bpmn.createExecutableProcess(); instance = builder .startEvent(START_EVENT_ID) .userTask(USER_TASK_ID) .boundaryEvent("boundary1") .sequenceFlowId(SEQUENCE_FLOW_ID) .endEvent(END_EVENT_ID) .moveToActivity(USER_TASK_ID) .endEvent() .moveToActivity(USER_TASK_ID) .boundaryEvent("boundary2") .done(); Bounds boundaryEvent1Bounds = findBpmnShape("boundary1").getBounds(); assertShapeCoordinates(boundaryEvent1Bounds, 218, 140); Bounds boundaryEvent2Bounds = findBpmnShape("boundary2").getBounds(); assertShapeCoordinates(boundaryEvent2Bounds, 254, 140); }
Example #27
Source File: CoordinatesGenerationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldPlaceThreeBoundaryEventsForSubProcess() { ProcessBuilder builder = Bpmn.createExecutableProcess(); instance = builder .startEvent(START_EVENT_ID) .subProcess(SUB_PROCESS_ID) .boundaryEvent("boundary1") .moveToActivity(SUB_PROCESS_ID) .boundaryEvent("boundary2") .moveToActivity(SUB_PROCESS_ID) .boundaryEvent("boundary3") .moveToActivity(SUB_PROCESS_ID) .endEvent() .done(); Bounds boundaryEvent1Bounds = findBpmnShape("boundary1").getBounds(); assertShapeCoordinates(boundaryEvent1Bounds, 343, 200); Bounds boundaryEvent2Bounds = findBpmnShape("boundary2").getBounds(); assertShapeCoordinates(boundaryEvent2Bounds, 379, 200); Bounds boundaryEvent3Bounds = findBpmnShape("boundary3").getBounds(); assertShapeCoordinates(boundaryEvent3Bounds, 307, 200); }
Example #28
Source File: CoordinatesGenerationTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldPlaceBoundaryEventForSubProcess() { 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(); Bounds boundaryEventBounds = findBpmnShape("boundary").getBounds(); assertShapeCoordinates(boundaryEventBounds, 343, 200); }
Example #29
Source File: CoordinatesGenerationTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@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); }
Example #30
Source File: CoordinatesGenerationTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@Test public void shouldPlaceTwoBoundaryEventsForSubProcess() { ProcessBuilder builder = Bpmn.createExecutableProcess(); instance = builder .startEvent(START_EVENT_ID) .subProcess(SUB_PROCESS_ID) .boundaryEvent("boundary1") .moveToActivity(SUB_PROCESS_ID) .boundaryEvent("boundary2") .moveToActivity(SUB_PROCESS_ID) .endEvent() .done(); Bounds boundaryEvent1Bounds = findBpmnShape("boundary1").getBounds(); assertShapeCoordinates(boundaryEvent1Bounds, 343, 200); Bounds boundaryEvent2Bounds = findBpmnShape("boundary2").getBounds(); assertShapeCoordinates(boundaryEvent2Bounds, 379, 200); }