From b2ef9d60408305e4560f969c9b74582d8374d8d9 Mon Sep 17 00:00:00 2001 From: dq-open-cloud <466608943@qq.com> Date: Mon, 24 Jan 2022 10:23:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/privateDelivery/cmp/ACmp.java | 21 ++++----------- .../test/privateDelivery/cmp/BCmp.java | 26 +++++-------------- .../test/resources/privateDelivery/flow.xml | 15 ++++++++--- .../CustomWhenThreadPoolSpringTest.java | 4 --- 4 files changed, 22 insertions(+), 44 deletions(-) diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/ACmp.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/ACmp.java index 88aa64dd8..89802080b 100644 --- a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/ACmp.java +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/ACmp.java @@ -8,36 +8,25 @@ package com.yomahub.liteflow.test.privateDelivery.cmp; import com.yomahub.liteflow.annotation.LiteflowComponent; -import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.entity.data.DefaultSlot; import com.yomahub.liteflow.entity.data.Slot; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.HashSet; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; +@Component("a") @LiteflowComponent("a") public class ACmp extends NodeComponent { - @Autowired - private FlowExecutor flowExecutor; + @Override public void process() { System.out.println("ACmp executed!"); Slot slot = getSlot(); slot.setData("testSet", new HashSet<>()); - try { - Queue queue = new ConcurrentLinkedQueue<>(); - for (int i = 1; i <= 100; i++) { - queue.add(i); - } - flowExecutor.execute2Resp("chain2", queue); - - }catch (Exception e) { - e.printStackTrace(); + for (int i = 0; i < 100; i++) { + this.sendPrivateDeliveryData("b",i+1); } } } + diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/BCmp.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/BCmp.java index d3c9b4997..4e6023b90 100644 --- a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/BCmp.java +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/privateDelivery/cmp/BCmp.java @@ -1,42 +1,28 @@ /** *

Title: liteflow

*

Description: 轻量级的组件式流程框架

- * * @author Bryan.Zhang * @email weenyc31@163.com * @Date 2020/4/1 */ package com.yomahub.liteflow.test.privateDelivery.cmp; -import cn.hutool.core.collection.CollUtil; import com.yomahub.liteflow.annotation.LiteflowComponent; import com.yomahub.liteflow.core.NodeComponent; import org.springframework.stereotype.Component; -import java.util.Queue; import java.util.Set; +@Component("b") @LiteflowComponent("b") public class BCmp extends NodeComponent { - @Override - public boolean isAccess() { - Queue values = this.getSlot().getRequestData(); - System.out.println("BCmp executed! values.size" + values.size()); - if (CollUtil.isEmpty(values)) { - return false; - } - Integer value = values.poll(); - if (value == null) { - return false; - } - this.sendPrivateDeliveryData(this.getNodeId(), value); - return true; - } - @Override public void process() { - Integer value = getPrivateDeliveryData(); - System.out.println("BCmp executed!" + value); + System.out.println("BCmp executed!"); + Integer value = this.getPrivateDeliveryData(); + Set testSet = this.getSlot().getData("testSet"); + testSet.add(value); } } + diff --git a/liteflow-testcase-springboot/src/test/resources/privateDelivery/flow.xml b/liteflow-testcase-springboot/src/test/resources/privateDelivery/flow.xml index 37ce81f4a..bf7146217 100644 --- a/liteflow-testcase-springboot/src/test/resources/privateDelivery/flow.xml +++ b/liteflow-testcase-springboot/src/test/resources/privateDelivery/flow.xml @@ -2,10 +2,17 @@ + + + + + + + + + + + - -
-        
-    
 
\ No newline at end of file
diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolSpringTest.java
index eef679734..b6cd16e45 100644
--- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolSpringTest.java
+++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolSpringTest.java
@@ -1,12 +1,8 @@
 package com.yomahub.liteflow.test.customWhenThreadPool;
 
-import com.yomahub.liteflow.builder.LiteFlowChainBuilder;
-import com.yomahub.liteflow.builder.LiteFlowConditionBuilder;
-import com.yomahub.liteflow.builder.LiteFlowNodeBuilder;
 import com.yomahub.liteflow.core.FlowExecutor;
 import com.yomahub.liteflow.entity.data.DefaultSlot;
 import com.yomahub.liteflow.entity.data.LiteflowResponse;
-import com.yomahub.liteflow.enums.NodeTypeEnum;
 import com.yomahub.liteflow.test.BaseTest;
 import org.junit.Assert;
 import org.junit.Test;