diff --git a/liteflow-solon-plugin/src/main/java/com/yomahub/liteflow/spi/solon/SolonPathContentParser.java b/liteflow-solon-plugin/src/main/java/com/yomahub/liteflow/spi/solon/SolonPathContentParser.java index e1ea3f71..522f553d 100644 --- a/liteflow-solon-plugin/src/main/java/com/yomahub/liteflow/spi/solon/SolonPathContentParser.java +++ b/liteflow-solon-plugin/src/main/java/com/yomahub/liteflow/spi/solon/SolonPathContentParser.java @@ -8,6 +8,7 @@ import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.StrUtil; import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.spi.PathContentParser; +import com.yomahub.liteflow.util.PathMatchUtil; import org.noear.solon.Utils; import java.io.File; @@ -47,9 +48,10 @@ public class SolonPathContentParser implements PathContentParser { if (CollectionUtil.isEmpty(pathList)) { throw new ConfigErrorException("rule source must not be null"); } - + List absolutePathList = PathMatchUtil.searchAbsolutePath(pathList); List allResource = new ArrayList<>(); - for (String path : pathList) { + + for (String path : absolutePathList) { // 如果 path 是绝对路径且这个文件存在时,我们认为这是一个本地文件路径,而并非classpath路径 if (FileUtil.isAbsolutePath(path) && FileUtil.isFile(path)) { allResource.add(new File(path).toURI().toURL()); 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 30df1e19..4551da5d 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 @@ -13,6 +13,7 @@ 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.condition.DisabledIf; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.slf4j.Logger; @@ -64,6 +65,7 @@ public class AbsoluteConfigPathELDeclMultiSpringbootTest extends BaseTest { } @Test + @DisabledIf("isWindows") public void testAbsPath() throws Exception{ Assertions.assertTrue(() -> { LiteflowConfig config = LiteflowConfigGetter.get(); @@ -73,6 +75,18 @@ public class AbsoluteConfigPathELDeclMultiSpringbootTest extends BaseTest { }); } + public static boolean isWindows() { + try { + String osName = System.getProperty("os.name"); + if (osName.isEmpty()) return false; + else { + return osName.contains("windows"); + } + } catch (Exception e) { + return false; + } + } + @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 0e1a40e6..d603e03c 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 @@ -15,6 +15,7 @@ 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.condition.DisabledIf; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.slf4j.Logger; @@ -66,6 +67,7 @@ public class AbsoluteConfigPathELDeclSpringbootTest extends BaseTest { } @Test + @DisabledIf("isWindows") public void testAbsPath() throws Exception{ Assertions.assertTrue(() -> { LiteflowConfig config = LiteflowConfigGetter.get(); @@ -75,6 +77,18 @@ public class AbsoluteConfigPathELDeclSpringbootTest extends BaseTest { }); } + public static boolean isWindows() { + try { + String osName = System.getProperty("os.name"); + if (osName.isEmpty()) return false; + else { + return osName.contains("windows"); + } + } catch (Exception e) { + return false; + } + } + @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 a536cede..f6709326 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 @@ -14,6 +14,7 @@ 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.condition.DisabledIf; import java.util.Objects; @@ -51,6 +52,7 @@ public class AbsoluteConfigPathTest extends BaseTest { } @Test + @DisabledIf("isWindows") public void testAbsPath() throws Exception{ Assertions.assertTrue(() -> { LiteflowConfig config = new LiteflowConfig(); @@ -60,6 +62,18 @@ public class AbsoluteConfigPathTest extends BaseTest { }); } + public static boolean isWindows() { + try { + String osName = System.getProperty("os.name"); + if (osName.isEmpty()) return false; + else { + return osName.contains("windows"); + } + } catch (Exception e) { + return false; + } + } + @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 2d3029b1..a418038f 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 @@ -13,6 +13,7 @@ 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.condition.DisabledIf; import org.junit.jupiter.api.extension.ExtendWith; import org.noear.solon.annotation.Inject; import org.noear.solon.test.SolonJUnit5Extension; @@ -57,6 +58,7 @@ public class AbsoluteConfigPathELSpringbootTest extends BaseTest { } @Test + @DisabledIf("isWindows") public void testAbsTest() throws Exception { Assertions.assertTrue(() -> { LiteflowConfig config = LiteflowConfigGetter.get(); @@ -66,6 +68,18 @@ public class AbsoluteConfigPathELSpringbootTest extends BaseTest { }); } + public static boolean isWindows() { + try { + String osName = System.getProperty("os.name"); + if (osName.isEmpty()) return false; + else { + return osName.contains("windows"); + } + } catch (Exception e) { + return false; + } + } + @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 8a2f4faf..b5cb1563 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 @@ -13,6 +13,7 @@ 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.condition.DisabledIf; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -71,6 +72,7 @@ public class AbsoluteConfigPathELSpringbootTest extends BaseTest { } @Test + @DisabledIf("isWindows") public void testAbsPath4() throws Exception{ Assertions.assertTrue(() -> { LiteflowConfig config = LiteflowConfigGetter.get(); @@ -80,6 +82,18 @@ public class AbsoluteConfigPathELSpringbootTest extends BaseTest { }); } + public static boolean isWindows() { + try { + String osName = System.getProperty("os.name"); + if (osName.isEmpty()) return false; + else { + return osName.contains("windows"); + } + } catch (Exception e) { + return false; + } + } + @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 f82c89b7..097bf03e 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 @@ -13,6 +13,7 @@ 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.condition.DisabledIf; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -56,6 +57,7 @@ public class AbsoluteConfigPathELSpringTest extends BaseTest { } @Test + @DisabledIf("isWindows") public void testAbsPath() throws Exception{ Assertions.assertTrue(() -> { LiteflowConfig config = LiteflowConfigGetter.get(); @@ -65,6 +67,18 @@ public class AbsoluteConfigPathELSpringTest extends BaseTest { }); } + public static boolean isWindows() { + try { + String osName = System.getProperty("os.name"); + if (osName.isEmpty()) return false; + else { + return osName.contains("windows"); + } + } catch (Exception e) { + return false; + } + } + @BeforeAll public static void createFiles() { rootDir = FileUtil.getAbsolutePath(ResourceUtil.getResource("").getPath());