diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/ParentDeclMultiSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/ParentDeclMultiSpringbootTest.java new file mode 100644 index 000000000..6d48560dd --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/ParentDeclMultiSpringbootTest.java @@ -0,0 +1,38 @@ +package com.yomahub.liteflow.test.parent; + +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.junit.jupiter.api.extension.ExtendWith; +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 org.springframework.test.context.junit.jupiter.SpringExtension; + +import javax.annotation.Resource; + +/** + * springboot环境最普通的例子测试 + * + * @author Bryan.Zhang + * @since 2.6.4 + */ +@ExtendWith(SpringExtension.class) +@TestPropertySource(value = "classpath:/parent/application.properties") +@SpringBootTest(classes = ParentDeclMultiSpringbootTest.class) +@EnableAutoConfiguration +@ComponentScan({ "com.yomahub.liteflow.test.parent.cmp" }) +public class ParentDeclMultiSpringbootTest extends BaseTest { + + @Resource + private FlowExecutor flowExecutor; + + @Test + public void testBase1() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); + Assertions.assertTrue(response.isSuccess()); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/cmp/CmpConfig.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/cmp/CmpConfig.java new file mode 100644 index 000000000..ef686a6b5 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/cmp/CmpConfig.java @@ -0,0 +1,31 @@ +package com.yomahub.liteflow.test.parent.cmp; + +import com.yomahub.liteflow.annotation.LiteflowComponent; +import com.yomahub.liteflow.annotation.LiteflowMethod; +import com.yomahub.liteflow.core.NodeComponent; +import com.yomahub.liteflow.enums.LiteFlowMethodEnum; +import com.yomahub.liteflow.test.base.cmp.TestDomain; + +import javax.annotation.Resource; + +@LiteflowComponent +public class CmpConfig extends ParentClass{ + + @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "a") + public void processA(NodeComponent bindCmp) { + this.setName("jack"); + System.out.println(this.sayHi()); + } + + @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "b") + public void processB(NodeComponent bindCmp) { + this.setName("tom"); + System.out.println(this.sayHi()); + } + + @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "c") + public void processC(NodeComponent bindCmp) { + this.setName("jerry"); + System.out.println(this.sayHi()); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/cmp/ParentClass.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/cmp/ParentClass.java new file mode 100644 index 000000000..322689371 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/cmp/ParentClass.java @@ -0,0 +1,14 @@ +package com.yomahub.liteflow.test.parent.cmp; + +public class ParentClass { + + private String name; + + public void setName(String name) { + this.name = name; + } + + public String sayHi() { + return "hello " + name; + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/parent/application.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/parent/application.properties new file mode 100644 index 000000000..03350a714 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/parent/application.properties @@ -0,0 +1 @@ +liteflow.rule-source=parent/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/parent/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/parent/flow.el.xml new file mode 100644 index 000000000..98c3cbae6 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/parent/flow.el.xml @@ -0,0 +1,7 @@ + + + + THEN(a, b, c); + + + \ No newline at end of file