From ff89a9aa203fe10475b5d648557007e6de0a6f29 Mon Sep 17 00:00:00 2001 From: "everywhere.z" Date: Wed, 5 Nov 2025 19:15:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=B3=E4=BA=8E=E5=A3=B0?= =?UTF-8?q?=E6=98=8E=E5=BC=8F=E7=BB=84=E4=BB=B6=E7=BB=A7=E6=89=BF=E7=88=B6?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parent/ParentDeclMultiSpringbootTest.java | 38 +++++++++++++++++++ .../liteflow/test/parent/cmp/CmpConfig.java | 31 +++++++++++++++ .../liteflow/test/parent/cmp/ParentClass.java | 14 +++++++ .../resources/parent/application.properties | 1 + .../src/test/resources/parent/flow.el.xml | 7 ++++ 5 files changed, 91 insertions(+) create mode 100644 liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/ParentDeclMultiSpringbootTest.java create mode 100644 liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/cmp/CmpConfig.java create mode 100644 liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parent/cmp/ParentClass.java create mode 100644 liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/parent/application.properties create mode 100644 liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/parent/flow.el.xml 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