From c8eeae665fa29c2efa5c68caa93e6adbf2475cf2 Mon Sep 17 00:00:00 2001
From: DaleLee <1658850308@qq.com>
Date: Tue, 22 Apr 2025 22:14:26 +0800
Subject: [PATCH] =?UTF-8?q?feature=20#IC2F4F=20=E5=AE=8C=E5=96=84=E5=8D=95?=
=?UTF-8?q?=E6=B5=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../monitorFile/MonitorFileELSpringbootTest2.java | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/monitorFile/MonitorFileELSpringbootTest2.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/monitorFile/MonitorFileELSpringbootTest2.java
index 6d9bc5233..2d9114bda 100644
--- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/monitorFile/MonitorFileELSpringbootTest2.java
+++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/monitorFile/MonitorFileELSpringbootTest2.java
@@ -4,9 +4,8 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.resource.ClassPathResource;
import cn.hutool.core.util.CharsetUtil;
import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.exception.ChainNotFoundException;
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.AfterEach;
import org.junit.jupiter.api.Assertions;
@@ -19,8 +18,6 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.TestPropertySource;
import javax.annotation.Resource;
-import java.io.File;
-import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -34,21 +31,22 @@ public class MonitorFileELSpringbootTest2 extends BaseTest {
@Resource
private FlowExecutor flowExecutor;
- // 测试监听新增文件
+ // 测试模糊路径下监听新增文件
@Test
public void testMonitorAddFile() throws Exception {
// 文件新增前
- LiteflowResponse liteflowResponse = flowExecutor.execute2Resp("chain2", "arg");
+ LiteflowResponse liteflowResponse = flowExecutor.execute2Resp("chain_add", "arg");
Assertions.assertFalse(liteflowResponse.isSuccess());
+ Assertions.assertTrue(liteflowResponse.getCause() instanceof ChainNotFoundException);
// 文件新增
String flowPath = new ClassPathResource("classpath:monitorFile").getAbsolutePath();
Path newFilePath = Paths.get(flowPath, "test", "flow.el.2.xml");
FileUtil.writeString("" +
- "THEN(a);",
+ "THEN(a);",
newFilePath.toFile(), CharsetUtil.CHARSET_UTF_8);
Thread.sleep(1000);
- liteflowResponse = flowExecutor.execute2Resp("chain2", "arg");
+ liteflowResponse = flowExecutor.execute2Resp("chain_add", "arg");
Assertions.assertTrue(liteflowResponse.isSuccess());
Assertions.assertEquals("a", liteflowResponse.getExecuteStepStr());
}