mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
enhancement #I8SMQB BREAK、IF、WHILE组件统一变成布尔组件
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
package com.yomahub.liteflow.annotation;
|
||||
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
import com.yomahub.liteflow.enums.NodeTypeEnum;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
@@ -22,5 +19,4 @@ import java.lang.annotation.Target;
|
||||
@Inherited
|
||||
public @interface FallbackCmp {
|
||||
|
||||
BooleanTypeEnum value() default BooleanTypeEnum.NOT_BOOL;
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.yomahub.liteflow.enums;
|
||||
|
||||
/**
|
||||
* 布尔节点的细分TYPE
|
||||
* 主要用于组件降级
|
||||
*
|
||||
* @author Bryan.Zhang
|
||||
* @since 2.12.0
|
||||
*/
|
||||
public enum BooleanTypeEnum {
|
||||
|
||||
NOT_BOOL,IF,WHILE,BREAK
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import com.yomahub.liteflow.core.ComponentInitializer;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.ScriptComponent;
|
||||
import com.yomahub.liteflow.core.proxy.DeclWarpBean;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
import com.yomahub.liteflow.enums.FlowParserTypeEnum;
|
||||
import com.yomahub.liteflow.enums.NodeTypeEnum;
|
||||
import com.yomahub.liteflow.exception.ComponentCannotRegisterException;
|
||||
@@ -261,12 +260,8 @@ public class FlowBus {
|
||||
return chainMap;
|
||||
}
|
||||
|
||||
public static Node getFallBackNode(NodeTypeEnum nodeType) {
|
||||
return getFallBackNode(nodeType, BooleanTypeEnum.NOT_BOOL);
|
||||
}
|
||||
|
||||
public static Node getFallBackNode(NodeTypeEnum nodeType, BooleanTypeEnum booleanTypeEnum){
|
||||
String key = StrUtil.format("{}_{}", nodeType.name(), booleanTypeEnum.name());
|
||||
public static Node getFallBackNode(NodeTypeEnum nodeType){
|
||||
String key = StrUtil.format("FB_{}", nodeType.name());
|
||||
return fallbackNodeMap.get(key);
|
||||
}
|
||||
|
||||
@@ -328,7 +323,7 @@ public class FlowBus {
|
||||
}
|
||||
|
||||
NodeTypeEnum nodeType = node.getType();
|
||||
String key = StrUtil.format("{}_{}", nodeType.name(), fallbackCmp.value().name());
|
||||
String key = StrUtil.format("FB_{}", nodeType.name());
|
||||
fallbackNodeMap.put(key, node);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.yomahub.liteflow.flow.element;
|
||||
import cn.hutool.core.text.StrFormatter;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
import com.yomahub.liteflow.enums.ConditionTypeEnum;
|
||||
import com.yomahub.liteflow.enums.NodeTypeEnum;
|
||||
import com.yomahub.liteflow.exception.FallbackCmpNotFoundException;
|
||||
@@ -91,7 +90,7 @@ public class FallbackNode extends Node {
|
||||
case TYPE_NOT_OPT:
|
||||
case TYPE_AND_OR_OPT:
|
||||
//组件降级用在与并或中,只能用在IF表达式中
|
||||
return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN, BooleanTypeEnum.IF);
|
||||
return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -101,7 +100,7 @@ public class FallbackNode extends Node {
|
||||
Executable ifItem = ifCondition.getIfItem();
|
||||
if (ifItem == this) {
|
||||
// 需要条件组件
|
||||
return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN, BooleanTypeEnum.IF);
|
||||
return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN);
|
||||
}
|
||||
|
||||
// 需要普通组件
|
||||
@@ -129,7 +128,7 @@ public class FallbackNode extends Node {
|
||||
private Node findNodeInWhile(WhileCondition whileCondition) {
|
||||
Executable whileItem = whileCondition.getWhileItem();
|
||||
if (whileItem == this) {
|
||||
return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN, BooleanTypeEnum.WHILE);
|
||||
return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN);
|
||||
}
|
||||
|
||||
return findNodeInLoop(whileCondition);
|
||||
@@ -147,7 +146,7 @@ public class FallbackNode extends Node {
|
||||
private Node findNodeInLoop(LoopCondition loopCondition) {
|
||||
Executable breakItem = loopCondition.getExecutableOne(ConditionKey.BREAK_KEY);
|
||||
if (breakItem == this) {
|
||||
return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN, BooleanTypeEnum.BREAK);
|
||||
return FlowBus.getFallBackNode(NodeTypeEnum.BOOLEAN);
|
||||
}
|
||||
|
||||
return FlowBus.getFallBackNode(NodeTypeEnum.COMMON);
|
||||
|
||||
@@ -5,13 +5,12 @@ import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.enums.NodeTypeEnum;
|
||||
|
||||
@LiteflowComponent("bn1")
|
||||
@LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
|
||||
@FallbackCmp(BooleanTypeEnum.BREAK)
|
||||
@FallbackCmp
|
||||
public class BreakCmp {
|
||||
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN)
|
||||
|
||||
@@ -5,13 +5,12 @@ import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.enums.NodeTypeEnum;
|
||||
|
||||
@LiteflowComponent("ifn2")
|
||||
@LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
|
||||
@FallbackCmp(BooleanTypeEnum.IF)
|
||||
@FallbackCmp
|
||||
public class IfCmp2 {
|
||||
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN)
|
||||
|
||||
@@ -5,13 +5,12 @@ import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.enums.NodeTypeEnum;
|
||||
|
||||
@LiteflowComponent("wn2")
|
||||
@LiteflowCmpDefine(NodeTypeEnum.BOOLEAN)
|
||||
@FallbackCmp(BooleanTypeEnum.WHILE)
|
||||
@FallbackCmp
|
||||
public class WhileCmp2 {
|
||||
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN)
|
||||
|
||||
@@ -2,9 +2,8 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@FallbackCmp(BooleanTypeEnum.BREAK)
|
||||
@FallbackCmp
|
||||
public class BreakCmp extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,9 +2,8 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@FallbackCmp(BooleanTypeEnum.IF)
|
||||
@FallbackCmp
|
||||
public class IfCmp2 extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,9 +2,8 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@FallbackCmp(BooleanTypeEnum.WHILE)
|
||||
@FallbackCmp
|
||||
public class WhileCmp2 extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,10 +3,9 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@LiteflowComponent("bn1")
|
||||
@FallbackCmp(BooleanTypeEnum.BREAK)
|
||||
@FallbackCmp
|
||||
public class BreakCmp extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,10 +3,9 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@LiteflowComponent("ifn2")
|
||||
@FallbackCmp(BooleanTypeEnum.IF)
|
||||
@FallbackCmp
|
||||
public class IfCmp2 extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,10 +3,9 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@LiteflowComponent("wn2")
|
||||
@FallbackCmp(BooleanTypeEnum.WHILE)
|
||||
@FallbackCmp
|
||||
public class WhileCmp2 extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,14 +36,14 @@ public class FallbackELSpringbootTest extends BaseTest {
|
||||
public void testThen1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("then1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>c", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("a==>fb_comm_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThen2() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("then2", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("c==>c==>c", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_comm_cmp==>fb_comm_cmp==>fb_comm_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -51,147 +51,112 @@ public class FallbackELSpringbootTest extends BaseTest {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("when1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
String executeStepStr = response.getExecuteStepStrWithoutTime();
|
||||
Assertions.assertTrue("b==>c".equals(executeStepStr) || "c==>b".equals(executeStepStr));
|
||||
Assertions.assertTrue("b==>fb_comm_cmp".equals(executeStepStr) || "fb_comm_cmp==>b".equals(executeStepStr));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIf1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("if1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("ifn2", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_bool_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIf2() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("if2", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("ifn1==>c", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("ifn1==>fb_comm_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFor1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("for1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("for1==>a==>a==>a", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_for_cmp==>a==>a==>a", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFor2() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("for2", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("LOOP_3==>c==>c==>c", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("LOOP_3==>fb_comm_cmp==>fb_comm_cmp==>fb_comm_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWhile1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("while1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("wn2", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWhile2() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("while2", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("wn1==>c==>wn1==>c==>wn1==>c==>wn1", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_bool_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIterator1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("iterator1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("itn2", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIterator2() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("iterator2", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("itn1==>c==>c==>c", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_iter_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBreak1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("break1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("LOOP_3==>a==>bn1", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBreak2() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("break2", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("wn1==>a==>bn1", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBreak3() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("break3", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("itn1==>a==>bn1", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("LOOP_3==>a==>fb_bool_cmp==>a==>fb_bool_cmp==>a==>fb_bool_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSwitch1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("switch1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("swn2==>b", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSwitch2() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("switch2", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("swn1==>a", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_sw_cmp==>b", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnd1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("and1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("ifn2", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_bool_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOr1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("or1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("ifn2==>ifn1==>a", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_bool_cmp==>ifn1==>a", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNot1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("not1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("ifn2==>a", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_bool_cmp==>a", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCatch1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("catch1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>d==>c", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("a==>d==>fb_comm_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMulti1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("multi1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>c==>ifn2", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("a==>fb_comm_cmp==>fb_bool_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMulti2() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("multi2", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("ifn2==>ifn1==>a==>c", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_bool_cmp==>ifn1==>a==>fb_comm_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMulti3() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("multi3", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("for1==>b==>c==>b==>c==>b==>c", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("fb_for_cmp==>b==>fb_comm_cmp==>b==>fb_comm_cmp==>b==>fb_comm_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -199,7 +164,7 @@ public class FallbackELSpringbootTest extends BaseTest {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("concurrent1", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
String stepStr = response.getExecuteStepStrWithoutTime();
|
||||
Assertions.assertTrue("c==>ifn2".equals(stepStr) || "ifn2==>c".equals(stepStr));
|
||||
Assertions.assertTrue("fb_comm_cmp==>fb_bool_cmp".equals(stepStr) || "fb_bool_cmp==>fb_comm_cmp".equals(stepStr));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -207,7 +172,7 @@ public class FallbackELSpringbootTest extends BaseTest {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("concurrent2", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
String stepStr = response.getExecuteStepStrWithoutTime();
|
||||
Assertions.assertTrue("c==>ifn2".equals(stepStr) || "ifn2==>c".equals(stepStr));
|
||||
Assertions.assertTrue("fb_comm_cmp==>fb_bool_cmp".equals(stepStr) || "ifn2==>c".equals(stepStr));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -220,10 +185,10 @@ public class FallbackELSpringbootTest extends BaseTest {
|
||||
LiteflowResponse response2 = future2.get();
|
||||
Assertions.assertTrue(response1.isSuccess());
|
||||
String stepStr1 = response1.getExecuteStepStrWithoutTime();
|
||||
Assertions.assertTrue("c==>ifn2".equals(stepStr1) || "ifn2==>c".equals(stepStr1));
|
||||
Assertions.assertTrue("fb_comm_cmp==>fb_bool_cmp".equals(stepStr1) || "fb_bool_cmp==>fb_comm_cmp".equals(stepStr1));
|
||||
Assertions.assertTrue(response2.isSuccess());
|
||||
String stepStr2 = response2.getExecuteStepStrWithoutTime();
|
||||
Assertions.assertTrue("c==>ifn2".equals(stepStr2) || "ifn2==>c".equals(stepStr2));
|
||||
Assertions.assertTrue("fb_comm_cmp==>fb_bool_cmp".equals(stepStr2) || "fb_bool_cmp==>fb_comm_cmp".equals(stepStr2));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -232,6 +197,6 @@ public class FallbackELSpringbootTest extends BaseTest {
|
||||
LiteFlowChainELBuilder.createChain().setChainId("elBuilder").setEL(el.toEL()).build();
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("elBuilder");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>b==>c", response.getExecuteStepStrWithoutTime());
|
||||
Assertions.assertEquals("a==>b==>fb_comm_cmp", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,10 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@LiteflowComponent("ifn2")
|
||||
@FallbackCmp(BooleanTypeEnum.IF)
|
||||
public class IfCmp2 extends NodeBooleanComponent {
|
||||
@LiteflowComponent("fb_bool_cmp")
|
||||
@FallbackCmp
|
||||
public class BooleanFBCmp extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
public boolean processBoolean() throws Exception {
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.yomahub.liteflow.test.fallback.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@LiteflowComponent("bn1")
|
||||
@FallbackCmp(BooleanTypeEnum.BREAK)
|
||||
public class BreakCmp extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
public boolean processBoolean() throws Exception {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,10 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.slot.DefaultContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@LiteflowComponent("c")
|
||||
@LiteflowComponent("fb_comm_cmp")
|
||||
@FallbackCmp
|
||||
public class CCmp extends NodeComponent {
|
||||
public class CommonFBCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
@@ -4,9 +4,9 @@ import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeForComponent;
|
||||
|
||||
@LiteflowComponent("for1")
|
||||
@LiteflowComponent("fb_for_cmp")
|
||||
@FallbackCmp
|
||||
public class ForCmp extends NodeForComponent {
|
||||
public class ForFBCmp extends NodeForComponent {
|
||||
|
||||
@Override
|
||||
public int processFor() throws Exception {
|
||||
@@ -7,9 +7,9 @@ import com.yomahub.liteflow.core.NodeIteratorComponent;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
@LiteflowComponent("itn2")
|
||||
@LiteflowComponent("fb_iter_cmp")
|
||||
@FallbackCmp
|
||||
public class IteratorCmp2 extends NodeIteratorComponent {
|
||||
public class IterFBCmp extends NodeIteratorComponent {
|
||||
|
||||
@Override
|
||||
public Iterator<?> processIterator() throws Exception {
|
||||
@@ -4,9 +4,9 @@ import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeSwitchComponent;
|
||||
|
||||
@LiteflowComponent("swn2")
|
||||
@LiteflowComponent("fb_sw_cmp")
|
||||
@FallbackCmp
|
||||
public class SwitchCmp2 extends NodeSwitchComponent {
|
||||
public class SwFBCmp extends NodeSwitchComponent {
|
||||
|
||||
@Override
|
||||
public String processSwitch() throws Exception {
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.yomahub.liteflow.test.fallback.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@LiteflowComponent("wn2")
|
||||
@FallbackCmp(BooleanTypeEnum.WHILE)
|
||||
public class WhileCmp2 extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
public boolean processBoolean() throws Exception {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -39,44 +39,21 @@
|
||||
WHILE(node("x")).DO(a)
|
||||
</chain>
|
||||
|
||||
<!-- WHILE 普通组件降级 -->
|
||||
<chain name="while2">
|
||||
WHILE(wn1).DO(node("x"))
|
||||
</chain>
|
||||
|
||||
<!-- ITERATOR 迭代组件降级 -->
|
||||
<chain name="iterator1">
|
||||
ITERATOR(node("x")).DO(a)
|
||||
</chain>
|
||||
|
||||
<!-- ITERATOR 普通组件降级 -->
|
||||
<chain name="iterator2">
|
||||
ITERATOR(itn1).DO(node("x"))
|
||||
</chain>
|
||||
|
||||
<!-- BREAK 退出循环组件降级 -->
|
||||
<chain name="break1">
|
||||
FOR(3).DO(a).BREAK(node("x"));
|
||||
</chain>
|
||||
|
||||
<chain name="break2">
|
||||
WHILE(wn1).DO(a).BREAK(node("x"));
|
||||
</chain>
|
||||
|
||||
<chain name="break3">
|
||||
ITERATOR(itn1).DO(a).BREAK(node("x"));
|
||||
</chain>
|
||||
|
||||
<!-- SWITCH 选择组件降级 -->
|
||||
<chain name="switch1">
|
||||
SWITCH(node("x")).to(a,b);
|
||||
</chain>
|
||||
|
||||
<!-- SWITCH 普通组件降级 -->
|
||||
<chain name="switch2">
|
||||
SWITCH(swn1).to(node("x"),a);
|
||||
</chain>
|
||||
|
||||
<!-- AND 条件组件降级 -->
|
||||
<chain name="and1">
|
||||
IF(AND(node("x"),ifn1), a);
|
||||
|
||||
@@ -3,10 +3,9 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@LiteflowComponent("bn1")
|
||||
@FallbackCmp(BooleanTypeEnum.BREAK)
|
||||
@FallbackCmp
|
||||
public class BreakCmp extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,10 +3,9 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@LiteflowComponent("ifn2")
|
||||
@FallbackCmp(BooleanTypeEnum.IF)
|
||||
@FallbackCmp
|
||||
public class IfCmp2 extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,10 +3,9 @@ package com.yomahub.liteflow.test.fallback.cmp;
|
||||
import com.yomahub.liteflow.annotation.FallbackCmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import com.yomahub.liteflow.enums.BooleanTypeEnum;
|
||||
|
||||
@LiteflowComponent("wn2")
|
||||
@FallbackCmp(BooleanTypeEnum.WHILE)
|
||||
@FallbackCmp
|
||||
public class WhileCmp2 extends NodeBooleanComponent {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user