Parcourir la source

增加switch的测试用例

everywhere.z il y a 2 ans
Parent
commit
78b95b7a40

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

@@ -92,4 +92,12 @@ public class SwitchELSpringbootTest extends BaseTest {
         Assert.assertEquals("a==>j==>d",response.getExecuteStepStr());
     }
 
+    //测试跳转到某个链路上
+    @Test
+    public void testSwitch9() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain9", "arg");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("k==>a==>b",response.getExecuteStepStr());
+    }
+
 }

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

@@ -0,0 +1,20 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Tingliang Wang
+ * @email bytlwang@126.com
+ * @Date 2022/12/09
+ */
+package com.yomahub.liteflow.test.switchcase.cmp;
+
+import com.yomahub.liteflow.core.NodeSwitchComponent;
+import org.springframework.stereotype.Component;
+
+@Component("k")
+public class KSwitchCmp extends NodeSwitchComponent {
+
+	@Override
+	public String processSwitch() throws Exception {
+		return "chain10";
+	}
+}

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

@@ -56,4 +56,12 @@
         SWITCH(j).to(b, c).DEFAULT(d)
         );
     </chain>
+
+    <chain name="chain9">
+        SWITCH(k).TO(a, chain10);
+    </chain>
+
+    <chain name="chain10">
+        THEN(a, b);
+    </chain>
 </flow>