martinweiler commented on code in PR #3403:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3403#discussion_r1516640887


##########
addons/common/persistence/jdbc/src/test/java/org/kie/persistence/jdbc/AbstractProcessInstancesIT.java:
##########
@@ -210,6 +216,62 @@ public void testUpdate() {
         assertEmpty(process.instances());
     }
 
+    @Test
+    public void testMigrateAll() throws Exception {
+        var factory = new TestProcessInstancesFactory(getDataSource(), lock());
+        BpmnProcess process = createProcess(factory, "BPMN2-UserTask.bpmn2");
+        ProcessInstance<BpmnVariables> processInstance1 = 
process.createInstance(BpmnVariables.create(Collections.singletonMap("test", 
"test")));
+        processInstance1.start();
+
+        ProcessInstance<BpmnVariables> processInstance2 = 
process.createInstance(BpmnVariables.create(Collections.singletonMap("test", 
"test")));
+        processInstance2.start();
+
+        process.instances().migrate("migrated", "2");
+
+        DataSource dataSource = getDataSource();
+        try (Connection connection = dataSource.getConnection();
+                ResultSet resultSet = 
connection.createStatement().executeQuery("SELECT process_id, process_version 
FROM process_instances")) {
+
+            while (resultSet.next()) {
+                assertEquals(resultSet.getString(1), "migrated");
+                assertEquals(resultSet.getString(2), "2");
+            }
+        }
+    }
+
+    @Test
+    public void testMigrateSingle() throws Exception {
+        var factory = new TestProcessInstancesFactory(getDataSource(), lock());
+        BpmnProcess process = createProcess(factory, "BPMN2-UserTask.bpmn2");
+        ProcessInstance<BpmnVariables> processInstance1 = 
process.createInstance(BpmnVariables.create(Collections.singletonMap("test", 
"test")));
+        processInstance1.start();
+
+        ProcessInstance<BpmnVariables> processInstance2 = 
process.createInstance(BpmnVariables.create(Collections.singletonMap("test", 
"test")));
+        processInstance2.start();
+
+        process.instances().migrate("migrated", "2", processInstance1.id());
+
+        DataSource dataSource = getDataSource();
+        try (Connection connection = dataSource.getConnection();
+                ResultSet resultSet = 
connection.createStatement().executeQuery("SELECT process_id, process_version 
FROM process_instances")) {
+
+            while (resultSet.next()) {
+                assertEquals(resultSet.getString(1), "migrated");
+                assertEquals(resultSet.getString(2), "2");
+            }
+        }
+
+        try (Connection connection = dataSource.getConnection();
+                ResultSet resultSet = 
connection.createStatement().executeQuery("SELECT process_id, process_version 
FROM process_instances WHERE id = " + processInstance2.id())) {

Review Comment:
   This query fails without wrapping the id:
   `FROM process_instances WHERE id = '" + processInstance2.id() + "'")) {`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to