diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java b/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java index 1d6b00b54..d393d75a4 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/core/FlowExecutor.java @@ -15,7 +15,6 @@ import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.*; import com.yomahub.liteflow.common.ChainConstant; import com.yomahub.liteflow.enums.ChainExecuteModeEnum; -import com.yomahub.liteflow.enums.InnerChainTypeEnum; import com.yomahub.liteflow.enums.ParseModeEnum; import com.yomahub.liteflow.exception.*; import com.yomahub.liteflow.flow.FlowBus; @@ -26,7 +25,6 @@ import com.yomahub.liteflow.flow.element.Rollbackable; import com.yomahub.liteflow.flow.entity.CmpStep; import com.yomahub.liteflow.flow.id.IdGeneratorHolder; import com.yomahub.liteflow.lifecycle.LifeCycleHolder; -import com.yomahub.liteflow.lifecycle.PostProcessFlowExecuteLifeCycle; import com.yomahub.liteflow.log.LFLog; import com.yomahub.liteflow.log.LFLoggerManager; import com.yomahub.liteflow.monitor.MonitorFile; @@ -45,10 +43,7 @@ import com.yomahub.liteflow.thread.ExecutorHelper; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; -import java.util.function.Consumer; import java.util.function.Function; -import java.util.function.Predicate; -import java.util.function.Supplier; import java.util.stream.Collectors; /** @@ -239,31 +234,6 @@ public class FlowExecutor { LOG.info("reload rules takes {}ms", System.currentTimeMillis() - start); } - // 隐式流程的调用方法 - @Deprecated - public void invoke(String chainId, Object param, Integer slotIndex) throws Exception { - LiteflowResponse response = this.invoke2Resp(chainId, param, slotIndex, InnerChainTypeEnum.IN_SYNC); - if (!response.isSuccess()) { - throw response.getCause(); - } - } - - @Deprecated - public void invokeInAsync(String chainId, Object param, Integer slotIndex) throws Exception { - LiteflowResponse response = this.invoke2Resp(chainId, param, slotIndex, InnerChainTypeEnum.IN_ASYNC); - if (!response.isSuccess()) { - throw response.getCause(); - } - } - - public LiteflowResponse invoke2Resp(String chainId, Object param, Integer slotIndex) { - return this.invoke2Resp(chainId, param, slotIndex, InnerChainTypeEnum.IN_SYNC); - } - - public LiteflowResponse invoke2RespInAsync(String chainId, Object param, Integer slotIndex) { - return this.invoke2Resp(chainId, param, slotIndex, InnerChainTypeEnum.IN_ASYNC); - } - // 单独调用某一个node @Deprecated public void invoke(String nodeId, Integer slotIndex) throws Exception { @@ -369,7 +339,7 @@ public class FlowExecutor { private LiteflowResponse execute2Resp(String chainId, Object param, String requestId, Class[] contextBeanClazzArray, Object[] contextBeanArray) { - Slot slot = doExecute(chainId, param, requestId, contextBeanClazzArray, contextBeanArray, null, InnerChainTypeEnum.NONE, ChainExecuteModeEnum.BODY); + Slot slot = doExecute(chainId, param, requestId, contextBeanClazzArray, contextBeanArray, ChainExecuteModeEnum.BODY); return LiteflowResponse.newMainResponse(slot); } @@ -378,31 +348,23 @@ public class FlowExecutor { return slotList.stream().map(LiteflowResponse::newMainResponse).collect(Collectors.toList()); } - private LiteflowResponse invoke2Resp(String chainId, Object param, Integer slotIndex, - InnerChainTypeEnum innerChainType) { - Slot slot = doExecute(chainId, param, null, null, null, slotIndex, innerChainType, ChainExecuteModeEnum.BODY); - return LiteflowResponse.newInnerResponse(chainId, slot); - } - private Slot doExecute(String chainId, Object param, String requestId, Class[] contextBeanClazzArray, Object[] contextBeanArray, - Integer slotIndex, InnerChainTypeEnum innerChainType, ChainExecuteModeEnum chainExecuteModeEnum) { + ChainExecuteModeEnum chainExecuteModeEnum) { if (FlowBus.needInit()) { init(true); } - // 如果不是隐式流程,那么需要分配Slot - if (innerChainType.equals(InnerChainTypeEnum.NONE) && ObjectUtil.isNull(slotIndex)) { - // 这里可以根据class分配,也可以根据bean去分配 - if (ArrayUtil.isNotEmpty(contextBeanClazzArray)) { - slotIndex = DataBus.offerSlotByClass(ListUtil.toList(contextBeanClazzArray)); - } - else { - slotIndex = DataBus.offerSlotByBean(ListUtil.toList(contextBeanArray)); - } + Integer slotIndex; + // 这里可以根据class分配,也可以根据bean去分配 + if (ArrayUtil.isNotEmpty(contextBeanClazzArray)) { + slotIndex = DataBus.offerSlotByClass(ListUtil.toList(contextBeanClazzArray)); + } + else { + slotIndex = DataBus.offerSlotByBean(ListUtil.toList(contextBeanArray)); + } - if (slotIndex == -1) { - throw new NoAvailableSlotException("there is no available slot"); - } + if (slotIndex == -1) { + throw new NoAvailableSlotException("there is no available slot"); } Slot slot = DataBus.getSlot(slotIndex); @@ -427,29 +389,10 @@ public class FlowExecutor { LOG.info("requestId has generated"); } - if (innerChainType.equals(InnerChainTypeEnum.NONE)) { - LOG.info("slot[{}] offered", slotIndex); - } - - // 如果是隐式流程,事先把subException给置空,然后把隐式流程的chainId放入slot元数据中 - // 我知道这在多线程调用隐式流程中会有问题。但是考虑到这种场景的不会多,也有其他的转换方式。 - // 所以暂且这么做,以后再优化 - if (!innerChainType.equals(InnerChainTypeEnum.NONE)) { - slot.removeSubException(chainId); - slot.addSubChain(chainId); - } - + LOG.info("slot[{}] offered", slotIndex); if (ObjectUtil.isNotNull(param)) { - if (innerChainType.equals(InnerChainTypeEnum.NONE)) { - slot.setRequestData(param); - } - else if (innerChainType.equals(InnerChainTypeEnum.IN_SYNC)) { - slot.setChainReqData(chainId, param); - } - else if (innerChainType.equals(InnerChainTypeEnum.IN_ASYNC)) { - slot.setChainReqData2Queue(chainId, param); - } + slot.setRequestData(param); } Chain chain = null; @@ -484,14 +427,7 @@ public class FlowExecutor { LOG.error(e.getMessage(), e); } - // 如果是正常流程需要把异常设置到slot的exception属性里 - // 如果是隐式流程,则需要设置到隐式流程的exception属性里 - if (innerChainType.equals(InnerChainTypeEnum.NONE)) { - slot.setException(e); - } - else { - slot.setSubException(chainId, e); - } + slot.setException(e); Deque executeSteps = slot.getExecuteSteps(); try { Iterator cmpStepIterator = executeSteps.descendingIterator(); @@ -510,11 +446,9 @@ public class FlowExecutor { } } finally { - if (innerChainType.equals(InnerChainTypeEnum.NONE)) { - slot.printStep(); - DataBus.releaseSlot(slotIndex); - LFLoggerManager.removeRequestId(); - } + slot.printStep(); + DataBus.releaseSlot(slotIndex); + LFLoggerManager.removeRequestId(); // 如果有FlowExecute生命周期实现,则执行 if (CollUtil.isNotEmpty(LifeCycleHolder.getPostProcessFlowExecuteLifeCycleList())){ @@ -576,7 +510,7 @@ public class FlowExecutor { List routeTupleList = new ArrayList<>(); for (Chain routeChain : routeChainList){ CompletableFuture f = CompletableFuture.supplyAsync( - () -> doExecute(routeChain.getChainId(), param, finalRequestId, contextBeanClazzArray, contextBeanArray, null, InnerChainTypeEnum.NONE, ChainExecuteModeEnum.ROUTE), + () -> doExecute(routeChain.getChainId(), param, finalRequestId, contextBeanClazzArray, contextBeanArray, ChainExecuteModeEnum.ROUTE), ExecutorHelper.loadInstance().buildWhenExecutor() ); @@ -613,7 +547,7 @@ public class FlowExecutor { List> executeChainCfList = new ArrayList<>(); for (Chain chain : matchedRouteChainList){ CompletableFuture cf = CompletableFuture.supplyAsync( - () -> doExecute(chain.getChainId(), param, finalRequestId, contextBeanClazzArray, contextBeanArray, null, InnerChainTypeEnum.NONE, ChainExecuteModeEnum.BODY), + () -> doExecute(chain.getChainId(), param, finalRequestId, contextBeanClazzArray, contextBeanArray, ChainExecuteModeEnum.BODY), ExecutorHelper.loadInstance().buildWhenExecutor() ); executeChainCfList.add(cf); diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java b/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java index 8e168c5a8..0a8c9e4eb 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java @@ -522,24 +522,6 @@ public abstract class NodeComponent{ this.getRefNode().setStepData(stepData); } - @Deprecated - public void invoke(String chainId, Object param) throws Exception { - FlowExecutorHolder.loadInstance().invoke(chainId, param, this.getSlotIndex()); - } - - public LiteflowResponse invoke2Resp(String chainId, Object param) { - return FlowExecutorHolder.loadInstance().invoke2Resp(chainId, param, this.getSlotIndex()); - } - - @Deprecated - public void invokeInAsync(String chainId, Object param) throws Exception { - FlowExecutorHolder.loadInstance().invokeInAsync(chainId, param, this.getSlotIndex()); - } - - public LiteflowResponse invoke2RespInAsync(String chainId, Object param) { - return FlowExecutorHolder.loadInstance().invoke2RespInAsync(chainId, param, this.getSlotIndex()); - } - public T getItemResultMetaValue(Integer slotIndex){ return null; } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Chain.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Chain.java index 185708d73..489749f39 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Chain.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Chain.java @@ -136,12 +136,7 @@ public class Chain implements Executable{ } catch (Exception e) { // 这里事先取到exception set到slot里,为了方便finally取到exception - if (slot.isSubChain(chainId)) { - slot.setSubException(chainId, e); - } - else { - slot.setException(e); - } + slot.setException(e); throw e; }finally { //如果有生命周期则执行相应生命周期实现 diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Condition.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Condition.java index 66e4d1e9d..67b65b59e 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Condition.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Condition.java @@ -63,14 +63,8 @@ public abstract class Condition implements Executable{ throw e; } catch (Exception e) { - String chainId = this.getCurrChainId(); // 这里事先取到exception set到slot里,为了方便finally取到exception - if (slot.isSubChain(chainId)) { - slot.setSubException(chainId, e); - } - else { - slot.setException(e); - } + slot.setException(e); throw e; } finally { // 当前 Condition 出栈 diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Node.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Node.java index fc8cfe1de..cdec75540 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Node.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/Node.java @@ -372,7 +372,6 @@ public class Node implements Executable, Cloneable, Rollbackable{ }finally { lock4LoopIndex.unlock(); } - } public Integer getLoopIndex() { diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/condition/ThenCondition.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/condition/ThenCondition.java index 7a7b99d5d..3bf120f48 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/condition/ThenCondition.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/condition/ThenCondition.java @@ -54,14 +54,8 @@ public class ThenCondition extends Condition { //正常情况下slot不可能为null //当设置了超时后,还在运行的组件就有可能因为主流程已经结束释放slot而导致slot为null if (slot != null){ - String chainId = this.getCurrChainId(); // 这里事先取到exception set到slot里,为了方便finally取到exception - if (slot.isSubChain(chainId)) { - slot.setSubException(chainId, e); - } - else { - slot.setException(e); - } + slot.setException(e); } throw e; } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java b/liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java index dc1896ac1..4f659cca0 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java @@ -80,8 +80,6 @@ public class Slot { private static final String PRIVATE_DELIVERY_PREFIX = "_private_d_"; - private static final String SUB_CHAIN = "_sub_chain"; - private final Deque executeSteps = new ConcurrentLinkedDeque<>(); private String executeStepsStr; @@ -476,14 +474,6 @@ public class Slot { return (Exception) this.metaDataMap.get(SUB_EXCEPTION_PREFIX + chainId); } - public void setSubException(String chainId, Exception e) { - putMetaDataMap(SUB_EXCEPTION_PREFIX + chainId, e); - } - - public void removeSubException(String chainId) { - metaDataMap.remove(SUB_EXCEPTION_PREFIX + chainId); - } - public List getContextBeanList() { return this.contextBeanList; } @@ -511,22 +501,6 @@ public class Slot { return this.getContextBean(firstContextBeanClazz); } - public void addSubChain(String chainId) { - Set subChainSet = (Set) metaDataMap.getOrDefault(SUB_CHAIN, new ConcurrentHashSet<>()); - subChainSet.add(chainId); - metaDataMap.putIfAbsent(SUB_CHAIN, subChainSet); - } - - public boolean isSubChain(String chainId) { - if (metaDataMap.containsKey(SUB_CHAIN)) { - Set subChainSet = (Set) metaDataMap.get(SUB_CHAIN); - return subChainSet.contains(chainId); - } - else { - return false; - } - } - public Boolean getRouteResult() { return routeResult; } diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELDeclMultiSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELDeclMultiSpringbootTest.java deleted file mode 100644 index 71028b80c..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELDeclMultiSpringbootTest.java +++ /dev/null @@ -1,58 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.test.SolonTest; -import java.util.HashSet; -import java.util.Set; - -/** - * 测试隐式调用子流程 单元测试 - * - * @author justin.xu - */ -@Import(profiles ="classpath:/subflow/application-implicit.properties") -@SolonTest -public class ImplicitSubFlowELDeclMultiSpringbootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - public static final Set RUN_TIME_SLOT = new HashSet<>(); - - // 这里GCmp中隐式的调用chain4,从而执行了h,m - @Test - public void testImplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("f==>g==>h==>m", response.getExecuteStepStr()); - - // 传递了slotIndex,则set的size==1 - Assertions.assertEquals(1, RUN_TIME_SLOT.size()); - // set中第一次设置的requestId和response中的requestId一致 - Assertions.assertTrue(RUN_TIME_SLOT.contains(response.getSlot().getRequestId())); - // requestData的取值正确 - Assertions.assertEquals("it's implicit subflow.", context.getData("innerRequest")); - } - - // 在p里多线程调用q 10次,每个q取到的参数都是不同的。 - @Test - public void testImplicitSubFlow2() { - LiteflowResponse response = flowExecutor.execute2Resp("c1", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - - Set set = context.getData("test"); - - // requestData的取值正确 - Assertions.assertEquals(10, set.size()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELDeclMultiSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELDeclMultiSpringbootTest.java deleted file mode 100644 index 25a533581..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELDeclMultiSpringbootTest.java +++ /dev/null @@ -1,48 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.core.AppContext; -import org.noear.solon.test.SolonTest; - -/** - * 测试主流程与子流程在不同的配置文件的场景 - * - * @author Bryan.Zhang - */ -@Import(profiles ="classpath:/subflow/application-subInDifferentConfig1.properties") -@SolonTest -public class SubflowInDifferentConfigELDeclMultiSpringbootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>b==>a==>e==>d", response.getExecuteStepStr()); - } - - @Inject - private AppContext context; - - // 主要测试有不同的配置类型后会不会报出既定的错误 - @Test - public void testExplicitSubFlow2() { - Assertions.assertThrows(MultipleParsersException.class, () -> { - LiteflowConfig config = context.getBean(LiteflowConfig.class); - config.setRuleSource("subflow/flow-main.xml,subflow/flow-sub1.xml,subflow/flow-sub2.yml"); - flowExecutor.reloadRule(); - }); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELDeclMultiSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELDeclMultiSpringBootTest.java deleted file mode 100644 index f23a6b354..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELDeclMultiSpringBootTest.java +++ /dev/null @@ -1,32 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.test.SolonTest; - -/** - * 测试显示调用子流程(json) 单元测试 - * - * @author justin.xu - */ -@Import(profiles ="classpath:/subflow/application-json.properties") -@SolonTest -public class SubflowJsonELDeclMultiSpringBootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELDeclMultiSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELDeclMultiSpringBootTest.java deleted file mode 100644 index 5a35ba6fc..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELDeclMultiSpringBootTest.java +++ /dev/null @@ -1,32 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.test.SolonTest; - -/** - * 测试显示调用子流程(xml) 单元测试 - * - * @author justin.xu - */ -@Import(profiles ="classpath:/subflow/application-xml.properties") -@SolonTest -public class SubflowXMLELDeclMultiSpringBootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELDeclMultiSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELDeclMultiSpringBootTest.java deleted file mode 100644 index ffb70c3bf..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELDeclMultiSpringBootTest.java +++ /dev/null @@ -1,32 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.test.SolonTest; - -/** - * 测试显示调用子流程(yml) 单元测试 - * - * @author justin.xu - */ -@Import(profiles ="classpath:/subflow/application-yml.properties") -@SolonTest -public class SubflowYmlELDeclMultiSpringBootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlowYml() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CmpConfig1.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CmpConfig1.java deleted file mode 100644 index 3039de59d..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CmpConfig1.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.annotation.LiteflowComponent; -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; - -@LiteflowComponent -public class CmpConfig1 { - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "a") - public void processA(NodeComponent bindCmp) { - System.out.println("ACmp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "b") - public void processB(NodeComponent bindCmp) { - System.out.println("BCmp executed!"); - - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "c") - public void processC(NodeComponent bindCmp) { - System.out.println("CCmp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "d") - public void processD(NodeComponent bindCmp) { - System.out.println("DCmp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "e") - public void processE(NodeComponent bindCmp) { - System.out.println("ECmp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/CmpConfig2.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/CmpConfig2.java deleted file mode 100644 index 8ee29b315..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/CmpConfig2.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowComponent; -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import com.yomahub.liteflow.slot.DefaultContext; -import org.noear.solon.annotation.Inject; - -import java.util.HashSet; -import java.util.Set; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELDeclMultiSpringbootTest.RUN_TIME_SLOT; - -@LiteflowComponent -public class CmpConfig2 { - - @Inject - private FlowExecutor flowExecutor; - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "f") - public void processF(NodeComponent bindCmp) { - - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Fcomp executed!"); - - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "g") - public void processG(NodeComponent bindCmp) throws Exception { - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Gcmp executed!"); - - bindCmp.invoke("chain4", "it's implicit subflow."); - - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "h") - public void processH(NodeComponent bindCmp) { - String requestData = bindCmp.getSubChainReqData(); - DefaultContext context = bindCmp.getFirstContextBean(); - context.setData("innerRequest", requestData); - - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Hcomp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "m") - public void processM(NodeComponent bindCmp) { - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Mcomp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "p") - public void processP(NodeComponent bindCmp) throws Exception { - int slotIndex = bindCmp.getSlotIndex(); - for (int i = 0; i < 10; i++) { - int finalI = i; - new Thread(() -> { - try { - flowExecutor.invokeInAsync("c2", "it's implicit subflow " + finalI, slotIndex); - } - catch (Exception e) { - throw new RuntimeException(e); - } - }).start(); - } - Thread.sleep(1000); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "q") - public void processQ(NodeComponent bindCmp) throws Exception { - String requestData = bindCmp.getSubChainReqDataInAsync(); - DefaultContext context = bindCmp.getFirstContextBean(); - - synchronized (this) { - if (context.hasData("test")) { - Set set = context.getData("test"); - set.add(requestData); - } - else { - Set set = new HashSet<>(); - set.add(requestData); - context.setData("test", set); - } - } - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-implicit.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-implicit.properties deleted file mode 100644 index 424d7cb10..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-implicit.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-implicit.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-json.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-json.properties deleted file mode 100644 index 4a247cadf..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-json.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.json \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-subInDifferentConfig1.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-subInDifferentConfig1.properties deleted file mode 100644 index 9006564d9..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-subInDifferentConfig1.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-subInDifferentConfig2.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-subInDifferentConfig2.properties deleted file mode 100644 index a0d247d83..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-subInDifferentConfig2.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-xml.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-xml.properties deleted file mode 100644 index 95b534046..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-xml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-yml.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-yml.properties deleted file mode 100644 index 3c2295809..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/application-yml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-implicit.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-implicit.el.xml deleted file mode 100644 index 91498014a..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-implicit.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(f, g); - - - - THEN(h, m); - - - - THEN(p); - - - - THEN(q); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-main.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-main.el.xml deleted file mode 100644 index 0310bbf15..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-main.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(a, b, chain2); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-sub1.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-sub1.el.xml deleted file mode 100644 index 829886d02..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-sub1.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(b, a, chain3); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-sub2.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-sub2.el.xml deleted file mode 100644 index 63676b2b3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-sub2.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-sub2.el.yml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-sub2.el.yml deleted file mode 100644 index 3d652cf48..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow-sub2.el.yml +++ /dev/null @@ -1,4 +0,0 @@ -flow: - chain: - - name: chain3 - value: "THEN(e, d);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow.el.json b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow.el.json deleted file mode 100644 index a92a77b90..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow.el.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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);" - } - ] - } -} \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow.el.xml deleted file mode 100644 index dac14dbca..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(a, b, c, chain2); - - - - THEN(d, e); - - - - THEN(b, a, chain3); - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow.el.yml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow.el.yml deleted file mode 100644 index cc8f056df..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/subflow/flow.el.yml +++ /dev/null @@ -1,10 +0,0 @@ -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);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELDeclMultiSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELDeclMultiSpringbootTest.java deleted file mode 100644 index 884441ea3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELDeclMultiSpringbootTest.java +++ /dev/null @@ -1,67 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-implicit.properties") -@SpringBootTest(classes = ImplicitSubFlowELDeclMultiSpringbootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp2" }) -public class ImplicitSubFlowELDeclMultiSpringbootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - public static final Set RUN_TIME_SLOT = new HashSet<>(); - - // 这里GCmp中隐式的调用chain4,从而执行了h,m - @Test - public void testImplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("f==>g==>h==>m", response.getExecuteStepStr()); - - // 传递了slotIndex,则set的size==1 - Assertions.assertEquals(1, RUN_TIME_SLOT.size()); - // set中第一次设置的requestId和response中的requestId一致 - Assertions.assertTrue(RUN_TIME_SLOT.contains(response.getSlot().getRequestId())); - // requestData的取值正确 - Assertions.assertEquals("it's implicit subflow.", context.getData("innerRequest")); - } - - // 在p里多线程调用q 10次,每个q取到的参数都是不同的。 - @Test - public void testImplicitSubFlow2() { - LiteflowResponse response = flowExecutor.execute2Resp("c1", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - - Set set = context.getData("test"); - - // requestData的取值正确 - Assertions.assertEquals(10, set.size()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELDeclMultiSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELDeclMultiSpringbootTest.java deleted file mode 100644 index da047c27e..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELDeclMultiSpringbootTest.java +++ /dev/null @@ -1,58 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-subInDifferentConfig1.properties") -@SpringBootTest(classes = SubflowInDifferentConfigELDeclMultiSpringbootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp1", "com.yomahub.liteflow.test.subflow.cmp2" }) -public class SubflowInDifferentConfigELDeclMultiSpringbootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>b==>a==>e==>d", response.getExecuteStepStr()); - } - - @Autowired - private ApplicationContext context; - - // 主要测试有不同的配置类型后会不会报出既定的错误 - @Test - public void testExplicitSubFlow2() { - Assertions.assertThrows(MultipleParsersException.class, () -> { - LiteflowConfig config = context.getBean(LiteflowConfig.class); - config.setRuleSource("subflow/flow-main.xml,subflow/flow-sub1.xml,subflow/flow-sub2.yml"); - flowExecutor.reloadRule(); - }); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELDeclMultiSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELDeclMultiSpringBootTest.java deleted file mode 100644 index 1e6cc049a..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELDeclMultiSpringBootTest.java +++ /dev/null @@ -1,41 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-json.properties") -@SpringBootTest(classes = SubflowJsonELDeclMultiSpringBootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp1" }) -public class SubflowJsonELDeclMultiSpringBootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELDeclMultiSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELDeclMultiSpringBootTest.java deleted file mode 100644 index 7cb779f57..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELDeclMultiSpringBootTest.java +++ /dev/null @@ -1,41 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-xml.properties") -@SpringBootTest(classes = SubflowXMLELDeclMultiSpringBootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp1" }) -public class SubflowXMLELDeclMultiSpringBootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELDeclMultiSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELDeclMultiSpringBootTest.java deleted file mode 100644 index ea9ed68e5..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELDeclMultiSpringBootTest.java +++ /dev/null @@ -1,41 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-yml.properties") -@SpringBootTest(classes = SubflowYmlELDeclMultiSpringBootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp1" }) -public class SubflowYmlELDeclMultiSpringBootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlowYml() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CmpConfig1.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CmpConfig1.java deleted file mode 100644 index 3039de59d..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CmpConfig1.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.annotation.LiteflowComponent; -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; - -@LiteflowComponent -public class CmpConfig1 { - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "a") - public void processA(NodeComponent bindCmp) { - System.out.println("ACmp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "b") - public void processB(NodeComponent bindCmp) { - System.out.println("BCmp executed!"); - - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "c") - public void processC(NodeComponent bindCmp) { - System.out.println("CCmp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "d") - public void processD(NodeComponent bindCmp) { - System.out.println("DCmp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "e") - public void processE(NodeComponent bindCmp) { - System.out.println("ECmp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/CmpConfig2.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/CmpConfig2.java deleted file mode 100644 index c3d4ef35e..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/CmpConfig2.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowComponent; -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import com.yomahub.liteflow.slot.DefaultContext; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.HashSet; -import java.util.Set; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELDeclMultiSpringbootTest.RUN_TIME_SLOT; - -@LiteflowComponent -public class CmpConfig2 { - - @Autowired - private FlowExecutor flowExecutor; - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "f") - public void processF(NodeComponent bindCmp) { - - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Fcomp executed!"); - - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "g") - public void processG(NodeComponent bindCmp) throws Exception { - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Gcmp executed!"); - - bindCmp.invoke("chain4", "it's implicit subflow."); - - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "h") - public void processH(NodeComponent bindCmp) { - String requestData = bindCmp.getSubChainReqData(); - DefaultContext context = bindCmp.getFirstContextBean(); - context.setData("innerRequest", requestData); - - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Hcomp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "m") - public void processM(NodeComponent bindCmp) { - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Mcomp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "p") - public void processP(NodeComponent bindCmp) throws Exception { - int slotIndex = bindCmp.getSlotIndex(); - for (int i = 0; i < 10; i++) { - int finalI = i; - new Thread(() -> { - try { - flowExecutor.invokeInAsync("c2", "it's implicit subflow " + finalI, slotIndex); - } - catch (Exception e) { - throw new RuntimeException(e); - } - }).start(); - } - Thread.sleep(1000); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "q") - public void processQ(NodeComponent bindCmp) throws Exception { - String requestData = bindCmp.getSubChainReqDataInAsync(); - DefaultContext context = bindCmp.getFirstContextBean(); - - synchronized (this) { - if (context.hasData("test")) { - Set set = context.getData("test"); - set.add(requestData); - } - else { - Set set = new HashSet<>(); - set.add(requestData); - context.setData("test", set); - } - } - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-implicit.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-implicit.properties deleted file mode 100644 index 424d7cb10..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-implicit.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-implicit.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-json.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-json.properties deleted file mode 100644 index 4a247cadf..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-json.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.json \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties deleted file mode 100644 index 9006564d9..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties deleted file mode 100644 index a0d247d83..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-xml.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-xml.properties deleted file mode 100644 index 95b534046..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-xml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-yml.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-yml.properties deleted file mode 100644 index 3c2295809..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/application-yml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-implicit.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-implicit.el.xml deleted file mode 100644 index 91498014a..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-implicit.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(f, g); - - - - THEN(h, m); - - - - THEN(p); - - - - THEN(q); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-main.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-main.el.xml deleted file mode 100644 index 0310bbf15..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-main.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(a, b, chain2); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-sub1.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-sub1.el.xml deleted file mode 100644 index 829886d02..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-sub1.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(b, a, chain3); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-sub2.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-sub2.el.xml deleted file mode 100644 index 63676b2b3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-sub2.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-sub2.el.yml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-sub2.el.yml deleted file mode 100644 index 3d652cf48..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow-sub2.el.yml +++ /dev/null @@ -1,4 +0,0 @@ -flow: - chain: - - name: chain3 - value: "THEN(e, d);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow.el.json b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow.el.json deleted file mode 100644 index a92a77b90..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow.el.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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);" - } - ] - } -} \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow.el.xml deleted file mode 100644 index dac14dbca..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(a, b, c, chain2); - - - - THEN(d, e); - - - - THEN(b, a, chain3); - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow.el.yml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow.el.yml deleted file mode 100644 index cc8f056df..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/subflow/flow.el.yml +++ /dev/null @@ -1,10 +0,0 @@ -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);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELDeclSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELDeclSpringbootTest.java deleted file mode 100644 index 818c973d7..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELDeclSpringbootTest.java +++ /dev/null @@ -1,67 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-implicit.properties") -@SpringBootTest(classes = ImplicitSubFlowELDeclSpringbootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp2" }) -public class ImplicitSubFlowELDeclSpringbootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - public static final Set RUN_TIME_SLOT = new HashSet<>(); - - // 这里GCmp中隐式的调用chain4,从而执行了h,m - @Test - public void testImplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("f==>g==>h==>m", response.getExecuteStepStr()); - - // 传递了slotIndex,则set的size==1 - Assertions.assertEquals(1, RUN_TIME_SLOT.size()); - // set中第一次设置的requestId和response中的requestId一致 - Assertions.assertTrue(RUN_TIME_SLOT.contains(response.getSlot().getRequestId())); - // requestData的取值正确 - Assertions.assertEquals("it's implicit subflow.", context.getData("innerRequest")); - } - - // 在p里多线程调用q 10次,每个q取到的参数都是不同的。 - @Test - public void testImplicitSubFlow2() { - LiteflowResponse response = flowExecutor.execute2Resp("c1", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - - Set set = context.getData("test"); - - // requestData的取值正确 - Assertions.assertEquals(10, set.size()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELDeclSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELDeclSpringbootTest.java deleted file mode 100644 index baa2c386b..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELDeclSpringbootTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.yomahub.liteflow.test.subflow; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.exception.MultipleParsersException; -import com.yomahub.liteflow.property.LiteflowConfig; -import com.yomahub.liteflow.test.BaseTest; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-subInDifferentConfig1.properties") -@SpringBootTest(classes = SubflowInDifferentConfigELDeclSpringbootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp1", "com.yomahub.liteflow.test.subflow.cmp2" }) -public class SubflowInDifferentConfigELDeclSpringbootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>b==>a==>e==>d", response.getExecuteStepStr()); - } - - @Autowired - private ApplicationContext context; - - // 主要测试有不同的配置类型后会不会报出既定的错误 - @Test - public void testExplicitSubFlow2() { - Assertions.assertThrows(MultipleParsersException.class, () -> { - LiteflowConfig config = context.getBean(LiteflowConfig.class); - config.setRuleSource("subflow/flow-main.xml, subflow/flow-sub1.xml,subflow/flow-sub2.yml"); - flowExecutor.reloadRule(); - }); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELDeclSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELDeclSpringBootTest.java deleted file mode 100644 index 4a9b44043..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELDeclSpringBootTest.java +++ /dev/null @@ -1,41 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-json.properties") -@SpringBootTest(classes = SubflowJsonELDeclSpringBootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp1" }) -public class SubflowJsonELDeclSpringBootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELDeclSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELDeclSpringBootTest.java deleted file mode 100644 index 57c19686e..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELDeclSpringBootTest.java +++ /dev/null @@ -1,41 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-xml.properties") -@SpringBootTest(classes = SubflowXMLELDeclSpringBootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp1" }) -public class SubflowXMLELDeclSpringBootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELDeclSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELDeclSpringBootTest.java deleted file mode 100644 index e86dc7c94..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELDeclSpringBootTest.java +++ /dev/null @@ -1,41 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.junit.jupiter.SpringExtension; -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 - */ -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:/subflow/application-yml.properties") -@SpringBootTest(classes = SubflowYmlELDeclSpringBootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp1" }) -public class SubflowYmlELDeclSpringBootTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlowYml() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java deleted file mode 100644 index 16740a05f..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -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") -public class ACmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) { - System.out.println("Acomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java deleted file mode 100644 index 044b4d600..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -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") -public class BCmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) { - System.out.println("Bcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java deleted file mode 100644 index 7c3354570..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import org.springframework.stereotype.Component; - -@Component("c") -public class CCmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) throws Exception { - System.out.println("Ccomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java deleted file mode 100644 index cbbb3bde7..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import org.springframework.stereotype.Component; - -@Component("d") -public class DCmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) throws Exception { - System.out.println("Dcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java deleted file mode 100644 index e5950ed8e..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import org.springframework.stereotype.Component; - -@Component("e") -public class ECmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) throws Exception { - System.out.println("Ecomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java deleted file mode 100644 index 3a492eb7d..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import org.springframework.stereotype.Component; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELDeclSpringbootTest.RUN_TIME_SLOT; - -@Component("f") -public class FCmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) throws Exception { - - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Fcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java deleted file mode 100644 index feea6b58b..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import org.springframework.stereotype.Component; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELDeclSpringbootTest.RUN_TIME_SLOT; - -@Component("g") -public class GCmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) throws Exception { - - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Gcmp executed!"); - - bindCmp.invoke("chain4", "it's implicit subflow."); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java deleted file mode 100644 index e1c8975cd..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import com.yomahub.liteflow.slot.DefaultContext; -import org.springframework.stereotype.Component; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELDeclSpringbootTest.RUN_TIME_SLOT; - -@Component("h") -public class HCmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) throws Exception { - String requestData = bindCmp.getSubChainReqData(); - DefaultContext context = bindCmp.getFirstContextBean(); - context.setData("innerRequest", requestData); - - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Hcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java deleted file mode 100644 index 3117e1704..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import org.springframework.stereotype.Component; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELDeclSpringbootTest.RUN_TIME_SLOT; - -@Component("m") -public class MCmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) throws Exception { - - RUN_TIME_SLOT.add(bindCmp.getSlot().getRequestId()); - - System.out.println("Mcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java deleted file mode 100644 index dfd0c56b3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component("p") -public class PCmp { - - @Autowired - private FlowExecutor flowExecutor; - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) throws Exception { - int slotIndex = bindCmp.getSlotIndex(); - for (int i = 0; i < 10; i++) { - int finalI = i; - new Thread(() -> { - try { - flowExecutor.invokeInAsync("c2", "it's implicit subflow " + finalI, slotIndex); - } - catch (Exception e) { - throw new RuntimeException(e); - } - }).start(); - } - Thread.sleep(1000); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java deleted file mode 100644 index 09ae19b02..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowMethod; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.enums.LiteFlowMethodEnum; -import com.yomahub.liteflow.slot.DefaultContext; -import org.springframework.stereotype.Component; - -import java.util.HashSet; -import java.util.Set; - -@Component("q") -public class QCmp { - - @LiteflowMethod(LiteFlowMethodEnum.PROCESS) - public void process(NodeComponent bindCmp) throws Exception { - String requestData = bindCmp.getSubChainReqDataInAsync(); - DefaultContext context = bindCmp.getFirstContextBean(); - - synchronized (QCmp.class) { - if (context.hasData("test")) { - Set set = context.getData("test"); - set.add(requestData); - } - else { - Set set = new HashSet<>(); - set.add(requestData); - context.setData("test", set); - } - } - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-implicit.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-implicit.properties deleted file mode 100644 index 424d7cb10..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-implicit.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-implicit.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-json.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-json.properties deleted file mode 100644 index 4a247cadf..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-json.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.json \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties deleted file mode 100644 index 9006564d9..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties deleted file mode 100644 index a0d247d83..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-xml.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-xml.properties deleted file mode 100644 index 95b534046..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-xml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-yml.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-yml.properties deleted file mode 100644 index 3c2295809..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/application-yml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-implicit.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-implicit.el.xml deleted file mode 100644 index 91498014a..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-implicit.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(f, g); - - - - THEN(h, m); - - - - THEN(p); - - - - THEN(q); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-main.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-main.el.xml deleted file mode 100644 index 0310bbf15..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-main.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(a, b, chain2); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-sub1.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-sub1.el.xml deleted file mode 100644 index 829886d02..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-sub1.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(b, a, chain3); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-sub2.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-sub2.el.xml deleted file mode 100644 index 63676b2b3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-sub2.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-sub2.el.yml b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-sub2.el.yml deleted file mode 100644 index 3d652cf48..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow-sub2.el.yml +++ /dev/null @@ -1,4 +0,0 @@ -flow: - chain: - - name: chain3 - value: "THEN(e, d);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow.el.json b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow.el.json deleted file mode 100644 index a92a77b90..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow.el.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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);" - } - ] - } -} \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow.el.xml deleted file mode 100644 index dac14dbca..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(a, b, c, chain2); - - - - THEN(d, e); - - - - THEN(b, a, chain3); - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow.el.yml b/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow.el.yml deleted file mode 100644 index cc8f056df..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/subflow/flow.el.yml +++ /dev/null @@ -1,10 +0,0 @@ -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);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowTest.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowTest.java deleted file mode 100644 index b95edc1c2..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.yomahub.liteflow.test.subflow; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.FlowExecutorHolder; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.property.LiteflowConfig; -import com.yomahub.liteflow.slot.DefaultContext; -import com.yomahub.liteflow.test.BaseTest; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.HashSet; -import java.util.Set; - -/** - * 测试隐式调用子流程 单元测试 - * - * @author justin.xu - */ -public class ImplicitSubFlowTest extends BaseTest { - - private static FlowExecutor flowExecutor; - - @BeforeAll - public static void init() { - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("subflow/flow-implicit.el.xml"); - flowExecutor = FlowExecutorHolder.loadInstance(config); - } - - public static final Set RUN_TIME_SLOT = new HashSet<>(); - - // 这里GCmp中隐式的调用chain4,从而执行了h,m - @Test - public void testImplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("f==>g==>h==>m", response.getExecuteStepStr()); - - // 传递了slotIndex,则set的size==1 - Assertions.assertEquals(1, RUN_TIME_SLOT.size()); - // set中第一次设置的requestId和response中的requestId一致 - Assertions.assertTrue(RUN_TIME_SLOT.contains(response.getSlot().getRequestId())); - // requestData的取值正确 - Assertions.assertEquals("it's implicit subflow.", context.getData("innerRequest")); - } - - // 在p里多线程调用q 10次,每个q取到的参数都是不同的。 - @Test - public void testImplicitSubFlow2() { - LiteflowResponse response = flowExecutor.execute2Resp("c1", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - - Set set = context.getData("test"); - - // requestData的取值正确 - Assertions.assertEquals(10, set.size()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigTest.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigTest.java deleted file mode 100644 index 4e34267ae..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.yomahub.liteflow.test.subflow; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.FlowExecutorHolder; -import com.yomahub.liteflow.exception.MultipleParsersException; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.property.LiteflowConfig; -import com.yomahub.liteflow.property.LiteflowConfigGetter; -import com.yomahub.liteflow.test.BaseTest; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/** - * 测试主流程与子流程在不同的配置文件的场景 - * - * @author Bryan.Zhang - */ -public class SubflowInDifferentConfigTest extends BaseTest { - - private static FlowExecutor flowExecutor; - - @BeforeAll - public static void init() { - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.xml"); - flowExecutor = FlowExecutorHolder.loadInstance(config); - } - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>b==>a==>e==>d", response.getExecuteStepStr()); - } - - // 主要测试有不同的配置类型后会不会报出既定的错误 - @Test - public void testExplicitSubFlow2() { - Assertions.assertThrows(MultipleParsersException.class, () -> { - LiteflowConfig config = LiteflowConfigGetter.get(); - config.setRuleSource("subflow/flow-main.xml,subflow/flow-sub1.xml,subflow/flow-sub2.yml"); - flowExecutor.reloadRule(); - }); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonTest.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonTest.java deleted file mode 100644 index 596a84b47..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.yomahub.liteflow.test.subflow; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.FlowExecutorHolder; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.property.LiteflowConfig; -import com.yomahub.liteflow.test.BaseTest; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/** - * 测试显示调用子流程(json) 单元测试 - * - * @author justin.xu - */ -public class SubflowJsonTest extends BaseTest { - - private static FlowExecutor flowExecutor; - - @BeforeAll - public static void init() { - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("subflow/flow.el.json"); - flowExecutor = FlowExecutorHolder.loadInstance(config); - } - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLTest.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLTest.java deleted file mode 100644 index b4a3411f0..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.yomahub.liteflow.test.subflow; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.FlowExecutorHolder; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.property.LiteflowConfig; -import com.yomahub.liteflow.test.BaseTest; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/** - * 测试显示调用子流程(xml) 单元测试 - * - * @author justin.xu - */ -public class SubflowXMLTest extends BaseTest { - - private static FlowExecutor flowExecutor; - - @BeforeAll - public static void init() { - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("subflow/flow.el.xml"); - flowExecutor = FlowExecutorHolder.loadInstance(config); - } - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlTest.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlTest.java deleted file mode 100644 index ee526f59f..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.yomahub.liteflow.test.subflow; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.FlowExecutorHolder; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.property.LiteflowConfig; -import com.yomahub.liteflow.test.BaseTest; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/** - * 测试显示调用子流程(yml) 单元测试 - * - * @author justin.xu - */ -public class SubflowYmlTest extends BaseTest { - - private static FlowExecutor flowExecutor; - - @BeforeAll - public static void init() { - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("subflow/flow.el.yml"); - flowExecutor = FlowExecutorHolder.loadInstance(config); - } - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlowYml() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java deleted file mode 100644 index 7e66eef6b..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; - -public class ACmp extends NodeComponent { - - @Override - public void process() { - System.out.println("Acomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java deleted file mode 100644 index 480e61742..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; - -public class BCmp extends NodeComponent { - - @Override - public void process() { - System.out.println("Bcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java deleted file mode 100644 index 3494e5bcb..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; - -public class CCmp extends NodeComponent { - - @Override - public void process() throws Exception { - System.out.println("Ccomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java deleted file mode 100644 index d802517c7..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; - -public class DCmp extends NodeComponent { - - @Override - public void process() throws Exception { - System.out.println("Dcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java deleted file mode 100644 index 07782fa37..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; - -public class ECmp extends NodeComponent { - - @Override - public void process() throws Exception { - System.out.println("Ecomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java deleted file mode 100644 index 9b66a5295..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.NodeComponent; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowTest.RUN_TIME_SLOT; - -public class FCmp extends NodeComponent { - - @Override - public void process() throws Exception { - - RUN_TIME_SLOT.add(this.getSlot().getRequestId()); - - System.out.println("Fcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java deleted file mode 100644 index 47ba6fac1..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.NodeComponent; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowTest.RUN_TIME_SLOT; - -public class GCmp extends NodeComponent { - - @Override - public void process() throws Exception { - - RUN_TIME_SLOT.add(this.getSlot().getRequestId()); - - System.out.println("Gcmp executed!"); - - this.invoke("chain4", "it's implicit subflow."); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java deleted file mode 100644 index 3d67447eb..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.slot.DefaultContext; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowTest.RUN_TIME_SLOT; - -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java deleted file mode 100644 index 2f544b9ff..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.NodeComponent; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowTest.RUN_TIME_SLOT; - -public class MCmp extends NodeComponent { - - @Override - public void process() throws Exception { - - RUN_TIME_SLOT.add(this.getSlot().getRequestId()); - - System.out.println("Mcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java deleted file mode 100644 index f33351c5b..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.FlowExecutorHolder; -import com.yomahub.liteflow.core.NodeComponent; - -public class PCmp extends NodeComponent { - - private FlowExecutor flowExecutor = FlowExecutorHolder.loadInstance(); - - @Override - public void process() throws Exception { - int slotIndex = this.getSlotIndex(); - for (int i = 0; i < 10; i++) { - int finalI = i; - new Thread(() -> { - try { - flowExecutor.invokeInAsync("c2", "it's implicit subflow " + finalI, slotIndex); - } - catch (Exception e) { - throw new RuntimeException(e); - } - }).start(); - } - Thread.sleep(1000); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java deleted file mode 100644 index d33b5f730..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.slot.DefaultContext; - -import java.util.HashSet; -import java.util.Set; - -public class QCmp extends NodeComponent { - - @Override - public void process() throws Exception { - String requestData = this.getSubChainReqDataInAsync(); - DefaultContext context = this.getFirstContextBean(); - - synchronized (QCmp.class) { - if (context.hasData("test")) { - Set set = context.getData("test"); - set.add(requestData); - } - else { - Set set = new HashSet<>(); - set.add(requestData); - context.setData("test", set); - } - } - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-implicit.el.xml b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-implicit.el.xml deleted file mode 100644 index df2d0996d..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-implicit.el.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - THEN(f, g); - - - - THEN(h, m); - - - - THEN(p); - - - - THEN(q); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-main.el.xml b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-main.el.xml deleted file mode 100644 index 4f479f6e5..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-main.el.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - THEN(a, b, chain2); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-sub1.el.xml b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-sub1.el.xml deleted file mode 100644 index 829886d02..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-sub1.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(b, a, chain3); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-sub2.el.xml b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-sub2.el.xml deleted file mode 100644 index 63676b2b3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-sub2.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-sub2.el.yml b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-sub2.el.yml deleted file mode 100644 index 3d652cf48..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow-sub2.el.yml +++ /dev/null @@ -1,4 +0,0 @@ -flow: - chain: - - name: chain3 - value: "THEN(e, d);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow.el.json b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow.el.json deleted file mode 100644 index e5f921e08..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow.el.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "flow": { - "nodes": { - "node": [ - { - "id": "a", - "class": "com.yomahub.liteflow.test.subflow.cmp1.ACmp" - }, - { - "id": "b", - "class": "com.yomahub.liteflow.test.subflow.cmp1.BCmp" - }, - { - "id": "c", - "class": "com.yomahub.liteflow.test.subflow.cmp1.CCmp" - }, - { - "id": "d", - "class": "com.yomahub.liteflow.test.subflow.cmp1.DCmp" - }, - { - "id": "e", - "class": "com.yomahub.liteflow.test.subflow.cmp1.ECmp" - }, - { - "id": "f", - "class": "com.yomahub.liteflow.test.subflow.cmp2.FCmp" - }, - { - "id": "g", - "class": "com.yomahub.liteflow.test.subflow.cmp2.GCmp" - }, - { - "id": "h", - "class": "com.yomahub.liteflow.test.subflow.cmp2.HCmp" - }, - { - "id": "M", - "class": "com.yomahub.liteflow.test.subflow.cmp2.MCmp" - } - ] - }, - "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);" - } - ] - } -} \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow.el.xml deleted file mode 100644 index e68841194..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow.el.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - THEN(a, b, c, chain2); - - - - THEN(d, e); - - - - THEN(b, a, chain3); - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow.el.yml b/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow.el.yml deleted file mode 100644 index d4191f531..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/subflow/flow.el.yml +++ /dev/null @@ -1,30 +0,0 @@ -flow: - nodes: - node: - - id: a - class: com.yomahub.liteflow.test.subflow.cmp1.ACmp - - id: b - class: com.yomahub.liteflow.test.subflow.cmp1.BCmp - - id: c - class: com.yomahub.liteflow.test.subflow.cmp1.CCmp - - id: d - class: com.yomahub.liteflow.test.subflow.cmp1.DCmp - - id: e - class: com.yomahub.liteflow.test.subflow.cmp1.ECmp - - id: f - class: com.yomahub.liteflow.test.subflow.cmp2.FCmp - - id: g - class: com.yomahub.liteflow.test.subflow.cmp2.GCmp - - id: h - class: com.yomahub.liteflow.test.subflow.cmp2.HCmp - - id: h - class: com.yomahub.liteflow.test.subflow.cmp2.MCmp - 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);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java deleted file mode 100644 index 39480ad31..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java +++ /dev/null @@ -1,67 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.test.SolonTest; - -import java.util.HashSet; -import java.util.Set; - -/** - * 测试隐式调用子流程 单元测试 - * - * @author justin.xu - */ -@SolonTest -@Import(profiles="classpath:/subflow/application-implicit.properties") -public class ImplicitSubFlowELSpringbootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - public static final Set RUN_TIME_SLOT = new HashSet<>(); - - // 这里GCmp中隐式的调用chain4,从而执行了h,m - @Test - public void testImplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("f==>g==>h==>m", response.getExecuteStepStr()); - - // 传递了slotIndex,则set的size==1 - Assertions.assertEquals(1, RUN_TIME_SLOT.size()); - // set中第一次设置的requestId和response中的requestId一致 - Assertions.assertTrue(RUN_TIME_SLOT.contains(response.getSlot().getRequestId())); - // requestData的取值正确 - Assertions.assertEquals("it's implicit subflow.", context.getData("innerRequest")); - } - - // 在p里多线程调用q 10次,每个q取到的参数都是不同的。 - @Test - public void testImplicitSubFlow2() { - LiteflowResponse response = flowExecutor.execute2Resp("c1", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - - Set set = context.getData("test"); - - // requestData的取值正确 - Assertions.assertEquals(10, set.size()); - } - - @Test - public void testImplicitSubFlow3() { - LiteflowResponse response = flowExecutor.execute2Resp("chain_r", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringbootTest.java deleted file mode 100644 index 2d395b508..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringbootTest.java +++ /dev/null @@ -1,49 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.core.AppContext; -import org.noear.solon.test.SolonTest; - -/** - * 测试主流程与子流程在不同的配置文件的场景 - * - * @author Bryan.Zhang - */ -@SolonTest -@Import(profiles = "classpath:/subflow/application-subInDifferentConfig1.properties") -public class SubflowInDifferentConfigELSpringbootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>b==>a==>e==>d", response.getExecuteStepStr()); - } - - @Inject - private AppContext context; - - // 主要测试有不同的配置类型后会不会报出既定的错误 - @Test - public void testExplicitSubFlow2() { - Assertions.assertThrows(MultipleParsersException.class, () -> { - LiteflowConfig config = context.getBean(LiteflowConfig.class); - config.setRuleSource("subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml"); - flowExecutor.reloadRule(); - }); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringBootTest.java deleted file mode 100644 index e1e88727f..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringBootTest.java +++ /dev/null @@ -1,33 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.test.SolonTest; - -/** - * 测试显示调用子流程(xml) 单元测试 - * - * @author justin.xu - */ -@SolonTest -@Import(profiles ="classpath:/subflow/application-xml.properties") -public class SubflowXMLELSpringBootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringBootTest.java deleted file mode 100644 index afdc21e47..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringBootTest.java +++ /dev/null @@ -1,33 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.test.SolonTest; - -/** - * 测试显示调用子流程(yml) 单元测试 - * - * @author justin.xu - */ -@SolonTest -@Import(profiles ="classpath:/subflow/application-yml.properties") -public class SubflowYmlELSpringBootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlowYml() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java deleted file mode 100644 index 1337e1da6..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("a") -public class ACmp extends NodeComponent { - - @Override - public void process() { - System.out.println("Acomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java deleted file mode 100644 index 53d838ffe..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("b") -public class BCmp extends NodeComponent { - - @Override - public void process() { - System.out.println("Bcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java deleted file mode 100644 index a9c5114a4..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("c") -public class CCmp extends NodeComponent { - - @Override - public void process() throws Exception { - System.out.println("Ccomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java deleted file mode 100644 index 043577698..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("d") -public class DCmp extends NodeComponent { - - @Override - public void process() throws Exception { - System.out.println("Dcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java deleted file mode 100644 index d3f0ee0f3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("e") -public class ECmp extends NodeComponent { - - @Override - public void process() throws Exception { - System.out.println("Ecomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java deleted file mode 100644 index 585d824ab..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.slot.DefaultContext; -import org.noear.solon.annotation.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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java deleted file mode 100644 index 747e6b5ee..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; -import org.noear.solon.annotation.Inject; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELSpringbootTest.RUN_TIME_SLOT; - -@Component("g") -public class GCmp extends NodeComponent { - - @Inject - private FlowExecutor flowExecutor; - - @Override - public void process() throws Exception { - - RUN_TIME_SLOT.add(this.getSlot().getRequestId()); - - System.out.println("Gcmp executed!"); - - this.invoke("chain4", "it's implicit subflow."); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java deleted file mode 100644 index 932fadef5..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.slot.DefaultContext; -import org.noear.solon.annotation.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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java deleted file mode 100644 index 3c27939e5..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java deleted file mode 100644 index 1fbfc9939..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; -import org.noear.solon.annotation.Inject; - -@Component("p") -public class PCmp extends NodeComponent { - - @Inject - private FlowExecutor flowExecutor; - - @Override - public void process() throws Exception { - int slotIndex = this.getSlotIndex(); - for (int i = 0; i < 10; i++) { - int finalI = i; - new Thread(() -> flowExecutor.invoke2RespInAsync("c2", "it's implicit subflow " + finalI, slotIndex)) - .start(); - } - Thread.sleep(1000); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java deleted file mode 100644 index ae7422b35..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.slot.DefaultContext; -import org.noear.solon.annotation.Component; - -import java.util.HashSet; -import java.util.Set; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELSpringbootTest.RUN_TIME_SLOT; - -@Component("q") -public class QCmp extends NodeComponent { - - @Override - public void process() throws Exception { - String requestData = this.getSubChainReqDataInAsync(); - DefaultContext context = this.getFirstContextBean(); - - synchronized (QCmp.class) { - if (context.hasData("test")) { - Set set = context.getData("test"); - set.add(requestData); - } - else { - Set set = new HashSet<>(); - set.add(requestData); - context.setData("test", set); - } - } - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/R.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/R.java deleted file mode 100644 index bfaa1ce94..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/R.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowComponent; -import com.yomahub.liteflow.core.NodeComponent; - -@LiteflowComponent("r") -public class R extends NodeComponent { - - @Override - public void process() throws Exception { - this.invoke2Resp("chain_s", ""); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/S.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/S.java deleted file mode 100644 index 8743967b3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/S.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowComponent; -import com.yomahub.liteflow.core.NodeComponent; - -@LiteflowComponent("s") -public class S extends NodeComponent { - - @Override - public void process() throws Exception { - throw new RuntimeException("test"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/SubflowJsonELSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/SubflowJsonELSpringBootTest.java deleted file mode 100644 index a966accdb..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/SubflowJsonELSpringBootTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.yomahub.liteflow.test.subflow2; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.test.BaseTest; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.noear.solon.annotation.Import; -import org.noear.solon.annotation.Inject; -import org.noear.solon.test.SolonTest; - -/** - * 测试显示调用子流程(json) 单元测试 - * - * @author justin.xu - */ -@SolonTest -@Import(profiles ="classpath:/subflow/application-json.properties") -public class SubflowJsonELSpringBootTest extends BaseTest { - - @Inject - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/ACmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/ACmp.java deleted file mode 100644 index e86d99059..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/ACmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow2.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("a") -public class ACmp extends NodeComponent { - - @Override - public void process() { - System.out.println("Acomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/BCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/BCmp.java deleted file mode 100644 index f1ad07500..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/BCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow2.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("b") -public class BCmp extends NodeComponent { - - @Override - public void process() { - System.out.println("Bcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/CCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/CCmp.java deleted file mode 100644 index 08e62aaf4..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/CCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow2.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("c") -public class CCmp extends NodeComponent { - - @Override - public void process() throws Exception { - System.out.println("Ccomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/DCmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/DCmp.java deleted file mode 100644 index d6fbd3bd5..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/DCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow2.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("d") -public class DCmp extends NodeComponent { - - @Override - public void process() throws Exception { - System.out.println("Dcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/ECmp.java b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/ECmp.java deleted file mode 100644 index 6afb8856f..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/subflow2/cmp1/ECmp.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow2.cmp1; - -import com.yomahub.liteflow.core.NodeComponent; -import org.noear.solon.annotation.Component; - -@Component("e") -public class ECmp extends NodeComponent { - - @Override - public void process() throws Exception { - System.out.println("Ecomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-implicit.properties b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-implicit.properties deleted file mode 100644 index 424d7cb10..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-implicit.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-implicit.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-json.properties b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-json.properties deleted file mode 100644 index 4a247cadf..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-json.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.json \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-subInDifferentConfig1.properties b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-subInDifferentConfig1.properties deleted file mode 100644 index 9006564d9..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-subInDifferentConfig1.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-subInDifferentConfig2.properties b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-subInDifferentConfig2.properties deleted file mode 100644 index a0d247d83..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-subInDifferentConfig2.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-xml.properties b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-xml.properties deleted file mode 100644 index 95b534046..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-xml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-yml.properties b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-yml.properties deleted file mode 100644 index 3c2295809..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/application-yml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-implicit.el.xml b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-implicit.el.xml deleted file mode 100644 index 3974e2116..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-implicit.el.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - THEN(f, g); - - - - THEN(h, m); - - - - THEN(p); - - - - THEN(q); - - - - THEN(r); - - - - THEN(s); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-main.el.xml b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-main.el.xml deleted file mode 100644 index 0310bbf15..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-main.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(a, b, chain2); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-sub1.el.xml b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-sub1.el.xml deleted file mode 100644 index 829886d02..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-sub1.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(b, a, chain3); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-sub2.el.xml b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-sub2.el.xml deleted file mode 100644 index 63676b2b3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-sub2.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-sub2.el.yml b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-sub2.el.yml deleted file mode 100644 index 3d652cf48..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow-sub2.el.yml +++ /dev/null @@ -1,4 +0,0 @@ -flow: - chain: - - name: chain3 - value: "THEN(e, d);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow.el.json b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow.el.json deleted file mode 100644 index a92a77b90..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow.el.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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);" - } - ] - } -} \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow.el.xml deleted file mode 100644 index dac14dbca..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(a, b, c, chain2); - - - - THEN(d, e); - - - - THEN(b, a, chain3); - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow.el.yml b/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow.el.yml deleted file mode 100644 index cc8f056df..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-solon/src/test/resources/subflow/flow.el.yml +++ /dev/null @@ -1,10 +0,0 @@ -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);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java deleted file mode 100644 index f91a7e834..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringbootTest.java +++ /dev/null @@ -1,70 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -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 javax.annotation.Resource; -import java.util.HashSet; -import java.util.Set; - -/** - * 测试隐式调用子流程 单元测试 - * - * @author justin.xu - */ -@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 RUN_TIME_SLOT = new HashSet<>(); - - // 这里GCmp中隐式的调用chain4,从而执行了h,m - @Test - public void testImplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("f==>g==>h==>m", response.getExecuteStepStr()); - - // 传递了slotIndex,则set的size==1 - Assertions.assertEquals(1, RUN_TIME_SLOT.size()); - // set中第一次设置的requestId和response中的requestId一致 - Assertions.assertTrue(RUN_TIME_SLOT.contains(response.getSlot().getRequestId())); - // requestData的取值正确 - Assertions.assertEquals("it's implicit subflow.", context.getData("innerRequest")); - } - - // 在p里多线程调用q 10次,每个q取到的参数都是不同的。 - @Test - public void testImplicitSubFlow2() { - LiteflowResponse response = flowExecutor.execute2Resp("c1", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - - Set set = context.getData("test"); - - // requestData的取值正确 - Assertions.assertEquals(10, set.size()); - } - - @Test - public void testImplicitSubFlow3() { - LiteflowResponse response = flowExecutor.execute2Resp("chain_r", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/NestedImplicitSubFlowTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/NestedImplicitSubFlowTest.java deleted file mode 100644 index 588ce3bd9..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/NestedImplicitSubFlowTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.yomahub.liteflow.test.subflow; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.flow.LiteflowResponse; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -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 javax.annotation.Resource; - -@TestPropertySource(value = "classpath:/subflow/nestedImplicitSubFlow.properties") -@SpringBootTest(classes = SubflowXMLELSpringBootTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp1","com.yomahub.liteflow.test.subflow.cmp3" }) -public class NestedImplicitSubFlowTest { - - @Resource - private FlowExecutor flowExecutor; - - @Test - public void testNested(){ - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringbootTest.java deleted file mode 100644 index 563a9a34d..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringbootTest.java +++ /dev/null @@ -1,53 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -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 javax.annotation.Resource; - -/** - * 测试主流程与子流程在不同的配置文件的场景 - * - * @author Bryan.Zhang - */ -@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"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>b==>a==>e==>d", response.getExecuteStepStr()); - } - - @Autowired - private ApplicationContext context; - - // 主要测试有不同的配置类型后会不会报出既定的错误 - @Test - public void testExplicitSubFlow2() { - Assertions.assertThrows(MultipleParsersException.class, () -> { - LiteflowConfig config = context.getBean(LiteflowConfig.class); - config.setRuleSource("subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml"); - flowExecutor.reloadRule(); - }); - } -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELSpringBootTest.java deleted file mode 100644 index ae6bdb8cb..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELSpringBootTest.java +++ /dev/null @@ -1,36 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -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 javax.annotation.Resource; - -/** - * 测试显示调用子流程(json) 单元测试 - * - * @author justin.xu - */ -@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"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowSpringbootTest.java new file mode 100644 index 000000000..ec6ad16a5 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowSpringbootTest.java @@ -0,0 +1,71 @@ +package com.yomahub.liteflow.test.subflow; + +import cn.hutool.core.collection.ListUtil; +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.slot.DefaultContext; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +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 javax.annotation.Resource; +import java.util.Map; +import java.util.Set; + +/** + * springboot环境EL常规的例子测试 + * + * @author Bryan.Zhang + */ +@TestPropertySource(value = "classpath:/subflow/application.properties") +@SpringBootTest(classes = SubflowSpringbootTest.class) +@EnableAutoConfiguration +@ComponentScan({ "com.yomahub.liteflow.test.subflow.cmp" }) +public class SubflowSpringbootTest extends BaseTest { + + @Resource + private FlowExecutor flowExecutor; + + //测试子变量形式 + @Test + public void testSubflow1() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); + Assertions.assertTrue(response.isSuccess()); + Assertions.assertTrue(ListUtil.toList("a==>c==>d==>b","a==>c==>b==>d").contains(response.getExecuteStepStr())); + } + + //测试子chain + @Test + public void testSubflow2() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("chain2", "arg"); + Assertions.assertTrue(response.isSuccess()); + Assertions.assertTrue(ListUtil.toList("a==>c==>d==>b","a==>c==>b==>d").contains(response.getExecuteStepStr())); + } + + //测试在组件里调用另一个流程 + @Test + public void testSubflow3() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("chain3", "arg"); + Assertions.assertTrue(response.isSuccess()); + + DefaultContext context = response.getFirstContextBean(); + Set set = context.getData("set"); + Assertions.assertEquals(100, set.size()); + } + + @Test + public void testSubflow4() throws Exception { + LiteflowResponse response = flowExecutor.execute2Resp("chain5", "arg"); + Assertions.assertTrue(response.isSuccess()); + + DefaultContext context = response.getFirstContextBean(); + Map testMap = context.getData("testMap"); + Assertions.assertEquals(100, testMap.get("out")); + Assertions.assertEquals(100, testMap.get("inner")); + } + +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringBootTest.java deleted file mode 100644 index ea93b075d..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringBootTest.java +++ /dev/null @@ -1,37 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -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 javax.annotation.Resource; - -/** - * 测试显示调用子流程(xml) 单元测试 - * - * @author justin.xu - */ -@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"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringBootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringBootTest.java deleted file mode 100644 index 73e18dc5b..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringBootTest.java +++ /dev/null @@ -1,36 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -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 javax.annotation.Resource; - -/** - * 测试显示调用子流程(yml) 单元测试 - * - * @author justin.xu - */ -@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"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/ACmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/ACmp.java new file mode 100644 index 000000000..69fa1aafe --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/ACmp.java @@ -0,0 +1,20 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.subflow.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!"); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/BCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/BCmp.java new file mode 100644 index 000000000..82a0ff2f7 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/BCmp.java @@ -0,0 +1,20 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.subflow.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!"); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/CCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/CCmp.java new file mode 100644 index 000000000..ccec951a9 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/CCmp.java @@ -0,0 +1,20 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.subflow.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!"); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/DCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/DCmp.java new file mode 100644 index 000000000..fcb48c6be --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/DCmp.java @@ -0,0 +1,20 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.subflow.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("DCmp executed!"); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/ECmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/ECmp.java new file mode 100644 index 000000000..e2a1ec0a7 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/ECmp.java @@ -0,0 +1,41 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.subflow.cmp; + +import cn.hutool.core.collection.ConcurrentHashSet; +import com.yomahub.liteflow.core.FlowExecutorHolder; +import com.yomahub.liteflow.core.NodeComponent; +import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.slot.DefaultContext; +import org.springframework.stereotype.Component; + +import java.util.Set; + +@Component("e") +public class ECmp extends NodeComponent { + + @Override + public void process() { + DefaultContext context = this.getFirstContextBean(); + + Set set; + if (!context.hasData("set")){ + set = new ConcurrentHashSet<>(); + context.setData("set",set); + }else { + set = context.getData("set"); + } + + for (int i = 0; i < 100; i++) { + LiteflowResponse response = FlowExecutorHolder.loadInstance().execute2Resp("chain4","arg"+i); + DefaultContext innerContext = response.getFirstContextBean(); + String innerFlowData = innerContext.getData("demo"); + set.add(innerFlowData); + } + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/FCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/FCmp.java new file mode 100644 index 000000000..8bb53775b --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/FCmp.java @@ -0,0 +1,25 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.subflow.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import com.yomahub.liteflow.slot.DefaultContext; +import org.springframework.stereotype.Component; + +import java.util.HashSet; +import java.util.Set; + +@Component("f") +public class FCmp extends NodeComponent { + + @Override + public void process() { + DefaultContext context = this.getFirstContextBean(); + context.setData("demo", this.getRequestData()+"_process"); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/GCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/GCmp.java new file mode 100644 index 000000000..2927d7feb --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/GCmp.java @@ -0,0 +1,24 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.subflow.cmp; + +import com.yomahub.liteflow.core.FlowExecutorHolder; +import com.yomahub.liteflow.core.NodeComponent; +import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.slot.DefaultContext; +import org.springframework.stereotype.Component; + +@Component("g") +public class GCmp extends NodeComponent { + + @Override + public void process() { + DefaultContext context = this.getFirstContextBean(); + LiteflowResponse response = FlowExecutorHolder.loadInstance().execute2Resp("chain6","arg", context); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/HCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/HCmp.java new file mode 100644 index 000000000..fca218e24 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp/HCmp.java @@ -0,0 +1,39 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.subflow.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import com.yomahub.liteflow.slot.DefaultContext; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + +@Component("h") +public class HCmp extends NodeComponent { + + @Override + public void process() { + DefaultContext context = this.getFirstContextBean(); + String data = this.getCmpData(String.class); + if (!context.hasData("testMap")){ + Map testMap = new HashMap<>(); + testMap.put(data, 1); + context.setData("testMap", testMap); + }else{ + Map testMap = context.getData("testMap"); + if (testMap.containsKey(data)){ + Integer count = testMap.get(data); + testMap.put(data, count + 1); + }else{ + testMap.put(data, 1); + } + } + System.out.println("HCmp executed!"); + } +} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java deleted file mode 100644 index 11697dc07..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java deleted file mode 100644 index 06459fc5a..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java deleted file mode 100644 index aa1668e2a..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java deleted file mode 100644 index 1b0cfb904..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java deleted file mode 100644 index 9dce7ccff..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java deleted file mode 100644 index b3ea86b46..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java +++ /dev/null @@ -1,23 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java deleted file mode 100644 index 27877e4a1..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java +++ /dev/null @@ -1,26 +0,0 @@ -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!"); - - this.invoke("chain4", "it's implicit subflow."); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java deleted file mode 100644 index 74c13bd86..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java +++ /dev/null @@ -1,23 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java deleted file mode 100644 index 0fa9e0b71..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java +++ /dev/null @@ -1,19 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java deleted file mode 100644 index b599bb070..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java +++ /dev/null @@ -1,27 +0,0 @@ -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("p") -public class PCmp extends NodeComponent { - - @Autowired - private FlowExecutor flowExecutor; - - @Override - public void process() throws Exception { - int slotIndex = this.getSlotIndex(); - for (int i = 0; i < 10; i++) { - int finalI = i; - new Thread(() -> flowExecutor.invoke2RespInAsync("c2", "it's implicit subflow " + finalI, slotIndex)) - .start(); - } - Thread.sleep(1000); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java deleted file mode 100644 index ed89408a2..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java +++ /dev/null @@ -1,33 +0,0 @@ -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 java.util.HashSet; -import java.util.Set; - -import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowELSpringbootTest.RUN_TIME_SLOT; - -@Component("q") -public class QCmp extends NodeComponent { - - @Override - public void process() throws Exception { - String requestData = this.getSubChainReqDataInAsync(); - DefaultContext context = this.getFirstContextBean(); - - synchronized (QCmp.class) { - if (context.hasData("test")) { - Set set = context.getData("test"); - set.add(requestData); - } - else { - Set set = new HashSet<>(); - set.add(requestData); - context.setData("test", set); - } - } - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/R.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/R.java deleted file mode 100644 index bfaa1ce94..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/R.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowComponent; -import com.yomahub.liteflow.core.NodeComponent; - -@LiteflowComponent("r") -public class R extends NodeComponent { - - @Override - public void process() throws Exception { - this.invoke2Resp("chain_s", ""); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/S.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/S.java deleted file mode 100644 index 8743967b3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/S.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp2; - -import com.yomahub.liteflow.annotation.LiteflowComponent; -import com.yomahub.liteflow.core.NodeComponent; - -@LiteflowComponent("s") -public class S extends NodeComponent { - - @Override - public void process() throws Exception { - throw new RuntimeException("test"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp3/VCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp3/VCmp.java deleted file mode 100644 index 063589396..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp3/VCmp.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yomahub.liteflow.test.subflow.cmp3; - -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.flow.LiteflowResponse; -import org.springframework.stereotype.Component; - -@Component("v") -public class VCmp extends NodeComponent { - - @Override - public void process() { - String data = this.getTag(); - LiteflowResponse resp = this.invoke2Resp(data, null); - - if (!resp.isSuccess()){ - throw new RuntimeException("implicit sub flow exception"); - } - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-implicit.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-implicit.properties deleted file mode 100644 index 424d7cb10..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-implicit.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-implicit.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-json.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-json.properties deleted file mode 100644 index 4a247cadf..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-json.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.json \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties deleted file mode 100644 index 9006564d9..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig1.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties deleted file mode 100644 index a0d247d83..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-subInDifferentConfig2.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-xml.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-xml.properties deleted file mode 100644 index 95b534046..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-xml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-yml.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-yml.properties deleted file mode 100644 index 3c2295809..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application-yml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/flow.el.yml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application.properties new file mode 100644 index 000000000..1abd50496 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/application.properties @@ -0,0 +1 @@ +liteflow.rule-source=subflow/flow.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-implicit.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-implicit.el.xml deleted file mode 100644 index 3974e2116..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-implicit.el.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - THEN(f, g); - - - - THEN(h, m); - - - - THEN(p); - - - - THEN(q); - - - - THEN(r); - - - - THEN(s); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-main.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-main.el.xml deleted file mode 100644 index 0310bbf15..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-main.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(a, b, chain2); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub1.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub1.el.xml deleted file mode 100644 index 829886d02..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub1.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(b, a, chain3); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.xml deleted file mode 100644 index 63676b2b3..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.yml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.yml deleted file mode 100644 index 3d652cf48..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow-sub2.el.yml +++ /dev/null @@ -1,4 +0,0 @@ -flow: - chain: - - name: chain3 - value: "THEN(e, d);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.json b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.json deleted file mode 100644 index a92a77b90..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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);" - } - ] - } -} \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.xml deleted file mode 100644 index dac14dbca..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(a, b, c, chain2); - - - - THEN(d, e); - - - - THEN(b, a, chain3); - - - - THEN(e, d); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.yml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.yml deleted file mode 100644 index cc8f056df..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.el.yml +++ /dev/null @@ -1,10 +0,0 @@ -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);" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.xml new file mode 100644 index 000000000..b632e3d19 --- /dev/null +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/flow.xml @@ -0,0 +1,32 @@ + + + + + sub = WHEN(c,d); + THEN(a,sub,b); + + + + THEN(a,subChain,b); + + + + WHEN(c,d); + + + + THEN(a,e); + + + + WHEN(a, f); + + + + FOR(100).DO(THEN(h.data("out"), g)); + + + + THEN(a, h.data("inner")); + + \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/nestedImplicitSubFlow.properties b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/nestedImplicitSubFlow.properties deleted file mode 100644 index 99a94d876..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/nestedImplicitSubFlow.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=subflow/nestedImplicitSubFlow.xml \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/nestedImplicitSubFlow.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/nestedImplicitSubFlow.xml deleted file mode 100644 index 6b3181263..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/subflow/nestedImplicitSubFlow.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - THEN(v.tag("subChain1")); - - - - THEN(v.tag("subChain2")); - - - - THEN(a, b); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringTest.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringTest.java deleted file mode 100644 index 0e99289bb..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowELSpringTest.java +++ /dev/null @@ -1,59 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import javax.annotation.Resource; -import java.util.HashSet; -import java.util.Set; - -/** - * 测试隐式调用子流程 单元测试 - * - * @author justin.xu - */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration("classpath:/subflow/application-implicit.xml") -public class ImplicitSubFlowELSpringTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - public static final Set RUN_TIME_SLOT = new HashSet<>(); - - // 这里GCmp中隐式的调用chain4,从而执行了h,m - @Test - public void testImplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("f==>g==>h==>m", response.getExecuteStepStr()); - - // 传递了slotIndex,则set的size==1 - Assertions.assertEquals(1, RUN_TIME_SLOT.size()); - // set中第一次设置的requestId和response中的requestId一致 - Assertions.assertTrue(RUN_TIME_SLOT.contains(response.getSlot().getRequestId())); - // requestData的取值正确 - Assertions.assertEquals("it's implicit subflow.", context.getData("innerRequest")); - } - - // 在p里多线程调用q 10次,每个q取到的参数都是不同的。 - @Test - public void testImplicitSubFlow2() { - LiteflowResponse response = flowExecutor.execute2Resp("c1", "it's a request"); - DefaultContext context = response.getFirstContextBean(); - Assertions.assertTrue(response.isSuccess()); - - Set set = context.getData("test"); - - // requestData的取值正确 - Assertions.assertEquals(10, set.size()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringTest.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringTest.java deleted file mode 100644 index 18b02b705..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigELSpringTest.java +++ /dev/null @@ -1,47 +0,0 @@ -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.property.LiteflowConfigGetter; -import com.yomahub.liteflow.test.BaseTest; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import javax.annotation.Resource; - -/** - * 测试主流程与子流程在不同的配置文件的场景 - * - * @author Bryan.Zhang - */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration("classpath:/subflow/application-subInDifferentConfig1.xml") -public class SubflowInDifferentConfigELSpringTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow1() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>b==>a==>e==>d", response.getExecuteStepStr()); - } - - // 主要测试有不同的配置类型后会不会报出既定的错误 - @Test - public void testExplicitSubFlow2() { - Assertions.assertThrows(MultipleParsersException.class, () -> { - LiteflowConfig config = LiteflowConfigGetter.get(); - config.setRuleSource("subflow/flow-main.el.xml,subflow/flow-sub1.el.xml,subflow/flow-sub2.el.yml"); - flowExecutor.reloadRule(); - }); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELSpringTest.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELSpringTest.java deleted file mode 100644 index fbe32c107..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonELSpringTest.java +++ /dev/null @@ -1,34 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import javax.annotation.Resource; - -/** - * 测试显示调用子流程(json) 单元测试 - * - * @author justin.xu - */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration("classpath:/subflow/application-json.xml") -public class SubflowJsonELSpringTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringTest.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringTest.java deleted file mode 100644 index bca2767ad..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLELSpringTest.java +++ /dev/null @@ -1,34 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import javax.annotation.Resource; - -/** - * 测试显示调用子流程(xml) 单元测试 - * - * @author justin.xu - */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration("classpath:/subflow/application-xml.xml") -public class SubflowXMLELSpringTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlow() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringTest.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringTest.java deleted file mode 100644 index 705610b61..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlELSpringTest.java +++ /dev/null @@ -1,34 +0,0 @@ -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.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import javax.annotation.Resource; - -/** - * 测试显示调用子流程(yml) 单元测试 - * - * @author justin.xu - */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration("classpath:/subflow/application-yml.xml") -public class SubflowYmlELSpringTest extends BaseTest { - - @Resource - private FlowExecutor flowExecutor; - - // 是否按照流程定义配置执行 - @Test - public void testExplicitSubFlowYml() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); - Assertions.assertTrue(response.isSuccess()); - Assertions.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr()); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java deleted file mode 100644 index 11697dc07..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java deleted file mode 100644 index 06459fc5a..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java deleted file mode 100644 index aa1668e2a..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java deleted file mode 100644 index 1b0cfb904..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java deleted file mode 100644 index 9dce7ccff..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java +++ /dev/null @@ -1,14 +0,0 @@ -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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java deleted file mode 100644 index f773bd5ca..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java +++ /dev/null @@ -1,19 +0,0 @@ -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.ImplicitSubFlowELSpringTest.RUN_TIME_SLOT; - -@Component("f") -public class FCmp extends NodeComponent { - - @Override - public void process() throws Exception { - - RUN_TIME_SLOT.add(this.getSlot().getRequestId()); - - System.out.println("Fcomp executed!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java deleted file mode 100644 index 308e75c38..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java +++ /dev/null @@ -1,21 +0,0 @@ -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.ImplicitSubFlowELSpringTest.RUN_TIME_SLOT; - -@Component("g") -public class GCmp extends NodeComponent { - - @Override - public void process() throws Exception { - - RUN_TIME_SLOT.add(this.getSlot().getRequestId()); - - System.out.println("Gcmp executed!"); - - this.invoke("chain4", "it's implicit subflow."); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java deleted file mode 100644 index e9b6fc540..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java +++ /dev/null @@ -1,23 +0,0 @@ -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.ImplicitSubFlowELSpringTest.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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java deleted file mode 100644 index 7d7115bb1..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java +++ /dev/null @@ -1,19 +0,0 @@ -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.ImplicitSubFlowELSpringTest.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!"); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java deleted file mode 100644 index d6d9ceec9..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/PCmp.java +++ /dev/null @@ -1,31 +0,0 @@ -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; - -@Component("p") -public class PCmp extends NodeComponent { - - @Autowired - private FlowExecutor flowExecutor; - - @Override - public void process() throws Exception { - int slotIndex = this.getSlotIndex(); - for (int i = 0; i < 10; i++) { - int finalI = i; - new Thread(() -> { - try { - flowExecutor.invokeInAsync("c2", "it's implicit subflow " + finalI, slotIndex); - } - catch (Exception e) { - throw new RuntimeException(e); - } - }).start(); - } - Thread.sleep(1000); - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java deleted file mode 100644 index 7399dc2dd..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/QCmp.java +++ /dev/null @@ -1,31 +0,0 @@ -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 java.util.HashSet; -import java.util.Set; - -@Component("q") -public class QCmp extends NodeComponent { - - @Override - public void process() throws Exception { - String requestData = this.getSubChainReqDataInAsync(); - DefaultContext context = this.getFirstContextBean(); - - synchronized (QCmp.class) { - if (context.hasData("test")) { - Set set = context.getData("test"); - set.add(requestData); - } - else { - Set set = new HashSet<>(); - set.add(requestData); - context.setData("test", set); - } - } - } - -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-implicit.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-implicit.xml deleted file mode 100644 index a7d121c5f..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-implicit.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-json.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-json.xml deleted file mode 100644 index 2fcc5066d..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-json.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-subInDifferentConfig1.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-subInDifferentConfig1.xml deleted file mode 100644 index 9ecb9b01f..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-subInDifferentConfig1.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-xml.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-xml.xml deleted file mode 100644 index 383d28414..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-xml.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-yml.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-yml.xml deleted file mode 100644 index a36a62b6b..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/application-yml.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-implicit.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-implicit.el.xml deleted file mode 100644 index 4ba68cecf..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-implicit.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(f, g) - - - - THEN(h, m) - - - - THEN(p); - - - - THEN(q); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-main.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-main.el.xml deleted file mode 100644 index a74e9a7e9..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-main.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(a, b, chain2) - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-sub1.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-sub1.el.xml deleted file mode 100644 index ca17907ab..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-sub1.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(b, a, chain3) - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-sub2.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-sub2.el.xml deleted file mode 100644 index c5a26a0bd..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-sub2.el.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(e, d) - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-sub2.el.yml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-sub2.el.yml deleted file mode 100644 index 78d5a1756..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow-sub2.el.yml +++ /dev/null @@ -1,4 +0,0 @@ -flow: - chain: - - name: chain3 - value: "THEN(e, d)" \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow.el.json b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow.el.json deleted file mode 100644 index c88cfd595..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow.el.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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)" - } - ] - } -} \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow.el.xml deleted file mode 100644 index 7ddc08720..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow.el.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - THEN(a, b, c, chain2) - - - - THEN(d, e) - - - - THEN(b, a, chain3) - - - - THEN(e, d) - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow.el.yml b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow.el.yml deleted file mode 100644 index 0a76dba14..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/resources/subflow/flow.el.yml +++ /dev/null @@ -1,10 +0,0 @@ -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)" \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6422ea1c8..1e77ff2e3 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ - 2.13.2.1 + 2.13.3 UTF-8 UTF-8 8