1
0
Эх сурвалжийг харах

增加switch的一个测试用例

everywhere.z 2 жил өмнө
parent
commit
15ed9b8912

+ 7 - 0
liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/switchcase/SwitchELSpringbootTest.java

@@ -100,4 +100,11 @@ public class SwitchELSpringbootTest extends BaseTest {
         Assert.assertEquals("k==>a==>b",response.getExecuteStepStr());
         Assert.assertEquals("k==>a==>b",response.getExecuteStepStr());
     }
     }
 
 
+    //相同组件复用的用例
+    @Test
+    public void testSwitch10() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain11", "arg");
+        Assert.assertTrue(response.isSuccess());
+    }
+
 }
 }

+ 1 - 0
liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/switchcase/cmp/ACmp.java

@@ -16,5 +16,6 @@ public class ACmp extends NodeComponent {
 	@Override
 	@Override
 	public void process() {
 	public void process() {
 		System.out.println("ACmp executed!");
 		System.out.println("ACmp executed!");
+		System.out.println(this.getTag());
 	}
 	}
 }
 }

+ 14 - 0
liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/switchcase/cmp/LSwitchCmp.java

@@ -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);
+    }
+}

+ 7 - 0
liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/switchcase/flow.el.xml

@@ -64,4 +64,11 @@
     <chain name="chain10">
     <chain name="chain10">
         THEN(a, b);
         THEN(a, b);
     </chain>
     </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>
 </flow>