forked from aizuda/flowlong
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e467e9b
commit 22e0ff4
Showing
6 changed files
with
174 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
flowlong-spring-boot-starter/src/test/java/test/mysql/TestParalleSubProcess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright 2023-2025 Licensed under the AGPL License | ||
*/ | ||
package test.mysql; | ||
|
||
import com.aizuda.bpm.engine.ProcessService; | ||
import com.aizuda.bpm.engine.assist.Assert; | ||
import com.aizuda.bpm.engine.core.FlowCreator; | ||
import com.aizuda.bpm.engine.entity.FlwProcess; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* 测试子流程 | ||
* | ||
* @author xdg | ||
*/ | ||
public class TestParalleSubProcess extends MysqlTest { | ||
|
||
@BeforeEach | ||
public void before() { | ||
processId = this.deployByResource("test/parallelSubProcess.json", getFlowCreator()); | ||
|
||
// 部署子流程 | ||
this.deployByResource("test/workHandover.json", getFlowCreator()); | ||
} | ||
|
||
@Test | ||
public void testProcess() { | ||
ProcessService processService = flowLongEngine.processService(); | ||
|
||
// 根据流程定义ID查询 | ||
FlwProcess process = processService.getProcessById(processId); | ||
if (null != process) { | ||
// 根据流程定义ID和版本号查询 | ||
Assertions.assertNotNull(processService.getProcessByVersion(process.getTenantId(), process.getProcessKey(), process.getProcessVersion())); | ||
} | ||
|
||
// 启动指定流程定义ID启动流程实例 | ||
FlowCreator flowCreator = this.getFlowCreator(); | ||
// 发起,执行条件路由 | ||
// 启动指定流程定义ID启动流程实例 | ||
flowLongEngine.startInstanceById(processId, testCreator).ifPresent(instance -> { | ||
this.executeTaskByKey(instance.getId(), test2Creator, "k003"); | ||
// 找到子流程并执行【接收工作任务】完成启动父流程执行结束 | ||
flowLongEngine.queryService().getHisTasksByInstanceId(instance.getId()).ifPresent(flwHisTasks -> flwHisTasks.forEach(flwHisTask -> { | ||
if (null != flwHisTask.getCallInstanceId()) { | ||
this.executeActiveTasks(flwHisTask.getCallInstanceId(), test3Creator); | ||
} | ||
})); | ||
this.executeTaskByKey(instance.getId(), test2Creator,"k005"); | ||
}); | ||
|
||
// 卸载指定的定义流程 | ||
// Assertions.assertTrue(processService.undeploy(processId)); | ||
} | ||
|
||
|
||
public FlowCreator getFlowCreator() { | ||
return testCreator; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
flowlong-spring-boot-starter/src/test/resources/test/parallelSubProcess.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"id":10, | ||
"key":"parallelNodes", | ||
"name":"请假审批", | ||
"nodeConfig":{ | ||
"nodeName":"发起人", | ||
"nodeKey":"k001", | ||
"type":0, | ||
"nodeAssigneeList":[ ], | ||
"childNode":{ | ||
"nodeName":"并行路由", | ||
"type":8, | ||
"nodeKey":"k002", | ||
"conditionNodes":[ ], | ||
"parallelNodes":[ | ||
{ | ||
"nodeName":"领导审批", | ||
"type":1, | ||
"setType":1, | ||
"nodeKey":"k003", | ||
"nodeAssigneeList":[ | ||
{ | ||
"id":"test002", | ||
"name":"测试2" | ||
} | ||
], | ||
"examineLevel":1, | ||
"directorLevel":1, | ||
"selectMode":1, | ||
"termAuto":false, | ||
"term":0, | ||
"termMode":1, | ||
"examineMode":1, | ||
"directorMode":0 | ||
}, | ||
{ | ||
"nodeName":"工作交接", | ||
"nodeKey":"k007", | ||
"type":5, | ||
"callProcess":"workHandover" | ||
} | ||
], | ||
"childNode":{ | ||
"nodeName":"最后审批", | ||
"type":1, | ||
"setType":1, | ||
"nodeKey":"k005", | ||
"nodeAssigneeList":[ | ||
{ | ||
"id":"test002", | ||
"name":"测试2" | ||
} | ||
], | ||
"examineLevel":1, | ||
"directorLevel":1, | ||
"selectMode":1, | ||
"termAuto":false, | ||
"term":0, | ||
"termMode":1, | ||
"examineMode":1, | ||
"directorMode":0 | ||
} | ||
} | ||
} | ||
} |