mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
bug #I6TRT2 EL表达式里的//被过滤掉了
This commit is contained in:
@@ -253,7 +253,7 @@ public class ParserHelper {
|
||||
private static class RegexUtil {
|
||||
|
||||
// java 注释的正则表达式
|
||||
private static final String REGEX_COMMENT = "/\\*((?!\\*/).|[\\r\\n])*?\\*/|[ \\t]*//.*";
|
||||
private static final String REGEX_COMMENT = "(?<!:)\\/\\/.*|\\/\\*(\\s|.)*?\\*\\/";
|
||||
|
||||
/**
|
||||
* 移除 el 表达式中的注释,支持 java 的注释,包括单行注释、多行注释, 会压缩字符串,移除空格和换行符
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.yomahub.liteflow.test.comments;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||
import com.yomahub.liteflow.slot.DefaultContext;
|
||||
import com.yomahub.liteflow.test.BaseTest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -27,10 +28,13 @@ public class LiteflowNodeELSpringbootTest extends BaseTest {
|
||||
|
||||
// 测试注释
|
||||
@Test
|
||||
public void testAsyncFlow1() {
|
||||
public void testComments1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a base request");
|
||||
DefaultContext context = response.getFirstContextBean();
|
||||
String str = context.getData("str");
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
Assert.assertTrue(ListUtil.toList("a==>b==>c==>b", "a==>b==>b==>c").contains(response.getExecuteStepStr()));
|
||||
Assert.assertEquals("https://liteflow.yomahub.com", str);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ package com.yomahub.liteflow.test.comments.cmp;
|
||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import com.yomahub.liteflow.slot.DefaultContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("a")
|
||||
@@ -17,6 +18,8 @@ public class ACmp {
|
||||
|
||||
@LiteflowMethod(LiteFlowMethodEnum.PROCESS)
|
||||
public void process(NodeComponent bindCmp) {
|
||||
DefaultContext context = bindCmp.getFirstContextBean();
|
||||
context.setData("str", bindCmp.getCmpData(String.class));
|
||||
System.out.println("ACmp executed!");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<chain name="chain1">
|
||||
str = "https://liteflow.yomahub.com";
|
||||
// 单行注释
|
||||
THEN(
|
||||
// 单行注释
|
||||
a,
|
||||
a.data(str),
|
||||
b,
|
||||
WHEN(
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user