From 4742ffea2827274277f99e9ef7b7cdd71d02df93 Mon Sep 17 00:00:00 2001 From: rain <672378783@qq.com> Date: Mon, 9 Oct 2023 16:11:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=BB=9D=E5=AF=B9=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E7=9A=84=E6=A8=A1=E7=B3=8A=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...teConfigPathELDeclMultiSpringbootTest.java | 40 ++++++++++++-- .../absoluteConfigPath/application.properties | 3 +- .../resources/absoluteConfigPath/flow.el.xml | 2 +- ...bsoluteConfigPathELDeclSpringbootTest.java | 40 ++++++++++++-- .../absoluteConfigPath/application.properties | 3 +- .../resources/absoluteConfigPath/flow.el.xml | 2 +- .../AbsoluteConfigPathTest.java | 55 ++++++++++++++++--- .../resources/absoluteConfigPath/flow.el.xml | 2 +- .../AbsoluteConfigPathELSpringbootTest.java | 39 +++++++++++-- .../absoluteConfigPath/application.properties | 3 +- .../resources/absoluteConfigPath/flow.el.xml | 2 +- .../AbsoluteConfigPathELSpringbootTest.java | 39 +++++++++++-- .../absoluteConfigPath/application.properties | 3 +- .../resources/absoluteConfigPath/flow.el.xml | 2 +- .../AbsoluteConfigPathELSpringTest.java | 39 ++++++++++++- .../absoluteConfigPath/application.xml | 6 +- .../resources/absoluteConfigPath/flow.el.xml | 2 +- 17 files changed, 233 insertions(+), 49 deletions(-) diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELDeclMultiSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELDeclMultiSpringbootTest.java index 293b56d83..e04dbc456 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELDeclMultiSpringbootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELDeclMultiSpringbootTest.java @@ -1,9 +1,15 @@ package com.yomahub.liteflow.test.absoluteConfigPath; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.CharsetUtil; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.property.LiteflowConfig; +import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -24,21 +30,45 @@ import javax.annotation.Resource; * @since 2.6.4 */ @ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/absoluteConfigPath/application.properties") @SpringBootTest(classes = AbsoluteConfigPathELDeclMultiSpringbootTest.class) @EnableAutoConfiguration @ComponentScan({ "com.yomahub.liteflow.test.absoluteConfigPath.cmp" }) public class AbsoluteConfigPathELDeclMultiSpringbootTest extends BaseTest { - private final Logger log = LoggerFactory.getLogger(this.getClass()); - @Resource private FlowExecutor flowExecutor; @Test public void testAbsoluteConfig() throws Exception { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assertions.assertTrue(response.isSuccess()); + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Test/a/b/c/flow.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @Test + public void testAbsolutePathMatch() throws Exception { + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Tes*/**/c/*.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @BeforeAll + public static void createFiles() { + String filePath = "C:/LiteFlow/Test/a/b/c"; + String content = "WHEN(a, b, c);"; + FileUtil.mkdir(filePath); + FileUtil.writeString(content, filePath + "/flow.el.xml", CharsetUtil.CHARSET_UTF_8); + } + + @AfterAll + public static void removeFiles() { + FileUtil.del("C:/LiteFlow"); } } diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/absoluteConfigPath/application.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/absoluteConfigPath/application.properties index cfd4db495..93a30df79 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/absoluteConfigPath/application.properties +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/absoluteConfigPath/application.properties @@ -1,2 +1 @@ -liteflow.rule-source=/usr/local/flow.el.xml -#liteflow.rule-source=/usr/**/*.xml \ No newline at end of file +liteflow.rule-source=C:/LiteFlow/Test/a/b/c/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/absoluteConfigPath/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/absoluteConfigPath/flow.el.xml index 2fda05e60..4871fa66c 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/absoluteConfigPath/flow.el.xml +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/absoluteConfigPath/flow.el.xml @@ -1,5 +1,5 @@ - + WHEN(a,b,c); diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELDeclSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELDeclSpringbootTest.java index 55c900075..c59dbe1a5 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELDeclSpringbootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELDeclSpringbootTest.java @@ -1,9 +1,15 @@ package com.yomahub.liteflow.test.absoluteConfigPath; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.CharsetUtil; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.property.LiteflowConfig; +import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -24,21 +30,45 @@ import javax.annotation.Resource; * @since 2.6.4 */ @ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/absoluteConfigPath/application.properties") @SpringBootTest(classes = AbsoluteConfigPathELDeclSpringbootTest.class) @EnableAutoConfiguration @ComponentScan({ "com.yomahub.liteflow.test.absoluteConfigPath.cmp" }) public class AbsoluteConfigPathELDeclSpringbootTest extends BaseTest { - private final Logger log = LoggerFactory.getLogger(this.getClass()); - @Resource private FlowExecutor flowExecutor; @Test public void testAbsoluteConfig() throws Exception { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assertions.assertTrue(response.isSuccess()); + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Test/a/b/c/flow.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @Test + public void testAbsolutePathMatch() throws Exception { + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Tes*/**/c/*.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @BeforeAll + public static void createFiles() { + String filePath = "C:/LiteFlow/Test/a/b/c"; + String content = "WHEN(a, b, c);"; + FileUtil.mkdir(filePath); + FileUtil.writeString(content, filePath + "/flow.el.xml", CharsetUtil.CHARSET_UTF_8); + } + + @AfterAll + public static void removeFiles() { + FileUtil.del("C:/LiteFlow"); } } diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/absoluteConfigPath/application.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/absoluteConfigPath/application.properties index cfd4db495..93a30df79 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/absoluteConfigPath/application.properties +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/absoluteConfigPath/application.properties @@ -1,2 +1 @@ -liteflow.rule-source=/usr/local/flow.el.xml -#liteflow.rule-source=/usr/**/*.xml \ No newline at end of file +liteflow.rule-source=C:/LiteFlow/Test/a/b/c/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/absoluteConfigPath/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/absoluteConfigPath/flow.el.xml index 2fda05e60..4871fa66c 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/absoluteConfigPath/flow.el.xml +++ b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/absoluteConfigPath/flow.el.xml @@ -1,5 +1,5 @@ - + WHEN(a,b,c); diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathTest.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathTest.java index 3d0ffef59..f9c1c3139 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathTest.java @@ -1,10 +1,14 @@ package com.yomahub.liteflow.test.absoluteConfigPath; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.CharsetUtil; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.core.FlowExecutorHolder; import com.yomahub.liteflow.flow.LiteflowResponse; import com.yomahub.liteflow.property.LiteflowConfig; +import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -19,18 +23,51 @@ public class AbsoluteConfigPathTest extends BaseTest { private static FlowExecutor flowExecutor; - @BeforeAll - public static void init() { - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("/usr/local/flow2.xml"); -// config.setRuleSource("/usr/**/*.xml"); - flowExecutor = FlowExecutorHolder.loadInstance(config); - } @Test public void testAbsoluteConfig() throws Exception { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assertions.assertTrue(response.isSuccess()); + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Test/a/b/c/flow.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); } + @Test + public void testAbsolutePathMatch() throws Exception { + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Tes*/**/c/*.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @BeforeAll + public static void createFiles() { + String filePath = "C:/LiteFlow/Test/a/b/c"; + String content = "\n" + + "\n" + + "\n" + + " \n" + + " \n" + + " \n" + + "\n" + + "\n" + + "\n" + + " WHEN(a,b,c);\n" + + "\n" + + ""; + FileUtil.mkdir(filePath); + FileUtil.writeString(content, filePath + "/flow.el.xml", CharsetUtil.CHARSET_UTF_8); + LiteflowConfig config = new LiteflowConfig(); + config.setRuleSource("absoluteConfigPath/flow.el.xml"); + flowExecutor = FlowExecutorHolder.loadInstance(config); + } + + @AfterAll + public static void removeFiles() { + FileUtil.del("C:/LiteFlow"); + } } diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/absoluteConfigPath/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/absoluteConfigPath/flow.el.xml index 9920ec543..59b01c85c 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/absoluteConfigPath/flow.el.xml +++ b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/absoluteConfigPath/flow.el.xml @@ -1,5 +1,5 @@ - + diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringbootTest.java index 8e8897b85..0ae3c55b0 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringbootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringbootTest.java @@ -1,9 +1,15 @@ package com.yomahub.liteflow.test.absoluteConfigPath; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.CharsetUtil; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.property.LiteflowConfig; +import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.noear.solon.annotation.Inject; @@ -19,18 +25,43 @@ import org.slf4j.LoggerFactory; * @since 2.6.4 */ @ExtendWith(SolonJUnit5Extension.class) -@TestPropertySource("classpath:/absoluteConfigPath/application.properties") public class AbsoluteConfigPathELSpringbootTest extends BaseTest { - private final Logger log = LoggerFactory.getLogger(this.getClass()); @Inject private FlowExecutor flowExecutor; @Test public void testAbsoluteConfig() throws Exception { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assertions.assertTrue(response.isSuccess()); + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Test/a/b/c/flow.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @Test + public void testAbsolutePathMatch() throws Exception { + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Tes*/**/c/*.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @BeforeAll + public static void createFiles() { + String filePath = "C:/LiteFlow/Test/a/b/c"; + String content = "WHEN(a, b, c);"; + FileUtil.mkdir(filePath); + FileUtil.writeString(content, filePath + "/flow.el.xml", CharsetUtil.CHARSET_UTF_8); + } + + @AfterAll + public static void removeFiles() { + FileUtil.del("C:/LiteFlow"); } } diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/absoluteConfigPath/application.properties b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/absoluteConfigPath/application.properties index cfd4db495..93a30df79 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/absoluteConfigPath/application.properties +++ b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/absoluteConfigPath/application.properties @@ -1,2 +1 @@ -liteflow.rule-source=/usr/local/flow.el.xml -#liteflow.rule-source=/usr/**/*.xml \ No newline at end of file +liteflow.rule-source=C:/LiteFlow/Test/a/b/c/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/absoluteConfigPath/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/absoluteConfigPath/flow.el.xml index 2fda05e60..4871fa66c 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/absoluteConfigPath/flow.el.xml +++ b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/absoluteConfigPath/flow.el.xml @@ -1,5 +1,5 @@ - + WHEN(a,b,c); diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringbootTest.java index ca844f9cc..5bf77bb7d 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringbootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringbootTest.java @@ -1,9 +1,15 @@ package com.yomahub.liteflow.test.absoluteConfigPath; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.CharsetUtil; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.property.LiteflowConfig; +import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,21 +26,46 @@ import javax.annotation.Resource; * @author Bryan.Zhang * @since 2.6.4 */ -@TestPropertySource(value = "classpath:/absoluteConfigPath/application.properties") @SpringBootTest(classes = AbsoluteConfigPathELSpringbootTest.class) @EnableAutoConfiguration @ComponentScan({ "com.yomahub.liteflow.test.absoluteConfigPath.cmp" }) public class AbsoluteConfigPathELSpringbootTest extends BaseTest { - private final Logger log = LoggerFactory.getLogger(this.getClass()); @Resource private FlowExecutor flowExecutor; @Test public void testAbsoluteConfig() throws Exception { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assertions.assertTrue(response.isSuccess()); + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Test/a/b/c/flow.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @Test + public void testAbsolutePathMatch() throws Exception { + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Tes*/**/c/*.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @BeforeAll + public static void createFiles() { + String filePath = "C:/LiteFlow/Test/a/b/c"; + String content = "WHEN(a, b, c);"; + FileUtil.mkdir(filePath); + FileUtil.writeString(content, filePath + "/flow.el.xml", CharsetUtil.CHARSET_UTF_8); + } + + @AfterAll + public static void removeFiles() { + FileUtil.del("C:/LiteFlow"); } } diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/absoluteConfigPath/application.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/absoluteConfigPath/application.properties index cfd4db495..93a30df79 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/absoluteConfigPath/application.properties +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/absoluteConfigPath/application.properties @@ -1,2 +1 @@ -liteflow.rule-source=/usr/local/flow.el.xml -#liteflow.rule-source=/usr/**/*.xml \ No newline at end of file +liteflow.rule-source=C:/LiteFlow/Test/a/b/c/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/absoluteConfigPath/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/absoluteConfigPath/flow.el.xml index 2fda05e60..4871fa66c 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/absoluteConfigPath/flow.el.xml +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/absoluteConfigPath/flow.el.xml @@ -1,5 +1,5 @@ - + WHEN(a,b,c); diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringTest.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringTest.java index 5a662976c..447d6e965 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/absoluteConfigPath/AbsoluteConfigPathELSpringTest.java @@ -1,9 +1,15 @@ package com.yomahub.liteflow.test.absoluteConfigPath; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.CharsetUtil; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.property.LiteflowConfig; +import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.context.ContextConfiguration; @@ -25,9 +31,36 @@ public class AbsoluteConfigPathELSpringTest extends BaseTest { private FlowExecutor flowExecutor; @Test - public void testAbsoluteConfig() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assertions.assertTrue(response.isSuccess()); + public void testAbsoluteConfig() throws Exception { + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Test/a/b/c/flow.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @Test + public void testAbsolutePathMatch() throws Exception { + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("C:/LiteFlow/Tes*/**/c/*.el.xml"); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + + @BeforeAll + public static void createFiles() { + String filePath = "C:/LiteFlow/Test/a/b/c"; + String content = "WHEN(a, b, c);"; + FileUtil.mkdir(filePath); + FileUtil.writeString(content, filePath + "/flow.el.xml", CharsetUtil.CHARSET_UTF_8); + } + + @AfterAll + public static void removeFiles() { + FileUtil.del("C:/LiteFlow"); } } diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/absoluteConfigPath/application.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/absoluteConfigPath/application.xml index c3e5fe362..a27805f4c 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/absoluteConfigPath/application.xml +++ b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/absoluteConfigPath/application.xml @@ -14,13 +14,9 @@ - + - - - - diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/absoluteConfigPath/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/absoluteConfigPath/flow.el.xml index 507e19d62..4871fa66c 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/absoluteConfigPath/flow.el.xml +++ b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/absoluteConfigPath/flow.el.xml @@ -1,5 +1,5 @@ - + WHEN(a,b,c);