Skip to content

Commit

Permalink
update camunda 7.20 and related versions
Browse files Browse the repository at this point in the history
fixes #335
fixes #324
  • Loading branch information
jangalinski committed Oct 6, 2023
1 parent aad40c1 commit 1e5512c
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 157 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches-ignore: [master]
schedule:
- cron: '2 2 * * 1' # run nightly master builds every monday
- cron: '2 2 * * 1' # run nightly master builds every monday

jobs:
build:
Expand All @@ -15,11 +15,11 @@ jobs:
- name: Java setup
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: zulu
cache: maven
- name: Run Maven
run: mvn -B clean install com.mycila:license-maven-plugin:check
run: ./mvnw -B clean install com.mycila:license-maven-plugin:check
- name: Run CodeCov
uses: codecov/codecov-action@v3

2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Java environment
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: zulu
cache: maven
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_SIGNING_KEY_SEC }}
Expand Down
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.8/apache-maven-3.8.8-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<properties>
<!-- Avoid the message "[WARNING] Using platform encoding (UTF-8 actually) ... also for the failsafe plugin -->
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<version.java>11</version.java>
<version.java>17</version.java>
<java.version>${version.java}</java.version>

<camunda.version>7.20.0</camunda.version>
<camunda-bpm-data.version>1.2.8</camunda-bpm-data.version>
<camunda-bpm-data.version>1.4.0</camunda-bpm-data.version>

<slf4j.version>2.0.9</slf4j.version>
<commons-lang3.version>3.13.0</commons-lang3.version>
Expand Down Expand Up @@ -177,7 +177,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>11</source>
<source>17</source>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public interface MockedModelConfigurer {

public CallActivityMock(final String processId, final MockedModelConfigurer modelConfigurer) {
this.processId = processId;
ProcessBuilder processBuilder = Bpmn.createExecutableProcess(processId);
ProcessBuilder processBuilder = Bpmn.createExecutableProcess(processId)
.camundaHistoryTimeToLive(1);
if (modelConfigurer != null) {
modelConfigurer.setProcessModelAttributes(processBuilder);
}
Expand Down Expand Up @@ -236,13 +237,13 @@ public CallActivityMock onExecutionThrowEscalation(final String escalationCode)
this.escalation = escalationCode;
return this;
}

/**
* On execution, the MockProcess will throw error for the given code when no escalation is set
*
* If called multiple times, this method adds only the last error to the end event.
*
* @param escalationCode the escalation code
* @param errorCode the errorCode
* @return self
*/
public CallActivityMock onExecutionThrowError(final String errorCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import org.camunda.bpm.engine.runtime.JobQuery;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.camunda.community.mockito.function.DeployProcess;
import org.camunda.bpm.model.bpmn.Bpmn;
import org.camunda.bpm.model.bpmn.BpmnModelInstance;
import org.camunda.community.mockito.function.DeployProcess;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -22,9 +22,9 @@
import java.util.Optional;

import static org.camunda.bpm.engine.variable.Variables.createVariables;
import static org.camunda.bpm.model.xml.test.assertions.ModelAssertions.assertThat;
import static org.camunda.community.mockito.MostUsefulProcessEngineConfiguration.mostUsefulProcessEngineConfiguration;
import static org.camunda.community.mockito.ProcessExpressions.registerCallActivityMock;
import static org.camunda.bpm.model.xml.test.assertions.ModelAssertions.assertThat;
import static org.junit.Assert.assertEquals;

public class CallActivityMockExampleTest {
Expand Down Expand Up @@ -114,6 +114,7 @@ public void register_subprocess_mock_withSendMessage() {

final String waitForMessageId = "waitForMessage";
final BpmnModelInstance waitForMessage = Bpmn.createExecutableProcess(waitForMessageId)
.camundaHistoryTimeToLive(1)
.startEvent("start")
.intermediateCatchEvent("waitForMessageCatchEvent")
.message(MESSAGE_DOIT)
Expand Down Expand Up @@ -169,6 +170,7 @@ public void register_subprocess_mock_withException() {
@Test
public void register_subprocesses_mocks_withVariables() {
final BpmnModelInstance processWithSubProcess = Bpmn.createExecutableProcess(PROCESS_ID)
.camundaHistoryTimeToLive(1)
.startEvent("start")
.callActivity("call_subprocess")
.camundaOut("foo", "foo")
Expand Down Expand Up @@ -238,6 +240,7 @@ public void register_subprocess_mock_throwEscalation() {
String escalationEndId = "EscalationEnd";

BpmnModelInstance processWithSubProcess = Bpmn.createExecutableProcess(PROCESS_ID)
.camundaHistoryTimeToLive(1)
.startEvent("start")
.callActivity(subprocessId)
.calledElement(SUB_PROCESS_ID)
Expand All @@ -260,39 +263,41 @@ public void register_subprocess_mock_throwEscalation() {
isEnded(processInstance);
assertEquals(escalationEndId, ((ProcessInstanceWithVariablesImpl) processInstance).getExecutionEntity().getActivityId());
}

@Test
public void register_subprocess_mock_throwError() {
String errorCode = "SOME_ERROR";
String subprocessId = "call_subprocess";
String errorEndId = "ErrorEnd";

BpmnModelInstance processWithSubProcess = Bpmn.createExecutableProcess(PROCESS_ID)
.startEvent("start")
.callActivity(subprocessId)
.calledElement(SUB_PROCESS_ID)
.boundaryEvent()
.error(errorCode)
.endEvent(errorEndId)
.moveToActivity(subprocessId)
.userTask(TASK_USERTASK)
.endEvent("end")
.done();

.camundaHistoryTimeToLive(1)
.startEvent("start")
.callActivity(subprocessId)
.calledElement(SUB_PROCESS_ID)
.boundaryEvent()
.error(errorCode)
.endEvent(errorEndId)
.moveToActivity(subprocessId)
.userTask(TASK_USERTASK)
.endEvent("end")
.done();

camunda.manageDeployment(new DeployProcess(camunda).apply(PROCESS_ID, processWithSubProcess));

camunda.manageDeployment(registerCallActivityMock(SUB_PROCESS_ID)
.onExecutionThrowError(errorCode)
.deploy(camunda));
.onExecutionThrowError(errorCode)
.deploy(camunda));

ProcessInstance processInstance = startProcess(PROCESS_ID);

isEnded(processInstance);
assertEquals(errorEndId, ((ProcessInstanceWithVariablesImpl) processInstance).getExecutionEntity().getActivityId());
}

private void prepareProcessWithOneSubprocess() {
final BpmnModelInstance processWithSubProcess = Bpmn.createExecutableProcess(PROCESS_ID)
.camundaHistoryTimeToLive(1)
.startEvent("start")
.callActivity("call_subprocess")
.camundaOut("foo", "foo")
Expand Down
116 changes: 58 additions & 58 deletions src/test/resources/MockProcess.bpmn
Original file line number Diff line number Diff line change
@@ -1,118 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_26WcoMvlEeOJ0dSME99_6w" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
<bpmn2:process id="process_mock_dummy" name="Dummy Mock Process" isExecutable="true">
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_26WcoMvlEeOJ0dSME99_6w" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="5.15.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="process_mock_dummy" name="Dummy Mock Process" isExecutable="true" camunda:versionTag="1" camunda:historyTimeToLive="1">
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:extensionElements>
<camunda:executionListener delegateExpression="#{startProcess}" event="end"/>
<camunda:executionListener delegateExpression="#{startProcess}" event="end" />
</bpmn2:extensionElements>
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:serviceTask id="ServiceTask_1" camunda:delegateExpression="#{loadData}" name="Load Data">
<bpmn2:serviceTask id="ServiceTask_1" name="Load Data" camunda:delegateExpression="#{loadData}">
<bpmn2:extensionElements>
<camunda:executionListener delegateExpression="#{beforeLoadData}" event="start"/>
<camunda:executionListener delegateExpression="#{beforeLoadData}" event="start" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="ServiceTask_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="ServiceTask_1" />
<bpmn2:userTask id="UserTask_1" name="Verify Data">
<bpmn2:extensionElements>
<camunda:taskListener delegateExpression="#{verifyData}" event="create"/>
<camunda:taskListener delegateExpression="#{verifyData}" event="create" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_2" sourceRef="ServiceTask_1" targetRef="UserTask_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="UserTask_1" targetRef="ServiceTask_2"/>
<bpmn2:serviceTask id="ServiceTask_2" camunda:delegateExpression="#{saveData}" name="Save Data">
<bpmn2:sequenceFlow id="SequenceFlow_2" sourceRef="ServiceTask_1" targetRef="UserTask_1" />
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="UserTask_1" targetRef="ServiceTask_2" />
<bpmn2:serviceTask id="ServiceTask_2" name="Save Data" camunda:delegateExpression="#{saveData}">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ServiceTask_2" targetRef="EndEvent_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ServiceTask_2" targetRef="EndEvent_1" />
<bpmn2:endEvent id="EndEvent_1">
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:textAnnotation id="TextAnnotation_1">
<bpmn2:text>with execution listener</bpmn2:text>
</bpmn2:textAnnotation>
<bpmn2:association id="Association_1" sourceRef="TextAnnotation_1" targetRef="StartEvent_1"/>
<bpmn2:association id="Association_1" sourceRef="TextAnnotation_1" targetRef="StartEvent_1" />
<bpmn2:textAnnotation id="TextAnnotation_2">
<bpmn2:text>with java delegate</bpmn2:text>
</bpmn2:textAnnotation>
<bpmn2:association id="Association_2" sourceRef="TextAnnotation_2" targetRef="ServiceTask_1"/>
<bpmn2:association id="Association_2" sourceRef="TextAnnotation_2" targetRef="ServiceTask_1" />
<bpmn2:textAnnotation id="TextAnnotation_3">
<bpmn2:text>with task listener</bpmn2:text>
</bpmn2:textAnnotation>
<bpmn2:association id="Association_3" sourceRef="TextAnnotation_3" targetRef="UserTask_1"/>
<bpmn2:association id="Association_4" sourceRef="TextAnnotation_2" targetRef="ServiceTask_2"/>
<bpmn2:association id="Association_3" sourceRef="TextAnnotation_3" targetRef="UserTask_1" />
<bpmn2:association id="Association_4" sourceRef="TextAnnotation_2" targetRef="ServiceTask_2" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="process_mock_dummy">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_7" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="112.0" y="243.0"/>
<dc:Bounds x="112" y="243" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ServiceTask_43" bpmnElement="ServiceTask_1">
<dc:Bounds height="80.0" width="100.0" x="198.0" y="221.0"/>
<dc:Bounds x="198" y="221" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_7" targetElement="_BPMNShape_ServiceTask_43">
<di:waypoint xsi:type="dc:Point" x="148.0" y="261.0"/>
<di:waypoint xsi:type="dc:Point" x="198.0" y="261.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_UserTask_22" bpmnElement="UserTask_1">
<dc:Bounds height="80.0" width="100.0" x="348.0" y="221.0"/>
<dc:Bounds x="348" y="221" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ServiceTask_44" bpmnElement="ServiceTask_2">
<dc:Bounds x="504" y="221" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ServiceTask_43" targetElement="_BPMNShape_UserTask_22">
<di:waypoint xsi:type="dc:Point" x="298.0" y="261.0"/>
<di:waypoint xsi:type="dc:Point" x="348.0" y="261.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_3" bpmnElement="EndEvent_1">
<dc:Bounds height="36.0" width="36.0" x="702.0" y="243.0"/>
<dc:Bounds x="702" y="243" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="720.0" y="284.0"/>
<dc:Bounds x="720" y="284" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ServiceTask_44" targetElement="_BPMNShape_EndEvent_3">
<di:waypoint xsi:type="dc:Point" x="604.0" y="261.0"/>
<di:waypoint xsi:type="dc:Point" x="702.0" y="261.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="626.0" y="261.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_TextAnnotation_13" bpmnElement="TextAnnotation_1">
<dc:Bounds height="50.0" width="159.0" x="118.0" y="346.0"/>
<dc:Bounds x="118" y="346" width="159" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_Association_1" bpmnElement="Association_1" sourceElement="_BPMNShape_TextAnnotation_13" targetElement="_BPMNShape_StartEvent_7">
<di:waypoint xsi:type="dc:Point" x="182.0" y="346.0"/>
<di:waypoint xsi:type="dc:Point" x="141.0" y="279.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_TextAnnotation_14" bpmnElement="TextAnnotation_2">
<dc:Bounds height="50.0" width="127.0" x="348.0" y="72.0"/>
<dc:Bounds x="348" y="72" width="127" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_Association_2" bpmnElement="Association_2" sourceElement="_BPMNShape_TextAnnotation_14" targetElement="_BPMNShape_ServiceTask_43">
<di:waypoint xsi:type="dc:Point" x="386.0" y="122.0"/>
<di:waypoint xsi:type="dc:Point" x="288.0" y="221.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_TextAnnotation_15" bpmnElement="TextAnnotation_3">
<dc:Bounds height="50.0" width="241.0" x="444.0" y="386.0"/>
<dc:Bounds x="444" y="386" width="241" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_Association_3" bpmnElement="Association_3" sourceElement="_BPMNShape_TextAnnotation_15" targetElement="_BPMNShape_UserTask_22">
<di:waypoint xsi:type="dc:Point" x="536.0" y="386.0"/>
<di:waypoint xsi:type="dc:Point" x="442.0" y="301.0"/>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_7" targetElement="_BPMNShape_ServiceTask_43">
<di:waypoint x="148" y="261" />
<di:waypoint x="198" y="261" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ServiceTask_43" targetElement="_BPMNShape_UserTask_22">
<di:waypoint x="298" y="261" />
<di:waypoint x="348" y="261" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ServiceTask_44" bpmnElement="ServiceTask_2">
<dc:Bounds height="80.0" width="100.0" x="504.0" y="221.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_UserTask_22" targetElement="_BPMNShape_ServiceTask_44">
<di:waypoint xsi:type="dc:Point" x="448.0" y="261.0"/>
<di:waypoint xsi:type="dc:Point" x="504.0" y="261.0"/>
<di:waypoint x="448" y="261" />
<di:waypoint x="504" y="261" />
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="470.0" y="261.0"/>
<dc:Bounds x="470" y="261" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ServiceTask_44" targetElement="_BPMNShape_EndEvent_3">
<di:waypoint x="604" y="261" />
<di:waypoint x="702" y="261" />
<bpmndi:BPMNLabel>
<dc:Bounds x="626" y="261" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_Association_1" bpmnElement="Association_1" sourceElement="_BPMNShape_TextAnnotation_13" targetElement="_BPMNShape_StartEvent_7">
<di:waypoint x="182" y="346" />
<di:waypoint x="141" y="279" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_Association_2" bpmnElement="Association_2" sourceElement="_BPMNShape_TextAnnotation_14" targetElement="_BPMNShape_ServiceTask_43">
<di:waypoint x="386" y="122" />
<di:waypoint x="288" y="221" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_Association_3" bpmnElement="Association_3" sourceElement="_BPMNShape_TextAnnotation_15" targetElement="_BPMNShape_UserTask_22">
<di:waypoint x="536" y="386" />
<di:waypoint x="442" y="301" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_Association_4" bpmnElement="Association_4" sourceElement="_BPMNShape_TextAnnotation_14" targetElement="_BPMNShape_ServiceTask_44">
<di:waypoint xsi:type="dc:Point" x="433.0" y="122.0"/>
<di:waypoint xsi:type="dc:Point" x="519.0" y="221.0"/>
<di:waypoint x="433" y="122" />
<di:waypoint x="519" y="221" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
</bpmn2:definitions>
Loading

0 comments on commit 1e5512c

Please sign in to comment.