From f6ef8d427660d7807488789cdfcaad26f6950d6c Mon Sep 17 00:00:00 2001 From: bryan31 Date: Sun, 12 Dec 2021 16:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=9A=E4=B8=8A=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomNodesSpringbootTest.java | 43 +++++++++++++++++++ .../liteflow/test/customNodes/cmp/ACmp.java | 20 +++++++++ .../liteflow/test/customNodes/cmp/BCmp.java | 21 +++++++++ .../liteflow/test/customNodes/cmp/CCmp.java | 21 +++++++++ .../liteflow/test/customNodes/cmp/DCmp.java | 21 +++++++++ .../liteflow/test/customNodes/cmp/ECmp.java | 21 +++++++++ .../liteflow/test/customNodes/cmp/FCmp.java | 21 +++++++++ .../customNodes/application.properties | 1 + .../src/test/resources/customNodes/flow.xml | 19 ++++++++ 9 files changed, 188 insertions(+) create mode 100644 liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/CustomNodesSpringbootTest.java create mode 100644 liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/ACmp.java create mode 100644 liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/BCmp.java create mode 100644 liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/CCmp.java create mode 100644 liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/DCmp.java create mode 100644 liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/ECmp.java create mode 100644 liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/FCmp.java create mode 100644 liteflow-testcase-springboot/src/test/resources/customNodes/application.properties create mode 100644 liteflow-testcase-springboot/src/test/resources/customNodes/flow.xml diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/CustomNodesSpringbootTest.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/CustomNodesSpringbootTest.java new file mode 100644 index 000000000..5627a0180 --- /dev/null +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/CustomNodesSpringbootTest.java @@ -0,0 +1,43 @@ +package com.yomahub.liteflow.test.customNodes; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.entity.data.DefaultSlot; +import com.yomahub.liteflow.entity.data.LiteflowResponse; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.junit4.SpringRunner; + +import javax.annotation.Resource; + +/** + * springboot环境下异步线程超时日志打印测试 + * @author Bryan.Zhang + * @since 2.6.4 + */ +@RunWith(SpringRunner.class) +@TestPropertySource(value = "classpath:/customNodes/application.properties") +@SpringBootTest(classes = CustomNodesSpringbootTest.class) +@EnableAutoConfiguration +public class CustomNodesSpringbootTest extends BaseTest { + + private final Logger log = LoggerFactory.getLogger(this.getClass()); + + @Resource + private FlowExecutor flowExecutor; + + @Test + public void testCustomNodes() throws Exception{ + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); + Assert.assertTrue(response.isSuccess()); + response = flowExecutor.execute2Resp("chain2", "arg"); + Assert.assertTrue(response.isSuccess()); + } +} diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/ACmp.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/ACmp.java new file mode 100644 index 000000000..fdf6ddc1c --- /dev/null +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/ACmp.java @@ -0,0 +1,20 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.customNodes.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("a") +public class ACmp extends NodeComponent { + + @Override + public void process() { + System.out.println("ACmp executed!"); + } +} diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/BCmp.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/BCmp.java new file mode 100644 index 000000000..2aa0dcd2f --- /dev/null +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/BCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.customNodes.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("b") +public class BCmp extends NodeComponent { + + @Override + public void process() { + System.out.println("BCmp executed!"); + } + +} diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/CCmp.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/CCmp.java new file mode 100644 index 000000000..a20a7951f --- /dev/null +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/CCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.customNodes.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("c") +public class CCmp extends NodeComponent { + + @Override + public void process() { + System.out.println("CCmp executed!"); + } + +} diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/DCmp.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/DCmp.java new file mode 100644 index 000000000..1230ae2f2 --- /dev/null +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/DCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.customNodes.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("d") +public class DCmp extends NodeComponent { + + @Override + public void process() { + System.out.println("DCmp executed!"); + } + +} diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/ECmp.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/ECmp.java new file mode 100644 index 000000000..ccf03451b --- /dev/null +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/ECmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.customNodes.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("e") +public class ECmp extends NodeComponent { + + @Override + public void process() { + System.out.println("ECmp executed!"); + } + +} diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/FCmp.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/FCmp.java new file mode 100644 index 000000000..d11ec255c --- /dev/null +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/customNodes/cmp/FCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.customNodes.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("f") +public class FCmp extends NodeComponent { + + @Override + public void process() { + System.out.println("FCmp executed!"); + } + +} diff --git a/liteflow-testcase-springboot/src/test/resources/customNodes/application.properties b/liteflow-testcase-springboot/src/test/resources/customNodes/application.properties new file mode 100644 index 000000000..ab7716a61 --- /dev/null +++ b/liteflow-testcase-springboot/src/test/resources/customNodes/application.properties @@ -0,0 +1 @@ +liteflow.rule-source=customNodes/flow.xml \ No newline at end of file diff --git a/liteflow-testcase-springboot/src/test/resources/customNodes/flow.xml b/liteflow-testcase-springboot/src/test/resources/customNodes/flow.xml new file mode 100644 index 000000000..ecc1abcd6 --- /dev/null +++ b/liteflow-testcase-springboot/src/test/resources/customNodes/flow.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file