Browse Source

feature #I5CW7I 【版本特性】构造全新的EL规则表达式

everywhere.z 2 years ago
parent
commit
4069ba569e
100 changed files with 2239 additions and 6 deletions
  1. 4 3
      liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/LiteFlowChainELBuilder.java
  2. 7 2
      liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/TagOperator.java
  3. 9 0
      liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java
  4. 4 0
      liteflow-core/src/main/java/com/yomahub/liteflow/flow/LiteflowResponse.java
  5. 1 1
      liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/requestId/LiteflowRequestIdSpringbootTest.java
  6. 2 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/BaseTest.java
  7. 42 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/PrivateDeliveryELSpringbootTest.java
  8. 29 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/ACmp.java
  9. 27 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/BCmp.java
  10. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/CCmp.java
  11. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/DCmp.java
  12. 69 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/refreshRule/RefreshRuleELSpringbootTest.java
  13. 20 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/refreshRule/cmp/ACmp.java
  14. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/refreshRule/cmp/BCmp.java
  15. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/refreshRule/cmp/CCmp.java
  16. 40 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/reload/ReloadELSpringbootTest.java
  17. 20 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/reload/cmp/ACmp.java
  18. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/reload/cmp/BCmp.java
  19. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/reload/cmp/CCmp.java
  20. 42 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/RemoveChainELSpringbootTest.java
  21. 20 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/cmp/ACmp.java
  22. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/cmp/BCmp.java
  23. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/cmp/CCmp.java
  24. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/cmp/DCmp.java
  25. 37 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/requestId/LiteflowRequestIdELSpringbootTest.java
  26. 25 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/requestId/cmp/ACmp.java
  27. 25 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/requestId/cmp/BCmp.java
  28. 18 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/requestId/config/CustomRequestIdGenerator.java
  29. 52 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java
  30. 53 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringbootTest.java
  31. 39 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELSpringBootTest.java
  32. 39 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringBootTest.java
  33. 39 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringBootTest.java
  34. 13 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java
  35. 13 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java
  36. 13 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java
  37. 13 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java
  38. 14 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java
  39. 22 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java
  40. 28 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java
  41. 22 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java
  42. 18 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java
  43. 69 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/NodeTagELSpringbootJsonTest.java
  44. 69 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/NodeTagELSpringbootXmlTest.java
  45. 30 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/ACmp.java
  46. 23 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/B1Cmp.java
  47. 24 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/BCmp.java
  48. 24 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/CCmp.java
  49. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/DCmp.java
  50. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/ECmp.java
  51. 25 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/FCmp.java
  52. 20 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/GCmp.java
  53. 16 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/TestTL.java
  54. 43 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/UseTTLInWhenELSpringbootTest.java
  55. 22 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/ACmp.java
  56. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/BCmp.java
  57. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/CCmp.java
  58. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/DCmp.java
  59. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/ECmp.java
  60. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/FCmp.java
  61. 44 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/WhenTimeOutELSpringbootTest1.java
  62. 42 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/WhenTimeOutELSpringbootTest2.java
  63. 20 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/ACmp.java
  64. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/BCmp.java
  65. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/CCmp.java
  66. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/DCmp.java
  67. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/ECmp.java
  68. 26 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/FCmp.java
  69. 82 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithJsonELSpringbootTest.java
  70. 82 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithXmlELSpringbootTest.java
  71. 82 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithYmlELSpringbootTest.java
  72. 20 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/cmp/ACmp.java
  73. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/cmp/BCmp.java
  74. 21 0
      liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/cmp/CCmp.java
  75. 1 0
      liteflow-testcase-el-springboot/src/test/resources/privateDelivery/application.properties
  76. 21 0
      liteflow-testcase-el-springboot/src/test/resources/privateDelivery/flow.el.xml
  77. 1 0
      liteflow-testcase-el-springboot/src/test/resources/refreshRule/application.properties
  78. 6 0
      liteflow-testcase-el-springboot/src/test/resources/refreshRule/flow.el.xml
  79. 6 0
      liteflow-testcase-el-springboot/src/test/resources/refreshRule/flow_update.el.xml
  80. 1 0
      liteflow-testcase-el-springboot/src/test/resources/reload/application.properties
  81. 6 0
      liteflow-testcase-el-springboot/src/test/resources/reload/flow.el.xml
  82. 1 0
      liteflow-testcase-el-springboot/src/test/resources/removeChain/application.properties
  83. 10 0
      liteflow-testcase-el-springboot/src/test/resources/removeChain/flow.el.xml
  84. 2 0
      liteflow-testcase-el-springboot/src/test/resources/requestId/application.properties
  85. 6 0
      liteflow-testcase-el-springboot/src/test/resources/requestId/flow.el.xml
  86. 1 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/application-implicit.properties
  87. 1 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/application-json.properties
  88. 1 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties
  89. 1 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties
  90. 1 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/application-xml.properties
  91. 1 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/application-yml.properties
  92. 10 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/flow-implicit.el.xml
  93. 6 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/flow-main.el.xml
  94. 6 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub1.el.xml
  95. 6 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.xml
  96. 4 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.yml
  97. 22 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.json
  98. 18 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.xml
  99. 10 0
      liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.yml
  100. 1 0
      liteflow-testcase-el-springboot/src/test/resources/tag/application-json.properties

+ 4 - 3
liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/LiteFlowChainELBuilder.java

@@ -96,12 +96,13 @@ public class LiteFlowChainELBuilder {
         try{
             DefaultContext<String, Object> context = new DefaultContext<>();
 
-            //往上下文里放入所有的node,使得el表达式可以直接引用到nodeId
-            FlowBus.getNodeMap().keySet().forEach(nodeId -> context.put(nodeId, FlowBus.copyNode(nodeId)));
-
+            //这里一定要先放chain,再放node,因为node优先于chain,所以当重名时,node会覆盖掉chain
             //往上下文里放入所有的chain,是的el表达式可以直接引用到chain
             FlowBus.getChainMap().values().forEach(chain -> context.put(chain.getChainName(), chain));
 
+            //往上下文里放入所有的node,使得el表达式可以直接引用到nodeId
+            FlowBus.getNodeMap().keySet().forEach(nodeId -> context.put(nodeId, FlowBus.getNode(nodeId)));
+
             //解析el成为一个Condition
             //为什么这里只是一个Condition,而不是一个List<Condition>呢
             //这里无论多复杂的,外面必定有一个最外层的Condition,所以这里只有一个,内部可以嵌套很多层,这点和以前的不太一样

+ 7 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/TagOperator.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.ArrayUtil;
 import com.ql.util.express.Operator;
 import com.yomahub.liteflow.core.NodeComponent;
 import com.yomahub.liteflow.exception.ELParseException;
+import com.yomahub.liteflow.flow.FlowBus;
 import com.yomahub.liteflow.flow.element.Node;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,9 +46,13 @@ public class TagOperator extends Operator {
                 throw new Exception();
             }
 
-            node.setTag(tag);
+            //这里为什么要clone一个呢?
+            //因为tag是跟着chain走的。而在el上下文里的放的都是同一个node,如果多个同样的node tag不同,则这里必须copy
+            Node copyNode = FlowBus.copyNode(node.getId());
 
-            return node;
+            copyNode.setTag(tag);
+
+            return copyNode;
 
         }catch (Exception e){
             throw new ELParseException("errors occurred in EL parsing");

+ 9 - 0
liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java

@@ -22,6 +22,9 @@ import com.yomahub.liteflow.exception.ComponentCannotRegisterException;
 import com.yomahub.liteflow.parser.LocalJsonFlowParser;
 import com.yomahub.liteflow.parser.LocalXmlFlowParser;
 import com.yomahub.liteflow.parser.LocalYmlFlowParser;
+import com.yomahub.liteflow.parser.el.LocalJsonFlowELParser;
+import com.yomahub.liteflow.parser.el.LocalXmlFlowELParser;
+import com.yomahub.liteflow.parser.el.LocalYmlFlowELParser;
 import com.yomahub.liteflow.script.ScriptExecutor;
 import com.yomahub.liteflow.script.ScriptExecutorFactory;
 import com.yomahub.liteflow.script.exception.ScriptSpiException;
@@ -232,6 +235,12 @@ public class FlowBus {
             new LocalJsonFlowParser().parse(content);
         } else if (type.equals(FlowParserTypeEnum.TYPE_YML)) {
             new LocalYmlFlowParser().parse(content);
+        } else if (type.equals(FlowParserTypeEnum.TYPE_EL_XML)) {
+            new LocalXmlFlowELParser().parse(content);
+        } else if (type.equals(FlowParserTypeEnum.TYPE_EL_JSON)) {
+            new LocalJsonFlowELParser().parse(content);
+        } else if (type.equals(FlowParserTypeEnum.TYPE_EL_YML)) {
+            new LocalYmlFlowELParser().parse(content);
         }
     }
 

+ 4 - 0
liteflow-core/src/main/java/com/yomahub/liteflow/flow/LiteflowResponse.java

@@ -85,4 +85,8 @@ public class LiteflowResponse implements Serializable {
     public String getExecuteStepStrWithoutTime(){
         return this.getSlot().getExecuteStepStr(false);
     }
+
+    public String getRequestId(){
+        return this.getSlot().getRequestId();
+    }
 }

+ 1 - 1
liteflow-testcase-declare-component/src/test/java/com/yomahub/liteflow/test/requestId/LiteflowRequestIdSpringbootTest.java

@@ -31,7 +31,7 @@ public class LiteflowRequestIdSpringbootTest extends BaseTest {
     public void testRequestId() throws Exception {
         LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
         Assert.assertTrue(response.isSuccess());
-        Assert.assertEquals(response.getSlot().getRequestId(), "1");
+        Assert.assertEquals("1", response.getSlot().getRequestId());
     }
 
 }

+ 2 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/BaseTest.java

@@ -1,6 +1,7 @@
 package com.yomahub.liteflow.test;
 
 import com.yomahub.liteflow.flow.FlowBus;
+import com.yomahub.liteflow.flow.id.IdGeneratorHelper;
 import com.yomahub.liteflow.property.LiteflowConfigGetter;
 import com.yomahub.liteflow.spi.holder.SpiFactoryCleaner;
 import com.yomahub.liteflow.spring.ComponentScanner;
@@ -16,5 +17,6 @@ public class BaseTest {
         ExecutorHelper.loadInstance().clearExecutorServiceMap();
         SpiFactoryCleaner.clean();
         LiteflowConfigGetter.clean();
+        IdGeneratorHelper.getInstance().clear();
     }
 }

+ 42 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/PrivateDeliveryELSpringbootTest.java

@@ -0,0 +1,42 @@
+package com.yomahub.liteflow.test.privateDelivery;
+
+import cn.hutool.core.collection.ConcurrentHashSet;
+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;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * springboot环境下隐私投递的测试
+ * @author Bryan.Zhang
+ * @since 2.5.0
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/privateDelivery/application.properties")
+@SpringBootTest(classes = PrivateDeliveryELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.privateDelivery.cmp"})
+public class PrivateDeliveryELSpringbootTest extends BaseTest {
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    @Test
+    public void testPrivateDelivery() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response.getFirstContextBean();
+        ConcurrentHashSet<Integer> set = context.getData("testSet");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals(100, set.size());
+    }
+}

+ 29 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/ACmp.java

@@ -0,0 +1,29 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.privateDelivery.cmp;
+
+import cn.hutool.core.collection.ConcurrentHashSet;
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+@LiteflowComponent("a")
+public class ACmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("ACmp executed!");
+		DefaultContext context = this.getFirstContextBean();
+		context.setData("testSet", new ConcurrentHashSet<>());
+
+		for (int i = 0; i < 100; i++) {
+			this.sendPrivateDeliveryData("b",i+1);
+		}
+	}
+}
+

+ 27 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/BCmp.java

@@ -0,0 +1,27 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.privateDelivery.cmp;
+
+import cn.hutool.core.collection.ConcurrentHashSet;
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+@LiteflowComponent("b")
+public class BCmp extends NodeComponent {
+
+    @Override
+    public void process() {
+        System.out.println("BCmp executed!");
+        Integer value = this.getPrivateDeliveryData();
+        DefaultContext context = this.getFirstContextBean();
+        ConcurrentHashSet<Integer> testSet = context.getData("testSet");
+        testSet.add(value);
+    }
+}
+

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/CCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.privateDelivery.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+
+@LiteflowComponent("c")
+public class CCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("CCmp executed!");
+	}
+
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/DCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.privateDelivery.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+
+@LiteflowComponent("d")
+public class DCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("CCmp executed!");
+	}
+
+}

+ 69 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/refreshRule/RefreshRuleELSpringbootTest.java

@@ -0,0 +1,69 @@
+package com.yomahub.liteflow.test.refreshRule;
+
+import cn.hutool.core.io.resource.ResourceUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.enums.FlowParserTypeEnum;
+import com.yomahub.liteflow.flow.FlowBus;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+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;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * springboot环境下重新加载规则测试
+ * @author Bryan.Zhang
+ * @since 2.6.4
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/refreshRule/application.properties")
+@SpringBootTest(classes = RefreshRuleELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.refreshRule.cmp"})
+public class RefreshRuleELSpringbootTest extends BaseTest {
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    //测试普通刷新流程的场景
+    @Test
+    public void testRefresh1() throws Exception{
+        String content = ResourceUtil.readUtf8Str("classpath: /refreshRule/flow_update.el.xml");
+        FlowBus.refreshFlowMetaData(FlowParserTypeEnum.TYPE_EL_XML, content);
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertTrue(response.isSuccess());
+    }
+
+    //测试优雅刷新的场景
+    @Test
+    public void testRefresh2() throws Exception{
+        new Thread(() -> {
+            try {
+                Thread.sleep(3000L);
+                String content = ResourceUtil.readUtf8Str("classpath: /refreshRule/flow_update.el.xml");
+                FlowBus.refreshFlowMetaData(FlowParserTypeEnum.TYPE_EL_XML, content);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+        }).start();
+
+        for (int i = 0; i < 500; i++) {
+            LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+            Assert.assertTrue(response.isSuccess());
+            try {
+                Thread.sleep(10L);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+
+    }
+}

+ 20 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/refreshRule/cmp/ACmp.java

@@ -0,0 +1,20 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.refreshRule.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("a")
+public class ACmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("ACmp executed!");
+	}
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/refreshRule/cmp/BCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.refreshRule.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("b")
+public class BCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("BCmp executed!");
+	}
+
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/refreshRule/cmp/CCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.refreshRule.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("c")
+public class CCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("CCmp executed!");
+	}
+
+}

+ 40 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/reload/ReloadELSpringbootTest.java

@@ -0,0 +1,40 @@
+package com.yomahub.liteflow.test.reload;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+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;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * springboot环境下重新加载规则测试
+ * @author Bryan.Zhang
+ * @since 2.5.0
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/reload/application.properties")
+@SpringBootTest(classes = ReloadELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.reload.cmp"})
+public class ReloadELSpringbootTest extends BaseTest {
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    //用reloadRule去重新加载,这里如果配置是放在本地。如果想修改,则要去修改target下面的flow.xml
+    //这里的测试,手动打断点然后去修改,是ok的。但是整个测试,暂且只是为了测试这个功能是否能正常运行
+    @Test
+    public void testReload() throws Exception{
+        flowExecutor.reloadRule();
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertTrue(response.isSuccess());
+    }
+}

+ 20 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/reload/cmp/ACmp.java

@@ -0,0 +1,20 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.reload.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("a")
+public class ACmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("ACmp executed!");
+	}
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/reload/cmp/BCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.reload.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("b")
+public class BCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("BCmp executed!");
+	}
+
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/reload/cmp/CCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.reload.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("c")
+public class CCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("CCmp executed!");
+	}
+
+}

+ 42 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/RemoveChainELSpringbootTest.java

@@ -0,0 +1,42 @@
+package com.yomahub.liteflow.test.removeChain;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.FlowBus;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+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;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * springboot环境最普通的例子测试
+ * @author Bryan.Zhang
+ * @since 2.6.4
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/removeChain/application.properties")
+@SpringBootTest(classes = RemoveChainELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.removeChain.cmp"})
+public class RemoveChainELSpringbootTest extends BaseTest {
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    @Test
+    public void testRemoveChain() throws Exception{
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertTrue(response1.isSuccess());
+        FlowBus.removeChain("chain1");
+        LiteflowResponse response2 = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertFalse(response2.isSuccess());
+    }
+
+}

+ 20 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/cmp/ACmp.java

@@ -0,0 +1,20 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.removeChain.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("a")
+public class ACmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("ACmp executed!");
+	}
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/cmp/BCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.removeChain.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("b")
+public class BCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("BCmp executed!");
+	}
+
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/cmp/CCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.removeChain.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("c")
+public class CCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("CCmp executed!");
+	}
+
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/removeChain/cmp/DCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.removeChain.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("d")
+public class DCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("CCmp executed!");
+	}
+
+}

+ 37 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/requestId/LiteflowRequestIdELSpringbootTest.java

@@ -0,0 +1,37 @@
+package com.yomahub.liteflow.test.requestId;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+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;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * @author tangkc
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/requestId/application.properties")
+@SpringBootTest(classes = LiteflowRequestIdELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.requestId.cmp"})
+public class LiteflowRequestIdELSpringbootTest extends BaseTest {
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    @Test
+    public void testRequestId() throws Exception {
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("1", response.getRequestId());
+    }
+
+}

+ 25 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/requestId/cmp/ACmp.java

@@ -0,0 +1,25 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.requestId.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import org.springframework.stereotype.Component;
+
+@Component("a")
+@LiteflowCmpDefine
+public class ACmp {
+
+    @LiteflowMethod(LiteFlowMethodEnum.PROCESS)
+    public void process(NodeComponent bindCmp) {
+        System.out.println("ACmp executed!");
+    }
+}

+ 25 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/requestId/cmp/BCmp.java

@@ -0,0 +1,25 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.requestId.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import org.springframework.stereotype.Component;
+
+@Component("b")
+@LiteflowCmpDefine
+public class BCmp{
+
+	@LiteflowMethod(LiteFlowMethodEnum.PROCESS)
+	public void process(NodeComponent bindCmp) {
+		System.out.println("BCmp executed!");
+	}
+
+}

+ 18 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/requestId/config/CustomRequestIdGenerator.java

@@ -0,0 +1,18 @@
+package com.yomahub.liteflow.test.requestId.config;
+
+import com.yomahub.liteflow.flow.id.RequestIdGenerator;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * @author tangkc
+ */
+public class CustomRequestIdGenerator implements RequestIdGenerator {
+
+    private final AtomicInteger atomicInteger = new AtomicInteger(0);
+
+    @Override
+    public String generate() {
+        return atomicInteger.incrementAndGet() + "";
+    }
+}

+ 52 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java

@@ -0,0 +1,52 @@
+package com.yomahub.liteflow.test.subflow;
+
+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;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * 测试隐式调用子流程
+ * 单元测试
+ *
+ * @author justin.xu
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/subflow/application-implicit.properties")
+@SpringBootTest(classes = ImplicitSubFlowELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.subflow.cmp2"})
+public class ImplicitSubFlowELSpringbootTest extends BaseTest {
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    public static final Set<String> RUN_TIME_SLOT = new HashSet<>();
+
+    //这里GCmp中隐式的调用chain4,从而执行了h,m
+    @Test
+    public void testImplicitSubFlow() {
+        LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request");
+        DefaultContext context = response.getFirstContextBean();
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("f==>g==>h==>m", response.getExecuteStepStr());
+
+        //  传递了slotIndex,则set的size==1
+        Assert.assertEquals(1, RUN_TIME_SLOT.size());
+        //  set中第一次设置的requestId和response中的requestId一致
+        Assert.assertTrue(RUN_TIME_SLOT.contains(response.getSlot().getRequestId()));
+        //requestData的取值正确
+        Assert.assertEquals("it's implicit subflow.", context.getData("innerRequest"));
+    }
+}

+ 53 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringbootTest.java

@@ -0,0 +1,53 @@
+package com.yomahub.liteflow.test.subflow;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.exception.MultipleParsersException;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.property.LiteflowConfig;
+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 javax.annotation.Resource;
+
+/**
+ * 测试主流程与子流程在不同的配置文件的场景
+ *
+ * @author Bryan.Zhang
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/subflow/application-subInDifferentConfig1.properties")
+@SpringBootTest(classes = SubflowInDifferentConfigELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.subflow.cmp1","com.yomahub.liteflow.test.subflow.cmp2"})
+public class SubflowInDifferentConfigELSpringbootTest extends BaseTest {
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    //是否按照流程定义配置执行
+    @Test
+    public void testExplicitSubFlow1() {
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("a==>b==>b==>a==>e==>d", response.getExecuteStepStr());
+    }
+
+    @Autowired
+    private ApplicationContext context;
+
+    //主要测试有不同的配置类型后会不会报出既定的错误
+    @Test(expected = MultipleParsersException.class)
+    public void testExplicitSubFlow2() {
+        LiteflowConfig config = context.getBean(LiteflowConfig.class);
+        config.setRuleSource("subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml");
+        flowExecutor.init();
+    }
+}

+ 39 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELSpringBootTest.java

@@ -0,0 +1,39 @@
+package com.yomahub.liteflow.test.subflow;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+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;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * 测试显示调用子流程(json)
+ * 单元测试
+ *
+ * @author justin.xu
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/subflow/application-json.properties")
+@SpringBootTest(classes = SubflowJsonELSpringBootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.subflow.cmp1"})
+public class SubflowJsonELSpringBootTest extends BaseTest {
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    //是否按照流程定义配置执行
+    @Test
+    public void testExplicitSubFlow() {
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr());
+    }
+}

+ 39 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringBootTest.java

@@ -0,0 +1,39 @@
+package com.yomahub.liteflow.test.subflow;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+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;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * 测试显示调用子流程(xml)
+ * 单元测试
+ *
+ * @author justin.xu
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/subflow/application-xml.properties")
+@SpringBootTest(classes = SubflowXMLELSpringBootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.subflow.cmp1"})
+public class SubflowXMLELSpringBootTest extends BaseTest {
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    //是否按照流程定义配置执行
+    @Test
+    public void testExplicitSubFlow() {
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr());
+    }
+}

+ 39 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringBootTest.java

@@ -0,0 +1,39 @@
+package com.yomahub.liteflow.test.subflow;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+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;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * 测试显示调用子流程(yml)
+ * 单元测试
+ *
+ * @author justin.xu
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/subflow/application-yml.properties")
+@SpringBootTest(classes = SubflowYmlELSpringBootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.subflow.cmp1"})
+public class SubflowYmlELSpringBootTest extends BaseTest {
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    //是否按照流程定义配置执行
+    @Test
+    public void testExplicitSubFlowYml() {
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr());
+    }
+}

+ 13 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java

@@ -0,0 +1,13 @@
+package com.yomahub.liteflow.test.subflow.cmp1;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+
+@Component("a")
+public class ACmp extends NodeComponent {
+    @Override
+    public void process() {
+        System.out.println("Acomp executed!");
+    }
+}

+ 13 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java

@@ -0,0 +1,13 @@
+package com.yomahub.liteflow.test.subflow.cmp1;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+
+@Component("b")
+public class BCmp extends NodeComponent {
+    @Override
+    public void process() {
+        System.out.println("Bcomp executed!");
+    }
+}

+ 13 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java

@@ -0,0 +1,13 @@
+package com.yomahub.liteflow.test.subflow.cmp1;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+
+@Component("c")
+public class CCmp extends NodeComponent {
+    @Override
+    public void process() throws Exception {
+        System.out.println("Ccomp executed!");
+    }
+}

+ 13 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java

@@ -0,0 +1,13 @@
+package com.yomahub.liteflow.test.subflow.cmp1;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+
+@Component("d")
+public class DCmp extends NodeComponent {
+    @Override
+    public void process() throws Exception {
+        System.out.println("Dcomp executed!");
+    }
+}

+ 14 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java

@@ -0,0 +1,14 @@
+package com.yomahub.liteflow.test.subflow.cmp1;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+
+@Component("e")
+public class ECmp extends NodeComponent {
+
+    @Override
+    public void process() throws Exception {
+        System.out.println("Ecomp executed!");
+    }
+}

+ 22 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java

@@ -0,0 +1,22 @@
+package com.yomahub.liteflow.test.subflow.cmp2;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+import org.springframework.stereotype.Component;
+
+import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELSpringbootTest.RUN_TIME_SLOT;
+
+
+@Component("f")
+public class FCmp extends NodeComponent {
+    @Override
+    public void process() throws Exception {
+
+        RUN_TIME_SLOT.add(this.getSlot().getRequestId());
+
+        DefaultContext context = this.getFirstContextBean();
+        context.setData("innerRequestData", "inner request");
+
+        System.out.println("Fcomp executed!");
+    }
+}

+ 28 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java

@@ -0,0 +1,28 @@
+package com.yomahub.liteflow.test.subflow.cmp2;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELSpringbootTest.RUN_TIME_SLOT;
+
+
+@Component("g")
+public class GCmp extends NodeComponent {
+
+    @Autowired
+    private FlowExecutor flowExecutor;
+
+    @Override
+    public void process() throws Exception {
+
+        RUN_TIME_SLOT.add(this.getSlot().getRequestId());
+
+        System.out.println("Gcmp executed!");
+
+
+
+        flowExecutor.invoke("chain4", "it's implicit subflow.", this.getSlotIndex());
+    }
+}

+ 22 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java

@@ -0,0 +1,22 @@
+package com.yomahub.liteflow.test.subflow.cmp2;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+import org.springframework.stereotype.Component;
+
+import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELSpringbootTest.RUN_TIME_SLOT;
+
+
+@Component("h")
+public class HCmp extends NodeComponent {
+    @Override
+    public void process() throws Exception {
+        String requestData = this.getSubChainReqData();
+        DefaultContext context = this.getFirstContextBean();
+        context.setData("innerRequest", requestData);
+
+        RUN_TIME_SLOT.add(this.getSlot().getRequestId());
+
+        System.out.println("Hcomp executed!");
+    }
+}

+ 18 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java

@@ -0,0 +1,18 @@
+package com.yomahub.liteflow.test.subflow.cmp2;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELSpringbootTest.RUN_TIME_SLOT;
+
+
+@Component("m")
+public class MCmp extends NodeComponent {
+    @Override
+    public void process() throws Exception {
+
+        RUN_TIME_SLOT.add(this.getSlot().getRequestId());
+
+        System.out.println("Mcomp executed!");
+    }
+}

+ 69 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/NodeTagELSpringbootJsonTest.java

@@ -0,0 +1,69 @@
+package com.yomahub.liteflow.test.tag;
+
+import cn.hutool.core.collection.ConcurrentHashSet;
+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;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * springboot环境下隐私投递的测试
+ * @author Bryan.Zhang
+ * @since 2.5.0
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/tag/application-json.properties")
+@SpringBootTest(classes = NodeTagELSpringbootJsonTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.tag.cmp"})
+public class NodeTagELSpringbootJsonTest extends BaseTest {
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    @Test
+    public void testTag1() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response.getFirstContextBean();
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("123",context.getData("test"));
+    }
+
+    @Test
+    public void testTag2() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain2", "arg");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("a==>a==>a==>c==>e", response.getExecuteStepStr());
+    }
+
+    //测试多线程when情况下的tag取值是否正确
+    //这里循环多次的原因是,因为when多线程,有时候因为凑巧,可能正确。所以多次情况下在2.6.4版本肯定出错
+    @Test
+    public void testTag3() throws Exception{
+        for (int i = 0; i < 50; i++) {
+            LiteflowResponse response = flowExecutor.execute2Resp("chain3", "arg");
+            DefaultContext context = response.getFirstContextBean();
+            Assert.assertTrue(response.isSuccess());
+            ConcurrentHashSet<String> testSet = context.getData("test");
+            Assert.assertEquals(3, testSet.size());
+        }
+    }
+
+    //测试tag是否能在isAccess中起效
+    @Test
+    public void testTag4() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain4", "arg");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("g", response.getExecuteStepStr());
+    }
+}

+ 69 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/NodeTagELSpringbootXmlTest.java

@@ -0,0 +1,69 @@
+package com.yomahub.liteflow.test.tag;
+
+import cn.hutool.core.collection.ConcurrentHashSet;
+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;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * springboot环境下隐私投递的测试
+ * @author Bryan.Zhang
+ * @since 2.5.0
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/tag/application-xml.properties")
+@SpringBootTest(classes = NodeTagELSpringbootXmlTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.tag.cmp"})
+public class NodeTagELSpringbootXmlTest extends BaseTest {
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    @Test
+    public void testTag1() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response.getFirstContextBean();
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("123",context.getData("test"));
+    }
+
+    @Test
+    public void testTag2() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain2", "arg");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("a==>a==>a==>c==>e", response.getExecuteStepStr());
+    }
+
+    //测试多线程when情况下的tag取值是否正确
+    //这里循环多次的原因是,因为when多线程,有时候因为凑巧,可能正确。所以多次情况下在2.6.4版本肯定出错
+    @Test
+    public void testTag3() throws Exception{
+        for (int i = 0; i < 50; i++) {
+            LiteflowResponse response = flowExecutor.execute2Resp("chain3", "arg");
+            DefaultContext context = response.getFirstContextBean();
+            Assert.assertTrue(response.isSuccess());
+            ConcurrentHashSet<String> testSet = context.getData("test");
+            Assert.assertEquals(3, testSet.size());
+        }
+    }
+
+    //测试tag是否能在isAccess中起效
+    @Test
+    public void testTag4() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain4", "arg");
+        Assert.assertTrue(response.isSuccess());
+        Assert.assertEquals("g", response.getExecuteStepStr());
+    }
+}

+ 30 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/ACmp.java

@@ -0,0 +1,30 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.tag.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+@LiteflowComponent("a")
+public class ACmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		String testKey = "test";
+
+		DefaultContext context = this.getFirstContextBean();
+		if (context.getData(testKey) == null){
+			context.setData(testKey,this.getTag());
+		}else{
+			String s = context.getData(testKey);
+			s += this.getTag();
+			context.setData(testKey, s);
+		}
+	}
+}

+ 23 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/B1Cmp.java

@@ -0,0 +1,23 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.tag.cmp;
+
+import cn.hutool.core.collection.ConcurrentHashSet;
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+@LiteflowComponent("b1")
+public class B1Cmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		DefaultContext context = this.getFirstContextBean();
+		context.setData("test",new ConcurrentHashSet<String>());
+	}
+}

+ 24 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/BCmp.java

@@ -0,0 +1,24 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.tag.cmp;
+
+import cn.hutool.core.collection.ConcurrentHashSet;
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+@LiteflowComponent("b")
+public class BCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		DefaultContext context = this.getFirstContextBean();
+		ConcurrentHashSet<String> testSet = context.getData("test");
+		testSet.add(this.getTag());
+	}
+}

+ 24 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/CCmp.java

@@ -0,0 +1,24 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.tag.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeSwitchComponent;
+
+@LiteflowComponent("c")
+public class CCmp extends NodeSwitchComponent {
+
+	@Override
+	public String processCond() throws Exception {
+		if(this.getTag().equals("2")){
+			return "e";
+		}else{
+			return "d";
+		}
+	}
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/DCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.tag.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+
+@LiteflowComponent("d")
+public class DCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println(this.getTag());
+		System.out.println("DCmp executed!");
+	}
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/ECmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.tag.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+
+@LiteflowComponent("e")
+public class ECmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println(this.getTag());
+		System.out.println("ECmp executed!");
+	}
+}

+ 25 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/FCmp.java

@@ -0,0 +1,25 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.tag.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+
+@LiteflowComponent("f")
+public class FCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("FCmp executed!");
+	}
+
+	@Override
+	public boolean isAccess() {
+		return Boolean.parseBoolean(this.getTag());
+	}
+}

+ 20 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/tag/cmp/GCmp.java

@@ -0,0 +1,20 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.tag.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.core.NodeComponent;
+
+@LiteflowComponent("g")
+public class GCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("GCmp executed!");
+	}
+}

+ 16 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/TestTL.java

@@ -0,0 +1,16 @@
+package com.yomahub.liteflow.test.useTTLInWhen;
+
+import com.alibaba.ttl.TransmittableThreadLocal;
+
+public class TestTL {
+
+    public static ThreadLocal<String> tl = new TransmittableThreadLocal<>();
+
+    public static String get(){
+        return tl.get();
+    }
+
+    public static void set(String value){
+        tl.set(value);
+    }
+}

+ 43 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/UseTTLInWhenELSpringbootTest.java

@@ -0,0 +1,43 @@
+package com.yomahub.liteflow.test.useTTLInWhen;
+
+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;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * 在when异步节点的情况下去拿ThreadLocal里的测试场景
+ * @author Bryan.Zhang
+ * @since 2.6.3
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/useTTLInWhen/application.properties")
+@SpringBootTest(classes = UseTTLInWhenELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.useTTLInWhen.cmp"})
+public class UseTTLInWhenELSpringbootTest extends BaseTest {
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    @Test
+    public void testUseTTLInWhen() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response.getFirstContextBean();
+        Assert.assertEquals("hello,b", context.getData("b"));
+        Assert.assertEquals("hello,c", context.getData("c"));
+        Assert.assertEquals("hello,d", context.getData("d"));
+        Assert.assertEquals("hello,e", context.getData("e"));
+        Assert.assertEquals("hello,f", context.getData("f"));
+    }
+}

+ 22 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/ACmp.java

@@ -0,0 +1,22 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.useTTLInWhen.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.test.useTTLInWhen.TestTL;
+import org.springframework.stereotype.Component;
+
+@Component("a")
+public class ACmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		TestTL.set("hello");
+		System.out.println("ACmp executed!");
+	}
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/BCmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.useTTLInWhen.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.useTTLInWhen.TestTL;
+import org.springframework.stereotype.Component;
+
+@Component("b")
+public class BCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		String value = TestTL.get();
+		DefaultContext context = this.getFirstContextBean();
+		context.setData(this.getNodeId(),value+",b");
+		System.out.println("BCmp executed!");
+	}
+
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/CCmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.useTTLInWhen.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.useTTLInWhen.TestTL;
+import org.springframework.stereotype.Component;
+
+@Component("c")
+public class CCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		String value = TestTL.get();
+		DefaultContext context = this.getFirstContextBean();
+		context.setData(this.getNodeId(),value+",c");
+		System.out.println("CCmp executed!");
+	}
+
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/DCmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.useTTLInWhen.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.useTTLInWhen.TestTL;
+import org.springframework.stereotype.Component;
+
+@Component("d")
+public class DCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		String value = TestTL.get();
+		DefaultContext context = this.getFirstContextBean();
+		context.setData(this.getNodeId(),value+",d");
+		System.out.println("DCmp executed!");
+	}
+
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/ECmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.useTTLInWhen.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.useTTLInWhen.TestTL;
+import org.springframework.stereotype.Component;
+
+@Component("e")
+public class ECmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		String value = TestTL.get();
+		DefaultContext context = this.getFirstContextBean();
+		context.setData(this.getNodeId(),value+",e");
+		System.out.println("ECmp executed!");
+	}
+
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/useTTLInWhen/cmp/FCmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.useTTLInWhen.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.useTTLInWhen.TestTL;
+import org.springframework.stereotype.Component;
+
+@Component("f")
+public class FCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		String value = TestTL.get();
+		DefaultContext context = this.getFirstContextBean();
+		context.setData(this.getNodeId(),value+",f");
+		System.out.println("FCmp executed!");
+	}
+
+}

+ 44 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/WhenTimeOutELSpringbootTest1.java

@@ -0,0 +1,44 @@
+package com.yomahub.liteflow.test.whenTimeOut;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.exception.WhenTimeoutException;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * springboot环境下异步线程超时日志打印测试
+ * @author Bryan.Zhang
+ * @since 2.6.4
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/whenTimeOut/application1.properties")
+@SpringBootTest(classes = WhenTimeOutELSpringbootTest1.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.whenTimeOut.cmp"})
+public class WhenTimeOutELSpringbootTest1 extends BaseTest {
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    //其中b和c在when情况下超时,所以抛出了WhenTimeoutException这个错
+    @Test
+    public void testWhenTimeOut() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertFalse(response.isSuccess());
+        Assert.assertEquals(WhenTimeoutException.class, response.getCause().getClass());
+    }
+}

+ 42 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/WhenTimeOutELSpringbootTest2.java

@@ -0,0 +1,42 @@
+package com.yomahub.liteflow.test.whenTimeOut;
+
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * springboot环境下异步线程超时日志打印测试
+ * @author Bryan.Zhang
+ * @since 2.6.4
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/whenTimeOut/application2.properties")
+@SpringBootTest(classes = WhenTimeOutELSpringbootTest2.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.whenTimeOut.cmp"})
+public class WhenTimeOutELSpringbootTest2 extends BaseTest {
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    //其中d,e,f都sleep 4秒,其中def是不同的组,超时设置5秒
+    @Test
+    public void testWhenTimeOut() throws Exception{
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertTrue(response.isSuccess());
+    }
+}

+ 20 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/ACmp.java

@@ -0,0 +1,20 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.whenTimeOut.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("a")
+public class ACmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("ACmp executed!");
+	}
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/BCmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.whenTimeOut.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("b")
+public class BCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		try {
+			Thread.sleep(4000);
+		}catch (Exception ignored){
+
+		}
+		System.out.println("BCmp executed!");
+	}
+
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/CCmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.whenTimeOut.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("c")
+public class CCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		try {
+			Thread.sleep(3500);
+		}catch (Exception ignored){
+
+		}
+		System.out.println("CCmp executed!");
+	}
+
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/DCmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.whenTimeOut.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("d")
+public class DCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		try {
+			Thread.sleep(4000);
+		}catch (Exception ignored){
+
+		}
+		System.out.println("DCmp executed!");
+	}
+
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/ECmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.whenTimeOut.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("e")
+public class ECmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		try {
+			Thread.sleep(4000);
+		}catch (Exception ignored){
+
+		}
+		System.out.println("ECmp executed!");
+	}
+
+}

+ 26 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/FCmp.java

@@ -0,0 +1,26 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.whenTimeOut.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("f")
+public class FCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		try {
+			Thread.sleep(4000);
+		}catch (Exception ignored){
+
+		}
+		System.out.println("FCmp executed!");
+	}
+
+}

+ 82 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithJsonELSpringbootTest.java

@@ -0,0 +1,82 @@
+package com.yomahub.liteflow.test.zookeeper;
+
+import cn.hutool.core.io.resource.ResourceUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.test.BaseTest;
+import org.I0Itec.zkclient.ZkClient;
+import org.I0Itec.zkclient.exception.ZkMarshallingError;
+import org.I0Itec.zkclient.serialize.ZkSerializer;
+import org.apache.curator.test.TestingServer;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.nio.charset.Charset;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * springboot环境下的zk配置源功能测试
+ * ZK节点存储数据的格式为json文件
+ * @author zendwang
+ * @since 2.5.0
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/zookeeper/application-json.properties")
+@SpringBootTest(classes = ZkNodeWithJsonELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.zookeeper.cmp"})
+public class ZkNodeWithJsonELSpringbootTest extends BaseTest {
+    
+    private static final String ZK_NODE_PATH = "/lite-flow/flow";
+
+    private static TestingServer zkServer;
+    
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        zkServer = new TestingServer(21810);
+        CountDownLatch latch = new CountDownLatch(1);
+        new Thread(() -> {
+            String data = ResourceUtil.readUtf8Str("zookeeper/flow.json");
+            ZkClient zkClient = new ZkClient("127.0.0.1:21810");
+            zkClient.setZkSerializer(new ZkSerializer() {
+                @Override
+                public byte[] serialize(final Object o) throws ZkMarshallingError {
+                    return o.toString().getBytes(Charset.forName("UTF-8"));
+                }
+
+                @Override
+                public Object deserialize(final byte[] bytes) throws ZkMarshallingError {
+                    return new String(bytes, Charset.forName("UTF-8"));
+                }
+            });
+            zkClient.createPersistent(ZK_NODE_PATH, true);
+            zkClient.writeData(ZK_NODE_PATH, data);
+            zkClient.close();
+            latch.countDown();
+        }).start();
+        latch.await();
+    }
+    
+    @Test
+    public void testZkNodeWithJson() {
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertTrue(response.isSuccess());
+    }
+    
+    @AfterClass
+    public static void tearDown() throws Exception {
+        zkServer.stop();
+    }
+}

+ 82 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithXmlELSpringbootTest.java

@@ -0,0 +1,82 @@
+package com.yomahub.liteflow.test.zookeeper;
+
+import cn.hutool.core.io.resource.ResourceUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.test.BaseTest;
+import org.I0Itec.zkclient.ZkClient;
+import org.I0Itec.zkclient.exception.ZkMarshallingError;
+import org.I0Itec.zkclient.serialize.ZkSerializer;
+import org.apache.curator.test.TestingServer;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.nio.charset.Charset;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * springboot环境下的zk配置源功能测试
+ * ZK节点存储数据的格式为xml文件
+ * @author zendwang
+ * @since 2.5.0
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/zookeeper/application-xml.properties")
+@SpringBootTest(classes = ZkNodeWithXmlELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.zookeeper.cmp"})
+public class ZkNodeWithXmlELSpringbootTest extends BaseTest {
+    
+    private static final String ZK_NODE_PATH = "/lite-flow/flow";
+
+    private static TestingServer zkServer;
+    
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        zkServer = new TestingServer(21810);
+        CountDownLatch latch = new CountDownLatch(1);
+        new Thread(() -> {
+            String data = ResourceUtil.readUtf8Str("zookeeper/flow.xml");
+            ZkClient zkClient = new ZkClient("127.0.0.1:21810");
+            zkClient.setZkSerializer(new ZkSerializer() {
+                @Override
+                public byte[] serialize(final Object o) throws ZkMarshallingError {
+                    return o.toString().getBytes(Charset.forName("UTF-8"));
+                }
+
+                @Override
+                public Object deserialize(final byte[] bytes) throws ZkMarshallingError {
+                    return new String(bytes, Charset.forName("UTF-8"));
+                }
+            });
+            zkClient.createPersistent(ZK_NODE_PATH, true);
+            zkClient.writeData(ZK_NODE_PATH, data);
+            zkClient.close();
+            latch.countDown();
+        }).start();
+        latch.await();
+    }
+    
+    @Test
+    public void testZkNodeWithXml() {
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertTrue(response.isSuccess());
+    }
+    
+    @AfterClass
+    public static void tearDown() throws Exception {
+        zkServer.stop();
+    }
+}

+ 82 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithYmlELSpringbootTest.java

@@ -0,0 +1,82 @@
+package com.yomahub.liteflow.test.zookeeper;
+
+import cn.hutool.core.io.resource.ResourceUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.test.BaseTest;
+import org.I0Itec.zkclient.ZkClient;
+import org.I0Itec.zkclient.exception.ZkMarshallingError;
+import org.I0Itec.zkclient.serialize.ZkSerializer;
+import org.apache.curator.test.TestingServer;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.nio.charset.Charset;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * springboot环境下的zk配置源功能测试
+ * ZK节点存储数据的格式为yml文件
+ * @author zendwang
+ * @since 2.5.0
+ */
+@RunWith(SpringRunner.class)
+@TestPropertySource(value = "classpath:/zookeeper/application-yml.properties")
+@SpringBootTest(classes = ZkNodeWithYmlELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.zookeeper.cmp"})
+public class ZkNodeWithYmlELSpringbootTest extends BaseTest {
+    
+    private static final String ZK_NODE_PATH = "/lite-flow/flow";
+
+    private static TestingServer zkServer;
+    
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        zkServer = new TestingServer(21810);
+        CountDownLatch latch = new CountDownLatch(1);
+        new Thread(() -> {
+            String data = ResourceUtil.readUtf8Str("zookeeper/flow.yml");
+            ZkClient zkClient = new ZkClient("127.0.0.1:21810");
+            zkClient.setZkSerializer(new ZkSerializer() {
+                @Override
+                public byte[] serialize(final Object o) throws ZkMarshallingError {
+                    return o.toString().getBytes(Charset.forName("UTF-8"));
+                }
+
+                @Override
+                public Object deserialize(final byte[] bytes) throws ZkMarshallingError {
+                    return new String(bytes, Charset.forName("UTF-8"));
+                }
+            });
+            zkClient.createPersistent(ZK_NODE_PATH, true);
+            zkClient.writeData(ZK_NODE_PATH, data);
+            zkClient.close();
+            latch.countDown();
+        }).start();
+        latch.await();
+    }
+    
+    @Test
+    public void testZkNodeWithYml() {
+        LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
+        Assert.assertTrue(response.isSuccess());
+    }
+    
+    @AfterClass
+    public static void tearDown() throws Exception {
+        zkServer.stop();
+    }
+}

+ 20 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/cmp/ACmp.java

@@ -0,0 +1,20 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.zookeeper.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("a")
+public class ACmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("ACmp executed!");
+	}
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/cmp/BCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.zookeeper.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("b")
+public class BCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("BCmp executed!");
+	}
+
+}

+ 21 - 0
liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/cmp/CCmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.zookeeper.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.stereotype.Component;
+
+@Component("c")
+public class CCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		System.out.println("CCmp executed!");
+	}
+
+}

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/privateDelivery/application.properties

@@ -0,0 +1 @@
+liteflow.rule-source=privateDelivery/flow.el.xml

+ 21 - 0
liteflow-testcase-el-springboot/src/test/resources/privateDelivery/flow.el.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        THEN(
+            a,
+            WHEN(
+                b,b,b,b,b,b,b,b,b,b,
+                b,b,b,b,b,b,b,b,b,b,
+                b,b,b,b,b,b,b,b,b,b,
+                b,b,b,b,b,b,b,b,b,b,
+                b,b,b,b,b,b,b,b,b,b,
+                b,b,b,b,b,b,b,b,b,b,
+                b,b,b,b,b,b,b,b,b,b,
+                b,b,b,b,b,b,b,b,b,b,
+                b,b,b,b,b,b,b,b,b,b,
+                b,b,b,b,b,b,b,b,b,b
+            ),
+            c
+        )
+    </chain>
+</flow>

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/refreshRule/application.properties

@@ -0,0 +1 @@
+liteflow.rule-source=refreshRule/flow.el.xml

+ 6 - 0
liteflow-testcase-el-springboot/src/test/resources/refreshRule/flow.el.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        THEN(a, b, c)
+    </chain>
+</flow>

+ 6 - 0
liteflow-testcase-el-springboot/src/test/resources/refreshRule/flow_update.el.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        THEN(c, b, a)
+    </chain>
+</flow>

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/reload/application.properties

@@ -0,0 +1 @@
+liteflow.rule-source=reload/flow.el.xml

+ 6 - 0
liteflow-testcase-el-springboot/src/test/resources/reload/flow.el.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        THEN(a, b, c)
+    </chain>
+</flow>

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/removeChain/application.properties

@@ -0,0 +1 @@
+liteflow.rule-source=removeChain/flow.el.xml

+ 10 - 0
liteflow-testcase-el-springboot/src/test/resources/removeChain/flow.el.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        THEN(a, b, WHEN(c, d))
+    </chain>
+
+    <chain name="chain2">
+        THEN(a, b, c, d)
+    </chain>
+</flow>

+ 2 - 0
liteflow-testcase-el-springboot/src/test/resources/requestId/application.properties

@@ -0,0 +1,2 @@
+liteflow.rule-source=requestId/flow.el.xml
+liteflow.request-id-generator-class=com.yomahub.liteflow.test.requestId.config.CustomRequestIdGenerator

+ 6 - 0
liteflow-testcase-el-springboot/src/test/resources/requestId/flow.el.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        THEN(a, b)
+    </chain>
+</flow>

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/application-implicit.properties

@@ -0,0 +1 @@
+liteflow.rule-source=subflow/flow-implicit.el.xml

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/application-json.properties

@@ -0,0 +1 @@
+liteflow.rule-source=subflow/flow.el.json

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties

@@ -0,0 +1 @@
+liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.xml

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties

@@ -0,0 +1 @@
+liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/application-xml.properties

@@ -0,0 +1 @@
+liteflow.rule-source=subflow/flow.el.xml

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/application-yml.properties

@@ -0,0 +1 @@
+liteflow.rule-source=subflow/flow.el.yml

+ 10 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/flow-implicit.el.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain3">
+        THEN(f, g)
+    </chain>
+
+    <chain name="chain4">
+        THEN(h, m)
+    </chain>
+</flow>

+ 6 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/flow-main.el.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        THEN(a, b, chain2)
+    </chain>
+</flow>

+ 6 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub1.el.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain2">
+        THEN(b, a, chain3)
+    </chain>
+</flow>

+ 6 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain3">
+        THEN(e, d)
+    </chain>
+</flow>

+ 4 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.yml

@@ -0,0 +1,4 @@
+flow:
+  chain:
+    - name: chain3
+      value: "THEN(e, d)"

+ 22 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.json

@@ -0,0 +1,22 @@
+{
+  "flow": {
+    "chain": [
+      {
+        "name": "chain3",
+        "value": "THEN(e,d)",
+      },
+      {
+        "name": "chain2",
+        "value": "THEN(b, a, chain3)",
+      },
+      {
+        "name": "chain1",
+        "value": "THEN(a, b, c, chain2)",
+      },
+      {
+        "name": "c",
+        "value": "THEN(d, e)",
+      }
+    ]
+  }
+}

+ 18 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        THEN(a, b, c, chain2)
+    </chain>
+
+    <chain name="c">
+        THEN(d, e)
+    </chain>
+
+    <chain name="chain2">
+        THEN(b, a, chain3)
+    </chain>
+
+    <chain name="chain3">
+        THEN(e, d)
+    </chain>
+</flow>

+ 10 - 0
liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.yml

@@ -0,0 +1,10 @@
+flow:
+  chain:
+    - name: chain3
+      value: "THEN(e, d)"
+    - name: chain1
+      value: "THEN(a, b, c, chain2)"
+    - name: c
+      value: "THEN(d, e)"
+    - name: chain2
+      value: "THEN(b, a, chain3)"

+ 1 - 0
liteflow-testcase-el-springboot/src/test/resources/tag/application-json.properties

@@ -0,0 +1 @@
+liteflow.rule-source=tag/flow.el.json

Some files were not shown because too many files changed in this diff