From 91ae79b8269587f19c109f66ac94d0dfa6e498e7 Mon Sep 17 00:00:00 2001 From: tangkc Date: Fri, 10 Jun 2022 18:51:41 +0800 Subject: [PATCH 1/4] up --- .../exception/ChainDuplicateException.java | 29 +++++++++ .../com/yomahub/liteflow/flow/FlowBus.java | 63 ++++++++++--------- 2 files changed, 63 insertions(+), 29 deletions(-) create mode 100644 liteflow-core/src/main/java/com/yomahub/liteflow/exception/ChainDuplicateException.java diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ChainDuplicateException.java b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ChainDuplicateException.java new file mode 100644 index 000000000..e458fd55d --- /dev/null +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ChainDuplicateException.java @@ -0,0 +1,29 @@ +package com.yomahub.liteflow.exception; + +/** + * Chain 重复异常 + * + * @author tangkc + */ +public class ChainDuplicateException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + /** + * 异常信息 + */ + private String message; + + public ChainDuplicateException(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + +} diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java index dec157568..56a4728c1 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java @@ -16,11 +16,12 @@ import com.yomahub.liteflow.core.ComponentInitializer; import com.yomahub.liteflow.core.NodeComponent; import com.yomahub.liteflow.core.ScriptComponent; import com.yomahub.liteflow.core.ScriptCondComponent; -import com.yomahub.liteflow.flow.element.Chain; -import com.yomahub.liteflow.flow.element.Node; import com.yomahub.liteflow.enums.FlowParserTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum; +import com.yomahub.liteflow.exception.ChainDuplicateException; import com.yomahub.liteflow.exception.ComponentCannotRegisterException; +import com.yomahub.liteflow.flow.element.Chain; +import com.yomahub.liteflow.flow.element.Node; import com.yomahub.liteflow.parser.LocalJsonFlowParser; import com.yomahub.liteflow.parser.LocalXmlFlowParser; import com.yomahub.liteflow.parser.LocalYmlFlowParser; @@ -39,6 +40,7 @@ import java.util.Map; /** * 流程元数据类 + * * @author Bryan.Zhang */ public class FlowBus { @@ -52,14 +54,16 @@ public class FlowBus { private FlowBus() { } - public static Chain getChain(String id){ + public static Chain getChain(String id) { return chainMap.get(id); } //这一方法主要用于第一阶段chain的预装载 - public static void addChain(String chainName){ - if (!chainMap.containsKey(chainName)){ + public static void addChain(String chainName) { + if (!chainMap.containsKey(chainName)) { chainMap.put(chainName, new Chain(chainName)); + } else { + throw new ChainDuplicateException(String.format("[chain name duplicate] chainName=%s", chainName)); } } @@ -84,25 +88,25 @@ public class FlowBus { nodeMap.put(nodeId, new Node(ComponentInitializer.loadInstance().initComponent(nodeComponent, NodeTypeEnum.COMMON, null, nodeId))); } - public static void addCommonNode(String nodeId, String name, String cmpClazzStr){ + public static void addCommonNode(String nodeId, String name, String cmpClazzStr) { Class cmpClazz; - try{ + try { cmpClazz = Class.forName(cmpClazzStr); - }catch (Exception e){ + } catch (Exception e) { throw new ComponentCannotRegisterException(e.getMessage()); } addNode(nodeId, name, NodeTypeEnum.COMMON, cmpClazz, null); } - public static void addCommonNode(String nodeId, String name, Class cmpClazz){ + public static void addCommonNode(String nodeId, String name, Class cmpClazz) { addNode(nodeId, name, NodeTypeEnum.COMMON, cmpClazz, null); } - public static void addCommonScriptNode(String nodeId, String name, String script){ + public static void addCommonScriptNode(String nodeId, String name, String script) { addNode(nodeId, name, NodeTypeEnum.SCRIPT, ScriptComponent.class, script); } - public static void addCondScriptNode(String nodeId, String name, String script){ + public static void addCondScriptNode(String nodeId, String name, String script) { addNode(nodeId, name, NodeTypeEnum.COND_SCRIPT, ScriptCondComponent.class, script); } @@ -111,7 +115,7 @@ public class FlowBus { //判断此类是否是声明式的组件,如果是声明式的组件,就用动态代理生成实例 //如果不是声明式的,就用传统的方式进行判断 NodeComponent cmpInstance = null; - if (LiteFlowProxyUtil.isMarkedCmp(cmpClazz)){ + if (LiteFlowProxyUtil.isMarkedCmp(cmpClazz)) { //这里的逻辑要仔细看下 //如果是spring体系,把原始的类往spring上下文中进行注册,那么会走到ComponentScanner中 //由于ComponentScanner中已经对原始类进行了动态代理,出来的对象已经变成了动态代理类,所以这时候的bean已经是NodeComponent的子类了 @@ -120,16 +124,16 @@ public class FlowBus { //这里用ContextAware的spi机制来判断是否spring体系 ContextAware contextAware = ContextAwareHolder.loadContextAware(); Object bean = ContextAwareHolder.loadContextAware().registerBean(nodeId, cmpClazz); - if (LocalContextAware.class.isAssignableFrom(contextAware.getClass())){ + if (LocalContextAware.class.isAssignableFrom(contextAware.getClass())) { cmpInstance = LiteFlowProxyUtil.proxy2NodeComponent(bean, nodeId); - }else { + } else { cmpInstance = (NodeComponent) bean; } - }else{ + } else { //以node方式配置,本质上是为了适配无spring的环境,如果有spring环境,其实不用这么配置 //这里的逻辑是判断是否能从spring上下文中取到,如果没有spring,则就是new instance了 //如果是script类型的节点,因为class只有一个,所以也不能注册进spring上下文,注册的时候需要new Instance - if (!CollectionUtil.newArrayList(NodeTypeEnum.SCRIPT, NodeTypeEnum.COND_SCRIPT).contains(type)){ + if (!CollectionUtil.newArrayList(NodeTypeEnum.SCRIPT, NodeTypeEnum.COND_SCRIPT).contains(type)) { cmpInstance = (NodeComponent) ContextAwareHolder.loadContextAware().registerOrGet(nodeId, cmpClazz); } @@ -145,12 +149,12 @@ public class FlowBus { Node node = new Node(cmpInstance); //如果是脚本节点(普通脚本节点/条件脚本节点),则还要加载script脚本 - if (StrUtil.isNotBlank(script)){ + if (StrUtil.isNotBlank(script)) { node.setScript(script); - if (type.equals(NodeTypeEnum.SCRIPT)){ - ((ScriptComponent)cmpInstance).loadScript(script); - }else if(type.equals(NodeTypeEnum.COND_SCRIPT)){ - ((ScriptCondComponent)cmpInstance).loadScript(script); + if (type.equals(NodeTypeEnum.SCRIPT)) { + ((ScriptComponent) cmpInstance).loadScript(script); + } else if (type.equals(NodeTypeEnum.COND_SCRIPT)) { + ((ScriptCondComponent) cmpInstance).loadScript(script); } } @@ -170,10 +174,10 @@ public class FlowBus { //那condNodeMap共用有关系么,原则上没有关系。但是从设计理念上,以后应该要分开 //tag和condNodeMap这2个属性不属于全局概念,属于每个chain范围的属性 public static Node copyNode(String nodeId) { - try{ + try { Node node = nodeMap.get(nodeId); return node.copy(); - }catch (Exception e){ + } catch (Exception e) { return null; } } @@ -186,12 +190,13 @@ public class FlowBus { public static void cleanScriptCache() { //如果引入了脚本组件SPI,则还需要清理脚本的缓存 - try{ + try { ScriptExecutor scriptExecutor = ScriptExecutorFactory.loadInstance().getScriptExecutor(); - if (ObjectUtil.isNotNull(scriptExecutor)){ + if (ObjectUtil.isNotNull(scriptExecutor)) { scriptExecutor.cleanCache(); } - }catch (ScriptSpiException ignored){} + } catch (ScriptSpiException ignored) { + } } public static void refreshFlowMetaData(FlowParserTypeEnum type, String content) throws Exception { @@ -204,11 +209,11 @@ public class FlowBus { } } - public static boolean removeChain(String chainId){ - if (containChain(chainId)){ + public static boolean removeChain(String chainId) { + if (containChain(chainId)) { chainMap.remove(chainId); return true; - }else{ + } else { String errMsg = StrUtil.format("cannot find the chain[{}]", chainId); LOG.error(errMsg); return false; From b1e1cfce5e6c552ff6327692b7c696a197fee176 Mon Sep 17 00:00:00 2001 From: tangkc Date: Mon, 13 Jun 2022 14:40:33 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[I5BR5M]chain=20=E9=87=8D=E5=A4=8D=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/Exception1SpringBootTest.java | 27 ++++++++++++------- .../resources/exception/flow-exception.xml | 10 +++++++ .../test/exception/Exception1Test.java | 20 +++++++++++--- .../resources/exception/flow-exception.xml | 10 +++++++ .../exception/Exception1SpringBootTest.java | 25 ++++++++++------- .../resources/exception/flow-exception.xml | 10 +++++++ .../test/exception/Exception1SpringTest.java | 17 ++++++++++++ .../resources/exception/flow-exception.xml | 10 +++++++ 8 files changed, 106 insertions(+), 23 deletions(-) create mode 100644 liteflow-testcase-declare-component/src/test/resources/exception/flow-exception.xml create mode 100644 liteflow-testcase-nospring/src/test/resources/exception/flow-exception.xml create mode 100644 liteflow-testcase-springboot/src/test/resources/exception/flow-exception.xml create mode 100644 liteflow-testcase-springnative/src/test/resources/exception/flow-exception.xml diff --git a/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java b/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java index 338fbe424..bd1e2fa90 100644 --- a/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java +++ b/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java @@ -1,26 +1,17 @@ package com.yomahub.liteflow.test.exception; import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.exception.ChainNotFoundException; import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.exception.FlowExecutorNotInitException; -import com.yomahub.liteflow.exception.FlowSystemException; -import com.yomahub.liteflow.flow.LiteflowResponse; import com.yomahub.liteflow.property.LiteflowConfig; import com.yomahub.liteflow.property.LiteflowConfigGetter; -import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.test.BaseTest; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.util.ReflectionUtils; import javax.annotation.Resource; @@ -34,10 +25,26 @@ import javax.annotation.Resource; @SpringBootTest(classes = Exception1SpringBootTest.class) @EnableAutoConfiguration public class Exception1SpringBootTest extends BaseTest { - + @Resource private FlowExecutor flowExecutor; + /** + * 验证 chain 节点重复的异常 + */ + @Test(expected = FlowExecutorNotInitException.class) + public void testChainDuplicateException() { + try { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("exception/flow-exception.xml"); + flowExecutor.init(); + } catch (Exception ex) { + // 这里需要 catch 是因为,异常是往上抛的,最后被包装成了 FlowExecutorNotInitException + Assert.assertTrue(ex.getMessage().contains("[chain name duplicate]")); + throw ex; + } + } + @Test(expected = ConfigErrorException.class) public void testConfigErrorException() { flowExecutor.setLiteflowConfig(null); diff --git a/liteflow-testcase-declare-component/src/test/resources/exception/flow-exception.xml b/liteflow-testcase-declare-component/src/test/resources/exception/flow-exception.xml new file mode 100644 index 000000000..662226def --- /dev/null +++ b/liteflow-testcase-declare-component/src/test/resources/exception/flow-exception.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception1Test.java b/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception1Test.java index c988a9b5a..b062dd7fb 100644 --- a/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception1Test.java +++ b/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception1Test.java @@ -2,14 +2,10 @@ package com.yomahub.liteflow.test.exception; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.core.FlowExecutorHolder; -import com.yomahub.liteflow.exception.ChainNotFoundException; import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.exception.FlowExecutorNotInitException; -import com.yomahub.liteflow.exception.FlowSystemException; -import com.yomahub.liteflow.flow.LiteflowResponse; import com.yomahub.liteflow.property.LiteflowConfig; import com.yomahub.liteflow.property.LiteflowConfigGetter; -import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.test.BaseTest; import org.junit.Assert; import org.junit.BeforeClass; @@ -33,6 +29,22 @@ public class Exception1Test extends BaseTest { flowExecutor = FlowExecutorHolder.loadInstance(config); } + /** + * 验证 chain 节点重复的异常 + */ + @Test(expected = FlowExecutorNotInitException.class) + public void testChainDuplicateException() { + try { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("exception/flow-exception.xml"); + flowExecutor.init(); + } catch (Exception ex) { + // 这里需要 catch 是因为,异常是往上抛的,最后被包装成了 FlowExecutorNotInitException + Assert.assertTrue(ex.getMessage().contains("[chain name duplicate]")); + throw ex; + } + } + @Test(expected = ConfigErrorException.class) public void testConfigErrorException() { flowExecutor.setLiteflowConfig(null); diff --git a/liteflow-testcase-nospring/src/test/resources/exception/flow-exception.xml b/liteflow-testcase-nospring/src/test/resources/exception/flow-exception.xml new file mode 100644 index 000000000..662226def --- /dev/null +++ b/liteflow-testcase-nospring/src/test/resources/exception/flow-exception.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java index 5a79866e4..65b7b7edc 100644 --- a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java @@ -1,26 +1,17 @@ package com.yomahub.liteflow.test.exception; import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.exception.ChainNotFoundException; import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.exception.FlowExecutorNotInitException; -import com.yomahub.liteflow.exception.FlowSystemException; -import com.yomahub.liteflow.flow.LiteflowResponse; import com.yomahub.liteflow.property.LiteflowConfig; import com.yomahub.liteflow.property.LiteflowConfigGetter; -import com.yomahub.liteflow.slot.DefaultContext; import com.yomahub.liteflow.test.BaseTest; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.util.ReflectionUtils; import javax.annotation.Resource; @@ -38,6 +29,22 @@ public class Exception1SpringBootTest extends BaseTest { @Resource private FlowExecutor flowExecutor; + /** + * 验证 chain 节点重复的异常 + */ + @Test(expected = FlowExecutorNotInitException.class) + public void testChainDuplicateException() { + try { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("exception/flow-exception.xml"); + flowExecutor.init(); + } catch (Exception ex) { + // 这里需要 catch 是因为,异常是往上抛的,最后被包装成了 FlowExecutorNotInitException + Assert.assertTrue(ex.getMessage().contains("[chain name duplicate]")); + throw ex; + } + } + @Test(expected = ConfigErrorException.class) public void testConfigErrorException() { flowExecutor.setLiteflowConfig(null); diff --git a/liteflow-testcase-springboot/src/test/resources/exception/flow-exception.xml b/liteflow-testcase-springboot/src/test/resources/exception/flow-exception.xml new file mode 100644 index 000000000..662226def --- /dev/null +++ b/liteflow-testcase-springboot/src/test/resources/exception/flow-exception.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringTest.java index 3bccb2781..fbb9d3c9e 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringTest.java @@ -6,6 +6,7 @@ import com.yomahub.liteflow.exception.FlowExecutorNotInitException; import com.yomahub.liteflow.property.LiteflowConfig; import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -26,6 +27,22 @@ public class Exception1SpringTest extends BaseTest { @Resource private FlowExecutor flowExecutor; + /** + * 验证 chain 节点重复的异常 + */ + @Test(expected = FlowExecutorNotInitException.class) + public void testChainDuplicateException() { + try { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("exception/flow-exception.xml"); + flowExecutor.init(); + } catch (Exception ex) { + // 这里需要 catch 是因为,异常是往上抛的,最后被包装成了 FlowExecutorNotInitException + Assert.assertTrue(ex.getMessage().contains("[chain name duplicate]")); + throw ex; + } + } + @Test(expected = ConfigErrorException.class) public void testConfigErrorException() { flowExecutor.setLiteflowConfig(null); diff --git a/liteflow-testcase-springnative/src/test/resources/exception/flow-exception.xml b/liteflow-testcase-springnative/src/test/resources/exception/flow-exception.xml new file mode 100644 index 000000000..662226def --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/exception/flow-exception.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file From fa8ff86d0592500e4228442b8cf717ea75873b67 Mon Sep 17 00:00:00 2001 From: tangkc Date: Mon, 13 Jun 2022 16:20:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?[I5BR5M]=E4=B8=B4=E6=97=B6=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yomahub/liteflow/core/FlowExecutor.java | 39 +++++++++++-------- .../com/yomahub/liteflow/flow/FlowBus.java | 7 ++++ .../exception/Exception1SpringBootTest.java | 16 +++----- .../test/exception/Exception1Test.java | 16 +++----- .../exception/Exception1SpringBootTest.java | 18 +++------ .../test/exception/Exception1SpringTest.java | 16 +++----- 6 files changed, 50 insertions(+), 62 deletions(-) diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java b/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java index d716bc8e3..b32c5b04e 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java @@ -65,13 +65,13 @@ public class FlowExecutor { DataBus.init(); } - public FlowExecutor(LiteflowConfig liteflowConfig){ + public FlowExecutor(LiteflowConfig liteflowConfig) { this.liteflowConfig = liteflowConfig; //把liteFlowConfig设到LiteFlowGetter中去 LiteflowConfigGetter.setLiteflowConfig(liteflowConfig); //设置FlowExecutor的Holder,虽然大部分地方都可以通过Spring上下文获取到,但放入Holder,还是为了某些地方能方便的取到 FlowExecutorHolder.setHolder(this); - if (liteflowConfig.isParseOnStart()){ + if (liteflowConfig.isParseOnStart()) { this.init(); } //初始化DataBus @@ -86,9 +86,11 @@ public class FlowExecutor { throw new ConfigErrorException("config error, please check liteflow config property"); } - if (StrUtil.isBlank(liteflowConfig.getRuleSource())){ + if (StrUtil.isBlank(liteflowConfig.getRuleSource())) { return; } + // 初始化前清空缓存 + FlowBus.cleanChainMap(); List sourceRulePathList = Lists.newArrayList(liteflowConfig.getRuleSource().split(",|;")); @@ -128,7 +130,7 @@ public class FlowExecutor { throw new ConfigErrorException("parse error, please check liteflow config property"); } } - } catch (CyclicDependencyException e){ + } catch (CyclicDependencyException e) { LOG.error(e.getMessage()); throw e; } catch (Exception e) { @@ -139,22 +141,25 @@ public class FlowExecutor { } //单类型的配置文件,需要一起解析 - if (!liteflowConfig.isSupportMultipleType()){ + if (!liteflowConfig.isSupportMultipleType()) { //检查Parser是否只有一个,因为多个不同的parser会造成子流程的混乱 - if (parserNameSet.size() > 1){ + if (parserNameSet.size() > 1) { String errorMsg = "cannot have multiple different parsers"; LOG.error(errorMsg); throw new MultipleParsersException(errorMsg); } //进行多个配置文件的一起解析 - try{ + try { if (ObjectUtil.isNotNull(parser)) { parser.parseMain(rulePathList); } else { throw new ConfigErrorException("parse error, please check liteflow config property"); } - } catch (CyclicDependencyException e){ + } catch (CyclicDependencyException e) { + LOG.error(e.getMessage()); + throw e; + } catch (ChainDuplicateException e) { LOG.error(e.getMessage()); throw e; } catch (Exception e) { @@ -270,7 +275,7 @@ public class FlowExecutor { this.execute(chainId, param, null, slotIndex, true); } - public LiteflowResponse invoke2Resp(String chainId, Object param, Integer slotIndex){ + public LiteflowResponse invoke2Resp(String chainId, Object param, Integer slotIndex) { return this.execute2Resp(chainId, param, null, slotIndex, true); } @@ -293,7 +298,7 @@ public class FlowExecutor { } private T execute(String chainId, Object param, Class contextBeanClazz, - Integer slotIndex, boolean isInnerChain) throws Exception { + Integer slotIndex, boolean isInnerChain) throws Exception { Slot slot = this.doExecute(chainId, param, contextBeanClazz, slotIndex, isInnerChain); if (ObjectUtil.isNotNull(slot.getException())) { throw slot.getException(); @@ -338,14 +343,14 @@ public class FlowExecutor { } private Slot doExecute(String chainId, Object param, Class contextBeanClazz, Integer slotIndex, - boolean isInnerChain) { + boolean isInnerChain) { if (FlowBus.needInit()) { init(); } if (!isInnerChain && ObjectUtil.isNull(slotIndex)) { slotIndex = DataBus.offerSlot(contextBeanClazz); - if (BooleanUtil.isTrue(liteflowConfig.getPrintExecutionLog())){ + if (BooleanUtil.isTrue(liteflowConfig.getPrintExecutionLog())) { LOG.info("slot[{}] offered", slotIndex); } } @@ -361,18 +366,18 @@ public class FlowExecutor { if (StrUtil.isBlank(slot.getRequestId())) { slot.generateRequestId(); - if (BooleanUtil.isTrue(liteflowConfig.getPrintExecutionLog())){ + if (BooleanUtil.isTrue(liteflowConfig.getPrintExecutionLog())) { LOG.info("requestId[{}] has generated", slot.getRequestId()); } } if (!isInnerChain) { - if (ObjectUtil.isNotNull(param)){ + if (ObjectUtil.isNotNull(param)) { slot.setRequestData(param); } slot.setChainName(chainId); } else { - if (ObjectUtil.isNotNull(param)){ + if (ObjectUtil.isNotNull(param)) { slot.setChainReqData(chainId, param); } } @@ -388,12 +393,12 @@ public class FlowExecutor { // 执行chain chain.execute(slotIndex); } catch (ChainEndException e) { - if (ObjectUtil.isNotNull(chain)){ + if (ObjectUtil.isNotNull(chain)) { String warnMsg = StrUtil.format("[{}]:chain[{}] execute end on slot[{}]", slot.getRequestId(), chain.getChainName(), slotIndex); LOG.warn(warnMsg); } } catch (Exception e) { - if (ObjectUtil.isNotNull(chain)){ + if (ObjectUtil.isNotNull(chain)) { String errMsg = StrUtil.format("[{}]:chain[{}] execute error on slot[{}]", slot.getRequestId(), chain.getChainName(), slotIndex); LOG.error(errMsg, e); } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java index 2a1c886d2..2cefb41f3 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java @@ -189,6 +189,10 @@ public class FlowBus { cleanScriptCache(); } + public static void cleanChainMap(){ + chainMap.clear(); + } + public static void cleanScriptCache() { //如果引入了脚本组件SPI,则还需要清理脚本的缓存 try { @@ -201,6 +205,9 @@ public class FlowBus { } public static void refreshFlowMetaData(FlowParserTypeEnum type, String content) throws Exception { + // 刷新前清空缓存 + cleanChainMap(); + if (type.equals(FlowParserTypeEnum.TYPE_XML)) { new LocalXmlFlowParser().parse(content); } else if (type.equals(FlowParserTypeEnum.TYPE_JSON)) { diff --git a/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java b/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java index bd1e2fa90..dfe350393 100644 --- a/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java +++ b/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java @@ -1,12 +1,12 @@ package com.yomahub.liteflow.test.exception; import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.exception.ChainDuplicateException; import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.exception.FlowExecutorNotInitException; import com.yomahub.liteflow.property.LiteflowConfig; import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; -import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -32,17 +32,11 @@ public class Exception1SpringBootTest extends BaseTest { /** * 验证 chain 节点重复的异常 */ - @Test(expected = FlowExecutorNotInitException.class) + @Test(expected = ChainDuplicateException.class) public void testChainDuplicateException() { - try { - LiteflowConfig config = LiteflowConfigGetter.get(); - config.setRuleSource("exception/flow-exception.xml"); - flowExecutor.init(); - } catch (Exception ex) { - // 这里需要 catch 是因为,异常是往上抛的,最后被包装成了 FlowExecutorNotInitException - Assert.assertTrue(ex.getMessage().contains("[chain name duplicate]")); - throw ex; - } + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("exception/flow-exception.xml"); + flowExecutor.init(); } @Test(expected = ConfigErrorException.class) diff --git a/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception1Test.java b/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception1Test.java index b062dd7fb..5be900a90 100644 --- a/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception1Test.java +++ b/liteflow-testcase-nospring/src/test/java/com/yomahub/liteflow/test/exception/Exception1Test.java @@ -2,12 +2,12 @@ package com.yomahub.liteflow.test.exception; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.core.FlowExecutorHolder; +import com.yomahub.liteflow.exception.ChainDuplicateException; import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.exception.FlowExecutorNotInitException; import com.yomahub.liteflow.property.LiteflowConfig; import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; -import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -32,17 +32,11 @@ public class Exception1Test extends BaseTest { /** * 验证 chain 节点重复的异常 */ - @Test(expected = FlowExecutorNotInitException.class) + @Test(expected = ChainDuplicateException.class) public void testChainDuplicateException() { - try { - LiteflowConfig config = LiteflowConfigGetter.get(); - config.setRuleSource("exception/flow-exception.xml"); - flowExecutor.init(); - } catch (Exception ex) { - // 这里需要 catch 是因为,异常是往上抛的,最后被包装成了 FlowExecutorNotInitException - Assert.assertTrue(ex.getMessage().contains("[chain name duplicate]")); - throw ex; - } + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("exception/flow-exception.xml"); + flowExecutor.init(); } @Test(expected = ConfigErrorException.class) diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java index 65b7b7edc..8c53b8c85 100644 --- a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringBootTest.java @@ -1,12 +1,12 @@ package com.yomahub.liteflow.test.exception; import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.exception.ChainDuplicateException; import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.exception.FlowExecutorNotInitException; import com.yomahub.liteflow.property.LiteflowConfig; import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; -import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -25,24 +25,18 @@ import javax.annotation.Resource; @SpringBootTest(classes = Exception1SpringBootTest.class) @EnableAutoConfiguration public class Exception1SpringBootTest extends BaseTest { - + @Resource private FlowExecutor flowExecutor; /** * 验证 chain 节点重复的异常 */ - @Test(expected = FlowExecutorNotInitException.class) + @Test(expected = ChainDuplicateException.class) public void testChainDuplicateException() { - try { - LiteflowConfig config = LiteflowConfigGetter.get(); - config.setRuleSource("exception/flow-exception.xml"); - flowExecutor.init(); - } catch (Exception ex) { - // 这里需要 catch 是因为,异常是往上抛的,最后被包装成了 FlowExecutorNotInitException - Assert.assertTrue(ex.getMessage().contains("[chain name duplicate]")); - throw ex; - } + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("exception/flow-exception.xml"); + flowExecutor.init(); } @Test(expected = ConfigErrorException.class) diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringTest.java index fbb9d3c9e..673cfc3a7 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/exception/Exception1SpringTest.java @@ -1,12 +1,12 @@ package com.yomahub.liteflow.test.exception; import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.exception.ChainDuplicateException; import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.exception.FlowExecutorNotInitException; import com.yomahub.liteflow.property.LiteflowConfig; import com.yomahub.liteflow.property.LiteflowConfigGetter; import com.yomahub.liteflow.test.BaseTest; -import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -30,17 +30,11 @@ public class Exception1SpringTest extends BaseTest { /** * 验证 chain 节点重复的异常 */ - @Test(expected = FlowExecutorNotInitException.class) + @Test(expected = ChainDuplicateException.class) public void testChainDuplicateException() { - try { - LiteflowConfig config = LiteflowConfigGetter.get(); - config.setRuleSource("exception/flow-exception.xml"); - flowExecutor.init(); - } catch (Exception ex) { - // 这里需要 catch 是因为,异常是往上抛的,最后被包装成了 FlowExecutorNotInitException - Assert.assertTrue(ex.getMessage().contains("[chain name duplicate]")); - throw ex; - } + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("exception/flow-exception.xml"); + flowExecutor.init(); } @Test(expected = ConfigErrorException.class) From d1b39ac06792c8aa1d38f61c6afe7d00e2de171c Mon Sep 17 00:00:00 2001 From: tangkc Date: Mon, 13 Jun 2022 17:15:54 +0800 Subject: [PATCH 4/4] =?UTF-8?q?[I5BR5M]chain=20=E9=87=8D=E5=A4=8D=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yomahub/liteflow/core/FlowExecutor.java | 2 -- .../com/yomahub/liteflow/flow/FlowBus.java | 11 +---------- .../liteflow/parser/JsonFlowParser.java | 14 ++++++++++++++ .../yomahub/liteflow/parser/XmlFlowParser.java | 18 +++++++++++++++++- .../parser/SpringELSupportSpringbootTest.java | 2 +- .../parser/subFoder1/subFoder2/flow1.xml | 4 ++-- .../parser/subFoder1/subFoder2/flow2.xml | 2 +- .../parser/subFoder1/subFoder2/flow3.xml | 2 +- .../parser/SpringELSupportSpringbootTest.java | 2 +- .../parser/subFoder1/subFoder2/flow1.xml | 4 ++-- .../parser/subFoder1/subFoder2/flow2.xml | 2 +- .../parser/subFoder1/subFoder2/flow3.xml | 2 +- 12 files changed, 42 insertions(+), 23 deletions(-) diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java b/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java index b32c5b04e..3693018ac 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java @@ -89,8 +89,6 @@ public class FlowExecutor { if (StrUtil.isBlank(liteflowConfig.getRuleSource())) { return; } - // 初始化前清空缓存 - FlowBus.cleanChainMap(); List sourceRulePathList = Lists.newArrayList(liteflowConfig.getRuleSource().split(",|;")); diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java index 2cefb41f3..f7abf89cf 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java @@ -18,7 +18,6 @@ import com.yomahub.liteflow.core.ScriptComponent; import com.yomahub.liteflow.core.ScriptCondComponent; import com.yomahub.liteflow.enums.FlowParserTypeEnum; import com.yomahub.liteflow.enums.NodeTypeEnum; -import com.yomahub.liteflow.exception.ChainDuplicateException; import com.yomahub.liteflow.exception.ComponentCannotRegisterException; import com.yomahub.liteflow.flow.element.Chain; import com.yomahub.liteflow.flow.element.Node; @@ -63,8 +62,6 @@ public class FlowBus { public static void addChain(String chainName) { if (!chainMap.containsKey(chainName)) { chainMap.put(chainName, new Chain(chainName)); - } else { - throw new ChainDuplicateException(String.format("[chain name duplicate] chainName=%s", chainName)); } } @@ -161,7 +158,7 @@ public class FlowBus { nodeMap.put(nodeId, node); } catch (Exception e) { - String error = StrUtil.format("component[{}][{}] register error", cmpClazz.getName(), StringUtils.isEmpty(name)?nodeId:nodeId+"("+name+")"); + String error = StrUtil.format("component[{}][{}] register error", cmpClazz.getName(), StringUtils.isEmpty(name) ? nodeId : nodeId + "(" + name + ")"); LOG.error(error, e); throw new ComponentCannotRegisterException(error); } @@ -189,10 +186,6 @@ public class FlowBus { cleanScriptCache(); } - public static void cleanChainMap(){ - chainMap.clear(); - } - public static void cleanScriptCache() { //如果引入了脚本组件SPI,则还需要清理脚本的缓存 try { @@ -205,8 +198,6 @@ public class FlowBus { } public static void refreshFlowMetaData(FlowParserTypeEnum type, String content) throws Exception { - // 刷新前清空缓存 - cleanChainMap(); if (type.equals(FlowParserTypeEnum.TYPE_XML)) { new LocalXmlFlowParser().parse(content); diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/JsonFlowParser.java b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/JsonFlowParser.java index e102ff4e7..c52d883de 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/JsonFlowParser.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/JsonFlowParser.java @@ -9,12 +9,15 @@ import com.yomahub.liteflow.builder.LiteFlowChainBuilder; import com.yomahub.liteflow.builder.prop.ChainPropBean; import com.yomahub.liteflow.builder.prop.NodePropBean; import com.yomahub.liteflow.enums.ConditionTypeEnum; +import com.yomahub.liteflow.exception.ChainDuplicateException; import com.yomahub.liteflow.flow.FlowBus; import com.yomahub.liteflow.spi.holder.ContextCmpInitHolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; import static com.yomahub.liteflow.common.ChainConstant.ANY; import static com.yomahub.liteflow.common.ChainConstant.CHAIN; @@ -42,6 +45,8 @@ public abstract class JsonFlowParser extends BaseFlowParser { private final Logger LOG = LoggerFactory.getLogger(JsonFlowParser.class); + private final Set CHAIN_NAME_SET = new CopyOnWriteArraySet<>(); + public void parse(String content) throws Exception { parse(ListUtil.toList(content)); } @@ -80,9 +85,18 @@ public abstract class JsonFlowParser extends BaseFlowParser { //先在元数据里放上chain chainArray.forEach(o -> { JSONObject innerJsonObject = (JSONObject) o; + + // 校验加载的 chainName 是否有重复的 + String chainName = innerJsonObject.getString(NAME); + if (!CHAIN_NAME_SET.add(chainName)) { + throw new ChainDuplicateException(String.format("[chain name duplicate] chainName=%s", chainName)); + } + FlowBus.addChain(innerJsonObject.getString(NAME)); }); }); + // 清空 + CHAIN_NAME_SET.clear(); for (JSONObject flowJsonObject : flowJsonObjectList) { // 当存在节点定义时,解析node节点 diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java index 6bc8c6e49..cf6468a0e 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java @@ -7,6 +7,7 @@ import com.yomahub.liteflow.builder.LiteFlowChainBuilder; import com.yomahub.liteflow.builder.prop.ChainPropBean; import com.yomahub.liteflow.builder.prop.NodePropBean; import com.yomahub.liteflow.enums.ConditionTypeEnum; +import com.yomahub.liteflow.exception.ChainDuplicateException; import com.yomahub.liteflow.flow.FlowBus; import com.yomahub.liteflow.spi.holder.ContextCmpInitHolder; import org.dom4j.Document; @@ -17,6 +18,8 @@ import org.slf4j.LoggerFactory; import java.util.Iterator; import java.util.List; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; import static com.yomahub.liteflow.common.ChainConstant.ANY; import static com.yomahub.liteflow.common.ChainConstant.CHAIN; @@ -43,6 +46,8 @@ public abstract class XmlFlowParser extends BaseFlowParser { private final Logger LOG = LoggerFactory.getLogger(XmlFlowParser.class); + private final Set CHAIN_NAME_SET = new CopyOnWriteArraySet<>(); + public void parse(String content) throws Exception { parse(ListUtil.toList(content)); } @@ -76,8 +81,19 @@ public abstract class XmlFlowParser extends BaseFlowParser { List chainList = document.getRootElement().elements(CHAIN); //先在元数据里放上chain - chainList.forEach(e -> FlowBus.addChain(e.attributeValue(NAME))); + chainList.forEach(e -> { + + // 校验加载的 chainName 是否有重复的 + String chainName = e.attributeValue(NAME); + if (!CHAIN_NAME_SET.add(chainName)) { + throw new ChainDuplicateException(String.format("[chain name duplicate] chainName=%s", chainName)); + } + + FlowBus.addChain(chainName); + }); }); + // 清空 + CHAIN_NAME_SET.clear(); for (Document document : documentList) { Element rootElement = document.getRootElement(); diff --git a/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/parser/SpringELSupportSpringbootTest.java b/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/parser/SpringELSupportSpringbootTest.java index 379854374..7837ffa6a 100644 --- a/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/parser/SpringELSupportSpringbootTest.java +++ b/liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/parser/SpringELSupportSpringbootTest.java @@ -26,7 +26,7 @@ public class SpringELSupportSpringbootTest extends BaseTest { //测试springEL的解析情况 @Test public void testSpringELParser() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); + LiteflowResponse response = flowExecutor.execute2Resp("chain11", "arg"); Assert.assertTrue(response.isSuccess()); } } diff --git a/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow1.xml b/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow1.xml index 0775c5ec1..de73569cd 100644 --- a/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow1.xml +++ b/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow1.xml @@ -10,13 +10,13 @@ - + - + \ No newline at end of file diff --git a/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow2.xml b/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow2.xml index d739f6b53..c77305d52 100644 --- a/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow2.xml +++ b/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow2.xml @@ -1,7 +1,7 @@ - + diff --git a/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow3.xml b/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow3.xml index 0a898126c..8eedecef6 100644 --- a/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow3.xml +++ b/liteflow-testcase-declare-component/src/test/resources/parser/subFoder1/subFoder2/flow3.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/parser/SpringELSupportSpringbootTest.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/parser/SpringELSupportSpringbootTest.java index 379854374..7837ffa6a 100644 --- a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/parser/SpringELSupportSpringbootTest.java +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/parser/SpringELSupportSpringbootTest.java @@ -26,7 +26,7 @@ public class SpringELSupportSpringbootTest extends BaseTest { //测试springEL的解析情况 @Test public void testSpringELParser() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); + LiteflowResponse response = flowExecutor.execute2Resp("chain11", "arg"); Assert.assertTrue(response.isSuccess()); } } diff --git a/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow1.xml b/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow1.xml index 0775c5ec1..de73569cd 100644 --- a/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow1.xml +++ b/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow1.xml @@ -10,13 +10,13 @@ - + - + \ No newline at end of file diff --git a/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow2.xml b/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow2.xml index d739f6b53..c77305d52 100644 --- a/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow2.xml +++ b/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow2.xml @@ -1,7 +1,7 @@ - + diff --git a/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow3.xml b/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow3.xml index 0a898126c..8eedecef6 100644 --- a/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow3.xml +++ b/liteflow-testcase-springboot/src/test/resources/parser/subFoder1/subFoder2/flow3.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file