This is an automated email from the ASF dual-hosted git repository.
mweiler pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-runtimes.git
The following commit(s) were added to refs/heads/main by this push:
new 8cc40f1582 [kie-issue#2142]Extract Process Instance Migration(PIM) to
an independent addon (#4093)
8cc40f1582 is described below
commit 8cc40f1582e8ea893e0bc65a4e578ed87cc6c65b
Author: Christine-Jose <[email protected]>
AuthorDate: Fri Oct 17 20:21:25 2025 +0530
[kie-issue#2142]Extract Process Instance Migration(PIM) to an independent
addon (#4093)
* KIE-#2142:Extract Process PIM to an independent addon
* Correcting the pom.xml
* rebasing the latest changes
* updating the license info
* review comments
* Correcting testcase
* updating the addon name to process instance migration
* correcting the springboot pom.xml
---
.rat-excludes | 6 +
addons/common/kie-addons-process-migration/pom.xml | 39 +++++
addons/common/pom.xml | 1 +
addons/common/process-instance-migration/README.md | 120 ++++++++++++++
addons/common/process-instance-migration/pom.xml | 68 ++++++++
.../BaseProcessInstanceMigrationResource.java | 76 +++++++++
.../migration/ProcessInstanceMigration.java | 27 +++
.../process/migration/ProcessMigrationSpec.java | 43 +++++
...g.jbpm.flow.migration.MigrationPlanFileProvider | 20 +++
...org.jbpm.flow.migration.MigrationPlanFileReader | 20 +++
...serialization.ProcessInstanceMarshallerListener | 20 +++
.../BaseProcessInstanceManagementResource.java | 27 ---
.../management/ProcessInstanceManagement.java | 4 -
.../BaseProcessInstanceManagementResourceTest.java | 10 --
kogito-bom/pom.xml | 44 +++++
quarkus/addons/pom.xml | 1 +
.../process-instance-migration/deployment/pom.xml | 69 ++++++++
.../KogitoAddOnProcessMigrationProcessor.java | 40 +++++
.../integration-tests/pom.xml | 153 +++++++++++++++++
.../resources/META-INF/migration-plan/signal.mpf | 16 ++
.../src/main/resources/application.properties | 26 +++
.../src/main/resources/signal.bpmn | 110 +++++++++++++
.../src/main/resources/signal2.bpmn | 158 ++++++++++++++++++
.../quarkus/workflows/ProcessMigrationIT.java | 126 ++++++++++++++
quarkus/addons/process-instance-migration/pom.xml | 42 +++++
.../process-instance-migration/runtime/pom.xml | 129 +++++++++++++++
.../ProcessInstanceMigrationResource.java | 82 ++++++++++
.../runtime/src/main/resources/META-INF/beans.xml | 20 +++
.../src/main/resources/META-INF/kogito.addon | 1 +
.../main/resources/META-INF/quarkus-extension.yaml | 33 ++++
.../ProcessInstanceMigrationResourceTest.java | 181 +++++++++++++++++++++
.../runtime/src/test/resources/logback-test.xml | 38 +++++
.../ProcessInstanceManagementResource.java | 16 --
springboot/addons/pom.xml | 1 +
.../addons/process-instance-migration/pom.xml | 77 +++++++++
.../ProcessInstanceMigrationRestController.java | 70 ++++++++
.../src/main/resources/META-INF/kogito.addon | 1 +
...ProcessInstanceMigrationRestControllerTest.java | 120 ++++++++++++++
.../ProcessInstanceManagementRestController.java | 12 --
39 files changed, 1978 insertions(+), 69 deletions(-)
diff --git a/.rat-excludes b/.rat-excludes
index fccd4bcb0a..2cf2f14f2e 100644
--- a/.rat-excludes
+++ b/.rat-excludes
@@ -222,3 +222,9 @@ PMMLRegression.pmml
.gitignore
#
springboot/integration-tests/integration-tests-springboot-processes-persistence-it/integration-tests-springboot-processes-persistence-common/src/main/resources/transactional_error.bpmn
transactional_error.bpmn
+#
quarkus/addons/process-migration/integration-tests/src/main/resources/signal.bpmn
+signal.bpmn
+#
quarkus/addons/process-migration/integration-tests/src/main/resources/signal2.bpmn
+signal2.bpmn
+#
quarkus/addons/process-migration/integration-tests/src/main/resources/META-INF/migration-plan/signal.mpf
+signal.mpf
diff --git a/addons/common/kie-addons-process-migration/pom.xml
b/addons/common/kie-addons-process-migration/pom.xml
new file mode 100644
index 0000000000..b54e3dbac6
--- /dev/null
+++ b/addons/common/kie-addons-process-migration/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-common-parent</artifactId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>kie-addons-process-instance-migration</artifactId>
+
+ <properties>
+ <maven.compiler.source>21</maven.compiler.source>
+ <maven.compiler.target>21</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+</project>
\ No newline at end of file
diff --git a/addons/common/pom.xml b/addons/common/pom.xml
index 019b0c76ba..8d0a782507 100644
--- a/addons/common/pom.xml
+++ b/addons/common/pom.xml
@@ -41,6 +41,7 @@
<module>rest-exception-handler</module>
<module>process-svg</module>
<module>process-management</module>
+ <module>process-instance-migration</module>
<module>process-dynamic</module>
<module>knative</module>
<module>kubernetes</module>
diff --git a/addons/common/process-instance-migration/README.md
b/addons/common/process-instance-migration/README.md
new file mode 100644
index 0000000000..9994699785
--- /dev/null
+++ b/addons/common/process-instance-migration/README.md
@@ -0,0 +1,120 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+# KIE Process Instance Migration Add-on
+
+The KIE Process Instance Migration (PIM) Add-on adds functionality for
migrating active processes.This functionality is exposed through management
REST endpoints after adding the platform specific dependencies as specified
below.
+
+Following two endpoints can be used to migrate active process instances:
+
+1. Endpoint to migrate all active process instances of a given processId to a
new target process
+
+Endpoint : POST /management/processes/{processId}/migrate:
+
+Request body :
+
+```json
+{
+"targetProcessId": "<>",
+"targetProcessVersion": "<>"
+}
+```
+
+Input parameters:
+1. processId: source process identifier (path parameter)
+2. targetProcessId : target process identifier(query parameter)
+3. targetProcessVersion : target process version(query parameter)
+
+Output:
+
+ The response JSON Schema includes details of processInstanceId migrated to
new process:
+
+```json
+{
+"message": <>,
+"numberOfProcessInstanceMigrated": <>
+ }
+```
+Sample JSON Response :
+
+```json
+{
+"message": "All instances migrated",
+"numberOfProcessInstanceMigrated": 1
+ }
+```
+
+2. Endpoint to migrate all active process instances of a given processId to a
new target process
+
+Endpoint. : POST
/management/processes/{processId}/instances/{processInstanceId}/migrate:
+
+Request body :
+```json
+{
+"targetProcessId": "<>",
+"targetProcessVersion": "<>"
+}
+```
+Input parameters:
+
+1. processId: source process identifier (path parameter)
+2. processInstanceId: source process instance identifier (path parameter)
+3. targetProcessId : target process identifier(query parameter)
+4. targetProcessVersion : target process version(query parameter)
+
+Output:
+
+The response JSON Schema includes details of the processInstanceId migrated to
new process
+```json
+{
+"processInstanceId": <>,
+"message": <>
+}
+```
+Sample JSON Response Example :
+
+```json
+{
+"processInstanceId": "1c67ac14-e26a-4f5f-8d42-f4c3bdb691e5",
+"message": "1c67ac14-e26a-4f5f-8d42-f4c3bdb691e5 instance migrated"
+}
+```
+### Usage
+
+Add this section to your `pom.xml` file:
+
+1. Quarkus:
+```xml
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-quarkus-process-instance-migration</artifactId>
+ </dependency>
+```
+2. Springboot:
+```xml
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-springboot-process-instance-migration</artifactId>
+</dependency>
+```
+
+## Examples
+
+See the following examples to explore more about this capability:
+
[process-instance-migration-quarkus](https://github.com/kiegroup/kogito-examples/tree/main/kogito-quarkus-examples/process-instance-migration-quarkus)
diff --git a/addons/common/process-instance-migration/pom.xml
b/addons/common/process-instance-migration/pom.xml
new file mode 100644
index 0000000000..dc4cfc6160
--- /dev/null
+++ b/addons/common/process-instance-migration/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>kogito-addons-common-parent</artifactId>
+ <groupId>org.kie</groupId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>kie-addons-process-instance-migration</artifactId>
+ <name>KIE :: Add-Ons :: Process Migration :: Common</name>
+
+ <properties>
+ <java.module.name>org.kie.kogito.process.migration</java.module.name>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.kie.kogito</groupId>
+ <artifactId>kogito-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie.kogito</groupId>
+ <artifactId>jbpm-deps-group-engine</artifactId>
+ <type>pom</type>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git
a/addons/common/process-instance-migration/src/main/java/org/kie/kogito/process/migration/BaseProcessInstanceMigrationResource.java
b/addons/common/process-instance-migration/src/main/java/org/kie/kogito/process/migration/BaseProcessInstanceMigrationResource.java
new file mode 100644
index 0000000000..ba9cdc1df1
--- /dev/null
+++
b/addons/common/process-instance-migration/src/main/java/org/kie/kogito/process/migration/BaseProcessInstanceMigrationResource.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.process.migration;
+
+import java.util.*;
+import java.util.function.Supplier;
+
+import org.kie.kogito.Application;
+import org.kie.kogito.Model;
+import org.kie.kogito.process.Process;
+import org.kie.kogito.process.Processes;
+
+public abstract class BaseProcessInstanceMigrationResource<T> implements
ProcessInstanceMigration<T> {
+
+ private Supplier<Processes> processes;
+
+ private Application application;
+
+ public BaseProcessInstanceMigrationResource(Processes processes,
Application application) {
+ this(() -> processes, application);
+ }
+
+ public BaseProcessInstanceMigrationResource(Supplier<Processes> processes,
Application application) {
+ this.processes = processes;
+ this.application = application;
+ }
+
+ public T doMigrateInstance(String processId, ProcessMigrationSpec
migrationSpec, String processInstanceId) {
+ try {
+ Process<? extends Model> process =
processes.get().processById(processId);
+
process.instances().migrateProcessInstances(migrationSpec.getTargetProcessId(),
migrationSpec.getTargetProcessVersion(), processInstanceId);
+ Map<String, Object> message = new HashMap<>();
+ message.put("message", processInstanceId + " instance migrated");
+ message.put("processInstanceId", processInstanceId);
+ return buildOkResponse(message);
+ } catch (Exception e) {
+ return badRequestResponse(e.getMessage());
+ }
+ }
+
+ public T doMigrateAllInstances(String processId, ProcessMigrationSpec
migrationSpec) {
+ try {
+ Process<? extends Model> process =
processes.get().processById(processId);
+ long numberOfProcessInstanceMigrated =
process.instances().migrateAll(migrationSpec.getTargetProcessId(),
migrationSpec.getTargetProcessVersion());
+ Map<String, Object> message = new HashMap<>();
+ message.put("message", "All instances migrated");
+ message.put("numberOfProcessInstanceMigrated",
numberOfProcessInstanceMigrated);
+ return buildOkResponse(message);
+ } catch (Exception e) {
+ return badRequestResponse(e.getMessage());
+ }
+ }
+
+ protected abstract <R> T buildOkResponse(R body);
+
+ protected abstract T badRequestResponse(String message);
+
+ protected abstract T notFoundResponse(String message);
+
+}
diff --git
a/addons/common/process-instance-migration/src/main/java/org/kie/kogito/process/migration/ProcessInstanceMigration.java
b/addons/common/process-instance-migration/src/main/java/org/kie/kogito/process/migration/ProcessInstanceMigration.java
new file mode 100644
index 0000000000..eeed9079dc
--- /dev/null
+++
b/addons/common/process-instance-migration/src/main/java/org/kie/kogito/process/migration/ProcessInstanceMigration.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.process.migration;
+
+public interface ProcessInstanceMigration<T> {
+
+ T migrateAllInstances(String processId, ProcessMigrationSpec
migrationSpec);
+
+ T migrateInstance(String processId, String processInstanceId,
ProcessMigrationSpec migrationSpec);
+
+}
diff --git
a/addons/common/process-instance-migration/src/main/java/org/kie/kogito/process/migration/ProcessMigrationSpec.java
b/addons/common/process-instance-migration/src/main/java/org/kie/kogito/process/migration/ProcessMigrationSpec.java
new file mode 100644
index 0000000000..db67beef4e
--- /dev/null
+++
b/addons/common/process-instance-migration/src/main/java/org/kie/kogito/process/migration/ProcessMigrationSpec.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.process.migration;
+
+public class ProcessMigrationSpec {
+
+ private String targetProcessId;
+
+ private String targetProcessVersion;
+
+ public String getTargetProcessId() {
+ return targetProcessId;
+ }
+
+ public void setTargetProcessId(String targetProcessId) {
+ this.targetProcessId = targetProcessId;
+ }
+
+ public String getTargetProcessVersion() {
+ return targetProcessVersion;
+ }
+
+ public void setTargetProcessVersion(String targetProcessVersion) {
+ this.targetProcessVersion = targetProcessVersion;
+ }
+
+}
diff --git
a/addons/common/process-instance-migration/src/main/resources/META-INF/services/org.jbpm.flow.migration.MigrationPlanFileProvider
b/addons/common/process-instance-migration/src/main/resources/META-INF/services/org.jbpm.flow.migration.MigrationPlanFileProvider
new file mode 100644
index 0000000000..e0b06353f7
--- /dev/null
+++
b/addons/common/process-instance-migration/src/main/resources/META-INF/services/org.jbpm.flow.migration.MigrationPlanFileProvider
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+org.jbpm.flow.migration.impl.FileSystemMigrationPlanFileProvider
\ No newline at end of file
diff --git
a/addons/common/process-instance-migration/src/main/resources/META-INF/services/org.jbpm.flow.migration.MigrationPlanFileReader
b/addons/common/process-instance-migration/src/main/resources/META-INF/services/org.jbpm.flow.migration.MigrationPlanFileReader
new file mode 100644
index 0000000000..4593e19617
--- /dev/null
+++
b/addons/common/process-instance-migration/src/main/resources/META-INF/services/org.jbpm.flow.migration.MigrationPlanFileReader
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+org.jbpm.flow.migration.impl.JsonMigrationPlanFileReader
\ No newline at end of file
diff --git
a/addons/common/process-instance-migration/src/main/resources/META-INF/services/org.jbpm.flow.serialization.ProcessInstanceMarshallerListener
b/addons/common/process-instance-migration/src/main/resources/META-INF/services/org.jbpm.flow.serialization.ProcessInstanceMarshallerListener
new file mode 100644
index 0000000000..012b544cfe
--- /dev/null
+++
b/addons/common/process-instance-migration/src/main/resources/META-INF/services/org.jbpm.flow.serialization.ProcessInstanceMarshallerListener
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+org.jbpm.flow.serialization.migration.StandardMigrationProcessInstanceMarshallerListener
\ No newline at end of file
diff --git
a/addons/common/process-management/src/main/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResource.java
b/addons/common/process-management/src/main/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResource.java
index 3291f8d7bd..2a118dc811 100644
---
a/addons/common/process-management/src/main/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResource.java
+++
b/addons/common/process-management/src/main/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResource.java
@@ -27,7 +27,6 @@ import org.jbpm.ruleflow.core.Metadata;
import org.jbpm.workflow.core.Node;
import org.jbpm.workflow.core.WorkflowProcess;
import org.kie.kogito.Application;
-import org.kie.kogito.Model;
import org.kie.kogito.internal.process.runtime.KogitoNodeInstance;
import org.kie.kogito.internal.process.runtime.KogitoWorkflowProcess;
import org.kie.kogito.process.Process;
@@ -125,32 +124,6 @@ public abstract class
BaseProcessInstanceManagementResource<T> implements Proces
});
}
- public T doMigrateInstance(String processId, ProcessMigrationSpec
migrationSpec, String processInstanceId) {
- try {
- Process<? extends Model> process =
processes.get().processById(processId);
-
process.instances().migrateProcessInstances(migrationSpec.getTargetProcessId(),
migrationSpec.getTargetProcessVersion(), processInstanceId);
- Map<String, Object> message = new HashMap<>();
- message.put("message", processInstanceId + " instance migrated");
- message.put("processInstanceId", processInstanceId);
- return buildOkResponse(message);
- } catch (Exception e) {
- return badRequestResponse(e.getMessage());
- }
- }
-
- public T doMigrateAllInstances(String processId, ProcessMigrationSpec
migrationSpec) {
- try {
- Process<? extends Model> process =
processes.get().processById(processId);
- long numberOfProcessInstanceMigrated =
process.instances().migrateAll(migrationSpec.getTargetProcessId(),
migrationSpec.getTargetProcessVersion());
- Map<String, Object> message = new HashMap<>();
- message.put("message", "All instances migrated");
- message.put("numberOfProcessInstanceMigrated",
numberOfProcessInstanceMigrated);
- return buildOkResponse(message);
- } catch (Exception e) {
- return badRequestResponse(e.getMessage());
- }
- }
-
public T doGetWorkItemsInProcessInstance(String processId, String
processInstanceId) {
return executeOnProcessInstance(processId, processInstanceId,
processInstance -> {
diff --git
a/addons/common/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagement.java
b/addons/common/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagement.java
index 7f877dc9c6..d1a80be519 100644
---
a/addons/common/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagement.java
+++
b/addons/common/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagement.java
@@ -46,10 +46,6 @@ public interface ProcessInstanceManagement<T> {
T cancelProcessInstanceId(String processId, String processInstanceId);
- T migrateAllInstances(String processId, ProcessMigrationSpec
migrationSpec);
-
- T migrateInstance(String processId, String processInstanceId,
ProcessMigrationSpec migrationSpec);
-
T updateNodeInstanceSla(String processId, String processInstanceId, String
nodeInstanceId, SlaPayload SLAPayload);
T updateProcessInstanceSla(String processId, String processInstanceId,
SlaPayload SLAPayload);
diff --git
a/addons/common/process-management/src/test/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResourceTest.java
b/addons/common/process-management/src/test/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResourceTest.java
index d9bdc433a3..f6517819d8 100644
---
a/addons/common/process-management/src/test/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResourceTest.java
+++
b/addons/common/process-management/src/test/java/org/kie/kogito/process/management/BaseProcessInstanceManagementResourceTest.java
@@ -212,16 +212,6 @@ class BaseProcessInstanceManagementResourceTest {
return null;
}
- @Override
- public Object migrateAllInstances(String processId,
ProcessMigrationSpec migrationSpec) {
- return null;
- }
-
- @Override
- public Object migrateInstance(String processId, String
processInstanceId, ProcessMigrationSpec migrationSpec) {
- return null;
- }
-
@Override
public Object updateNodeInstanceSla(String processId, String
processInstanceId, String nodeInstanceId, SlaPayload SLAPayload) {
return null;
diff --git a/kogito-bom/pom.xml b/kogito-bom/pom.xml
index 702eec48bb..ed3bae1614 100755
--- a/kogito-bom/pom.xml
+++ b/kogito-bom/pom.xml
@@ -1215,6 +1215,50 @@
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-process-instance-migration</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-process-instance-migration</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-quarkus-process-instance-migration</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-quarkus-process-instance-migration</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+
<artifactId>kie-addons-quarkus-process-instance-migration-deployment</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+
<artifactId>kie-addons-quarkus-process-instance-migration-deployment</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+
<artifactId>kie-addons-springboot-process-instance-migration</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+
<artifactId>kie-addons-springboot-process-instance-migration</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-process-definitions</artifactId>
diff --git a/quarkus/addons/pom.xml b/quarkus/addons/pom.xml
index aad5323b8f..d290318abc 100644
--- a/quarkus/addons/pom.xml
+++ b/quarkus/addons/pom.xml
@@ -62,6 +62,7 @@
<module>dynamic</module>
<module>jbpm-usertask-storage-jpa</module>
<module>token-exchange</module>
+ <module>process-instance-migration</module>
<module>openapi</module>
</modules>
diff --git a/quarkus/addons/process-instance-migration/deployment/pom.xml
b/quarkus/addons/process-instance-migration/deployment/pom.xml
new file mode 100644
index 0000000000..23116e92ab
--- /dev/null
+++ b/quarkus/addons/process-instance-migration/deployment/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.kie</groupId>
+
<artifactId>kie-addons-quarkus-process-instance-migration-parent</artifactId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+
<artifactId>kie-addons-quarkus-process-instance-migration-deployment</artifactId>
+ <name>KIE Add-On Process Migration - Deployment</name>
+
+ <properties>
+
<java.module.name>org.kie.kogito.process.quarkus.migration.deployment</java.module.name>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-quarkus-process-instance-migration</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-arc-deployment</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${version.io.quarkus}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/quarkus/addons/process-instance-migration/deployment/src/main/java/org/kie/kogito/process/migration/deployment/KogitoAddOnProcessMigrationProcessor.java
b/quarkus/addons/process-instance-migration/deployment/src/main/java/org/kie/kogito/process/migration/deployment/KogitoAddOnProcessMigrationProcessor.java
new file mode 100644
index 0000000000..797ff2b984
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/deployment/src/main/java/org/kie/kogito/process/migration/deployment/KogitoAddOnProcessMigrationProcessor.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.process.migration.deployment;
+
+import org.kie.kogito.quarkus.addons.common.deployment.KogitoCapability;
+import
org.kie.kogito.quarkus.addons.common.deployment.OneOfCapabilityKogitoAddOnProcessor;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+class KogitoAddOnProcessMigrationProcessor extends
OneOfCapabilityKogitoAddOnProcessor {
+
+ private static final String FEATURE =
"kie-addon-process-instance-migration-extension";
+
+ KogitoAddOnProcessMigrationProcessor() {
+ super(KogitoCapability.PROCESSES);
+ }
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+}
\ No newline at end of file
diff --git
a/quarkus/addons/process-instance-migration/integration-tests/pom.xml
b/quarkus/addons/process-instance-migration/integration-tests/pom.xml
new file mode 100644
index 0000000000..6086fe5bba
--- /dev/null
+++ b/quarkus/addons/process-instance-migration/integration-tests/pom.xml
@@ -0,0 +1,153 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.kie</groupId>
+
<artifactId>kie-addons-quarkus-process-instance-migration-parent</artifactId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+
<artifactId>kie-addons-quarkus-process-instance-migration-integration-tests</artifactId>
+ <name>KIE:: Addons :: Quarkus:: Process Migration :: Integration Test</name>
+ <description>Process Migration addon testing Testing</description>
+
+ <properties>
+
<java.module.name>org.kie.kogito.process.quarkus.migration.test</java.module.name>
+ </properties>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-with-drools-quarkus</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-quarkus-persistence-jdbc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-quarkus-process-instance-migration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jdbc-postgresql</artifactId>
+ </dependency>
+
+ <!-- hack for CI to work -->
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-with-drools-quarkus-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+
<artifactId>kie-addons-quarkus-process-instance-migration-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.kie.kogito</groupId>
+ <artifactId>kogito-quarkus-test-utils</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.native.enabled>true</quarkus.native.enabled>
+ </properties>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
diff --git
a/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/META-INF/migration-plan/signal.mpf
b/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/META-INF/migration-plan/signal.mpf
new file mode 100644
index 0000000000..aaa2bf3e64
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/META-INF/migration-plan/signal.mpf
@@ -0,0 +1,16 @@
+{
+ "name" : "test migration plan",
+ "processMigrationPlan" : {
+ "sourceProcessDefinition" : {
+ "processId" : "signal",
+ "processVersion" : "1.0"
+ },
+ "targetProcessDefinition" : {
+ "processId" : "signal2",
+ "processVersion" : "1.0"
+ },
+ "nodeInstanceMigrationPlan" : [
+
+ ]
+ }
+}
\ No newline at end of file
diff --git
a/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/application.properties
b/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/application.properties
new file mode 100644
index 0000000000..a957e13448
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/application.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+quarkus.devservices.enabled=false
+quarkus.http.test-port=0
+
+quarkus.datasource.db-kind=postgresql
+kogito.persistence.type=jdbc
+quarkus.hibernate-orm.database.generation=none
+kie.flyway.enabled=true
\ No newline at end of file
diff --git
a/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/signal.bpmn
b/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/signal.bpmn
new file mode 100644
index 0000000000..603ccda0cc
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/signal.bpmn
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<bpmn2:definitions
+ xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+ xmlns:bpsim="http://www.bpsim.org/schemas/1.0"
+ xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
+ xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
+ xmlns:drools="http://www.jboss.org/drools"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ id="_vKypkFbMED6i0Prdh13aPA"
+ xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd
http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0
bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd
http://www.omg.org/spec/DD/20100524/DI DI.xsd "
+ exporter="jBPM Process Modeler"
+ exporterVersion="2.0"
+ targetNamespace="http://www.omg.org/bpmn20"
+>
+ <bpmn2:collaboration id="_4FAAA871-E12C-4B9B-8DE3-669E79A5C6AE"
name="Default Collaboration">
+ <bpmn2:participant id="_CE5523A8-07BD-4067-8C06-A722C95F1ED3" name="Pool
Participant" processRef="signal" />
+ </bpmn2:collaboration>
+ <bpmn2:signal id="_E5FF8FEA-C7B6-4D81-9FFA-D35B68916AA3"
structureRef="continueType" name="continue" />
+ <bpmn2:process
+ id="signal"
+ drools:packageName="com.ibm.bamoe.signal"
+ drools:version="1.0"
+ drools:adHoc="false"
+ name="signal"
+ isExecutable="true"
+ processType="Public"
+ >
+ <bpmn2:endEvent id="_1F7E98C5-B76F-441A-84AA-8EEE4621C6E4">
+ <bpmn2:incoming>_7D66DF52-329A-4C8F-882A-ECCCD3E2EC2E</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:intermediateCatchEvent id="_6BC9588F-0752-4897-89B2-F670F8809B21"
name="signal">
+ <bpmn2:extensionElements>
+ <drools:metaData name="elementname">
+ <drools:metaValue>signal</drools:metaValue>
+ </drools:metaData>
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>_DF3CEA04-4DAA-47E9-8556-DFD525F0918A</bpmn2:incoming>
+ <bpmn2:outgoing>_7D66DF52-329A-4C8F-882A-ECCCD3E2EC2E</bpmn2:outgoing>
+ <bpmn2:signalEventDefinition
signalRef="_E5FF8FEA-C7B6-4D81-9FFA-D35B68916AA3" />
+ </bpmn2:intermediateCatchEvent>
+ <bpmn2:sequenceFlow
+ id="_7D66DF52-329A-4C8F-882A-ECCCD3E2EC2E"
+ sourceRef="_6BC9588F-0752-4897-89B2-F670F8809B21"
+ targetRef="_1F7E98C5-B76F-441A-84AA-8EEE4621C6E4"
+ />
+ <bpmn2:sequenceFlow
+ id="_DF3CEA04-4DAA-47E9-8556-DFD525F0918A"
+ sourceRef="_A3A18C04-1AB1-4AB0-9871-E31B09986D70"
+ targetRef="_6BC9588F-0752-4897-89B2-F670F8809B21"
+ />
+ <bpmn2:startEvent id="_A3A18C04-1AB1-4AB0-9871-E31B09986D70">
+ <bpmn2:outgoing>_DF3CEA04-4DAA-47E9-8556-DFD525F0918A</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ </bpmn2:process>
+ <bpmndi:BPMNDiagram id="_5D58817A-7456-491F-AEE4-C5BFBBF9AFF4">
+ <bpmndi:BPMNPlane bpmnElement="signal"
id="_5069893F-E62B-4FD6-A04F-AC165F0C064F">
+ <bpmndi:BPMNShape
+ id="shape__A3A18C04-1AB1-4AB0-9871-E31B09986D70"
+ bpmnElement="_A3A18C04-1AB1-4AB0-9871-E31B09986D70"
+ >
+ <dc:Bounds height="56" width="56" x="192" y="246" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape
+ id="shape__6BC9588F-0752-4897-89B2-F670F8809B21"
+ bpmnElement="_6BC9588F-0752-4897-89B2-F670F8809B21"
+ >
+ <dc:Bounds height="56" width="56" x="328" y="246" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape
+ id="shape__1F7E98C5-B76F-441A-84AA-8EEE4621C6E4"
+ bpmnElement="_1F7E98C5-B76F-441A-84AA-8EEE4621C6E4"
+ >
+ <dc:Bounds height="56" width="56" x="464" y="246" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge
+
id="edge_shape__A3A18C04-1AB1-4AB0-9871-E31B09986D70_to_shape__6BC9588F-0752-4897-89B2-F670F8809B21"
+ bpmnElement="_DF3CEA04-4DAA-47E9-8556-DFD525F0918A"
+ >
+ <di:waypoint x="220" y="274" />
+ <di:waypoint x="356" y="274" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge
+
id="edge_shape__6BC9588F-0752-4897-89B2-F670F8809B21_to_shape__1F7E98C5-B76F-441A-84AA-8EEE4621C6E4"
+ bpmnElement="_7D66DF52-329A-4C8F-882A-ECCCD3E2EC2E"
+ >
+ <di:waypoint x="356" y="274" />
+ <di:waypoint x="492" y="274" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+ <bpmn2:relationship type="BPSimData">
+ <bpmn2:extensionElements>
+ <bpsim:BPSimData>
+ <bpsim:Scenario id="default" name="Simulationscenario">
+ <bpsim:ScenarioParameters />
+ <bpsim:ElementParameters
elementRef="_A3A18C04-1AB1-4AB0-9871-E31B09986D70">
+ <bpsim:TimeParameters>
+ <bpsim:ProcessingTime>
+ <bpsim:NormalDistribution mean="0" standardDeviation="0" />
+ </bpsim:ProcessingTime>
+ </bpsim:TimeParameters>
+ </bpsim:ElementParameters>
+ </bpsim:Scenario>
+ </bpsim:BPSimData>
+ </bpmn2:extensionElements>
+ <bpmn2:source>_vKypkFbMED6i0Prdh13aPA</bpmn2:source>
+ <bpmn2:target>_vKypkFbMED6i0Prdh13aPA</bpmn2:target>
+ </bpmn2:relationship>
+</bpmn2:definitions>
diff --git
a/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/signal2.bpmn
b/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/signal2.bpmn
new file mode 100644
index 0000000000..e2078488fe
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/integration-tests/src/main/resources/signal2.bpmn
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<bpmn2:definitions
+ xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL"
+ xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+ xmlns:bpsim="http://www.bpsim.org/schemas/1.0"
+ xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
+ xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
+ xmlns:drools="http://www.jboss.org/drools"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ id="_0n2V4FbRED6eP5d7G7kW6Q"
+ xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd
http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0
bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd
http://www.omg.org/spec/DD/20100524/DI DI.xsd "
+ exporter="jBPM Process Modeler"
+ exporterVersion="2.0"
+ targetNamespace="http://www.omg.org/bpmn20"
+>
+ <bpmn2:collaboration id="_DBA0557D-0320-444E-806E-286C9A468F5C"
name="Default Collaboration">
+ <bpmn2:participant id="_7B56D207-7BC3-48A4-9CB3-3F0B675582E6" name="Pool
Participant" processRef="signal2" />
+ </bpmn2:collaboration>
+ <bpmn2:signal id="_606E874B-1B3A-4166-B9CA-5150AE27D596"
structureRef="continueType" name="continue" />
+ <bpmn2:process
+ id="signal2"
+ drools:version="1.0"
+ drools:adHoc="false"
+ name="signal2"
+ isExecutable="true"
+ processType="Public"
+ drools:packageName="com.ibm.bamoe.signal"
+ >
+ <bpmn2:endEvent id="_1F7E98C5-B76F-441A-84AA-8EEE4621C6E4">
+ <bpmn2:incoming>_1F1418A6-6B37-4E68-8C55-428C653B4788</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:intermediateCatchEvent id="_6BC9588F-0752-4897-89B2-F670F8809B21"
name="signal">
+ <bpmn2:extensionElements>
+ <drools:metaData name="elementname">
+ <drools:metaValue>signal</drools:metaValue>
+ </drools:metaData>
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>_DF3CEA04-4DAA-47E9-8556-DFD525F0918A</bpmn2:incoming>
+ <bpmn2:outgoing>_2BBB202D-6EEE-4110-B148-5002FF84CD0F</bpmn2:outgoing>
+ <bpmn2:signalEventDefinition
signalRef="_606E874B-1B3A-4166-B9CA-5150AE27D596" />
+ </bpmn2:intermediateCatchEvent>
+ <bpmn2:scriptTask id="_32F07E24-E3DD-4394-A366-471003EE02EE" name="Script"
scriptFormat="http://www.java.com/java">
+ <bpmn2:extensionElements>
+ <drools:metaData name="elementname">
+ <drools:metaValue>Script</drools:metaValue>
+ </drools:metaData>
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>_2BBB202D-6EEE-4110-B148-5002FF84CD0F</bpmn2:incoming>
+ <bpmn2:outgoing>_1F1418A6-6B37-4E68-8C55-428C653B4788</bpmn2:outgoing>
+ <bpmn2:script>System.out.println("Signal2!");</bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow
+ id="_1F1418A6-6B37-4E68-8C55-428C653B4788"
+ sourceRef="_32F07E24-E3DD-4394-A366-471003EE02EE"
+ targetRef="_1F7E98C5-B76F-441A-84AA-8EEE4621C6E4"
+ />
+ <bpmn2:sequenceFlow
+ id="_2BBB202D-6EEE-4110-B148-5002FF84CD0F"
+ sourceRef="_6BC9588F-0752-4897-89B2-F670F8809B21"
+ targetRef="_32F07E24-E3DD-4394-A366-471003EE02EE"
+ />
+ <bpmn2:sequenceFlow
+ id="_DF3CEA04-4DAA-47E9-8556-DFD525F0918A"
+ sourceRef="_A3A18C04-1AB1-4AB0-9871-E31B09986D70"
+ targetRef="_6BC9588F-0752-4897-89B2-F670F8809B21"
+ />
+ <bpmn2:startEvent id="_A3A18C04-1AB1-4AB0-9871-E31B09986D70">
+ <bpmn2:outgoing>_DF3CEA04-4DAA-47E9-8556-DFD525F0918A</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ </bpmn2:process>
+ <bpmndi:BPMNDiagram id="_98662E59-B03F-4812-97C4-A6109E99D058">
+ <bpmndi:BPMNPlane bpmnElement="signal2"
id="_A34283F7-B26C-4001-B9B7-521C6E1B90CE">
+ <bpmndi:BPMNShape
+ id="shape__A3A18C04-1AB1-4AB0-9871-E31B09986D70"
+ bpmnElement="_A3A18C04-1AB1-4AB0-9871-E31B09986D70"
+ >
+ <dc:Bounds height="56" width="56" x="192" y="246" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape
+ id="shape__6BC9588F-0752-4897-89B2-F670F8809B21"
+ bpmnElement="_6BC9588F-0752-4897-89B2-F670F8809B21"
+ >
+ <dc:Bounds height="56" width="56" x="328" y="246" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape
+ id="shape__1F7E98C5-B76F-441A-84AA-8EEE4621C6E4"
+ bpmnElement="_1F7E98C5-B76F-441A-84AA-8EEE4621C6E4"
+ >
+ <dc:Bounds height="56" width="56" x="756" y="246" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape
+ id="shape__32F07E24-E3DD-4394-A366-471003EE02EE"
+ bpmnElement="_32F07E24-E3DD-4394-A366-471003EE02EE"
+ >
+ <dc:Bounds height="102" width="154" x="498" y="223" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge
+
id="edge_shape__A3A18C04-1AB1-4AB0-9871-E31B09986D70_to_shape__6BC9588F-0752-4897-89B2-F670F8809B21"
+ bpmnElement="_DF3CEA04-4DAA-47E9-8556-DFD525F0918A"
+ >
+ <di:waypoint x="220" y="274" />
+ <di:waypoint x="356" y="274" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge
+
id="edge_shape__6BC9588F-0752-4897-89B2-F670F8809B21_to_shape__32F07E24-E3DD-4394-A366-471003EE02EE"
+ bpmnElement="_2BBB202D-6EEE-4110-B148-5002FF84CD0F"
+ >
+ <di:waypoint x="356" y="274" />
+ <di:waypoint x="498" y="274" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge
+
id="edge_shape__32F07E24-E3DD-4394-A366-471003EE02EE_to_shape__1F7E98C5-B76F-441A-84AA-8EEE4621C6E4"
+ bpmnElement="_1F1418A6-6B37-4E68-8C55-428C653B4788"
+ >
+ <di:waypoint x="575" y="274" />
+ <di:waypoint x="756" y="274" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+ <bpmn2:relationship type="BPSimData">
+ <bpmn2:extensionElements>
+ <bpsim:BPSimData>
+ <bpsim:Scenario id="default" name="Simulationscenario">
+ <bpsim:ScenarioParameters />
+ <bpsim:ElementParameters
elementRef="_A3A18C04-1AB1-4AB0-9871-E31B09986D70">
+ <bpsim:TimeParameters>
+ <bpsim:ProcessingTime>
+ <bpsim:NormalDistribution mean="0" standardDeviation="0" />
+ </bpsim:ProcessingTime>
+ </bpsim:TimeParameters>
+ </bpsim:ElementParameters>
+ <bpsim:ElementParameters
elementRef="_32F07E24-E3DD-4394-A366-471003EE02EE">
+ <bpsim:TimeParameters>
+ <bpsim:ProcessingTime>
+ <bpsim:NormalDistribution mean="0" standardDeviation="0" />
+ </bpsim:ProcessingTime>
+ </bpsim:TimeParameters>
+ <bpsim:ResourceParameters>
+ <bpsim:Availability>
+ <bpsim:FloatingParameter value="0" />
+ </bpsim:Availability>
+ <bpsim:Quantity>
+ <bpsim:FloatingParameter value="0" />
+ </bpsim:Quantity>
+ </bpsim:ResourceParameters>
+ <bpsim:CostParameters>
+ <bpsim:UnitCost>
+ <bpsim:FloatingParameter value="0" />
+ </bpsim:UnitCost>
+ </bpsim:CostParameters>
+ </bpsim:ElementParameters>
+ </bpsim:Scenario>
+ </bpsim:BPSimData>
+ </bpmn2:extensionElements>
+ <bpmn2:source>_0n2V4FbRED6eP5d7G7kW6Q</bpmn2:source>
+ <bpmn2:target>_0n2V4FbRED6eP5d7G7kW6Q</bpmn2:target>
+ </bpmn2:relationship>
+</bpmn2:definitions>
diff --git
a/quarkus/addons/process-instance-migration/integration-tests/src/test/java/org/kie/kogito/quarkus/workflows/ProcessMigrationIT.java
b/quarkus/addons/process-instance-migration/integration-tests/src/test/java/org/kie/kogito/quarkus/workflows/ProcessMigrationIT.java
new file mode 100644
index 0000000000..caabe0c9af
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/integration-tests/src/test/java/org/kie/kogito/quarkus/workflows/ProcessMigrationIT.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.util.Map;
+
+import org.junit.jupiter.api.Test;
+import org.kie.kogito.process.migration.ProcessMigrationSpec;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.*;
+
+@QuarkusIntegrationTest
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class,
restrictToAnnotatedClass = true)
+public class ProcessMigrationIT {
+
+ static {
+ RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
+ }
+
+ @Test
+ void testMigrationEndpointMigrateAllInstances() {
+
+ given()
+ .contentType(ContentType.JSON)
+ .accept(ContentType.JSON)
+ .body(Map.of())
+ .when()
+ .post("/signal")
+ .then()
+ .statusCode(201);
+
+ given()
+ .contentType(ContentType.JSON)
+ .accept(ContentType.JSON)
+ .body(Map.of())
+ .when()
+ .post("/signal")
+ .then()
+ .statusCode(201);
+
+ ProcessMigrationSpec processMigrationSpec = new ProcessMigrationSpec();
+ processMigrationSpec.setTargetProcessId("signal2");
+ processMigrationSpec.setTargetProcessVersion("1.0");
+
+ given()
+ .contentType("application/json")
+ .body(processMigrationSpec)
+ .when()
+ .post("/management/processes/{processId}/migrate", "signal")
+ .then()
+ .body(notNullValue());
+
+ given()
+ .when()
+ .get("/signal2")
+ .then()
+ .statusCode(200)
+ .body("$.size()", equalTo(2));
+ }
+
+ @Test
+ void testMigrationEndpointMigrateOneInstance() {
+
+ String processInstanceId = given()
+ .contentType(ContentType.JSON)
+ .accept(ContentType.JSON)
+ .body(Map.of())
+ .when()
+ .post("/signal")
+ .then()
+ .statusCode(201)
+ .extract().path("id");
+
+ given()
+ .contentType(ContentType.JSON)
+ .accept(ContentType.JSON)
+ .body(Map.of())
+ .when()
+ .post("/signal")
+ .then()
+ .statusCode(201);
+
+ ProcessMigrationSpec processMigrationSpec = new ProcessMigrationSpec();
+ processMigrationSpec.setTargetProcessId("signal2");
+ processMigrationSpec.setTargetProcessVersion("1.0");
+
+ given()
+ .contentType("application/json")
+ .body(processMigrationSpec)
+ .when()
+
.post("/management/processes/{processId}/instances/{processInstanceId}/migrate",
"signal", processInstanceId)
+ .then()
+ .body(notNullValue());
+
+ given()
+ .when()
+ .get("/signal2")
+ .then()
+ .statusCode(200)
+ .body("id", hasItem(processInstanceId));
+ ;
+ }
+}
diff --git a/quarkus/addons/process-instance-migration/pom.xml
b/quarkus/addons/process-instance-migration/pom.xml
new file mode 100644
index 0000000000..c0665f309c
--- /dev/null
+++ b/quarkus/addons/process-instance-migration/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>kogito-addons-quarkus-parent</artifactId>
+ <groupId>org.kie</groupId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>kie-addons-quarkus-process-instance-migration-parent</artifactId>
+ <name>KIE Add-On Process Migration - Parent</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ <module>integration-tests</module>
+ </modules>
+
+</project>
\ No newline at end of file
diff --git a/quarkus/addons/process-instance-migration/runtime/pom.xml
b/quarkus/addons/process-instance-migration/runtime/pom.xml
new file mode 100644
index 0000000000..01b2e36fc2
--- /dev/null
+++ b/quarkus/addons/process-instance-migration/runtime/pom.xml
@@ -0,0 +1,129 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.kie</groupId>
+
<artifactId>kie-addons-quarkus-process-instance-migration-parent</artifactId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+ <artifactId>kie-addons-quarkus-process-instance-migration</artifactId>
+ <name>KIE Add-On Process Migration</name>
+ <description>Migration of process instances for Quarkus</description>
+
+ <properties>
+
<java.module.name>org.kie.kogito.process.quarkus.migration</java.module.name>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-arc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-process-instance-migration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie.kogito</groupId>
+ <artifactId>kogito-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie.kogito</groupId>
+ <artifactId>jbpm-deps-group-engine</artifactId>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.ws.rs</groupId>
+ <artifactId>jakarta.ws.rs-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.xml.bind</groupId>
+ <artifactId>jakarta.xml.bind-api</artifactId>
+ <scope>test</scope>
+ <version>4.0.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-maven-plugin</artifactId>
+ <version>${version.io.quarkus}</version>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>extension-descriptor</goal>
+ </goals>
+ <configuration>
+
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
+ <capabilities>
+ <provides>org.kie.addons.process.migration</provides>
+ </capabilities>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${version.io.quarkus}</version>
+ </path>
+ </annotationProcessorPaths>
+ <compilerArgs>
+ <arg>-AlegacyConfigRoot=true</arg>
+ </compilerArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git
a/quarkus/addons/process-instance-migration/runtime/src/main/java/org/kie/kogito/process/migration/ProcessInstanceMigrationResource.java
b/quarkus/addons/process-instance-migration/runtime/src/main/java/org/kie/kogito/process/migration/ProcessInstanceMigrationResource.java
new file mode 100644
index 0000000000..7f107f533d
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/runtime/src/main/java/org/kie/kogito/process/migration/ProcessInstanceMigrationResource.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.process.migration;
+
+import org.kie.kogito.Application;
+import org.kie.kogito.process.Processes;
+
+import jakarta.enterprise.inject.Instance;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.*;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+
+@Path("/management/processes/")
+public class ProcessInstanceMigrationResource extends
BaseProcessInstanceMigrationResource<Response> {
+
+ //CDI
+ public ProcessInstanceMigrationResource() {
+ this(null, null);
+ }
+
+ @Inject
+ public ProcessInstanceMigrationResource(Instance<Processes> processes,
Application application) {
+ super(processes::get, application);
+ }
+
+ @Override
+ protected <R> Response buildOkResponse(R body) {
+ return Response
+ .status(Response.Status.OK)
+ .entity(body)
+ .build();
+ }
+
+ @Override
+ protected Response badRequestResponse(String message) {
+ return Response
+ .status(Response.Status.BAD_REQUEST)
+ .entity(message)
+ .build();
+ }
+
+ @Override
+ protected Response notFoundResponse(String message) {
+ return Response
+ .status(Response.Status.NOT_FOUND)
+ .entity(message)
+ .build();
+ }
+
+ @Override
+ @POST
+ @Path("{processId}/instances/{processInstanceId}/migrate")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response migrateInstance(@PathParam("processId") String processId,
@PathParam("processInstanceId") String processInstanceId, ProcessMigrationSpec
migrationSpec) {
+ return doMigrateInstance(processId, migrationSpec, processInstanceId);
+ }
+
+ @Override
+ @POST
+ @Path("{processId}/migrate")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response migrateAllInstances(@PathParam("processId") String
processId, ProcessMigrationSpec migrationSpec) {
+ return doMigrateAllInstances(processId, migrationSpec);
+ }
+}
diff --git
a/quarkus/addons/process-instance-migration/runtime/src/main/resources/META-INF/beans.xml
b/quarkus/addons/process-instance-migration/runtime/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000000..a0eb9fbf8c
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/runtime/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
diff --git
a/quarkus/addons/process-instance-migration/runtime/src/main/resources/META-INF/kogito.addon
b/quarkus/addons/process-instance-migration/runtime/src/main/resources/META-INF/kogito.addon
new file mode 100644
index 0000000000..4910c1aa08
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/runtime/src/main/resources/META-INF/kogito.addon
@@ -0,0 +1 @@
+process-instance-migration
\ No newline at end of file
diff --git
a/quarkus/addons/process-instance-migration/runtime/src/main/resources/META-INF/quarkus-extension.yaml
b/quarkus/addons/process-instance-migration/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000000..d2ee8f8c6a
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,33 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: KIE Process Instance Migration Add-On
+description: KIE Process Instance Migration REST API
+metadata:
+ keywords:
+ - KIE
+ - processes
+ - migration
+ - BPMN
+ - workflows
+ guide: https://quarkus.io/guides/kie
+ categories:
+ - "business-automation"
+ - "cloud"
+ status: "stable"
diff --git
a/quarkus/addons/process-instance-migration/runtime/src/test/java/org/kie/kogito/process/migration/ProcessInstanceMigrationResourceTest.java
b/quarkus/addons/process-instance-migration/runtime/src/test/java/org/kie/kogito/process/migration/ProcessInstanceMigrationResourceTest.java
new file mode 100644
index 0000000000..71c5fad3fb
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/runtime/src/test/java/org/kie/kogito/process/migration/ProcessInstanceMigrationResourceTest.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.process.migration;
+
+import java.util.Optional;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.kie.kogito.Application;
+import org.kie.kogito.internal.process.runtime.KogitoProcessInstance;
+import org.kie.kogito.internal.process.runtime.KogitoWorkflowProcess;
+import org.kie.kogito.process.ProcessError;
+import org.kie.kogito.process.ProcessInstance;
+import org.kie.kogito.process.ProcessInstances;
+import org.kie.kogito.process.Processes;
+import org.kie.kogito.process.impl.AbstractProcess;
+import org.kie.kogito.services.uow.CollectingUnitOfWorkFactory;
+import org.kie.kogito.services.uow.DefaultUnitOfWorkManager;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import jakarta.enterprise.inject.Instance;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response.ResponseBuilder;
+import jakarta.ws.rs.core.Response.StatusType;
+import jakarta.ws.rs.ext.RuntimeDelegate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.verify;
+
+@ExtendWith(MockitoExtension.class)
+public class ProcessInstanceMigrationResourceTest {
+
+ public static final String MESSAGE = "message";
+ public static final String PROCESS_ID = "test";
+ public static final String PROCESS_INSTANCE_ID = "testInstance";
+ public static final String TARGET_PROCESS_ID = "targetProcess";
+ public static final String TARGET_VERSION = "1.0";
+
+ private static RuntimeDelegate runtimeDelegate;
+ private ResponseBuilder responseBuilder;
+
+ private Processes processes;
+ @SuppressWarnings("rawtypes")
+ private ProcessInstance processInstance;
+ private ProcessError error;
+ private Application application;
+ private ProcessInstanceMigrationResource resource;
+
+ @Mock
+ ProcessInstances mockInstances;
+
+ @BeforeAll
+ public static void configureEnvironment() {
+ runtimeDelegate = mock(RuntimeDelegate.class);
+ RuntimeDelegate.setInstance(runtimeDelegate);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @BeforeEach
+ public void setup() {
+
+ responseBuilder = mock(ResponseBuilder.class);
+ Response response = mock(Response.class);
+
+
when((runtimeDelegate).createResponseBuilder()).thenReturn(responseBuilder);
+
lenient().when((responseBuilder).status(any(StatusType.class))).thenReturn(responseBuilder);
+
lenient().when((responseBuilder).entity(any())).thenReturn(responseBuilder);
+ lenient().when((responseBuilder).build()).thenReturn(response);
+
+ application = mock(Application.class);
+ processes = mock(Processes.class);
+ AbstractProcess process = mock(AbstractProcess.class);
+ processInstance = mock(ProcessInstance.class);
+ error = mock(ProcessError.class);
+
+ Instance<Processes> processesInstance = mock(Instance.class);
+ lenient().when(processes.processById(anyString())).thenReturn(process);
+ lenient().when(processesInstance.get()).thenReturn(processes);
+ lenient().when(process.instances()).thenReturn(mockInstances);
+
lenient().when(mockInstances.findById(anyString())).thenReturn(Optional.of(processInstance));
+ lenient().when(processInstance.error()).thenReturn(Optional.of(error));
+ lenient().when(processInstance.id()).thenReturn("abc-def");
+
lenient().when(processInstance.status()).thenReturn(KogitoProcessInstance.STATE_ACTIVE);
+ lenient().when(error.failedNodeId()).thenReturn("test");
+ lenient().when(error.errorMessage()).thenReturn("Test error message");
+
lenient().when(process.get()).thenReturn(mock(KogitoWorkflowProcess.class));
+
+ lenient().when(application.unitOfWorkManager()).thenReturn(new
DefaultUnitOfWorkManager(new CollectingUnitOfWorkFactory()));
+ resource = spy(new ProcessInstanceMigrationResource(processesInstance,
application));
+ }
+
+ @Test
+ public void testMigrateInstance() {
+ ProcessMigrationSpec processMigrationSpec = new ProcessMigrationSpec();
+ processMigrationSpec.setTargetProcessId(TARGET_PROCESS_ID);
+ processMigrationSpec.setTargetProcessVersion(TARGET_VERSION);
+
+ Response response = resource.migrateInstance(PROCESS_ID,
PROCESS_INSTANCE_ID, processMigrationSpec);
+ assertThat(response).isNotNull();
+ verify(responseBuilder, times(1)).status((StatusType)
Response.Status.OK);
+ verify(responseBuilder, times(1)).entity(any());
+ verify(resource).migrateInstance(PROCESS_ID, PROCESS_INSTANCE_ID,
processMigrationSpec);
+ verify(mockInstances).migrateProcessInstances(TARGET_PROCESS_ID,
TARGET_VERSION, "testInstance");
+ verify(mockInstances, times(1)).migrateProcessInstances(any(), any(),
any());
+ }
+
+ @Test
+ public void testMigrateAllInstance() {
+ ProcessMigrationSpec processMigrationSpec = new ProcessMigrationSpec();
+ processMigrationSpec.setTargetProcessId(TARGET_PROCESS_ID);
+ processMigrationSpec.setTargetProcessVersion(TARGET_VERSION);
+
+ Response response = resource.migrateAllInstances(PROCESS_ID,
processMigrationSpec);
+ assertThat(response).isNotNull();
+ verify(responseBuilder, times(1)).status((StatusType)
Response.Status.OK);
+ verify(responseBuilder, times(1)).entity(any());
+ verify(resource).migrateAllInstances(PROCESS_ID, processMigrationSpec);
+ verify(mockInstances).migrateAll(TARGET_PROCESS_ID, TARGET_VERSION);
+ verify(mockInstances, times(1)).migrateAll(any(), any());
+
+ }
+
+ @Test
+ public void testMigrateInstanceInvocation() {
+ ProcessMigrationSpec processMigrationSpec = new ProcessMigrationSpec();
+ resource.doMigrateInstance(PROCESS_ID, processMigrationSpec,
PROCESS_INSTANCE_ID);
+ verify(resource).doMigrateInstance(PROCESS_ID, processMigrationSpec,
PROCESS_INSTANCE_ID);
+ }
+
+ @Test
+ public void testMigrateAllInstanceInvocation() {
+ ProcessMigrationSpec processMigrationSpec = new ProcessMigrationSpec();
+ resource.doMigrateAllInstances(PROCESS_ID, processMigrationSpec);
+ verify(resource).doMigrateAllInstances(PROCESS_ID,
processMigrationSpec);
+ }
+
+ @Test
+ public void testBubildOkResponse(@Mock Object body) {
+ Response response = resource.buildOkResponse(body);
+ assertResponse(body, Response.Status.OK);
+ }
+
+ public void assertResponse(Object body, Response.Status status) {
+ verify(responseBuilder).status((Response.StatusType) status);
+ verify(responseBuilder).entity(body);
+ }
+
+ @Test
+ public void testBadRequestResponse() {
+ Response response = resource.badRequestResponse(MESSAGE);
+ assertResponse(MESSAGE, Response.Status.BAD_REQUEST);
+ }
+
+ @Test
+ public void testNotFoundResponse() {
+ Response response = resource.notFoundResponse(MESSAGE);
+ assertResponse(MESSAGE, Response.Status.NOT_FOUND);
+ }
+}
diff --git
a/quarkus/addons/process-instance-migration/runtime/src/test/resources/logback-test.xml
b/quarkus/addons/process-instance-migration/runtime/src/test/resources/logback-test.xml
new file mode 100755
index 0000000000..8ea18d9150
--- /dev/null
+++
b/quarkus/addons/process-instance-migration/runtime/src/test/resources/logback-test.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<configuration>
+
+ <appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <!-- %l lowers performance -->
+ <!--<pattern>%d [%t] %-5p %l%n %m%n</pattern>-->
+ <pattern>%d [%t|%C] %-5p %m%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.kie" level="info" />
+
+ <root level="info">
+ <appender-ref ref="consoleAppender" />
+ </root>
+
+</configuration>
diff --git
a/quarkus/addons/process-management/runtime/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementResource.java
b/quarkus/addons/process-management/runtime/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementResource.java
index 9aecfa2ecb..87b6ba2c51 100644
---
a/quarkus/addons/process-management/runtime/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementResource.java
+++
b/quarkus/addons/process-management/runtime/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementResource.java
@@ -97,22 +97,6 @@ public class ProcessInstanceManagementResource extends
BaseProcessInstanceManage
return doGetInstanceInError(processId, processInstanceId);
}
- @Override
- @POST
- @Path("{processId}/instances/{processInstanceId}/migrate")
- @Produces(MediaType.APPLICATION_JSON)
- public Response migrateInstance(@PathParam("processId") String processId,
@PathParam("processInstanceId") String processInstanceId, ProcessMigrationSpec
migrationSpec) {
- return doMigrateInstance(processId, migrationSpec, processInstanceId);
- }
-
- @Override
- @POST
- @Path("{processId}/migrate")
- @Produces(MediaType.APPLICATION_JSON)
- public Response migrateAllInstances(@PathParam("processId") String
processId, ProcessMigrationSpec migrationSpec) {
- return doMigrateAllInstances(processId, migrationSpec);
- }
-
@Override
@GET
@Path("{processId}/instances/{processInstanceId}/nodeInstances")
diff --git a/springboot/addons/pom.xml b/springboot/addons/pom.xml
index ebc2345cf5..97607540a6 100644
--- a/springboot/addons/pom.xml
+++ b/springboot/addons/pom.xml
@@ -48,6 +48,7 @@
<module>rest-exception-handler</module>
<module>process-svg</module>
<module>process-management</module>
+ <module>process-instance-migration</module>
<module>task-management</module>
<module>kubernetes</module>
<module>flyway</module>
diff --git a/springboot/addons/process-instance-migration/pom.xml
b/springboot/addons/process-instance-migration/pom.xml
new file mode 100644
index 0000000000..f37373a890
--- /dev/null
+++ b/springboot/addons/process-instance-migration/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>kogito-addons-springboot-parent</artifactId>
+ <groupId>org.kie</groupId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>kie-addons-springboot-process-instance-migration</artifactId>
+ <name>KIE :: Add-Ons :: Process Migration :: Spring Boot Addon</name>
+ <description>Migration of process instances for Spring Boot</description>
+
+ <properties>
+
<java.module.name>org.kie.kogito.springboot.process.migration</java.module.name>
+ </properties>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-addons-process-instance-migration</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.kie.kogito</groupId>
+ <artifactId>kogito-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git
a/springboot/addons/process-instance-migration/src/main/java/org/kie/kogito/process/management/ProcessInstanceMigrationRestController.java
b/springboot/addons/process-instance-migration/src/main/java/org/kie/kogito/process/management/ProcessInstanceMigrationRestController.java
new file mode 100644
index 0000000000..d38e9a1d23
--- /dev/null
+++
b/springboot/addons/process-instance-migration/src/main/java/org/kie/kogito/process/management/ProcessInstanceMigrationRestController.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.process.management;
+
+import org.kie.kogito.Application;
+import org.kie.kogito.process.Processes;
+import org.kie.kogito.process.migration.BaseProcessInstanceMigrationResource;
+import org.kie.kogito.process.migration.ProcessMigrationSpec;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
+
+@RestController
+@RequestMapping("/management/processes")
+public class ProcessInstanceMigrationRestController extends
BaseProcessInstanceMigrationResource<ResponseEntity> {
+
+ @Autowired
+ @Lazy
+ public ProcessInstanceMigrationRestController(Processes processes,
Application application) {
+ super(processes, application);
+ }
+
+ @Override
+ public <R> ResponseEntity buildOkResponse(R body) {
+ return ResponseEntity.ok(body);
+ }
+
+ @Override
+ public ResponseEntity badRequestResponse(String message) {
+ return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(message);
+ }
+
+ @Override
+ public ResponseEntity notFoundResponse(String message) {
+ return ResponseEntity.status(HttpStatus.NOT_FOUND).body(message);
+ }
+
+ @Override
+ @PostMapping(value = "{processId}/instances/{processInstanceId}/migrate",
produces = APPLICATION_JSON_VALUE)
+ public ResponseEntity migrateInstance(@PathVariable("processId") String
processId, @PathVariable("processInstanceId") String processInstanceId,
ProcessMigrationSpec migrationSpec) {
+ return doMigrateInstance(processId, migrationSpec, processInstanceId);
+ }
+
+ @Override
+ @PostMapping(value = "{processId}/migrate", produces =
APPLICATION_JSON_VALUE)
+ public ResponseEntity migrateAllInstances(String processId,
ProcessMigrationSpec migrationSpec) {
+ return doMigrateAllInstances(processId, migrationSpec);
+ }
+
+}
diff --git
a/springboot/addons/process-instance-migration/src/main/resources/META-INF/kogito.addon
b/springboot/addons/process-instance-migration/src/main/resources/META-INF/kogito.addon
new file mode 100644
index 0000000000..4910c1aa08
--- /dev/null
+++
b/springboot/addons/process-instance-migration/src/main/resources/META-INF/kogito.addon
@@ -0,0 +1 @@
+process-instance-migration
\ No newline at end of file
diff --git
a/springboot/addons/process-instance-migration/src/test/java/org/kie/kogito/process/migration/ProcessInstanceMigrationRestControllerTest.java
b/springboot/addons/process-instance-migration/src/test/java/org/kie/kogito/process/migration/ProcessInstanceMigrationRestControllerTest.java
new file mode 100644
index 0000000000..8c6b014ae8
--- /dev/null
+++
b/springboot/addons/process-instance-migration/src/test/java/org/kie/kogito/process/migration/ProcessInstanceMigrationRestControllerTest.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.process.migration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.kie.kogito.Application;
+import org.kie.kogito.process.Process;
+import org.kie.kogito.process.ProcessInstances;
+import org.kie.kogito.process.Processes;
+import
org.kie.kogito.process.management.ProcessInstanceMigrationRestController;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.*;
+
+@ExtendWith(MockitoExtension.class)
+class ProcessInstanceMigrationRestControllerTest {
+
+ public static final String PROCESS_ID = "processId";
+ public static final String PROCESS_INSTANCE_ID = "processInstanceId";
+ public static final String MESSAGE = "message";
+ public static final String TARGET_PROCESS_ID = "targetProcess";
+ public static final String TARGET_VERSION = "1.0";
+
+ private ProcessInstanceMigrationRestController tested;
+
+ @Mock
+ private Processes processes;
+
+ @Mock
+ private Application application;
+
+ @Mock
+ private Object body;
+
+ @Mock
+ ProcessInstances mockInstances;
+
+ @Mock
+ Process process;
+
+ @BeforeEach
+ void setUp() {
+ tested = spy(new ProcessInstanceMigrationRestController(processes,
application));
+ lenient().when(processes.processById(anyString())).thenReturn(process);
+ lenient().when(process.instances()).thenReturn(mockInstances);
+ }
+
+ @Test
+ void buildOkResponse() {
+ ResponseEntity responseEntity = tested.buildOkResponse(body);
+ assertResponse(responseEntity, HttpStatus.OK, body);
+ }
+
+ private void assertResponse(ResponseEntity responseEntity, HttpStatus ok,
Object body) {
+ assertThat(responseEntity.getStatusCode()).isEqualTo(ok);
+ assertThat(responseEntity.getBody()).isEqualTo(body);
+ }
+
+ @Test
+ void badRequestResponse() {
+ ResponseEntity responseEntity = tested.badRequestResponse(MESSAGE);
+ assertResponse(responseEntity, HttpStatus.BAD_REQUEST, MESSAGE);
+ }
+
+ @Test
+ void notFoundResponse() {
+ ResponseEntity responseEntity = tested.notFoundResponse(MESSAGE);
+ assertResponse(responseEntity, HttpStatus.NOT_FOUND, MESSAGE);
+ }
+
+ @Test
+ void triggerDoMigrateAllInstances() {
+ ProcessMigrationSpec processMigrationSpec = new ProcessMigrationSpec();
+ processMigrationSpec.setTargetProcessId(TARGET_PROCESS_ID);
+ processMigrationSpec.setTargetProcessVersion(TARGET_VERSION);
+
+ tested.doMigrateAllInstances(PROCESS_ID, processMigrationSpec);
+ verify(tested).doMigrateAllInstances(PROCESS_ID, processMigrationSpec);
+ verify(mockInstances).migrateAll(TARGET_PROCESS_ID, TARGET_VERSION);
+ verify(mockInstances, times(1)).migrateAll(any(), any());
+
+ }
+
+ @Test
+ void triggerDoMigrateInstance() {
+ ProcessMigrationSpec processMigrationSpec = new ProcessMigrationSpec();
+ processMigrationSpec.setTargetProcessId(TARGET_PROCESS_ID);
+ processMigrationSpec.setTargetProcessVersion(TARGET_VERSION);
+
+ tested.doMigrateInstance(PROCESS_ID, processMigrationSpec,
PROCESS_INSTANCE_ID);
+ verify(tested).doMigrateInstance(PROCESS_ID, processMigrationSpec,
PROCESS_INSTANCE_ID);
+ verify(mockInstances).migrateProcessInstances(TARGET_PROCESS_ID,
TARGET_VERSION, "processInstanceId");
+ verify(mockInstances, times(1)).migrateProcessInstances(any(), any(),
any());
+
+ }
+
+}
diff --git
a/springboot/addons/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementRestController.java
b/springboot/addons/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementRestController.java
index 55c646b78a..52b42e4578 100644
---
a/springboot/addons/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementRestController.java
+++
b/springboot/addons/process-management/src/main/java/org/kie/kogito/process/management/ProcessInstanceManagementRestController.java
@@ -71,18 +71,6 @@ public class ProcessInstanceManagementRestController extends
BaseProcessInstance
return doGetProcessNodes(processId);
}
- @Override
- @PostMapping(value = "{processId}/instances/{processInstanceId}/migrate",
produces = APPLICATION_JSON_VALUE)
- public ResponseEntity migrateInstance(@PathVariable("processId") String
processId, @PathVariable("processInstanceId") String processInstanceId,
ProcessMigrationSpec migrationSpec) {
- return doMigrateInstance(processId, migrationSpec, processInstanceId);
- }
-
- @Override
- @PostMapping(value = "{processId}/migrate", produces =
APPLICATION_JSON_VALUE)
- public ResponseEntity migrateAllInstances(String processId,
ProcessMigrationSpec migrationSpec) {
- return doMigrateAllInstances(processId, migrationSpec);
- }
-
@Override
@GetMapping(value = "{processId}/instances/{processInstanceId}/error",
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getInstanceInError(@PathVariable("processId") String
processId,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]