From 4e7a3d377df191ec30ef3b9733a3850bde233ab6 Mon Sep 17 00:00:00 2001 From: Jan Galinski Date: Wed, 26 Jun 2024 15:27:57 +0200 Subject: [PATCH 01/25] Update for next development version --- examples/basic-junit4/pom.xml | 2 +- examples/basic-junit5/pom.xml | 2 +- examples/pom.xml | 2 +- extension/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/basic-junit4/pom.xml b/examples/basic-junit4/pom.xml index b8f29fd..e649e6f 100644 --- a/examples/basic-junit4/pom.xml +++ b/examples/basic-junit4/pom.xml @@ -6,7 +6,7 @@ io.holunda.testing camunda-bpm-jgiven-examples - 1.21.0 + 1.21.1-SNAPSHOT camunda-bpm-jgiven-examples-basic-junit4 diff --git a/examples/basic-junit5/pom.xml b/examples/basic-junit5/pom.xml index 29eacc5..c226196 100644 --- a/examples/basic-junit5/pom.xml +++ b/examples/basic-junit5/pom.xml @@ -6,7 +6,7 @@ io.holunda.testing camunda-bpm-jgiven-examples - 1.21.0 + 1.21.1-SNAPSHOT camunda-bpm-jgiven-examples-basic-junit5 diff --git a/examples/pom.xml b/examples/pom.xml index fa45002..467f804 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -6,7 +6,7 @@ io.holunda.testing camunda-bpm-jgiven-parent - 1.21.0 + 1.21.1-SNAPSHOT camunda-bpm-jgiven-examples diff --git a/extension/pom.xml b/extension/pom.xml index f5c3a22..1539001 100644 --- a/extension/pom.xml +++ b/extension/pom.xml @@ -6,7 +6,7 @@ io.holunda.testing camunda-bpm-jgiven-parent - 1.21.0 + 1.21.1-SNAPSHOT camunda-bpm-jgiven diff --git a/pom.xml b/pom.xml index b190172..c09dc95 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ io.holunda.testing camunda-bpm-jgiven-parent - 1.21.0 + 1.21.1-SNAPSHOT pom From 1669a954a13d414177f58815badc353df4108651 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 23:08:54 +0000 Subject: [PATCH 02/25] Bump org.assertj:assertj-core from 3.26.0 to 3.26.3 Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.26.0 to 3.26.3. - [Release notes](https://github.com/assertj/assertj/releases) - [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.26.0...assertj-build-3.26.3) --- updated-dependencies: - dependency-name: org.assertj:assertj-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c09dc95..54a9e28 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ 7.21.0 1.3.1 - 3.26.0 + 3.26.3 1.3.1.0 17 From d5cc0f500a3a9ae469fdd0e28bab745d8ec1afbb Mon Sep 17 00:00:00 2001 From: Simon Zambrovski Date: Wed, 10 Jul 2024 17:04:51 +0200 Subject: [PATCH 03/25] adding new step functions, fix #278, fix #276, fix #275 --- .../examples/basic/ApprovalProcessBean.kt | 3 +- .../src/main/resources/approval.bpmn | 86 ++++++++--- .../basic/junit5/ApprovalProcessTest.kt | 106 ++++++++++---- .../ActivityTrackingExternalTaskWorker.kt | 29 ++++ .../bpm/extension/jgiven/ProcessStage.kt | 133 ++++++++++++++++++ .../jgiven/SelfUpdatingInstanceSupplier.kt | 26 ++++ 6 files changed, 332 insertions(+), 51 deletions(-) create mode 100644 extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ActivityTrackingExternalTaskWorker.kt create mode 100644 extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/SelfUpdatingInstanceSupplier.kt diff --git a/examples/basic-junit5/src/main/kotlin/io/holunda/testing/examples/basic/ApprovalProcessBean.kt b/examples/basic-junit5/src/main/kotlin/io/holunda/testing/examples/basic/ApprovalProcessBean.kt index 3b8a834..7f1c1dd 100644 --- a/examples/basic-junit5/src/main/kotlin/io/holunda/testing/examples/basic/ApprovalProcessBean.kt +++ b/examples/basic-junit5/src/main/kotlin/io/holunda/testing/examples/basic/ApprovalProcessBean.kt @@ -31,6 +31,7 @@ class ApprovalProcessBean( const val USER_APPROVE_REQUEST = "user_approve_request" const val USER_AMEND_REQUEST = "user_amend_request" const val SERVICE_AUTO_APPROVE = "service_auto_approve_request" + const val EXTERNAL_INFORM_REJECTION = "external_inform_rejection" } /** @@ -40,7 +41,7 @@ class ApprovalProcessBean( const val APPROVAL_REQUEST_ID = "approvalRequestId" const val APPROVAL_STRATEGY = "approvalStrategy" const val APPROVAL_DECISION = "approvalDecision" - const val AMEND_ACTION = "ammendAction" + const val AMEND_ACTION = "amendAction" const val ORIGINATOR = "originator" } diff --git a/examples/basic-junit5/src/main/resources/approval.bpmn b/examples/basic-junit5/src/main/resources/approval.bpmn index 18b6b67..6d3cd76 100644 --- a/examples/basic-junit5/src/main/resources/approval.bpmn +++ b/examples/basic-junit5/src/main/resources/approval.bpmn @@ -1,5 +1,5 @@ - + flow1 @@ -39,9 +39,9 @@ ${approvalDecision == "APPROVE"} - SequenceFlow_1i81jsh + Flow_0ic9b46 - + ${approvalDecision == "REJECT"} @@ -113,6 +113,23 @@ PT5D + + + SequenceFlow_1i81jsh + Flow_0ic9b46 + + + async after + + + + async after + + + + async after + + @@ -141,18 +158,6 @@ - - - - - - - - - - - - @@ -186,6 +191,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -230,17 +262,17 @@ - + - + - + - + @@ -308,6 +340,22 @@ + + + + + + + + + + + + + + + + diff --git a/examples/basic-junit5/src/test/kotlin/io/holunda/testing/examples/basic/junit5/ApprovalProcessTest.kt b/examples/basic-junit5/src/test/kotlin/io/holunda/testing/examples/basic/junit5/ApprovalProcessTest.kt index ebc2a37..9040ccc 100644 --- a/examples/basic-junit5/src/test/kotlin/io/holunda/testing/examples/basic/junit5/ApprovalProcessTest.kt +++ b/examples/basic-junit5/src/test/kotlin/io/holunda/testing/examples/basic/junit5/ApprovalProcessTest.kt @@ -2,15 +2,18 @@ package io.holunda.testing.examples.basic.junit5 import com.tngtech.jgiven.annotation.ScenarioState import com.tngtech.jgiven.junit5.ScenarioTest +import io.holunda.camunda.bpm.extension.jgiven.ActivityTrackingExternalTaskWorker import io.holunda.testing.examples.basic.ApprovalProcessBean import io.holunda.testing.examples.basic.ApprovalProcessBean.Elements import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions +import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.ApprovalDecision.APPROVE +import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.ApprovalDecision.REJECT +import io.holunda.testing.examples.basic.ApprovalProcessBean.Variables.APPROVAL_DECISION import io.toolisticon.testing.jgiven.AND import io.toolisticon.testing.jgiven.GIVEN import io.toolisticon.testing.jgiven.THEN import io.toolisticon.testing.jgiven.WHEN import org.assertj.core.api.Assertions.assertThat -import org.camunda.bpm.engine.externaltask.LockedExternalTask import org.camunda.bpm.engine.test.Deployment import org.camunda.bpm.engine.variable.Variables.putValue import org.junit.jupiter.api.Test @@ -31,6 +34,8 @@ internal class ApprovalProcessTest : @ScenarioState val camunda = extension.processEngine + private val ppi = ApprovalProcessBean(camunda) + @Test fun `should deploy`() { THEN @@ -82,6 +87,15 @@ internal class ApprovalProcessTest : GIVEN .process_is_deployed(ApprovalProcessBean.KEY) .AND + .using_process_instance_starter { + ppi.let { + it.start(approvalRequestId) + it.processInstance + } + } + .AND + .using_process_instance_supplier { _ -> ppi } + .AND .process_is_started_for_request(approvalRequestId) .AND .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC) @@ -89,37 +103,25 @@ internal class ApprovalProcessTest : .process_continues() WHEN - .automatic_approval_returns(Expressions.ApprovalDecision.APPROVE) + .automatic_approval_returns(APPROVE) THEN - .process_is_finished() + .process_is_finished(Elements.END_APPROVED) .AND - .process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_APPROVED) + .process_has_passed(Elements.SERVICE_AUTO_APPROVE) + .AND + .variable_was_set(APPROVAL_DECISION, APPROVE) } @Test fun `should automatic approve with custom worker`() { - // this is our custom worker that is called directly. It will track the activities it was called for. - class DummyWorker( - val workerName: String, - val topicName: String, - val activities: MutableList = mutableListOf() - ) : (LockedExternalTask) -> Unit { - override fun invoke(task: LockedExternalTask) { - camunda.externalTaskService.complete( - task.id, - workerName, - putValue(ApprovalProcessBean.Variables.APPROVAL_DECISION, Expressions.ApprovalDecision.APPROVE) - ) - activities.add(task.activityId) - } - - - } - - val worker = DummyWorker(workerName = "dummyWorker", topicName = "approve-request") + val worker = ActivityTrackingExternalTaskWorker( + externalTaskService = camunda.externalTaskService, + topicName = "approve-request", + variablesToSet = putValue(APPROVAL_DECISION, APPROVE) + ) val approvalRequestId = UUID.randomUUID().toString() @@ -168,13 +170,14 @@ internal class ApprovalProcessTest : .process_continues() WHEN - .automatic_approval_returns(Expressions.ApprovalDecision.REJECT) + .automatic_approval_returns(REJECT) THEN - .process_is_finished() + .process_has_passed(Elements.SERVICE_AUTO_APPROVE) .AND - .process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_REJECTED) - + .process_waits_in_external_task(Elements.EXTERNAL_INFORM_REJECTION) + .AND + .external_task_exists("inform-about-rejection") } @Test @@ -199,17 +202,58 @@ internal class ApprovalProcessTest : WHEN .task_is_completed_with_variables( - putValue(ApprovalProcessBean.Variables.APPROVAL_DECISION, Expressions.ApprovalDecision.REJECT), + putValue(APPROVAL_DECISION, REJECT), isAsyncAfter = true ) THEN - .process_is_finished() + .process_has_passed(Elements.USER_APPROVE_REQUEST) + .AND + .process_waits_in_external_task(Elements.EXTERNAL_INFORM_REJECTION) .AND - .process_has_passed(Elements.END_REJECTED) + .external_task_exists("inform-about-rejection") } + @Test + fun `should inform about rejection`() { + val worker = ActivityTrackingExternalTaskWorker( + externalTaskService = camunda.externalTaskService, + topicName = "inform-about-rejection" + ) + val approvalRequestId = UUID.randomUUID().toString() + + GIVEN + .process_is_deployed(ApprovalProcessBean.KEY) + .AND + .process_is_started_for_request(approvalRequestId) + .AND + .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC) + .AND + .process_continues() + .AND + .automatic_approval_returns(REJECT) + .AND + .process_has_passed(Elements.SERVICE_AUTO_APPROVE) + .AND + .process_waits_in_external_task(Elements.EXTERNAL_INFORM_REJECTION) + .AND + .external_task_exists("inform-about-rejection") + + WHEN + .external_task_is_completed_by_worker( + workerName = worker.workerName, + topicName = worker.topicName, + isAsyncAfter = true, + worker = worker + ) + + THEN + .process_is_finished(Elements.END_REJECTED) + .AND + .variable_was_set(APPROVAL_DECISION, REJECT) + } + @Test fun `should manually approve`() { @@ -228,7 +272,7 @@ internal class ApprovalProcessTest : WHEN .task_is_completed_with_variables( - putValue(ApprovalProcessBean.Variables.APPROVAL_DECISION, Expressions.ApprovalDecision.APPROVE), + putValue(APPROVAL_DECISION, APPROVE), isAsyncAfter = true ) diff --git a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ActivityTrackingExternalTaskWorker.kt b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ActivityTrackingExternalTaskWorker.kt new file mode 100644 index 0000000..8bf8001 --- /dev/null +++ b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ActivityTrackingExternalTaskWorker.kt @@ -0,0 +1,29 @@ +package io.holunda.camunda.bpm.extension.jgiven + +import org.camunda.bpm.engine.ExternalTaskService +import org.camunda.bpm.engine.externaltask.LockedExternalTask +import org.camunda.bpm.engine.variable.VariableMap +import org.camunda.bpm.engine.variable.Variables + +/** + * Custom worker that is called directly. It will track the activities it was called for. + */ +class ActivityTrackingExternalTaskWorker( + val externalTaskService: ExternalTaskService, + val workerName: String = "dummy", + val topicName: String, + val activities: MutableList = mutableListOf(), + val variablesToSet: VariableMap = Variables.createVariables() +) : (LockedExternalTask) -> Unit { + + override fun invoke(task: LockedExternalTask) { + if (task.topicName == topicName) { + externalTaskService.complete( + task.id, + workerName, + variablesToSet + ) + activities.add(task.activityId) + } + } +} diff --git a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt index b48c457..0126bd1 100644 --- a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt +++ b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt @@ -19,6 +19,7 @@ import org.camunda.bpm.engine.variable.Variables.createVariables import java.time.Period import java.time.temporal.ChronoUnit import java.util.* +import java.util.function.Function import java.util.function.Supplier /** @@ -70,6 +71,46 @@ class ProcessStage, PROCESS_BEAN : Suppl @ScenarioState lateinit var processInstanceSupplier: PROCESS_BEAN + /** + * Process instance supplier builder. + */ + @ScenarioState + lateinit var processInstanceSupplierBuilder: Function + + /** + * Starts process instance. + */ + @ScenarioState + lateinit var processInstanceStarter: Supplier + + /** + * Flag controlling if the process instance should be automatically re-loaded after job execution. + */ + var updateInstanceAutomatically: Boolean = false + + @As("using process instance supplier") + fun using_process_instance_supplier(processInstanceSupplierBuilder: Function): SELF = step { + this.processInstanceSupplierBuilder = processInstanceSupplierBuilder + } + + @As("using process instance starter") + fun using_process_instance_starter(processInstanceStarter: Supplier): SELF = step { + this.processInstanceStarter = processInstanceStarter + } + + @As("process_is_started") + fun process_is_started() : SELF = step { + assertProcessInstanceStarter() + assertProcessInstanceSupplierBuilder() + val instance = this.processInstanceStarter.get() + assertThat(instance).isStarted + processInstanceSupplier = processInstanceSupplierBuilder.apply(instance) + } + + fun updating_instance_automatically(flag: Boolean): SELF = step { + this.updateInstanceAutomatically = flag + } + /** * Checks if the process instance is waiting in a activity with specified id. * @param activityId definition id. @@ -80,6 +121,21 @@ class ProcessStage, PROCESS_BEAN : Suppl assertThat(processInstanceSupplier.get()).isWaitingAt(activityId) } + /** + * Asserts that the process waits in external task. + * @param activityId activity id of the external task. + * @return fluent stage. + */ + @As("process waits in external task \$activityId") + fun process_waits_in_external_task(@Quoted activityId: String): SELF = step { + val externalTasks = camunda + .externalTaskService + .createExternalTaskQuery() + .list() + .filter { task -> task.activityId == activityId && task.processInstanceId == processInstanceSupplier.get().processInstanceId } + assertThat(externalTasks).isNotEmpty + } + /** * Checks if the process instance is _not_ waiting in an activity with specified id. * @param activityId definition id. @@ -167,6 +223,17 @@ class ProcessStage, PROCESS_BEAN : Suppl assertThat(processInstanceSupplier.get()).isEnded } + /** + * Asserts that the process is finished in specified end event. + * @param activityId id of the end event. + * @return fluent stage. + */ + @NestedSteps + fun process_is_finished(@Quoted activityId: String): SELF = step { + process_is_finished() + process_has_passed(activityId) + } + /** * Asserts that the process has passed in order elements. * @param elements element definition ids. @@ -303,6 +370,22 @@ class ProcessStage, PROCESS_BEAN : Suppl assertThat(processInstanceSupplier.get()).variables().containsEntry(variableName, value) } + /** + * Asserts that variable was set on a historic instance. + * @param variableName name of the variable. + * @param value value of the variable. + * @return fluent stage. + */ + @As("variable \$variableName was set to \$value") + fun variable_was_set(@Quoted variableName: String, @Quoted value: Any): SELF = step { + val historicVariables = camunda.historyService.createHistoricVariableInstanceQuery().list() + assertThat(historicVariables.any { variable -> + variable.processInstanceId == processInstanceSupplier.get().processInstanceId + && variable.name == variableName + && variable.value == value + }).`as`("Could not find historic variable $variableName").isTrue() + } + /** * Asserts that variable is not set. * @param variableName name of the variable. @@ -359,6 +442,29 @@ class ProcessStage, PROCESS_BEAN : Suppl } } + /** + * Completes a task with variables and continues if the task is marked as async-after. + * @param variables optional map with variables + * @param isAsyncAfter if true expects that the task is marked as async-after and continues the execution + * after completion. Defaults to false. + * @return fluent stage. + */ + @As("task $ is completed with variables $") + fun task_is_completed_with_variables( + @Quoted taskDefinitionKey: String, + @VariableMapFormat variables: VariableMap = createVariables(), + @Hidden isAsyncAfter: Boolean = false + ): SELF = step { + assertThat(task()).hasDefinitionKey(taskDefinitionKey) + taskService().complete(task().id, variables) + if (isAsyncAfter) { + assertThat(processInstanceSupplier.get()) + .`as`("Expecting the task $taskDefinitionKey to be marked as async after and continue on complete.") + .isWaitingAt(taskDefinitionKey) + job_is_executed(taskDefinitionKey) + } + } + /** * No op. * @return fluent stage. @@ -375,6 +481,7 @@ class ProcessStage, PROCESS_BEAN : Suppl fun job_is_executed(): SELF = step { assertThat(processInstanceSupplier.get()).isNotNull execute(job()) + handleAutomaticInstanceUpdate() } /** @@ -388,9 +495,11 @@ class ProcessStage, PROCESS_BEAN : Suppl val job = job(it) assertThat(job).`as`("Expecting the process to be waiting in activity '$it', but it was not.").isNotNull execute(job) + handleAutomaticInstanceUpdate() } } + /** * Asserts that the instance is waiting for the timer to be executed on the expected time. * @param timerActivityId activity id of the timer. @@ -572,4 +681,28 @@ class ProcessStage, PROCESS_BEAN : Suppl ): (LockedExternalTask) -> Unit = { externalTaskService.complete(it.id, workerName, variables) } + + internal fun handleAutomaticInstanceUpdate() { + if (this.updateInstanceAutomatically) { + assertProcessInstanceSupplierBuilder() + assertThat(processInstanceSupplier.get()).isNotNull + val instances = camunda.runtimeService.createProcessInstanceQuery().active() + .processInstanceId(processInstanceSupplier.get().processInstanceId).list() + if (instances.isNotEmpty()) { + this.processInstanceSupplier = processInstanceSupplierBuilder.apply(instances.first()) + } + } + } + + internal fun assertProcessInstanceSupplierBuilder() { + assertThat(this::processInstanceSupplierBuilder.isInitialized) + .`as`("Process instance supplier builder is not initialized. Please pass the initialization function using ${this::using_process_instance_supplier.name} step.") + .isTrue() + } + + internal fun assertProcessInstanceStarter() { + assertThat(this::processInstanceStarter.isInitialized) + .`as`("Process instance starter is not initialized. Please pass the initialization function using ${this::using_process_instance_starter.name} step.") + .isTrue() + } } diff --git a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/SelfUpdatingInstanceSupplier.kt b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/SelfUpdatingInstanceSupplier.kt new file mode 100644 index 0000000..2aaacc4 --- /dev/null +++ b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/SelfUpdatingInstanceSupplier.kt @@ -0,0 +1,26 @@ +package io.holunda.camunda.bpm.extension.jgiven + +import org.camunda.bpm.engine.RuntimeService +import org.camunda.bpm.engine.runtime.ProcessInstance +import java.util.function.Supplier + +/** + * Implementation holding one process instance id and loading it from runtime service on every request. + * This class is intended to be subclassed. + */ +open class SelfUpdatingInstanceSupplier( + protected val processInstanceId: String, + protected val runtimeService: RuntimeService +) : Supplier { + + /** + * Retrieves the process instance. + */ + override fun get(): ProcessInstance { + val instances = runtimeService.createProcessInstanceQuery().active().processInstanceId(processInstanceId).list() + return when (instances.size) { + 1 -> instances.first() + else -> throw IllegalArgumentException("Could not find process instance with id: $processInstanceId.") + } + } +} From 44ee8611b8a3be415ce356b862274eb1d087a8ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 23:42:52 +0000 Subject: [PATCH 04/25] Bump org.apache.maven.plugins:maven-surefire-plugin from 3.3.0 to 3.3.1 Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.0...surefire-3.3.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 54a9e28..ab6488c 100644 --- a/pom.xml +++ b/pom.xml @@ -183,7 +183,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.3.0 + 3.3.1 From 2b3c0fe3a2e50069b0f16030db0f98d439c8e647 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 23:42:55 +0000 Subject: [PATCH 05/25] Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.3.0 to 3.3.1 Bumps [org.apache.maven.plugins:maven-failsafe-plugin](https://github.com/apache/maven-surefire) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.0...surefire-3.3.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-failsafe-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 54a9e28..4c2a738 100644 --- a/pom.xml +++ b/pom.xml @@ -189,7 +189,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.3.0 + 3.3.1 From e03b6b7330c8902b4289a5fe8b3503a30b6fc4a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 23:37:20 +0000 Subject: [PATCH 06/25] Bump kotlin.version from 2.0.0 to 2.0.10 Bumps `kotlin.version` from 2.0.0 to 2.0.10. Updates `org.jetbrains.kotlin:kotlin-bom` from 2.0.0 to 2.0.10 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/compare/v2.0.0...v2.0.10) Updates `org.jetbrains.kotlin:kotlin-maven-allopen` from 2.0.0 to 2.0.10 Updates `org.jetbrains.kotlin:kotlin-maven-noarg` from 2.0.0 to 2.0.10 Updates `org.jetbrains.kotlin:kotlin-maven-plugin` from 2.0.0 to 2.0.10 --- updated-dependencies: - dependency-name: org.jetbrains.kotlin:kotlin-bom dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-maven-allopen dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-maven-noarg dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ee008bd..3796edc 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.3.1.0 17 - 2.0.0 + 2.0.10 true ${java.version} ${java.version} From dc3ed3077874e63cf2dafceddb9f670c4108fbee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 23:13:58 +0000 Subject: [PATCH 07/25] Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.4 to 3.2.5 Bumps [org.apache.maven.plugins:maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 3.2.4 to 3.2.5. - [Release notes](https://github.com/apache/maven-gpg-plugin/releases) - [Commits](https://github.com/apache/maven-gpg-plugin/compare/maven-gpg-plugin-3.2.4...maven-gpg-plugin-3.2.5) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-gpg-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3796edc..ff91286 100644 --- a/pom.xml +++ b/pom.xml @@ -358,7 +358,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.4 + 3.2.5 --batch From 2ae6d7b2c8891e5de4aa8cf0c4b7f7fcfc8af08a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 23:27:04 +0000 Subject: [PATCH 08/25] Bump org.apache.maven.plugins:maven-install-plugin from 3.1.2 to 3.1.3 Bumps [org.apache.maven.plugins:maven-install-plugin](https://github.com/apache/maven-install-plugin) from 3.1.2 to 3.1.3. - [Release notes](https://github.com/apache/maven-install-plugin/releases) - [Commits](https://github.com/apache/maven-install-plugin/compare/maven-install-plugin-3.1.2...maven-install-plugin-3.1.3) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-install-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ff91286..cb4f637 100644 --- a/pom.xml +++ b/pom.xml @@ -409,7 +409,7 @@ maven-install-plugin - 3.1.2 + 3.1.3 From 362ab34f2ad89c3fa27d050363f937f2864b962e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 23:27:12 +0000 Subject: [PATCH 09/25] Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.2 to 3.1.3 Bumps [org.apache.maven.plugins:maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin) from 3.1.2 to 3.1.3. - [Release notes](https://github.com/apache/maven-deploy-plugin/releases) - [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-3.1.2...maven-deploy-plugin-3.1.3) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-deploy-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ff91286..c640bc9 100644 --- a/pom.xml +++ b/pom.xml @@ -381,7 +381,7 @@ maven-deploy-plugin - 3.1.2 + 3.1.3 true From d6438bc54ff0bb58d2b0cc234b9b6aba261d4e62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:58:57 +0000 Subject: [PATCH 10/25] Bump kotlin.version from 2.0.10 to 2.0.20 Bumps `kotlin.version` from 2.0.10 to 2.0.20. Updates `org.jetbrains.kotlin:kotlin-bom` from 2.0.10 to 2.0.20 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/v2.0.20/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/compare/v2.0.10...v2.0.20) Updates `org.jetbrains.kotlin:kotlin-maven-allopen` from 2.0.10 to 2.0.20 Updates `org.jetbrains.kotlin:kotlin-maven-noarg` from 2.0.10 to 2.0.20 Updates `org.jetbrains.kotlin:kotlin-maven-plugin` from 2.0.10 to 2.0.20 --- updated-dependencies: - dependency-name: org.jetbrains.kotlin:kotlin-bom dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-maven-allopen dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-maven-noarg dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ff91286..d5b7aef 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.3.1.0 17 - 2.0.10 + 2.0.20 true ${java.version} ${java.version} From 0e46600d8c621d3d110f918acf9b22956af8dcf7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:59:04 +0000 Subject: [PATCH 11/25] Bump spring-boot.version from 3.2.5 to 3.3.3 Bumps `spring-boot.version` from 3.2.5 to 3.3.3. Updates `org.springframework.boot:spring-boot-dependencies` from 3.2.5 to 3.3.3 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.2.5...v3.3.3) Updates `org.springframework.boot:spring-boot-maven-plugin` from 3.2.5 to 3.3.3 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.2.5...v3.3.3) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-dependencies dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.springframework.boot:spring-boot-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- examples/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pom.xml b/examples/pom.xml index 467f804..f9bf939 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -13,7 +13,7 @@ pom - 3.2.5 + 3.3.3 2.6.0 7.21.0 4.13.2 From 70e20a4fbde9fe7a3585b554a867dd511b00e1a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:41:34 +0000 Subject: [PATCH 12/25] Bump camunda-process-test-coverage.version from 2.6.0 to 2.7.0 Bumps `camunda-process-test-coverage.version` from 2.6.0 to 2.7.0. Updates `org.camunda.community.process_test_coverage:camunda-process-test-coverage-junit4-platform-7` from 2.6.0 to 2.7.0 Updates `org.camunda.community.process_test_coverage:camunda-process-test-coverage-junit5-platform-7` from 2.6.0 to 2.7.0 --- updated-dependencies: - dependency-name: org.camunda.community.process_test_coverage:camunda-process-test-coverage-junit4-platform-7 dependency-type: direct:development update-type: version-update:semver-minor - dependency-name: org.camunda.community.process_test_coverage:camunda-process-test-coverage-junit5-platform-7 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- examples/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pom.xml b/examples/pom.xml index f9bf939..ef540cd 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -14,7 +14,7 @@ 3.3.3 - 2.6.0 + 2.7.0 7.21.0 4.13.2 From 442eab88698a87817daa4b4c9a9624bcfdca9466 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 23:35:55 +0000 Subject: [PATCH 13/25] Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.3.1 to 3.5.0 Bumps [org.apache.maven.plugins:maven-failsafe-plugin](https://github.com/apache/maven-surefire) from 3.3.1 to 3.5.0. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.1...surefire-3.5.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-failsafe-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d5b7aef..70cd5b0 100644 --- a/pom.xml +++ b/pom.xml @@ -189,7 +189,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.3.1 + 3.5.0 From 04b4db2a1885ef868b559a1ae08559c06cd128ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 23:36:01 +0000 Subject: [PATCH 14/25] Bump org.apache.maven.plugins:maven-surefire-plugin from 3.3.1 to 3.5.0 Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.3.1 to 3.5.0. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.3.1...surefire-3.5.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d5b7aef..1f350b4 100644 --- a/pom.xml +++ b/pom.xml @@ -183,7 +183,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.3.1 + 3.5.0 From a5aa80511ff3f867b13a2d42d3ee783d076d5a04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:41:07 +0000 Subject: [PATCH 15/25] Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.5 to 3.2.6 Bumps [org.apache.maven.plugins:maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 3.2.5 to 3.2.6. - [Release notes](https://github.com/apache/maven-gpg-plugin/releases) - [Commits](https://github.com/apache/maven-gpg-plugin/compare/maven-gpg-plugin-3.2.5...maven-gpg-plugin-3.2.6) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-gpg-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d4c9cf5..6e15942 100644 --- a/pom.xml +++ b/pom.xml @@ -358,7 +358,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.5 + 3.2.6 --batch From 501ef9a1677de3cd18446309216c7e9cce006d24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 23:35:54 +0000 Subject: [PATCH 16/25] Bump spring-boot.version from 3.3.3 to 3.3.4 Bumps `spring-boot.version` from 3.3.3 to 3.3.4. Updates `org.springframework.boot:spring-boot-dependencies` from 3.3.3 to 3.3.4 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.3...v3.3.4) Updates `org.springframework.boot:spring-boot-maven-plugin` from 3.3.3 to 3.3.4 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.3...v3.3.4) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-dependencies dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.springframework.boot:spring-boot-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- examples/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pom.xml b/examples/pom.xml index f9bf939..ce569a1 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -13,7 +13,7 @@ pom - 3.3.3 + 3.3.4 2.6.0 7.21.0 4.13.2 From 3c3617d551af94105415e31b600f1d72499caf2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Sep 2024 23:50:27 +0000 Subject: [PATCH 17/25] Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.6 to 3.2.7 Bumps [org.apache.maven.plugins:maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 3.2.6 to 3.2.7. - [Release notes](https://github.com/apache/maven-gpg-plugin/releases) - [Commits](https://github.com/apache/maven-gpg-plugin/compare/maven-gpg-plugin-3.2.6...maven-gpg-plugin-3.2.7) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-gpg-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6e15942..63f7172 100644 --- a/pom.xml +++ b/pom.xml @@ -358,7 +358,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.6 + 3.2.7 --batch From 09588795ce64245ac7636d2d9797f9b6a8274038 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 23:50:06 +0000 Subject: [PATCH 18/25] Bump org.apache.maven.plugins:maven-surefire-plugin from 3.5.0 to 3.5.1 Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.5.0 to 3.5.1. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.5.0...surefire-3.5.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 63f7172..3128a31 100644 --- a/pom.xml +++ b/pom.xml @@ -183,7 +183,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.0 + 3.5.1 From 59920f73f47c2fded305e9d4ab77346009dd3a6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 23:50:15 +0000 Subject: [PATCH 19/25] Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.5.0 to 3.5.1 Bumps [org.apache.maven.plugins:maven-failsafe-plugin](https://github.com/apache/maven-surefire) from 3.5.0 to 3.5.1. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.5.0...surefire-3.5.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-failsafe-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 63f7172..b664c2f 100644 --- a/pom.xml +++ b/pom.xml @@ -189,7 +189,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.5.0 + 3.5.1 From 5021951e6affd1cd48f865311d08562d380052b9 Mon Sep 17 00:00:00 2001 From: Simon Zambrovski Date: Tue, 8 Oct 2024 09:52:12 +0200 Subject: [PATCH 20/25] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8202de0..8febe73 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Camunda specific stages and scenarios for the BDD testing tool JGiven written in Kotlin. [![stable](https://img.shields.io/badge/lifecycle-STABLE-green.svg)](https://github.com/holisticon#open-source-lifecycle) -[![Camunda 7.20](https://img.shields.io/badge/Camunda%20Version-7.20-orange.svg)]([https://github.com/holisticon#open-source-lifecycle](https://docs.camunda.org/manual/7.20/)) +[![Camunda 7.21](https://img.shields.io/badge/Camunda%20Version-7.21-orange.svg)]([https://github.com/holisticon#open-source-lifecycle](https://docs.camunda.org/manual/7.21/)) [![Development braches](https://github.com/holunda-io/camunda-bpm-jgiven/workflows/Development%20braches/badge.svg)](https://github.com/holunda-io/camunda-bpm-jgiven/workflows) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.holunda.testing/camunda-bpm-jgiven/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.holunda.testing/camunda-bpm-jgiven) @@ -29,7 +29,7 @@ Add the following dependency to your Maven pom: io.holunda.testing camunda-bpm-jgiven - 1.20.0 + 1.21.0 test ``` From 948195aa4346b05a661b0cdab8c8f44cb75ea947 Mon Sep 17 00:00:00 2001 From: Simon Zambrovski Date: Tue, 8 Oct 2024 11:48:09 +0200 Subject: [PATCH 21/25] integrate comments --- .../jgiven/SelfUpdatingInstanceSupplier.kt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/SelfUpdatingInstanceSupplier.kt b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/SelfUpdatingInstanceSupplier.kt index 2aaacc4..68004f7 100644 --- a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/SelfUpdatingInstanceSupplier.kt +++ b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/SelfUpdatingInstanceSupplier.kt @@ -10,17 +10,25 @@ import java.util.function.Supplier */ open class SelfUpdatingInstanceSupplier( protected val processInstanceId: String, - protected val runtimeService: RuntimeService + protected val runtimeService: RuntimeService, + private var lastSeenInstance: ProcessInstance? = null ) : Supplier { /** * Retrieves the process instance. */ override fun get(): ProcessInstance { - val instances = runtimeService.createProcessInstanceQuery().active().processInstanceId(processInstanceId).list() - return when (instances.size) { - 1 -> instances.first() - else -> throw IllegalArgumentException("Could not find process instance with id: $processInstanceId.") + val instance: ProcessInstance? = runtimeService + .createProcessInstanceQuery() + .active() + .processInstanceId(processInstanceId) + .singleResult() + + if (instance != null) { + this.lastSeenInstance = instance } + + return this.lastSeenInstance + ?: throw IllegalArgumentException("Could not find process instance with id: $processInstanceId.") } } From fd7a97c38c710c21514a5acb8771968409b8e4fc Mon Sep 17 00:00:00 2001 From: Simon Zambrovski Date: Tue, 8 Oct 2024 12:02:00 +0200 Subject: [PATCH 22/25] improve GH actions, add some comments --- .github/dependabot.yml | 19 ++++++++++++------- .github/workflows/default.yml | 6 +++--- .github/workflows/master.yml | 8 ++++---- .../bpm/extension/jgiven/ProcessStage.kt | 17 ++++++++++++++++- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0ad7235..ab6648b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,15 @@ version: 2 updates: -- package-ecosystem: maven - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 10 - default-labels: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 19 + labels: + - "Type: dependencies" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + labels: - "Type: dependencies" - diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index c4ef2a8..b22eb21 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -13,10 +13,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 17 distribution: zulu @@ -26,7 +26,7 @@ jobs: run: chmod +x ./mvnw - name: Build with Maven - run: ./mvnw clean verify -U -B -T4 + run: ./mvnw clean verify -U -B -T4 -ntp # - name: Upload test coverage to Codacy # if: github.event_name == 'push' && github.actor != 'dependabot[bot]' diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index d536eab..5f31489 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Get GPG private key into GPG - name: Import GPG Owner Trust @@ -21,7 +21,7 @@ jobs: # Setup JDK and Maven - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 17 distribution: zulu @@ -34,10 +34,10 @@ jobs: run: chmod +x ./mvnw - name: Build with Maven - run: ./mvnw clean verify -U -B -T4 + run: ./mvnw clean verify -U -B -T4 -ntp - name: Deploy a new version to central - run: ./mvnw clean deploy -B -DskipTests -DskipExamples -Prelease -Dgpg.keyname="${{secrets.GPG_KEYNAME}}" -Dgpg.passphrase="${{secrets.GPG_PASSPHRASE}}" + run: ./mvnw clean deploy -B -ntp -DskipTests -DskipExamples -Prelease -Dgpg.keyname="${{secrets.GPG_KEYNAME}}" -Dgpg.passphrase="${{secrets.GPG_PASSPHRASE}}" env: OSS_CENTRAL_USERNAME: "${{ secrets.SONATYPE_USERNAME }}" OSS_CENTRAL_PASSWORD: "${{ secrets.SONATYPE_PASSWORD }}" diff --git a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt index 0126bd1..3998920 100644 --- a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt +++ b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt @@ -88,16 +88,27 @@ class ProcessStage, PROCESS_BEAN : Suppl */ var updateInstanceAutomatically: Boolean = false + /** + * Creates the stage using process instance supplier builder: a function that is able to construct process bean out of process instance. + * @param processInstanceSupplierBuilder builder function. + */ @As("using process instance supplier") fun using_process_instance_supplier(processInstanceSupplierBuilder: Function): SELF = step { this.processInstanceSupplierBuilder = processInstanceSupplierBuilder } + /** + * Creates the stage using process instance starter. + * @param processInstanceStarter starter for the process instance. + */ @As("using process instance starter") fun using_process_instance_starter(processInstanceStarter: Supplier): SELF = step { this.processInstanceStarter = processInstanceStarter } + /** + * Process is started using the process instance starter. + */ @As("process_is_started") fun process_is_started() : SELF = step { assertProcessInstanceStarter() @@ -107,6 +118,10 @@ class ProcessStage, PROCESS_BEAN : Suppl processInstanceSupplier = processInstanceSupplierBuilder.apply(instance) } + /** + * Fluent builder to update instance rebuilding the process instance supplier each time. + * @param flag if true, the process instance supplier will be constructed each time using the process instance supplier builder. + */ fun updating_instance_automatically(flag: Boolean): SELF = step { this.updateInstanceAutomatically = flag } @@ -284,7 +299,7 @@ class ProcessStage, PROCESS_BEAN : Suppl } /** - * Asserts the task task has a follow-up date + * Asserts the task has a follow-up date * @param followUpDatePeriod period calculated from creation. * @return fluent stage. */ From 3f1701c5f1829fd0a4ff11769c8fb0d8b5cc1c46 Mon Sep 17 00:00:00 2001 From: Simon Zambrovski Date: Tue, 8 Oct 2024 12:09:49 +0200 Subject: [PATCH 23/25] kill some warnings from codacy --- .../testing/examples/basic/ApprovalProcessBean.kt | 3 +++ .../examples/basic/junit5/ApprovalProcessTest.kt | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/basic-junit5/src/main/kotlin/io/holunda/testing/examples/basic/ApprovalProcessBean.kt b/examples/basic-junit5/src/main/kotlin/io/holunda/testing/examples/basic/ApprovalProcessBean.kt index 7f1c1dd..e107216 100644 --- a/examples/basic-junit5/src/main/kotlin/io/holunda/testing/examples/basic/ApprovalProcessBean.kt +++ b/examples/basic-junit5/src/main/kotlin/io/holunda/testing/examples/basic/ApprovalProcessBean.kt @@ -55,6 +55,9 @@ class ApprovalProcessBean( const val AUTOMATIC_APPROVAL_FAILED = "automaticApprovalFailed" const val APPROVE_REQUEST_TASK_LISTENER = "approveRequestTaskListener" + const val TOPIC_APPROVE_REQUEST = "approve-request" + const val TOPIC_INFORM_ABOUT_REJECTION = "inform-about-rejection" + /** * Values for approval strategy. */ diff --git a/examples/basic-junit5/src/test/kotlin/io/holunda/testing/examples/basic/junit5/ApprovalProcessTest.kt b/examples/basic-junit5/src/test/kotlin/io/holunda/testing/examples/basic/junit5/ApprovalProcessTest.kt index 9040ccc..e251821 100644 --- a/examples/basic-junit5/src/test/kotlin/io/holunda/testing/examples/basic/junit5/ApprovalProcessTest.kt +++ b/examples/basic-junit5/src/test/kotlin/io/holunda/testing/examples/basic/junit5/ApprovalProcessTest.kt @@ -8,6 +8,8 @@ import io.holunda.testing.examples.basic.ApprovalProcessBean.Elements import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.ApprovalDecision.APPROVE import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.ApprovalDecision.REJECT +import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.TOPIC_APPROVE_REQUEST +import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.TOPIC_INFORM_ABOUT_REJECTION import io.holunda.testing.examples.basic.ApprovalProcessBean.Variables.APPROVAL_DECISION import io.toolisticon.testing.jgiven.AND import io.toolisticon.testing.jgiven.GIVEN @@ -75,7 +77,7 @@ internal class ApprovalProcessTest : .AND .process_does_not_wait_in(Elements.USER_APPROVE_REQUEST) .AND - .external_task_exists("approve-request") + .external_task_exists(TOPIC_APPROVE_REQUEST) } @@ -119,7 +121,7 @@ internal class ApprovalProcessTest : val worker = ActivityTrackingExternalTaskWorker( externalTaskService = camunda.externalTaskService, - topicName = "approve-request", + topicName = TOPIC_APPROVE_REQUEST, variablesToSet = putValue(APPROVAL_DECISION, APPROVE) ) @@ -177,7 +179,7 @@ internal class ApprovalProcessTest : .AND .process_waits_in_external_task(Elements.EXTERNAL_INFORM_REJECTION) .AND - .external_task_exists("inform-about-rejection") + .external_task_exists(TOPIC_INFORM_ABOUT_REJECTION) } @Test @@ -211,7 +213,7 @@ internal class ApprovalProcessTest : .AND .process_waits_in_external_task(Elements.EXTERNAL_INFORM_REJECTION) .AND - .external_task_exists("inform-about-rejection") + .external_task_exists(TOPIC_INFORM_ABOUT_REJECTION) } @@ -219,7 +221,7 @@ internal class ApprovalProcessTest : fun `should inform about rejection`() { val worker = ActivityTrackingExternalTaskWorker( externalTaskService = camunda.externalTaskService, - topicName = "inform-about-rejection" + topicName = TOPIC_INFORM_ABOUT_REJECTION ) val approvalRequestId = UUID.randomUUID().toString() @@ -238,7 +240,7 @@ internal class ApprovalProcessTest : .AND .process_waits_in_external_task(Elements.EXTERNAL_INFORM_REJECTION) .AND - .external_task_exists("inform-about-rejection") + .external_task_exists(TOPIC_INFORM_ABOUT_REJECTION) WHEN .external_task_is_completed_by_worker( From 51b7b1b2db8d88b0706de64579511471ff564306 Mon Sep 17 00:00:00 2001 From: Simon Zambrovski Date: Tue, 8 Oct 2024 12:12:04 +0200 Subject: [PATCH 24/25] exclude trests from codacy --- .codacy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.codacy.yaml b/.codacy.yaml index 9d437b7..ec7afbd 100644 --- a/.codacy.yaml +++ b/.codacy.yaml @@ -6,4 +6,5 @@ engines: exclude_paths: - "README.md" - ".github/**" - - "docs/**" \ No newline at end of file + - "docs/**" + - "**/src/test/kotlin/**" From 04ac55391ca4aa924c50cbb323a5c9e03953cf1b Mon Sep 17 00:00:00 2001 From: Simon Zambrovski Date: Tue, 8 Oct 2024 12:23:21 +0200 Subject: [PATCH 25/25] Update for next development version --- examples/basic-junit4/pom.xml | 2 +- examples/basic-junit5/pom.xml | 2 +- examples/pom.xml | 2 +- extension/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/basic-junit4/pom.xml b/examples/basic-junit4/pom.xml index e649e6f..cbd0086 100644 --- a/examples/basic-junit4/pom.xml +++ b/examples/basic-junit4/pom.xml @@ -6,7 +6,7 @@ io.holunda.testing camunda-bpm-jgiven-examples - 1.21.1-SNAPSHOT + 1.21.1 camunda-bpm-jgiven-examples-basic-junit4 diff --git a/examples/basic-junit5/pom.xml b/examples/basic-junit5/pom.xml index c226196..142ceaa 100644 --- a/examples/basic-junit5/pom.xml +++ b/examples/basic-junit5/pom.xml @@ -6,7 +6,7 @@ io.holunda.testing camunda-bpm-jgiven-examples - 1.21.1-SNAPSHOT + 1.21.1 camunda-bpm-jgiven-examples-basic-junit5 diff --git a/examples/pom.xml b/examples/pom.xml index 8d93a17..c92cccb 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -6,7 +6,7 @@ io.holunda.testing camunda-bpm-jgiven-parent - 1.21.1-SNAPSHOT + 1.21.1 camunda-bpm-jgiven-examples diff --git a/extension/pom.xml b/extension/pom.xml index 1539001..28a7d42 100644 --- a/extension/pom.xml +++ b/extension/pom.xml @@ -6,7 +6,7 @@ io.holunda.testing camunda-bpm-jgiven-parent - 1.21.1-SNAPSHOT + 1.21.1 camunda-bpm-jgiven diff --git a/pom.xml b/pom.xml index c224f37..0d3eec5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ io.holunda.testing camunda-bpm-jgiven-parent - 1.21.1-SNAPSHOT + 1.21.1 pom