@@ -100,4 +100,11 @@ public class SwitchELSpringbootTest extends BaseTest {
Assert.assertEquals("k==>a==>b",response.getExecuteStepStr());
}
+ //相同组件复用的用例
+ @Test
+ public void testSwitch10() throws Exception{
+ LiteflowResponse response = flowExecutor.execute2Resp("chain11", "arg");
+ Assert.assertTrue(response.isSuccess());
+ }
+
@@ -16,5 +16,6 @@ public class ACmp extends NodeComponent {
@Override
public void process() {
System.out.println("ACmp executed!");
+ System.out.println(this.getTag());
@@ -0,0 +1,14 @@
+package com.yomahub.liteflow.test.switchcase.cmp;
+import cn.hutool.core.util.StrUtil;
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeSwitchComponent;
+@LiteflowComponent("l")
+public class LSwitchCmp extends NodeSwitchComponent {
+ @Override
+ public String processSwitch() throws Exception {
+ String tag = this.getTag();
+ return StrUtil.format("tag:{}",tag);
+}
@@ -64,4 +64,11 @@
<chain name="chain10">
THEN(a, b);
</chain>
+ <chain name="chain11">
+ THEN(
+ SWITCH(l.tag("node_2")).TO(a.tag("node_1"), a.tag("node_2")),
+ SWITCH(l.tag("node_3")).TO(a.tag("node_3"), a.tag("node_4"))
+ );
+ </chain>
</flow>