新增重新加载模型测试用例

This commit is contained in:
hubin 2025-01-04 15:34:13 +08:00
parent e5c410c9cd
commit 5e34af7afb
2 changed files with 154 additions and 0 deletions

View File

@ -0,0 +1,64 @@
/*
* Copyright 2023-2025 Licensed under the Dual Licensing
* website: https://aizuda.com
*/
package test.mysql;
import com.aizuda.bpm.engine.FlowDataTransfer;
import com.aizuda.bpm.engine.core.FlowCreator;
import com.aizuda.bpm.engine.model.DynamicAssignee;
import com.aizuda.bpm.engine.model.NodeAssignee;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* 重新加载模型测试类
*
* <p>
* <a href="https://aizuda.com">官网</a>尊重知识产权不允许非法使用后果自负
* </p>
*
* @author hubin
* @since 1.0
*/
public class TestReloadProcessModel extends MysqlTest {
@BeforeEach
public void before() {
processId = this.deployByResource("test/reloadProcessModel.json", testCreator);
}
@Test
public void test() {
flowLongEngine.startInstanceById(processId, testCreator).ifPresent(instance -> {
// 作执行任务动态设置下一步节点处理人信息
this.dynamicAssigneeAndExecuteTask(instance.getId(), "flk1735880993544", test2Creator, testCreator);
this.dynamicAssigneeAndExecuteTask(instance.getId(), "flk1735881014635", test3Creator, test2Creator);
// 审核人3 执行任务
this.executeTask(instance.getId(), test3Creator);
});
}
private void dynamicAssigneeAndExecuteTask(Long instanceId, String nodeKey, FlowCreator flowCreator, FlowCreator taskCreator) {
// 传递动态分配处理人员
Map<String, Object> assigneeMap = new HashMap<>();
DynamicAssignee dynamicAssignee = DynamicAssignee.builder();
dynamicAssignee.setType(1);
NodeAssignee nodeAssignee = new NodeAssignee();
nodeAssignee.setId(flowCreator.getCreateId());
nodeAssignee.setName(flowCreator.getCreateBy());
dynamicAssignee.setAssigneeList(Collections.singletonList(nodeAssignee));
assigneeMap.put(nodeKey, dynamicAssignee);
FlowDataTransfer.dynamicAssignee(assigneeMap);
// 执行当前任务
this.executeTask(instanceId, taskCreator);
}
}

View File

@ -0,0 +1,90 @@
{
"key": "reloadProcessModel",
"name": "重新加载模型测试",
"nodeConfig": {
"nodeName": "发起人",
"nodeKey": "flk1735880971673",
"type": 0,
"childNode": {
"nodeName": "审核人1",
"nodeKey": "flk1735880973738",
"type": 1,
"setType": 1,
"nodeAssigneeList": [
{
"id": "test001",
"name": "李小广"
}
],
"examineLevel": 1,
"directorLevel": 1,
"selectMode": 1,
"termAuto": false,
"term": 0,
"termMode": 1,
"examineMode": 1,
"directorMode": 0,
"typeOfApprove": 1,
"rejectStrategy": 1,
"rejectStart": 1,
"remind": false,
"approveSelf": 0,
"childNode": {
"nodeName": "审核人2",
"nodeKey": "flk1735880993544",
"type": 1,
"setType": 1,
"nodeAssigneeList": [
{
"id": "test002",
"name": "陈小辉"
}
],
"examineLevel": 1,
"directorLevel": 1,
"selectMode": 1,
"termAuto": false,
"term": 0,
"termMode": 1,
"examineMode": 1,
"directorMode": 0,
"typeOfApprove": 1,
"rejectStrategy": 1,
"rejectStart": 1,
"remind": false,
"allowRollback": true,
"approveSelf": 0,
"childNode": {
"nodeName": "审核人3",
"nodeKey": "flk1735881014635",
"type": 1,
"setType": 1,
"nodeAssigneeList": [
{
"id": "test003",
"name": "杨小凤"
}
],
"examineLevel": 1,
"directorLevel": 1,
"selectMode": 1,
"termAuto": false,
"term": 0,
"termMode": 1,
"examineMode": 1,
"directorMode": 0,
"typeOfApprove": 1,
"rejectStrategy": 1,
"rejectStart": 1,
"remind": false,
"approveSelf": 0,
"childNode": {
"nodeName": "结束",
"nodeKey": "flk17358809716731",
"type": -1
}
}
}
}
}
}