From 3a25c35b628ae0db8fee868f1baab45c613c2610 Mon Sep 17 00:00:00 2001 From: rain <672378783@qq.com> Date: Wed, 24 Apr 2024 21:23:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dwindows=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E4=B8=8B=E6=97=A0=E6=B3=95=E8=A7=A3=E6=9E=90=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yomahub/liteflow/core/FlowExecutor.java | 4 ++-- .../AbsoluteConfigPathELDeclMultiSpringbootTest.java | 10 ++++++++++ .../AbsoluteConfigPathELDeclSpringbootTest.java | 10 ++++++++++ .../absoluteConfigPath/AbsoluteConfigPathTest.java | 10 ++++++++++ .../AbsoluteConfigPathELSpringbootTest.java | 10 ++++++++++ .../AbsoluteConfigPathELSpringbootTest.java | 10 ++++++++++ .../AbsoluteConfigPathELSpringTest.java | 10 ++++++++++ 7 files changed, 62 insertions(+), 2 deletions(-) diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java b/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java index 56a5f5ac4..a60c3222c 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java @@ -136,8 +136,8 @@ public class FlowExecutor { // 查找对应的解析器 parser = FlowParserProvider.lookup(path); parserNameSet.add(parser.getClass().getName()); - // 替换掉前缀标识(如:xml:/json:),保留剩下的完整地址 - path = ReUtil.replaceAll(path, PREFIX_FORMAT_CONFIG_REGEX, ""); + // 替换掉前缀标识(如:xml:/json:),保留剩下的完整地址,并统一路径格式 + path = ReUtil.replaceAll(path, PREFIX_FORMAT_CONFIG_REGEX, "").replace("\\", "/"); rulePathList.add(path); // 支持多类型的配置文件,分别解析 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 ba135a619..30df1e195 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 @@ -63,6 +63,16 @@ public class AbsoluteConfigPathELDeclMultiSpringbootTest extends BaseTest { }); } + @Test + public void testAbsPath() throws Exception{ + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource(StrUtil.format("{}\\sub\\**\\*.xml",rootDir)); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + @BeforeAll public static void createFiles() { rootDir = FileUtil.getAbsolutePath(ResourceUtil.getResource("").getPath()); 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 ae2393aed..0e1a40e65 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 @@ -65,6 +65,16 @@ public class AbsoluteConfigPathELDeclSpringbootTest extends BaseTest { }); } + @Test + public void testAbsPath() throws Exception{ + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource(StrUtil.format("{}\\sub\\**\\*.xml",rootDir)); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + @BeforeAll public static void createFiles() { rootDir = FileUtil.getAbsolutePath(ResourceUtil.getResource("").getPath()); 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 06e206679..a536cede1 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 @@ -50,6 +50,16 @@ public class AbsoluteConfigPathTest extends BaseTest { }); } + @Test + public void testAbsPath() throws Exception{ + Assertions.assertTrue(() -> { + LiteflowConfig config = new LiteflowConfig(); + config.setRuleSource(StrUtil.format("{}\\sub\\**\\*.xml",rootDir)); + flowExecutor = FlowExecutorHolder.loadInstance(config); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + @BeforeAll public static void createFiles() { rootDir = FileUtil.getAbsolutePath(ResourceUtil.getResource("").getPath()); 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 62812c80b..2d3029b13 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 @@ -56,6 +56,16 @@ public class AbsoluteConfigPathELSpringbootTest extends BaseTest { }); } + @Test + public void testAbsTest() throws Exception { + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource(StrUtil.format("{}\\sub\\**\\*.xml",rootDir)); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + @BeforeAll public static void createFiles() { rootDir = FileUtil.getAbsolutePath(ResourceUtil.getResource("").getPath()); 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 97ac251ca..8a2f4faf6 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 @@ -70,6 +70,16 @@ public class AbsoluteConfigPathELSpringbootTest extends BaseTest { }); } + @Test + public void testAbsPath4() throws Exception{ + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource(StrUtil.format("{}\\sub\\a\\*.xml,sub\\b\\*.xml",rootDir)); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain2", "arg").isSuccess(); + }); + } + @BeforeAll public static void createFiles() { rootDir = FileUtil.getAbsolutePath(ResourceUtil.getResource("").getPath()); 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 f44acb08a..f82c89b71 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 @@ -55,6 +55,16 @@ public class AbsoluteConfigPathELSpringTest extends BaseTest { }); } + @Test + public void testAbsPath() throws Exception{ + Assertions.assertTrue(() -> { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource(StrUtil.format("{}\\sub\\**\\*.xml",rootDir)); + flowExecutor.reloadRule(); + return flowExecutor.execute2Resp("chain1", "arg").isSuccess(); + }); + } + @BeforeAll public static void createFiles() { rootDir = FileUtil.getAbsolutePath(ResourceUtil.getResource("").getPath());