flowable / flowable/flowable-engine

I am in trouble when change state from 2 more branchs

Open
#2,259 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
7h 8m
Merged PRs (30d)
2

Description

when i change state from 2 more branchs that one is multi-instance and other is plain usertask to a before usertask, now the before usertask have 2+ task instance. Is this a bug or its the right way?

![Snipaste_2020-06-08_11-52-47](https://user-images.githubusercontent.com/17521668/83997509-22f42880-a991-11ea-89e4-ddd115d205cb.jpg)

The ChangeActivityStateBuilder#moveActivityIdsToSingleActivityId works well if there is no multi-instance in process like above. And i do some tests using flowable-engine test case through 6.4.* and 6.5.0 ,

**Code**
**1. process for test**
*file name is multiInstanceParallel-lzh.bpmn20.xml*
```xml






${nrOfLoops}








```

**2 here is the origin task case i modified a bit**
`org.flowable.engine.test.api.runtime.changestate.ChangeStateForMultiInstanceTest#testSetCurrentActivityOfParallelMultiInstanceTask`

```java
@Test
@Deployment(resources = "org/flowable/engine/test/api/multiInstanceParallel-lzh.bpmn20.xml")
public void testSetCurrentActivityOfParallelMultiInstanceTask() {
ProcessInstance processInstance = runtimeService.createProcessInstanceBuilder().processDefinitionKey("parallelMultiInstance")
.variable("nrOfLoops", 3)
.start();

completeTask(taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult());

List parallelExecutions = runtimeService.createExecutionQuery()
.processInstanceId(processInstance.getId())
.onlyChildExecutions().list();
assertEquals(6, parallelExecutions.size());
List activeParallelTasks = taskService.createTaskQuery()
.taskDefinitionKey("parallelTasks")
.processInstanceId(processInstance.getId()).active().list();
assertEquals(3, activeParallelTasks.size());

runtimeService.createChangeActivityStateBuilder()
.processInstanceId(processInstance.getId())
.moveActivityIdsToSingleActivityId(
Arrays.asList("parallelTasks","branchTask","branchTask2"), "beforeMultiInstance")
.changeState();
List tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
assertEquals(1,tasks.size()); // here i got 2
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.