修复windows场景下无法解析模糊路径的bug

This commit is contained in:
rain 2024-04-24 21:23:48 +08:00
parent 252c81dd15
commit 3a25c35b62
7 changed files with 62 additions and 2 deletions

View File

@ -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);
// 支持多类型的配置文件分别解析

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -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());