mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
bug #I49EHH setIsEnd设计的不合理性
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package com.yomahub.liteflow.core;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
@@ -297,13 +298,15 @@ public class FlowExecutor {
|
||||
return this.execute2Resp(chainId, param, slotClazz, null, false);
|
||||
}
|
||||
|
||||
private final ArrayList<Class<? extends Exception>> notFailExceptionList = ListUtil.toList(ChainEndException.class);
|
||||
|
||||
public <T extends Slot> LiteflowResponse<T> execute2Resp(String chainId, Object param, Class<T> slotClazz, Integer slotIndex,
|
||||
boolean isInnerChain) {
|
||||
LiteflowResponse<T> response = new LiteflowResponse<>();
|
||||
|
||||
T slot = doExecute(chainId, param, slotClazz, slotIndex, isInnerChain);
|
||||
|
||||
if (ObjectUtil.isNotNull(slot.getException())) {
|
||||
if (ObjectUtil.isNotNull(slot.getException()) && !notFailExceptionList.contains(slot.getException().getClass())) {
|
||||
response.setSuccess(false);
|
||||
response.setMessage(slot.getException().getMessage());
|
||||
response.setCause(slot.getException());
|
||||
|
||||
@@ -63,19 +63,19 @@ public class FlowExecutorTest extends BaseTest {
|
||||
}
|
||||
|
||||
//isEnd方法的功能点测试
|
||||
@Test(expected = ChainEndException.class)
|
||||
@Test
|
||||
public void testIsEnd() throws Exception {
|
||||
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain4", 10);
|
||||
Assert.assertFalse(response.isSuccess());
|
||||
ReflectionUtils.rethrowException(response.getCause());
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
Assert.assertEquals("d",response.getSlot().printStep());
|
||||
}
|
||||
|
||||
//setIsEnd方法的功能点测试
|
||||
@Test(expected = ChainEndException.class)
|
||||
@Test
|
||||
public void testSetIsEnd() throws Exception {
|
||||
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain5", 10);
|
||||
Assert.assertFalse(response.isSuccess());
|
||||
ReflectionUtils.rethrowException(response.getCause());
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
Assert.assertEquals("e",response.getSlot().printStep());
|
||||
}
|
||||
|
||||
//条件组件的功能点测试
|
||||
|
||||
Reference in New Issue
Block a user