From bd5ac006627ba06e526286619f6dccef74d0d6ff Mon Sep 17 00:00:00 2001 From: "everywhere.z" Date: Fri, 13 Oct 2023 00:20:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=82=E6=AD=A5=E5=A4=9A?= =?UTF-8?q?=E5=B5=8C=E5=A5=97WHEN=E5=A4=9A=E7=BA=BF=E7=A8=8B=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../asyncNode/AsyncNodeELSpringbootTest.java | 2 +- .../AsyncNodeThreadPoolELSpringbootTest.java | 28 +++++++++++++++++++ .../liteflow/test/asyncNode/cmp/FCmp.java | 1 + .../asyncNode/application.properties | 1 - .../asyncNode/application1.properties | 1 + .../asyncNode/application2.properties | 4 +++ .../asyncNode/{flow.el.xml => flow1.xml} | 0 .../src/test/resources/asyncNode/flow2.xml | 7 +++++ 8 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/AsyncNodeThreadPoolELSpringbootTest.java delete mode 100644 liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application.properties create mode 100644 liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application1.properties create mode 100644 liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application2.properties rename liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/{flow.el.xml => flow1.xml} (100%) create mode 100644 liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/flow2.xml diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/AsyncNodeELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/AsyncNodeELSpringbootTest.java index 541a2fe38..37e0413d2 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/AsyncNodeELSpringbootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/AsyncNodeELSpringbootTest.java @@ -20,7 +20,7 @@ import javax.annotation.Resource; * * @author ssss */ -@TestPropertySource(value = "classpath:/asyncNode/application.properties") +@TestPropertySource(value = "classpath:/asyncNode/application1.properties") @SpringBootTest(classes = AsyncNodeELSpringbootTest.class) @EnableAutoConfiguration @ComponentScan({ "com.yomahub.liteflow.test.asyncNode.cmp" }) diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/AsyncNodeThreadPoolELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/AsyncNodeThreadPoolELSpringbootTest.java new file mode 100644 index 000000000..f4cc56eda --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/AsyncNodeThreadPoolELSpringbootTest.java @@ -0,0 +1,28 @@ +package com.yomahub.liteflow.test.asyncNode; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.flow.LiteflowResponse; +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; + +@TestPropertySource(value = "classpath:/asyncNode/application2.properties") +@SpringBootTest(classes = AsyncNodeThreadPoolELSpringbootTest.class) +@EnableAutoConfiguration +@ComponentScan({ "com.yomahub.liteflow.test.asyncNode.cmp" }) +public class AsyncNodeThreadPoolELSpringbootTest { + + @Resource + private FlowExecutor flowExecutor; + + @Test + public void testAsyncFlow1() { + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a base request"); + Assertions.assertTrue(response.isSuccess()); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/cmp/FCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/cmp/FCmp.java index c6ee31bac..637072499 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/cmp/FCmp.java +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/asyncNode/cmp/FCmp.java @@ -8,6 +8,7 @@ public class FCmp extends NodeComponent { @Override public void process() throws Exception { + Thread.sleep(1500); System.out.println("Fcomp executed!"); } diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application.properties deleted file mode 100644 index 69053aff5..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=asyncNode/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application1.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application1.properties new file mode 100644 index 000000000..02913a94f --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application1.properties @@ -0,0 +1 @@ +liteflow.rule-source=asyncNode/flow1.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application2.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application2.properties new file mode 100644 index 000000000..a317b2576 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/application2.properties @@ -0,0 +1,4 @@ +liteflow.rule-source=asyncNode/flow2.xml +liteflow.when-max-workers=4 +liteflow.when-max-wait-time=20 +liteflow.when-max-wait-time-unit=SECONDS \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/flow1.xml similarity index 100% rename from liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/flow.el.xml rename to liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/flow1.xml diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/flow2.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/flow2.xml new file mode 100644 index 000000000..3b1249767 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/asyncNode/flow2.xml @@ -0,0 +1,7 @@ + + + + + WHEN(f, f, WHEN(f, WHEN(f, f, f, f, WHEN(f, f, f, f, f, f, f))), f, f); + + \ No newline at end of file