enhancement #IBQCWB 对所有 EL 进行规范化后重新计算 MD5

This commit is contained in:
luoyi
2025-06-30 19:39:53 +08:00
parent 852c18ac0b
commit 670a110bc2
2 changed files with 15 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import com.yomahub.liteflow.log.LFLog;
import com.yomahub.liteflow.log.LFLoggerManager; import com.yomahub.liteflow.log.LFLoggerManager;
import com.yomahub.liteflow.slot.DataBus; import com.yomahub.liteflow.slot.DataBus;
import com.yomahub.liteflow.slot.Slot; import com.yomahub.liteflow.slot.Slot;
import com.yomahub.liteflow.util.ElRegexUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -245,7 +246,11 @@ public class Chain implements Executable {
} }
public String getElMd5() { public String getElMd5() {
return elMd5 == null ? MD5.create().digestHex(el) : elMd5; // 若为 null 时,先规范化 EL再计算 MD5
if (elMd5 == null) {
elMd5 = MD5.create().digestHex(ElRegexUtil.normalize(el));
}
return elMd5;
} }
public void setElMd5(String elMd5) { public void setElMd5(String elMd5) {

View File

@@ -89,4 +89,13 @@ public class BaseELSpringbootTest extends BaseTest {
Assertions.assertNotEquals(response.getChainId(), response1.getChainId()); Assertions.assertNotEquals(response.getChainId(), response1.getChainId());
} }
// 运行文件里同样的 chain
@Test
public void testBase8() throws Exception {
LiteflowResponse response = flowExecutor.execute2RespWithEL("THEN(a,b,SWITCH(e).to(d,f));");
Assertions.assertTrue(response.isSuccess());
// 应返回 chain2
Assertions.assertEquals("chain2", response.getChainId());
}
} }