diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainJsonELSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainJsonELSpringBootTest.java index 47856b191..63d25911c 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainJsonELSpringBootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainJsonELSpringBootTest.java @@ -28,10 +28,26 @@ public class AbstractChainJsonELSpringBootTest extends BaseTest { // 是否按照流程定义配置执行 @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("implA", "it's a request"); + public void test1() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("implA", "arg"); Assertions.assertTrue(response.isSuccess()); Assertions.assertEquals("a==>b==>c==>d==>f==>j", response.getExecuteStepStrWithoutTime()); } + //测试嵌套继承的baseChain是否重复解析 + @Test + public void test2() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("implB", "arg"); + Assertions.assertTrue(response.isSuccess()); + Assertions.assertEquals("a==>b==>a==>b==>a==>b==>f==>j", response.getExecuteStepStrWithoutTime()); + } + + //测试嵌套继承的baseChain是否重复解析 + @Test + public void test3() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("implC", "arg"); + Assertions.assertTrue(response.isSuccess()); + Assertions.assertEquals("a==>b==>a==>b==>a==>b==>f==>a==>b", response.getExecuteStepStrWithoutTime()); + } + } diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainXMLELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainXmlELSpringbootTest.java similarity index 93% rename from liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainXMLELSpringbootTest.java rename to liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainXmlELSpringbootTest.java index 099436baf..efc11bec2 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainXMLELSpringbootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainXmlELSpringbootTest.java @@ -18,10 +18,10 @@ import javax.annotation.Resource; * @author Bryan.Zhang */ @TestPropertySource(value = "classpath:/abstractChain/application.properties") -@SpringBootTest(classes = AbstractChainXMLELSpringbootTest.class) +@SpringBootTest(classes = AbstractChainXmlELSpringbootTest.class) @EnableAutoConfiguration @ComponentScan({ "com.yomahub.liteflow.test.abstractChain.cmp" }) -public class AbstractChainXMLELSpringbootTest extends BaseTest { +public class AbstractChainXmlELSpringbootTest extends BaseTest { @Resource private FlowExecutor flowExecutor; diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainYmlELSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainYmlELSpringBootTest.java new file mode 100644 index 000000000..b6fb89330 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/abstractChain/AbstractChainYmlELSpringBootTest.java @@ -0,0 +1,54 @@ +package com.yomahub.liteflow.test.abstractChain; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.test.context.TestPropertySource; + +import javax.annotation.Resource; + +/** + * 测试显示调用子流程(yml) 单元测试 + * + * @author justin.xu + */ +@TestPropertySource(value = "classpath:/abstractChain/application-yml.properties") +@SpringBootTest(classes = AbstractChainYmlELSpringBootTest.class) +@EnableAutoConfiguration +@ComponentScan({ "com.yomahub.liteflow.test.abstractChain.cmp" }) +public class AbstractChainYmlELSpringBootTest extends BaseTest { + + @Resource + private FlowExecutor flowExecutor; + + // 是否按照流程定义配置执行 + // XML文件基本继承测试 + @Test + public void test1() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("implA", "arg"); + Assertions.assertTrue(response.isSuccess()); + Assertions.assertEquals("a==>b==>c==>d==>f==>j", response.getExecuteStepStrWithoutTime()); + } + + //测试嵌套继承的baseChain是否重复解析 + @Test + public void test2() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("implB", "arg"); + Assertions.assertTrue(response.isSuccess()); + Assertions.assertEquals("a==>b==>a==>b==>a==>b==>f==>j", response.getExecuteStepStrWithoutTime()); + } + + //测试嵌套继承的baseChain是否重复解析 + @Test + public void test3() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("implC", "arg"); + Assertions.assertTrue(response.isSuccess()); + Assertions.assertEquals("a==>b==>a==>b==>a==>b==>f==>a==>b", response.getExecuteStepStrWithoutTime()); + } + +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/application-yml.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/application-yml.properties new file mode 100644 index 000000000..e3b9c04c9 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/application-yml.properties @@ -0,0 +1 @@ +liteflow.rule-source=abstractChain/flow.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.json b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.json index 759672bb7..453bda2d9 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.json +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.json @@ -2,14 +2,30 @@ "flow": { "chain": [ { - "name": "base", + "id": "implB", + "extends": "base2", + "value": "{3}=THEN(a,b);\n {4}=j;" + }, + { + "id": "implC", + "extends": "base2", + "value": "{3}=THEN(a,b);\n {4}=THEN(a,b).id(\"j\");" + }, + { + "id": "base", "abstract": true, "value": "THEN(a, b, {0}, {1});" }, { - "name": "implA", + "id": "implA", "extends": "base", "value": "{0}=IF(c, d, e);\n {1}=SWITCH(f).to(j,k);" + }, + { + "id": "base2", + "extends": "base", + "abstract": true, + "value": "{0}=THEN(a,b,{3});\n {1}=SWITCH(f).to({4},k);" } ] } diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.xml index 2cfe33ef4..1994b64c5 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.xml +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.xml @@ -10,7 +10,7 @@ {4}=THEN(a,b).id("j"); - + THEN(a, b, {0}, {1}) diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.yml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.yml new file mode 100644 index 000000000..b79e458fe --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.yml @@ -0,0 +1,18 @@ +flow: + chain: + - id: implB + extends: base2 + value: "{3}=THEN(a,b);\n {4}=j;" + - id: implC + extends: base2 + value: "{3}=THEN(a,b);\n {4}=THEN(a,b).id(\"j\");" + - id: base + abstract: true + value: "THEN(a, b, {0}, {1});" + - id: implA + extends: base + value: "{0}=IF(c, d, e);\n {1}=SWITCH(f).to(j,k);" + - id: base2 + extends: base + abstract: true + value: "{0}=THEN(a,b,{3});\n {1}=SWITCH(f).to({4},k);"