Kaynağa Gözat

enhancement #I5FNR4 减少Liteflow核心包对第三方包的依赖

everywhere.z 2 yıl önce
ebeveyn
işleme
ba2349038a

+ 2 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/builder/LiteFlowChainBuilder.java

@@ -2,8 +2,8 @@ package com.yomahub.liteflow.builder;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.util.StrUtil;
-import com.google.common.collect.Lists;
 import com.yomahub.liteflow.enums.ConditionTypeEnum;
 import com.yomahub.liteflow.flow.FlowBus;
 import com.yomahub.liteflow.flow.element.Chain;
@@ -79,7 +79,7 @@ public class LiteFlowChainBuilder {
      * build 前简单校验
      */
     private void checkBuild() {
-        List<String> errorList = Lists.newArrayList();
+        List<String> errorList = new ArrayList<>();
         if (StrUtil.isBlank(this.chain.getChainName())) {
             errorList.add("name is blank");
         }

+ 2 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/builder/LiteFlowNodeBuilder.java

@@ -3,7 +3,6 @@ package com.yomahub.liteflow.builder;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.io.resource.ResourceUtil;
 import cn.hutool.core.util.StrUtil;
-import com.google.common.collect.Lists;
 import com.yomahub.liteflow.enums.NodeTypeEnum;
 import com.yomahub.liteflow.exception.NodeBuildException;
 import com.yomahub.liteflow.flow.FlowBus;
@@ -11,6 +10,7 @@ import com.yomahub.liteflow.flow.element.Node;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 
@@ -120,7 +120,7 @@ public class LiteFlowNodeBuilder {
      * build 前简单校验
      */
     private void checkBuild() {
-        List<String> errorList = Lists.newArrayList();
+        List<String> errorList = new ArrayList<>();
         if (StrUtil.isBlank(this.node.getId())) {
             errorList.add("id is blank");
         }

+ 1 - 7
liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/LiteFlowChainELBuilder.java

@@ -1,13 +1,10 @@
 package com.yomahub.liteflow.builder.el;
 
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
-import com.google.common.collect.Lists;
 import com.ql.util.express.DefaultContext;
 import com.ql.util.express.ExpressRunner;
 import com.yomahub.liteflow.builder.el.operator.*;
-import com.yomahub.liteflow.enums.ConditionTypeEnum;
 import com.yomahub.liteflow.exception.ELParseException;
 import com.yomahub.liteflow.exception.FlowSystemException;
 import com.yomahub.liteflow.flow.FlowBus;
@@ -16,11 +13,8 @@ import com.yomahub.liteflow.flow.element.Executable;
 import com.yomahub.liteflow.flow.element.condition.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import java.util.ArrayList;
 import java.util.List;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
 
 /**
  * Chain基于代码形式的组装器
@@ -145,7 +139,7 @@ public class LiteFlowChainELBuilder {
      * build 前简单校验
      */
     private void checkBuild() {
-        List<String> errorList = Lists.newArrayList();
+        List<String> errorList = new ArrayList<>();
         if (StrUtil.isBlank(this.chain.getChainName())) {
             errorList.add("name is blank");
         }

+ 2 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/builder/entity/ExecutableEntity.java

@@ -1,8 +1,8 @@
 package com.yomahub.liteflow.builder.entity;
 
 import cn.hutool.core.collection.CollUtil;
-import com.google.common.collect.Lists;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -57,7 +57,7 @@ public class ExecutableEntity {
 
     public ExecutableEntity addNodeCondComponent(ExecutableEntity conditionNodeEntity) {
         if (CollUtil.isEmpty(this.nodeCondComponents)) {
-            this.nodeCondComponents = Lists.newArrayList();
+            this.nodeCondComponents = new ArrayList<>();
         }
         this.nodeCondComponents.add(conditionNodeEntity);
         return this;

+ 1 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java

@@ -13,7 +13,6 @@ import cn.hutool.core.util.BooleanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ReUtil;
 import cn.hutool.core.util.StrUtil;
-import com.google.common.collect.Lists;
 import com.yomahub.liteflow.enums.FlowParserTypeEnum;
 import com.yomahub.liteflow.exception.*;
 import com.yomahub.liteflow.flow.FlowBus;
@@ -120,7 +119,7 @@ public class FlowExecutor {
             return;
         }
 
-        List<String> sourceRulePathList = Lists.newArrayList(liteflowConfig.getRuleSource().split(",|;"));
+        List<String> sourceRulePathList = ListUtil.toList(liteflowConfig.getRuleSource().split(",|;"));
 
         FlowParser parser = null;
         Set<String> parserNameSet = new HashSet<>();

+ 2 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/flow/executor/NodeExecutorHelper.java

@@ -1,7 +1,7 @@
 package com.yomahub.liteflow.flow.executor;
 
+import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ObjectUtil;
-import com.google.common.collect.Maps;
 import com.yomahub.liteflow.spi.holder.ContextAwareHolder;
 
 import java.util.Map;
@@ -17,7 +17,7 @@ public class NodeExecutorHelper {
     private final Map<Class<? extends NodeExecutor>, NodeExecutor> nodeExecutorMap;
 
     private NodeExecutorHelper() {
-        nodeExecutorMap = Maps.newConcurrentMap();
+        nodeExecutorMap = MapUtil.newConcurrentHashMap();
     }
 
     //使用静态内部类实现单例模式

+ 1 - 2
liteflow-core/src/main/java/com/yomahub/liteflow/thread/ExecutorHelper.java

@@ -11,7 +11,6 @@ package com.yomahub.liteflow.thread;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
-import com.google.common.collect.Maps;
 import com.yomahub.liteflow.exception.ThreadExecutorServiceCreateException;
 import com.yomahub.liteflow.property.LiteflowConfig;
 import com.yomahub.liteflow.property.LiteflowConfigGetter;
@@ -40,7 +39,7 @@ public class ExecutorHelper {
     private final Map<String, ExecutorService> executorServiceMap;
 
     private ExecutorHelper() {
-        executorServiceMap = Maps.newConcurrentMap();
+        executorServiceMap = MapUtil.newConcurrentHashMap();
     }
 
     /**

+ 8 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/pom.xml

@@ -39,6 +39,14 @@
             <artifactId>zkclient</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 8 - 0
liteflow-testcase-el/liteflow-testcase-el-script-groovy-springboot/pom.xml

@@ -38,6 +38,14 @@
             <artifactId>zkclient</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.yomahub</groupId>
             <artifactId>liteflow-script-groovy</artifactId>

+ 8 - 0
liteflow-testcase-el/liteflow-testcase-el-script-qlexpress-springboot/pom.xml

@@ -36,6 +36,14 @@
             <groupId>com.101tec</groupId>
             <artifactId>zkclient</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.yomahub</groupId>
             <artifactId>liteflow-script-qlexpress</artifactId>

+ 8 - 0
liteflow-testcase-el/liteflow-testcase-el-springboot/pom.xml

@@ -38,6 +38,14 @@
             <artifactId>zkclient</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 8 - 0
liteflow-testcase-old/liteflow-testcase-declare-springboot/pom.xml

@@ -39,6 +39,14 @@
             <artifactId>zkclient</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 8 - 0
liteflow-testcase-old/liteflow-testcase-nospring/pom.xml

@@ -38,6 +38,14 @@
             <artifactId>zkclient</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 8 - 0
liteflow-testcase-old/liteflow-testcase-script-groovy-springboot/pom.xml

@@ -38,6 +38,14 @@
             <artifactId>zkclient</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.yomahub</groupId>
             <artifactId>liteflow-script-groovy</artifactId>

+ 8 - 0
liteflow-testcase-old/liteflow-testcase-script-qlexpress-springboot/pom.xml

@@ -36,6 +36,14 @@
             <groupId>com.101tec</groupId>
             <artifactId>zkclient</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.yomahub</groupId>
             <artifactId>liteflow-script-qlexpress</artifactId>

+ 8 - 0
liteflow-testcase-old/liteflow-testcase-springboot/pom.xml

@@ -35,6 +35,14 @@
             <groupId>com.101tec</groupId>
             <artifactId>zkclient</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 8 - 0
liteflow-testcase-old/liteflow-testcase-springnative/pom.xml

@@ -49,6 +49,14 @@
             <groupId>com.101tec</groupId>
             <artifactId>zkclient</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.aspectj</groupId>
             <artifactId>aspectjweaver</artifactId>

+ 9 - 1
pom.xml

@@ -97,7 +97,7 @@
 				<groupId>org.springframework</groupId>
 				<artifactId>spring-test</artifactId>
 				<version>${spring.version}</version>
-				<scope>provided</scope>
+				<scope>test</scope>
 				<optional>true</optional>
 			</dependency>
 			<dependency>
@@ -124,6 +124,7 @@
 				<groupId>junit</groupId>
 				<artifactId>junit</artifactId>
 				<version>${junit.version}</version>
+				<scope>test</scope>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.curator</groupId>
@@ -139,12 +140,14 @@
 						<groupId>org.slf4j</groupId>
 					</exclusion>
 				</exclusions>
+				<scope>provided</scope>
 				<optional>true</optional>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.curator</groupId>
 				<artifactId>curator-recipes</artifactId>
 				<version>${curator.version}</version>
+				<scope>provided</scope>
 				<optional>true</optional>
 			</dependency>
 			<dependency>
@@ -161,11 +164,14 @@
 				<groupId>org.apache.curator</groupId>
 				<artifactId>curator-test</artifactId>
 				<version>${curator-test.version}</version>
+				<scope>test</scope>
 			</dependency>
 			<dependency>
 				<groupId>com.101tec</groupId>
 				<artifactId>zkclient</artifactId>
 				<version>${zkclient.version}</version>
+				<scope>provided</scope>
+				<optional>true</optional>
 			</dependency>
 
 			<dependency>
@@ -193,6 +199,8 @@
 				<groupId>org.aspectj</groupId>
 				<artifactId>aspectjweaver</artifactId>
 				<version>${aspectjweaver.version}</version>
+				<scope>provided</scope>
+				<optional>true</optional>
 			</dependency>
 			<dependency>
 				<groupId>ch.qos.logback</groupId>