Skip to content

Commit

Permalink
wip: none, message, start event implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlukas committed May 10, 2023
1 parent 7e72028 commit 18d37b2
Show file tree
Hide file tree
Showing 117 changed files with 1,915 additions and 250 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<version.zeebe>8.2.4</version.zeebe>
<version.spring-boot-starter-camunda>8.2.0</version.spring-boot-starter-camunda>
<version.spring-boot-starter-camunda>8.2.1</version.spring-boot-starter-camunda>
<version.zeebe-process-test-extension-testcontainer>8.2.2</version.zeebe-process-test-extension-testcontainer>
<version.camunda-bom>7.19.0</version.camunda-bom>
<version.jsoup>1.16.1</version.jsoup>
Expand All @@ -33,7 +33,7 @@
<version.camunda-bpm-assert>15.0.0</version.camunda-bpm-assert>
<version.scala-library>2.13.10</version.scala-library>
<version.feel-engine>1.15.3</version.feel-engine>
<version.protobuf>3.21.9</version.protobuf>
<version.protobuf>3.22.3</version.protobuf>
<version.guava>31.1-android</version.guava>
<version.error_prone_annotations>2.14.0</version.error_prone_annotations>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.camunda.community.migration.processInstance.api.model.data.SubProcessData;
import org.camunda.community.migration.processInstance.api.model.data.UserTaskData;
import org.camunda.community.migration.processInstance.api.model.data.chunk.ActivityNodeData;
import org.camunda.community.migration.processInstance.api.model.data.chunk.CommonActivityNodeData;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -193,6 +194,8 @@ void shouldExportMultiInstanceUserTask() throws JsonProcessingException {
private ActivityNodeData findForLoopCounter(
MultiInstanceData multiInstanceData, int loopCounter) {
return multiInstanceData.getInstances().stream()
.filter(a -> CommonActivityNodeData.class.isAssignableFrom(a.getClass()))
.map(CommonActivityNodeData.class::cast)
.filter(a -> a.getVariables().get("loopCounter").asInt() == loopCounter)
.findFirst()
.get();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.camunda.community.migration.processInstance.exporter;

import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.*;
import static org.junit.jupiter.api.DynamicContainer.*;
import static org.junit.jupiter.api.DynamicTest.*;

import com.fasterxml.jackson.core.JsonProcessingException;
Expand All @@ -17,21 +18,36 @@
import org.camunda.bpm.engine.test.junit5.ProcessEngineExtension;
import org.camunda.community.migration.processInstance.api.model.data.BusinessRuleTaskData;
import org.camunda.community.migration.processInstance.api.model.data.CallActivityData;
import org.camunda.community.migration.processInstance.api.model.data.EndEventData;
import org.camunda.community.migration.processInstance.api.model.data.EventBasedGatewayData;
import org.camunda.community.migration.processInstance.api.model.data.ExclusiveGatewayData;
import org.camunda.community.migration.processInstance.api.model.data.InclusiveGatewayData;
import org.camunda.community.migration.processInstance.api.model.data.IntermediateThrowEventData;
import org.camunda.community.migration.processInstance.api.model.data.ManualTaskData;
import org.camunda.community.migration.processInstance.api.model.data.MessageBoundaryEventData;
import org.camunda.community.migration.processInstance.api.model.data.MessageEndEventData;
import org.camunda.community.migration.processInstance.api.model.data.MessageIntermediateCatchEventData;
import org.camunda.community.migration.processInstance.api.model.data.MessageIntermediateThrowEventData;
import org.camunda.community.migration.processInstance.api.model.data.MessageStartEventData;
import org.camunda.community.migration.processInstance.api.model.data.ParallelGatewayData;
import org.camunda.community.migration.processInstance.api.model.data.ProcessInstanceData;
import org.camunda.community.migration.processInstance.api.model.data.ReceiveTaskData;
import org.camunda.community.migration.processInstance.api.model.data.ScriptTaskData;
import org.camunda.community.migration.processInstance.api.model.data.SendTaskData;
import org.camunda.community.migration.processInstance.api.model.data.ServiceTaskData;
import org.camunda.community.migration.processInstance.api.model.data.SignalBoundaryEventData;
import org.camunda.community.migration.processInstance.api.model.data.SignalEndEventData;
import org.camunda.community.migration.processInstance.api.model.data.SignalIntermediateCatchEventData;
import org.camunda.community.migration.processInstance.api.model.data.SignalIntermediateThrowEventData;
import org.camunda.community.migration.processInstance.api.model.data.SignalStartEventData;
import org.camunda.community.migration.processInstance.api.model.data.StartEventData;
import org.camunda.community.migration.processInstance.api.model.data.SubProcessData;
import org.camunda.community.migration.processInstance.api.model.data.TaskData;
import org.camunda.community.migration.processInstance.api.model.data.TransactionData;
import org.camunda.community.migration.processInstance.api.model.data.UserTaskData;
import org.camunda.community.migration.processInstance.api.model.data.chunk.ActivityNodeData;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.DynamicContainer;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith;
Expand All @@ -55,6 +71,7 @@ private static List<Consumer<ProcessInstance>> defaultSteps() {
}

@TestFactory
@DisplayName("Task Coverage")
Stream<DynamicTest> taskCoverage() {
return Stream.of(
dynamicTest("Task", () -> performTest("bpmn/coverage/task.bpmn", TaskData.class)),
Expand All @@ -80,6 +97,7 @@ Stream<DynamicTest> taskCoverage() {
}

@TestFactory
@DisplayName("Sub Process Coverage")
Stream<DynamicTest> subProcessCoverage() {
return Stream.of(
dynamicTest(
Expand All @@ -101,6 +119,7 @@ Stream<DynamicTest> subProcessCoverage() {
}

@TestFactory
@DisplayName("Gateway Coverage")
Stream<DynamicTest> gatewayCoverage() {
return Stream.of(
dynamicTest(
Expand All @@ -118,6 +137,93 @@ Stream<DynamicTest> gatewayCoverage() {
() -> performTest("bpmn/coverage/inclusive-gateway.bpmn", InclusiveGatewayData.class)));
}

@TestFactory
@DisplayName("Event Coverage")
Stream<DynamicContainer> eventCoverage() {
return Stream.of(
dynamicContainer(
"None Events",
Stream.of(
dynamicTest(
"Start",
() -> performTest("bpmn/coverage/none-start-event.bpmn", StartEventData.class)),
dynamicTest(
"Intermediate Throw",
() ->
performTest(
"bpmn/coverage/none-intermediate-event.bpmn",
IntermediateThrowEventData.class)),
dynamicTest(
"End",
() -> performTest("bpmn/coverage/none-end-event.bpmn", EndEventData.class)))),
dynamicContainer(
"Message Events",
Stream.of(
dynamicTest(
"Start",
() ->
performTest(
"bpmn/coverage/message-start-event.bpmn", MessageStartEventData.class)),
dynamicTest(
"Intermediate Throw",
() ->
performTest(
"bpmn/coverage/message-intermediate-throw-event.bpmn",
MessageIntermediateThrowEventData.class)),
dynamicTest(
"Intermediate Catch",
() ->
performTest(
"bpmn/coverage/message-intermediate-catch-event.bpmn",
MessageIntermediateCatchEventData.class)),
dynamicTest(
"End",
() ->
performTest(
"bpmn/coverage/message-end-event.bpmn", MessageEndEventData.class)),
dynamicTest(
"Boundary Event",
() ->
performTest(
"bpmn/coverage/message-boundary-event.bpmn",
Collections.singletonList(
pi -> runtimeService().correlateMessage("msg")),
MessageBoundaryEventData.class)))),
dynamicContainer(
"Signal Events",
Stream.of(
dynamicTest(
"Start",
() ->
performTest(
"bpmn/coverage/signal-start-event.bpmn", SignalStartEventData.class)),
dynamicTest(
"Intermediate Throw",
() ->
performTest(
"bpmn/coverage/signal-intermediate-throw-event.bpmn",
SignalIntermediateThrowEventData.class)),
dynamicTest(
"Intermediate Catch",
() ->
performTest(
"bpmn/coverage/signal-intermediate-catch-event.bpmn",
SignalIntermediateCatchEventData.class)),
dynamicTest(
"End",
() ->
performTest(
"bpmn/coverage/signal-end-event.bpmn", SignalEndEventData.class)),
dynamicTest(
"Boundary Event",
() ->
performTest(
"bpmn/coverage/signal-boundary-event.bpmn",
Collections.singletonList(
pi -> runtimeService().createSignalEvent("msg").send()),
SignalBoundaryEventData.class)))));
}

private void performTest(String resourceName, Class<? extends ActivityNodeData> expectedType) {
performTest(resourceName, defaultSteps(), defaultTypeExtractor(), expectedType);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1mok7ff" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.11.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.18.0">
<bpmn:process id="EventBasedGatewayProcess" name="Event Based Gateway" isExecutable="true">
<bpmn:startEvent id="ProcessStartedStartEvent" name="Process started">
<bpmn:outgoing>Flow_13bnbu3</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_13bnbu3" sourceRef="ProcessStartedStartEvent" targetRef="EventBasedGatewayGateway" />
<bpmn:endEvent id="ProcessCompleteEndEvent" name="Process complete">
<bpmn:incoming>Flow_0so6of6</bpmn:incoming>
</bpmn:endEvent>
<bpmn:eventBasedGateway id="EventBasedGatewayGateway" name="Event Based Gateway" camunda:asyncBefore="true">
<bpmn:incoming>Flow_13bnbu3</bpmn:incoming>
<bpmn:outgoing>Flow_0gmbwwc</bpmn:outgoing>
</bpmn:eventBasedGateway>
<bpmn:intermediateCatchEvent id="MessageArrivedEvent" name="Message arrived">
<bpmn:incoming>Flow_0gmbwwc</bpmn:incoming>
<bpmn:outgoing>Flow_0so6of6</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_1azw9ym" messageRef="Message_1euu5bi" />
</bpmn:intermediateCatchEvent>
<bpmn:sequenceFlow id="Flow_0gmbwwc" sourceRef="EventBasedGatewayGateway" targetRef="MessageArrivedEvent" />
<bpmn:sequenceFlow id="Flow_0so6of6" sourceRef="MessageArrivedEvent" targetRef="ProcessCompleteEndEvent" />
</bpmn:process>
<bpmn:message id="Message_1euu5bi" name="msg" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="EventBasedGatewayProcess">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="ProcessStartedStartEvent">
<dc:Bounds x="172" y="99" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="152" y="142" width="77" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_1yyc5qw_di" bpmnElement="EventBasedGatewayGateway">
<dc:Bounds x="475" y="92" width="50" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="469" y="68" width="63" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0xuucm3_di" bpmnElement="MessageArrivedEvent">
<dc:Bounds x="582" y="99" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="559" y="142" width="82" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1acybb3_di" bpmnElement="ProcessCompleteEndEvent">
<dc:Bounds x="672" y="99" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="646" y="142" width="88" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_13bnbu3_di" bpmnElement="Flow_13bnbu3">
<di:waypoint x="208" y="117" />
<di:waypoint x="475" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0gmbwwc_di" bpmnElement="Flow_0gmbwwc">
<di:waypoint x="525" y="117" />
<di:waypoint x="582" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0so6of6_di" bpmnElement="Flow_0so6of6">
<di:waypoint x="618" y="117" />
<di:waypoint x="672" y="117" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1mok7ff" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.11.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.18.0">
<bpmn:process id="InclusiveGatewayProcess" name="Inclusive Gateway" isExecutable="true">
<bpmn:startEvent id="ProcessStartedStartEvent" name="Process started">
<bpmn:outgoing>Flow_13bnbu3</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_13bnbu3" sourceRef="ProcessStartedStartEvent" targetRef="InclusiveGatewayInclusiveGateway" />
<bpmn:endEvent id="ProcessCompleteEndEvent" name="Process complete">
<bpmn:incoming>Flow_1hw0z77</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1hw0z77" sourceRef="InclusiveGatewayInclusiveGateway" targetRef="ProcessCompleteEndEvent" />
<bpmn:inclusiveGateway id="InclusiveGatewayInclusiveGateway" name="Inclusive Gateway" camunda:asyncBefore="true">
<bpmn:incoming>Flow_13bnbu3</bpmn:incoming>
<bpmn:outgoing>Flow_1hw0z77</bpmn:outgoing>
</bpmn:inclusiveGateway>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="InclusiveGatewayProcess">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="ProcessStartedStartEvent">
<dc:Bounds x="172" y="99" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="152" y="142" width="77" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1acybb3_di" bpmnElement="ProcessCompleteEndEvent">
<dc:Bounds x="622" y="99" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="596" y="142" width="88" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_0ygg2hi_di" bpmnElement="InclusiveGatewayInclusiveGateway">
<dc:Bounds x="475" y="92" width="50" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="455" y="68" width="90" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_13bnbu3_di" bpmnElement="Flow_13bnbu3">
<di:waypoint x="208" y="117" />
<di:waypoint x="475" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1hw0z77_di" bpmnElement="Flow_1hw0z77">
<di:waypoint x="525" y="117" />
<di:waypoint x="622" y="117" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Loading

0 comments on commit 18d37b2

Please sign in to comment.