diff --git a/timer-testing/pom.xml b/timer-testing/pom.xml
index d9961ed0..086082f0 100644
--- a/timer-testing/pom.xml
+++ b/timer-testing/pom.xml
@@ -9,9 +9,8 @@
21
- 3.3.0
- 2.7.0
- 8.5.7
+ 3.4.0
+ 8.6.7
${java.version}
${java.version}
@@ -30,9 +29,9 @@
- io.camunda.spring
- spring-boot-starter-camunda
- ${spring-zeebe.version}
+ io.camunda
+ spring-boot-starter-camunda-sdk
+ ${camunda.version}
@@ -46,15 +45,9 @@
test
- io.camunda.spring
- spring-boot-starter-camunda-test
- ${spring-zeebe.version}
- test
-
-
- org.camunda.community.process_test_coverage
- camunda-process-test-coverage-junit5-platform-8
- ${camunda-process-test-coverage.version}
+ io.camunda
+ camunda-process-test-spring
+ ${camunda.version}
test
@@ -166,4 +159,4 @@
-
\ No newline at end of file
+
diff --git a/timer-testing/src/main/resources/application.yaml b/timer-testing/src/main/resources/application.yaml
index 8467dae4..f5407ce2 100644
--- a/timer-testing/src/main/resources/application.yaml
+++ b/timer-testing/src/main/resources/application.yaml
@@ -1,3 +1,3 @@
camunda:
client:
- mode: simple
+ mode: selfmanaged
diff --git a/timer-testing/src/main/resources/get-up.bpmn b/timer-testing/src/main/resources/get-up.bpmn
index bee03516..c6116e69 100644
--- a/timer-testing/src/main/resources/get-up.bpmn
+++ b/timer-testing/src/main/resources/get-up.bpmn
@@ -1,5 +1,5 @@
-
+
Flow_0lin8i4
@@ -21,7 +21,7 @@
Flow_0j8vm25
-
+
Flow_1m7we6c
Flow_0nxql0b
@@ -105,7 +105,7 @@
Flow_14nugz7
Flow_0ih5vlk
-
+
Flow_0ih5vlk
Flow_0j2xfnn
@@ -208,7 +208,7 @@
-
+
@@ -272,7 +272,7 @@
-
+
diff --git a/timer-testing/src/test/java/com/camunda/consulting/SpringTimerTest.java b/timer-testing/src/test/java/com/camunda/consulting/SpringTimerTest.java
index e14945de..299508b7 100644
--- a/timer-testing/src/test/java/com/camunda/consulting/SpringTimerTest.java
+++ b/timer-testing/src/test/java/com/camunda/consulting/SpringTimerTest.java
@@ -1,34 +1,29 @@
package com.camunda.consulting;
import static com.camunda.consulting.ExampleApplication.*;
-import static io.camunda.zeebe.process.test.assertions.BpmnAssert.*;
-import static io.camunda.zeebe.spring.test.ZeebeTestThreadSupport.*;
+import static io.camunda.process.test.api.CamundaAssert.*;
import static org.assertj.core.api.Assertions.*;
+import io.camunda.process.test.api.CamundaProcessTestContext;
+import io.camunda.process.test.api.CamundaSpringProcessTest;
import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.response.ProcessInstanceEvent;
-import io.camunda.zeebe.process.test.api.ZeebeTestEngine;
-import io.camunda.zeebe.process.test.inspections.model.InspectedProcessInstance;
-import io.camunda.zeebe.spring.test.ZeebeSpringTest;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeoutException;
-import org.camunda.community.process_test_coverage.junit5.platform8.ProcessEngineCoverageExtension;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.RepeatedTest;
-import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
-@ZeebeSpringTest
+@CamundaSpringProcessTest
@SpringBootTest
-@ExtendWith(ProcessEngineCoverageExtension.class)
public class SpringTimerTest {
private static final Duration DEFAULT = Duration.ofSeconds(30);
- @Autowired ZeebeTestEngine zeebeTestEngine;
+ @Autowired CamundaProcessTestContext camundaProcessTestContext;
@Autowired ZeebeClient zeebeClient;
@BeforeEach
@@ -41,78 +36,49 @@ void reset() {
progressOverride = null;
}
- @RepeatedTest(10)
+ @Test
void happyPath() throws InterruptedException, TimeoutException {
progressOverride = "ready";
ProcessInstanceEvent processInstance = createInstance("GetUpProcess");
- InspectedProcessInstance inspectedProcessInstance =
- new InspectedProcessInstance(processInstance.getProcessInstanceKey());
- waitForProcessInstanceHasPassedElement(processInstance, "TellKidsToGetUpTask", DEFAULT);
- skipTimer(inspectedProcessInstance, "Wait15MinutesEvent", Duration.ofMinutes(15));
- waitForProcessInstanceHasPassedElement(processInstance, "CheckCurrentProgressTask", DEFAULT);
- skipTimer(inspectedProcessInstance, "Wait15MinutesEvent1", Duration.ofMinutes(15));
- skipTimer(inspectedProcessInstance, "Wait5MinutesEvent1", Duration.ofMinutes(5));
- waitForProcessInstanceCompleted(processInstance);
+ assertThat(processInstance).hasActiveElements("Wait 15 minutes");
+ skipTimer(Duration.ofMinutes(15));
+ assertThat(processInstance).hasActiveElements("Wait another 15 minutes");
+ skipTimer(Duration.ofMinutes(15));
+ assertThat(processInstance).hasActiveElements("Wait another 5 minutes");
+ skipTimer(Duration.ofMinutes(5));
+ assertThat(processInstance).isCompleted();
}
- @RepeatedTest(10)
+ @Test
void boundaryEvent() throws InterruptedException, TimeoutException {
progressOverride = "in bed";
ProcessInstanceEvent processInstance = createInstance("GetUpProcess");
- InspectedProcessInstance inspectedProcessInstance =
- new InspectedProcessInstance(processInstance.getProcessInstanceKey());
- waitForProcessInstanceHasPassedElement(processInstance, "TellKidsToGetUpTask", DEFAULT);
- skipTimer(inspectedProcessInstance, "Wait15MinutesEvent", Duration.ofMinutes(15));
- waitForProcessInstanceHasPassedElement(processInstance, "CheckCurrentProgressTask", DEFAULT);
- waitForProcessInstanceHasPassedElement(
- inspectedProcessInstance, "TellKidsToGetUpTask", DEFAULT, 2);
- skipTimer(inspectedProcessInstance, "Wait15MinutesEvent", Duration.ofMinutes(15), 2);
- waitForProcessInstanceHasPassedElement(
- inspectedProcessInstance, "CheckCurrentProgressTask", DEFAULT, 2);
+ assertThat(processInstance).hasActiveElements("Wait 15 minutes");
+ skipTimer(Duration.ofMinutes(15));
+ assertThat(processInstance).hasActiveElements("Wait 15 minutes");
+ skipTimer(Duration.ofMinutes(15));
+ assertThat(processInstance).hasActiveElements("Wait 15 minutes");
progressOverride = "dressing";
- waitForProcessInstanceHasPassedElement(
- inspectedProcessInstance, "TellKidsToGetUpTask", DEFAULT, 3);
- skipTimer(inspectedProcessInstance, "Wait15MinutesEvent", Duration.ofMinutes(15), 3);
- waitForProcessInstanceHasPassedElement(
- inspectedProcessInstance, "CheckCurrentProgressTask", DEFAULT, 3);
+ skipTimer(Duration.ofMinutes(15));
+ assertThat(processInstance).hasActiveElements("Wait 5 minutes");
progressOverride = "ready";
- skipTimer(inspectedProcessInstance, "Wait5MinutesEvent", Duration.ofMinutes(5));
- waitForProcessInstanceHasPassedElement(
- inspectedProcessInstance, "CheckCurrentProgressTask", DEFAULT, 4);
+ skipTimer(Duration.ofMinutes(5));
// we start having breakfast (finally)
- zeebeTestEngine.increaseTime(Duration.ofMinutes(10));
+ skipTimer(Duration.ofMinutes(10));
// we are running late at this point (15+15+15+5+10 = 60) so the boundary event gets triggered
// instead
- waitForProcessInstanceHasPassedElement(processInstance, "RunningLateBoundaryEvent", DEFAULT);
- skipTimer(inspectedProcessInstance, "Wait5MinutesEvent1", Duration.ofMinutes(5));
- waitForProcessInstanceCompleted(processInstance);
- assertThat(processInstance)
- .isCompleted()
- .hasPassedElement("MakeThemReadyTask")
- .hasNotPassedElement("KidsAreFedEndEvent");
+ assertThat(processInstance).hasCompletedElements("Running late");
+ assertThat(processInstance).hasActiveElements("Wait another 5 minutes");
+ skipTimer(Duration.ofMinutes(5));
+ assertThat(processInstance).isCompleted().hasCompletedElements("Make them ready");
+ // missing: has not completed elements
}
- private void skipTimer(
- InspectedProcessInstance processInstance, String timerElementId, Duration timerDuration)
- throws InterruptedException, TimeoutException {
- skipTimer(processInstance, timerElementId, timerDuration, 1);
+ private void skipTimer(Duration timerDuration) throws InterruptedException, TimeoutException {
+ camundaProcessTestContext.increaseTime(timerDuration);
}
- private void skipTimer(
- InspectedProcessInstance processInstance,
- String timerElementId,
- Duration timerDuration,
- int times)
- throws InterruptedException, TimeoutException {
- zeebeTestEngine.waitForIdleState(DEFAULT);
- assertThat(processInstance).isWaitingAtElements(timerElementId);
- zeebeTestEngine.increaseTime(timerDuration);
- waitForProcessInstanceHasPassedElement(processInstance, timerElementId, DEFAULT, times);
- zeebeTestEngine.waitForIdleState(DEFAULT);
- }
-
- private ProcessInstanceEvent createInstance(String bpmnProcessId)
- throws InterruptedException, TimeoutException {
+ private ProcessInstanceEvent createInstance(String bpmnProcessId) {
ProcessInstanceEvent instance =
zeebeClient
.newCreateInstanceCommand()
@@ -120,19 +86,16 @@ private ProcessInstanceEvent createInstance(String bpmnProcessId)
.latestVersion()
.send()
.join();
- zeebeTestEngine.waitForIdleState(DEFAULT);
return instance;
}
- private void completeJob(String jobType) throws InterruptedException, TimeoutException {
+ private void completeJob(String jobType) {
completeJob(jobType, Map.of());
}
- private void completeJob(String jobType, Map variables)
- throws InterruptedException, TimeoutException {
+ private void completeJob(String jobType, Map variables) {
ActivatedJob activatedJob = job(jobType);
complete(activatedJob.getKey(), variables);
- zeebeTestEngine.waitForIdleState(DEFAULT);
}
private void complete(long jobKey, Map variables) {
diff --git a/timer-testing/src/test/java/com/camunda/consulting/TimerTest.java b/timer-testing/src/test/java/com/camunda/consulting/TimerTest.java
index ccf27810..2e372055 100644
--- a/timer-testing/src/test/java/com/camunda/consulting/TimerTest.java
+++ b/timer-testing/src/test/java/com/camunda/consulting/TimerTest.java
@@ -1,27 +1,24 @@
package com.camunda.consulting;
-import static io.camunda.zeebe.process.test.assertions.BpmnAssert.*;
+import static io.camunda.process.test.api.CamundaAssert.*;
import static org.assertj.core.api.Assertions.*;
+import io.camunda.process.test.api.CamundaProcessTest;
+import io.camunda.process.test.api.CamundaProcessTestContext;
import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.response.ProcessInstanceEvent;
-import io.camunda.zeebe.process.test.api.ZeebeTestEngine;
-import io.camunda.zeebe.process.test.extension.ZeebeProcessTest;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeoutException;
-import org.camunda.community.process_test_coverage.junit5.platform8.ProcessEngineCoverageExtension;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.RepeatedTest;
-import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.Test;
-@ZeebeProcessTest
-@ExtendWith(ProcessEngineCoverageExtension.class)
+@CamundaProcessTest
public class TimerTest {
private static final Duration DEFAULT = Duration.ofSeconds(30);
- ZeebeTestEngine zeebeTestEngine;
+ CamundaProcessTestContext camundaProcessTestContext;
ZeebeClient zeebeClient;
@BeforeEach
@@ -29,61 +26,56 @@ void deploy() {
zeebeClient.newDeployResourceCommand().addResourceFromClasspath("get-up.bpmn").send().join();
}
- @RepeatedTest(10)
+ @Test
void happyPath() throws InterruptedException, TimeoutException {
ProcessInstanceEvent processInstance = createInstance("GetUpProcess");
- assertThat(processInstance).isWaitingAtElements("TellKidsToGetUpTask");
+ assertThat(processInstance).hasActiveElements("Tell kids to get up");
completeJob("callKids");
- assertThat(processInstance).isWaitingAtElements("Wait15MinutesEvent");
+ assertThat(processInstance).hasActiveElements("Wait 15 minutes");
skipTimer(Duration.ofMinutes(15));
- assertThat(processInstance).isWaitingAtElements("CheckCurrentProgressTask");
+ assertThat(processInstance).hasActiveElements("Check current progress");
completeJob("checkProgress", Map.of("progress", "ready"));
- assertThat(processInstance).isWaitingAtElements("Wait15MinutesEvent1");
+ assertThat(processInstance).hasActiveElements("Wait another 15 minutes");
skipTimer(Duration.ofMinutes(15));
- assertThat(processInstance).isWaitingAtElements("Wait5MinutesEvent1");
+ assertThat(processInstance).hasActiveElements("Wait another 5 minutes");
skipTimer(Duration.ofMinutes(5));
- assertThat(processInstance).isCompleted().hasPassedElement("KidsAreFedEndEvent");
+ assertThat(processInstance).isCompleted().hasCompletedElements("Kids are fed");
}
- @RepeatedTest(10)
+ @Test
void boundaryEvent() throws InterruptedException, TimeoutException {
ProcessInstanceEvent processInstance = createInstance("GetUpProcess");
- assertThat(processInstance).isWaitingAtElements("TellKidsToGetUpTask");
+ assertThat(processInstance).hasActiveElements("Tell kids to get up");
completeJob("callKids");
- assertThat(processInstance).isWaitingAtElements("Wait15MinutesEvent");
+ assertThat(processInstance).hasActiveElements("Wait 15 minutes");
skipTimer(Duration.ofMinutes(15));
- assertThat(processInstance).isWaitingAtElements("CheckCurrentProgressTask");
+ assertThat(processInstance).hasActiveElements("Check current progress");
completeJob("checkProgress", Map.of("progress", "in bed"));
- assertThat(processInstance).isWaitingAtElements("TellKidsToGetUpTask");
+ assertThat(processInstance).hasActiveElements("Tell kids to get up");
completeJob("callKids");
- assertThat(processInstance).isWaitingAtElements("Wait15MinutesEvent");
+ assertThat(processInstance).hasActiveElements("Wait 15 minutes");
skipTimer(Duration.ofMinutes(15));
- assertThat(processInstance).isWaitingAtElements("CheckCurrentProgressTask");
+ assertThat(processInstance).hasActiveElements("Check current progress");
completeJob("checkProgress", Map.of("progress", "in bed"));
- assertThat(processInstance).isWaitingAtElements("TellKidsToGetUpTask");
+ assertThat(processInstance).hasActiveElements("Tell kids to get up");
completeJob("callKids");
- assertThat(processInstance).isWaitingAtElements("Wait15MinutesEvent");
+ assertThat(processInstance).hasActiveElements("Wait 15 minutes");
skipTimer(Duration.ofMinutes(15));
- assertThat(processInstance).isWaitingAtElements("CheckCurrentProgressTask");
+ assertThat(processInstance).hasActiveElements("Check current progress");
completeJob("checkProgress", Map.of("progress", "dressing"));
skipTimer(Duration.ofMinutes(5));
- assertThat(processInstance).isWaitingAtElements("CheckCurrentProgressTask");
+ assertThat(processInstance).hasActiveElements("Check current progress");
completeJob("checkProgress", Map.of("progress", "ready"));
- assertThat(processInstance).isWaitingAtElements("Wait15MinutesEvent1");
+ assertThat(processInstance).hasActiveElements("Wait another 15 minutes");
skipTimer(Duration.ofMinutes(15));
- assertThat(processInstance).isWaitingAtElements("Wait5MinutesEvent1");
+ assertThat(processInstance).hasActiveElements("Wait another 5 minutes");
skipTimer(Duration.ofMinutes(5));
- assertThat(processInstance)
- .isCompleted()
- .hasPassedElement("MakeThemReadyTask")
- .hasNotPassedElement("KidsAreFedEndEvent");
+ assertThat(processInstance).isCompleted().hasCompletedElements("Make them ready");
+ // missing: hasNotCompletedElements()
}
- private void skipTimer(Duration timerDuration) throws InterruptedException, TimeoutException {
- zeebeTestEngine.waitForIdleState(DEFAULT);
- zeebeTestEngine.increaseTime(timerDuration);
- zeebeTestEngine.waitForBusyState(DEFAULT);
- zeebeTestEngine.waitForIdleState(DEFAULT);
+ private void skipTimer(Duration timerDuration) {
+ camundaProcessTestContext.increaseTime(timerDuration);
}
private ProcessInstanceEvent createInstance(String bpmnProcessId)
@@ -95,7 +87,6 @@ private ProcessInstanceEvent createInstance(String bpmnProcessId)
.latestVersion()
.send()
.join();
- zeebeTestEngine.waitForIdleState(DEFAULT);
return instance;
}
@@ -103,11 +94,9 @@ private void completeJob(String jobType) throws InterruptedException, TimeoutExc
completeJob(jobType, Map.of());
}
- private void completeJob(String jobType, Map variables)
- throws InterruptedException, TimeoutException {
+ private void completeJob(String jobType, Map variables) {
ActivatedJob activatedJob = job(jobType);
complete(activatedJob.getKey(), variables);
- zeebeTestEngine.waitForIdleState(DEFAULT);
}
private void complete(long jobKey, Map variables) {