From 22011e90126c0eb0e481fe9f1a60384a46dacba1 Mon Sep 17 00:00:00 2001 From: Tijs Rademakers Date: Mon, 13 Nov 2023 12:03:16 +0100 Subject: [PATCH] Remove wrong tests --- ...essInstanceMigrationMultiInstanceTest.java | 230 ------------------ 1 file changed, 230 deletions(-) diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/migration/ProcessInstanceMigrationMultiInstanceTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/migration/ProcessInstanceMigrationMultiInstanceTest.java index dc9e2d320f8..cae6bf48eff 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/migration/ProcessInstanceMigrationMultiInstanceTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/migration/ProcessInstanceMigrationMultiInstanceTest.java @@ -1342,127 +1342,6 @@ public void testMigrateParallelMultiInstanceTaskWithLocalVariables() { assertProcessEnded(processInstance.getId()); } - @Test - public void testMigrateParallelMultiInstanceTaskWithLocalVariablesWithMigrationMapping() { - ProcessDefinition startProcessDefinition = deployProcessDefinition("my deploy", - "org/flowable/engine/test/api/runtime/migration/parallel-multi-instance-task-local-variable.bpmn20.xml"); - - // Start the processInstance - Map variableMap = new HashMap<>(); - ArrayNode collectionArray = processEngineConfiguration.getObjectMapper().createArrayNode(); - ObjectNode element1Node = collectionArray.addObject(); - element1Node.put("name", "John Doe"); - element1Node.put("age", 30); - ObjectNode element2Node = collectionArray.addObject(); - element2Node.put("name", "Jane Doe"); - element2Node.put("age", 29); - variableMap.put("myCollection", collectionArray); - ProcessInstance processInstance = runtimeService.startProcessInstanceById(startProcessDefinition.getId(), variableMap); - - // Progress to the MI subProcess - Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); - assertThat(task).extracting(Task::getTaskDefinitionKey).isEqualTo("beforeMultiInstance"); - completeTask(task); - - // Confirm the state to migrate - List executions = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).onlyChildExecutions().list(); - // MI subProcess root execution, actual subProcess and 1 task - assertThat(executions) - .extracting(Execution::getActivityId) - .containsExactly("task", "task", "task"); - assertThat(executions) - .extracting("processDefinitionId") - .containsOnly(startProcessDefinition.getId()); - Execution miRoot = executions.stream().filter(e -> ((ExecutionEntity) e).isMultiInstanceRoot()).findFirst().get(); - Map miRootVars = runtimeService.getVariables(miRoot.getId()); - assertThat(miRootVars) - .extracting("nrOfActiveInstances", "nrOfCompletedInstances") - .containsExactly(2, 0); - List tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); - assertThat(tasks) - .extracting(Task::getTaskDefinitionKey) - .containsOnly("task"); - assertThat(tasks) - .extracting(Task::getProcessDefinitionId) - .containsOnly(startProcessDefinition.getId()); - assertThat(tasks) - .extracting(Task::getAssignee) - .containsOnly("kermit"); - List loopCounters = tasks.stream().map(aTask -> taskService.getVariable(aTask.getId(), "loopCounter", Integer.class)) - .collect(Collectors.toList()); - assertThat(loopCounters).containsExactlyInAnyOrder(0, 1); - - for (Task miTask : tasks) { - Execution execution = runtimeService.createExecutionQuery().executionId(miTask.getExecutionId()).singleResult(); - runtimeService.setVariableLocal(execution.getId(), "localVar", "test"); - taskService.setAssignee(miTask.getId(), "othervalue"); - } - - tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); - assertThat(tasks) - .extracting(Task::getAssignee) - .containsOnly("othervalue"); - - ProcessDefinition migrateToProcessDefinition = deployProcessDefinition("my deploy", - "org/flowable/engine/test/api/runtime/migration/parallel-multi-instance-task-local-variable.bpmn20.xml"); - - // Prepare and action the migration - ProcessInstanceMigrationBuilder processInstanceMigrationBuilder = processMigrationService.createProcessInstanceMigrationBuilder() - .migrateToProcessDefinition(migrateToProcessDefinition.getId()) - .addActivityMigrationMapping(ActivityMigrationMapping.createMappingFor("task", "task")); - ProcessInstanceMigrationValidationResult processInstanceMigrationValidationResult = processInstanceMigrationBuilder - .validateMigration(processInstance.getId()); - assertThat(processInstanceMigrationValidationResult.isMigrationValid()).isTrue(); - processInstanceMigrationBuilder.migrate(processInstance.getId()); - - //Confirm - executions = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).onlyChildExecutions().list(); - assertThat(executions).hasSize(3); - assertThat(executions) - .extracting(Execution::getActivityId) - .containsExactly("task", "task", "task"); - assertThat(executions) - .extracting("processDefinitionId") - .containsOnly(migrateToProcessDefinition.getId()); - - tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); - assertThat(tasks).hasSize(2); - assertThat(tasks) - .extracting(Task::getTaskDefinitionKey) - .containsOnly("task"); - assertThat(tasks) - .extracting(Task::getProcessDefinitionId) - .containsOnly(migrateToProcessDefinition.getId()); - assertThat(tasks) - .extracting(Task::getAssignee) - .containsOnly("kermit"); - loopCounters = tasks.stream().map(aTask -> taskService.getVariable(aTask.getId(), "loopCounter", Integer.class)) - .collect(Collectors.toList()); - assertThat(loopCounters).containsExactlyInAnyOrder(0, 1); - - for (Task miTask : tasks) { - Execution execution = runtimeService.createExecutionQuery().executionId(miTask.getExecutionId()).singleResult(); - assertThat(runtimeService.getVariableLocal(execution.getId(), "localVar")).isEqualTo("test"); - } - - if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) { - checkActivityInstances(migrateToProcessDefinition, processInstance, "userTask", "beforeMultiInstance", "task", "task"); - - checkTaskInstance(migrateToProcessDefinition, processInstance, "beforeMultiInstance", "task", "task", "task", "task"); - } - - // Complete the process - completeProcessInstanceTasks(processInstance.getId()); - - if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) { - checkActivityInstances(migrateToProcessDefinition, processInstance, "userTask", "beforeMultiInstance", "task", "task", "afterMultiInstance"); - - checkTaskInstance(migrateToProcessDefinition, processInstance, "beforeMultiInstance", "task", "task", "task", "task", "afterMultiInstance"); - } - - assertProcessEnded(processInstance.getId()); - } - @Test public void testMigrateParallelMultiInstanceSubProcessWithLocalVariables() { ProcessDefinition startProcessDefinition = deployProcessDefinition("my deploy", @@ -1571,115 +1450,6 @@ public void testMigrateParallelMultiInstanceSubProcessWithLocalVariables() { assertProcessEnded(processInstance.getId()); } - @Test - public void testMigrateParallelMultiInstanceSubProcessWithLocalVariablesWithMigrationMapping() { - ProcessDefinition startProcessDefinition = deployProcessDefinition("my deploy", - "org/flowable/engine/test/api/runtime/migration/parallel-multi-instance-subprocess-local-variable.bpmn20.xml"); - - // Start the processInstance - Map variableMap = new HashMap<>(); - ArrayNode collectionArray = processEngineConfiguration.getObjectMapper().createArrayNode(); - ObjectNode element1Node = collectionArray.addObject(); - element1Node.put("name", "John Doe"); - element1Node.put("age", 30); - ObjectNode element2Node = collectionArray.addObject(); - element2Node.put("name", "Jane Doe"); - element2Node.put("age", 29); - variableMap.put("myCollection", collectionArray); - ProcessInstance processInstance = runtimeService.startProcessInstanceById(startProcessDefinition.getId(), variableMap); - - // Progress to the MI subProcess - Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); - assertThat(task).extracting(Task::getTaskDefinitionKey).isEqualTo("beforeMultiInstance"); - completeTask(task); - - // Confirm the state to migrate - List executions = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).onlyChildExecutions().list(); - // MI subProcess root execution, actual subProcess and 1 task - assertThat(executions) - .extracting(Execution::getActivityId) - .containsExactly("parallelMISubProcess", "parallelMISubProcess", "parallelMISubProcess", "subTask1", "subTask1"); - assertThat(executions) - .extracting("processDefinitionId") - .containsOnly(startProcessDefinition.getId()); - Execution miRoot = executions.stream().filter(e -> ((ExecutionEntity) e).isMultiInstanceRoot()).findFirst().get(); - Map miRootVars = runtimeService.getVariables(miRoot.getId()); - assertThat(miRootVars) - .extracting("nrOfActiveInstances", "nrOfCompletedInstances") - .containsExactly(2, 0); - List tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); - assertThat(tasks) - .extracting(Task::getTaskDefinitionKey) - .containsOnly("subTask1"); - assertThat(tasks) - .extracting(Task::getProcessDefinitionId) - .containsOnly(startProcessDefinition.getId()); - List loopCounters = tasks.stream().map(aTask -> taskService.getVariable(aTask.getId(), "loopCounter", Integer.class)) - .collect(Collectors.toList()); - assertThat(loopCounters).containsExactlyInAnyOrder(0, 1); - - for (Task miTask : tasks) { - Execution execution = runtimeService.createExecutionQuery().executionId(miTask.getExecutionId()).singleResult(); - runtimeService.setVariableLocal(execution.getId(), "localVar", "test"); - } - - ProcessDefinition migrateToProcessDefinition = deployProcessDefinition("my deploy", - "org/flowable/engine/test/api/runtime/migration/parallel-multi-instance-subprocess-local-variable.bpmn20.xml"); - - // Prepare and action the migration - ProcessInstanceMigrationBuilder processInstanceMigrationBuilder = processMigrationService.createProcessInstanceMigrationBuilder() - .migrateToProcessDefinition(migrateToProcessDefinition.getId()) - .addActivityMigrationMapping(ActivityMigrationMapping.createMappingFor("subTask1", "subTask1")); - ProcessInstanceMigrationValidationResult processInstanceMigrationValidationResult = processInstanceMigrationBuilder - .validateMigration(processInstance.getId()); - assertThat(processInstanceMigrationValidationResult.isMigrationValid()).isTrue(); - processInstanceMigrationBuilder.migrate(processInstance.getId()); - - //Confirm - executions = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).onlyChildExecutions().list(); - assertThat(executions).hasSize(5); - assertThat(executions) - .extracting(Execution::getActivityId) - .containsExactly("parallelMISubProcess", "parallelMISubProcess", "parallelMISubProcess", "subTask1", "subTask1"); - assertThat(executions) - .extracting("processDefinitionId") - .containsOnly(migrateToProcessDefinition.getId()); - - tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); - assertThat(tasks).hasSize(2); - assertThat(tasks) - .extracting(Task::getTaskDefinitionKey) - .containsOnly("subTask1"); - assertThat(tasks) - .extracting(Task::getProcessDefinitionId) - .containsOnly(migrateToProcessDefinition.getId()); - loopCounters = tasks.stream().map(aTask -> taskService.getVariable(aTask.getId(), "loopCounter", Integer.class)) - .collect(Collectors.toList()); - assertThat(loopCounters).containsExactlyInAnyOrder(0, 1); - - for (Task miTask : tasks) { - Execution execution = runtimeService.createExecutionQuery().executionId(miTask.getExecutionId()).singleResult(); - assertThat(runtimeService.getVariableLocal(execution.getId(), "localVar")).isEqualTo("test"); - } - - if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) { - checkActivityInstances(migrateToProcessDefinition, processInstance, "userTask", "beforeMultiInstance", "subTask1", "subTask1", "subTask1", "subTask1"); - - checkTaskInstance(migrateToProcessDefinition, processInstance, "beforeMultiInstance", "subTask1", "subTask1", "subTask1", "subTask1"); - } - - // Complete the process - completeProcessInstanceTasks(processInstance.getId()); - - if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) { - checkActivityInstances(migrateToProcessDefinition, processInstance, "userTask", "beforeMultiInstance", "subTask1", "subTask1", "subTask1", "subTask1", "afterMultiInstance"); - - checkTaskInstance(migrateToProcessDefinition, processInstance, "beforeMultiInstance", "subTask1", "subTask1", "subTask1", "subTask1", "afterMultiInstance"); - } - - assertProcessEnded(processInstance.getId()); - } - @Test public void testMigrateParallelMultiInstanceServiceTaskWithLocalVariables() { ProcessDefinition startProcessDefinition = deployProcessDefinition("my deploy",