diff --git a/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/LiteflowExecutorInit.java b/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/LiteflowExecutorInit.java index 450626f35..f36f47dcb 100644 --- a/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/LiteflowExecutorInit.java +++ b/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/LiteflowExecutorInit.java @@ -12,7 +12,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; */ public class LiteflowExecutorInit implements InitializingBean { - private FlowExecutor flowExecutor; + private final FlowExecutor flowExecutor; public LiteflowExecutorInit(FlowExecutor flowExecutor) { this.flowExecutor = flowExecutor; diff --git a/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/config/LiteflowMainAutoConfiguration.java b/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/config/LiteflowMainAutoConfiguration.java index aeba4eee5..18eda53ea 100644 --- a/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/config/LiteflowMainAutoConfiguration.java +++ b/liteflow-spring-boot-starter/src/main/java/com/yomahub/liteflow/springboot/config/LiteflowMainAutoConfiguration.java @@ -34,7 +34,9 @@ public class LiteflowMainAutoConfiguration { @Bean public FlowExecutor flowExecutor(LiteflowConfig liteflowConfig) { - return new FlowExecutor(liteflowConfig); + FlowExecutor flowExecutor = new FlowExecutor(); + flowExecutor.setLiteflowConfig(liteflowConfig); + return flowExecutor; } @Bean diff --git a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java index 368825469..499dc28dc 100644 --- a/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java +++ b/liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java @@ -3,6 +3,7 @@ package com.yomahub.liteflow.test.subflow.cmp2; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.core.NodeComponent; import com.yomahub.liteflow.entity.data.DefaultSlot; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -13,7 +14,7 @@ import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowTest.RUN_TIME_SLO @Component("g") public class GCmp extends NodeComponent { - @Resource + @Autowired private FlowExecutor flowExecutor; @Override @@ -21,7 +22,7 @@ public class GCmp extends NodeComponent { RUN_TIME_SLOT.add(this.getSlot().getRequestId()); - System.out.println("Gcomp executed!"); + System.out.println("Gcmp executed!"); flowExecutor.invoke("chain4", "it's implicit subflow.", DefaultSlot.class, this.getSlotIndex()); } diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolSpringTest.java index b6cd16e45..052108b59 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolSpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolSpringTest.java @@ -15,7 +15,7 @@ import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; /** - * springboot环境下异步线程超时日志打印测试 + * spring环境下异步线程超时日志打印测试 * * @author Bryan.Zhang * @since 2.6.4 diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/FlowExecutorTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/FlowExecutorTest.java index cc0115eb0..24959eceb 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/FlowExecutorTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/FlowExecutorTest.java @@ -20,9 +20,7 @@ public class FlowExecutorTest extends BaseTest { public void testMethodExecute2Resp() { LiteflowConfig config = new LiteflowConfig(); config.setRuleSource("executor/flow.json"); - FlowExecutor executor = new FlowExecutor(); - executor.setLiteflowConfig(config); - executor.init(); + FlowExecutor executor = new FlowExecutor(config); LiteflowResponse response = executor.execute2Resp("chain1", "test0", CustomSlot.class); Assert.assertTrue(response.isSuccess()); Assert.assertEquals("custom", response.getSlot().getName()); @@ -32,9 +30,7 @@ public class FlowExecutorTest extends BaseTest { public void testMethodExecute2RespWithException() throws Exception{ LiteflowConfig config = new LiteflowConfig(); config.setRuleSource("executor/flow0.json"); - FlowExecutor executor = new FlowExecutor(); - executor.setLiteflowConfig(config); - executor.init(); + FlowExecutor executor = new FlowExecutor(config); LiteflowResponse response = executor.execute2Resp("chain1", "test1", CustomSlot.class); Assert.assertFalse(response.isSuccess()); ReflectionUtils.rethrowException(response.getCause()); @@ -44,9 +40,7 @@ public class FlowExecutorTest extends BaseTest { public void testMethodExecute() throws Exception { LiteflowConfig config = new LiteflowConfig(); config.setRuleSource("executor/flow.json"); - FlowExecutor executor = new FlowExecutor(); - executor.setLiteflowConfig(config); - executor.init(); + FlowExecutor executor = new FlowExecutor(config); CustomSlot slot = executor.execute("chain1", "test0", CustomSlot.class); Assert.assertEquals("custom", slot.getName()); } @@ -55,9 +49,7 @@ public class FlowExecutorTest extends BaseTest { public void testMethodExecuteWithException() throws Exception { LiteflowConfig config = new LiteflowConfig(); config.setRuleSource("executor/flow0.json"); - FlowExecutor executor = new FlowExecutor(); - executor.setLiteflowConfig(config); - executor.init(); + FlowExecutor executor = new FlowExecutor(config); executor.execute("chain1", "test1", CustomSlot.class); } } diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/monitor/MonitorSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/monitor/MonitorSpringTest.java index 2aa85721a..2384098fd 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/monitor/MonitorSpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/monitor/MonitorSpringTest.java @@ -16,7 +16,7 @@ import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; /** - * springboot环境最普通的例子测试 + * spring环境下监控的测试 * @author Bryan.Zhang * @since 2.6.4 */ diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/multipleType/LiteflowMultipleTypeSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/multipleType/LiteflowMultipleTypeSpringTest.java index cb5e628a0..7a9f95d97 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/multipleType/LiteflowMultipleTypeSpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/multipleType/LiteflowMultipleTypeSpringTest.java @@ -13,7 +13,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** - * 测试springboot下混合格式规则的场景 + * 测试spring下混合格式规则的场景 * @author Bryan.Zhang * @since 2.5.10 */ diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/nodeExecutor/LiteflowNodeExecutorSpringbootTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/nodeExecutor/LiteflowNodeExecutorSpringTest.java similarity index 95% rename from liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/nodeExecutor/LiteflowNodeExecutorSpringbootTest.java rename to liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/nodeExecutor/LiteflowNodeExecutorSpringTest.java index 0d384129e..ee1deef95 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/nodeExecutor/LiteflowNodeExecutorSpringbootTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/nodeExecutor/LiteflowNodeExecutorSpringTest.java @@ -14,14 +14,14 @@ import javax.annotation.Resource; /** - * 测试springboot下的组件重试 + * 测试spring下的组件重试 * * @author Bryan.Zhang * @since 2.5.10 */ @RunWith(SpringRunner.class) @ContextConfiguration("classpath:/nodeExecutor/application.xml") -public class LiteflowNodeExecutorSpringbootTest extends BaseTest { +public class LiteflowNodeExecutorSpringTest extends BaseTest { @Resource private FlowExecutor flowExecutor; diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserJsonNoSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserJsonNoSpringTest.java index a70c5a427..1e69d8fc4 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserJsonNoSpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserJsonNoSpringTest.java @@ -18,11 +18,9 @@ public class LFParserJsonNoSpringTest extends BaseTest { //测试无spring场景的json parser @Test public void testNoSpring() { - FlowExecutor executor = new FlowExecutor(); LiteflowConfig liteflowConfig = new LiteflowConfig(); liteflowConfig.setRuleSource("parser/flow.json"); - executor.setLiteflowConfig(liteflowConfig); - executor.init(); + FlowExecutor executor = new FlowExecutor(liteflowConfig); LiteflowResponse response = executor.execute2Resp("chain1", "arg"); Assert.assertTrue(response.isSuccess()); } diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserXmlNoSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserXmlNoSpringTest.java index f073d6e3c..117fadaa1 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserXmlNoSpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserXmlNoSpringTest.java @@ -18,11 +18,9 @@ public class LFParserXmlNoSpringTest extends BaseTest { //测试无spring场景的xml parser @Test public void testNoSpring() { - FlowExecutor executor = new FlowExecutor(); LiteflowConfig liteflowConfig = new LiteflowConfig(); liteflowConfig.setRuleSource("parser/flow.xml"); - executor.setLiteflowConfig(liteflowConfig); - executor.init(); + FlowExecutor executor = new FlowExecutor(liteflowConfig); LiteflowResponse response = executor.execute2Resp("chain1", "arg"); Assert.assertTrue(response.isSuccess()); } diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserYmlNoSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserYmlNoSpringTest.java index 43a05c380..b87ce4bb5 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserYmlNoSpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/parser/LFParserYmlNoSpringTest.java @@ -18,11 +18,9 @@ public class LFParserYmlNoSpringTest extends BaseTest { //测试无spring场景的yml parser @Test public void testNoSpring() { - FlowExecutor executor = new FlowExecutor(); LiteflowConfig liteflowConfig = new LiteflowConfig(); liteflowConfig.setRuleSource("parser/flow.yml"); - executor.setLiteflowConfig(liteflowConfig); - executor.init(); + FlowExecutor executor = new FlowExecutor(liteflowConfig); LiteflowResponse response = executor.execute2Resp("chain1", "arg"); Assert.assertTrue(response.isSuccess()); } diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/preAndFinally/PreAndFinallySpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/preAndFinally/PreAndFinallySpringTest.java index d70b3509e..d2eac3624 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/preAndFinally/PreAndFinallySpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/preAndFinally/PreAndFinallySpringTest.java @@ -13,7 +13,7 @@ import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; /** - * springboot环境下pre节点和finally节点的测试 + * spring环境下pre节点和finally节点的测试 * @author Bryan.Zhang * @since 2.6.4 */ diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/privateDelivery/PrivateDeliverySpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/privateDelivery/PrivateDeliverySpringTest.java index c446227ed..5cf5a7426 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/privateDelivery/PrivateDeliverySpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/privateDelivery/PrivateDeliverySpringTest.java @@ -14,7 +14,7 @@ import javax.annotation.Resource; import java.util.Set; /** - * springboot环境下隐私投递的测试 + * spring环境下隐私投递的测试 * @author Bryan.Zhang * @since 2.5.0 */ diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/refreshRule/RefreshRuleSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/refreshRule/RefreshRuleSpringTest.java index 1191c2c27..5f9d0cd07 100644 --- a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/refreshRule/RefreshRuleSpringTest.java +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/refreshRule/RefreshRuleSpringTest.java @@ -16,7 +16,7 @@ import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; /** - * springboot环境下重新加载规则测试 + * spring环境下重新加载规则测试 * @author Bryan.Zhang * @since 2.6.4 */ diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/ReloadSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/ReloadSpringTest.java new file mode 100644 index 000000000..3acccbc04 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/ReloadSpringTest.java @@ -0,0 +1,35 @@ +package com.yomahub.liteflow.test.reload; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.entity.data.DefaultSlot; +import com.yomahub.liteflow.entity.data.LiteflowResponse; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +/** + * spring环境下重新加载规则测试 + * @author Bryan.Zhang + * @since 2.5.0 + */ +@RunWith(SpringRunner.class) +@ContextConfiguration("classpath:/reload/application.xml") +public class ReloadSpringTest extends BaseTest { + + @Resource + private FlowExecutor flowExecutor; + + //用reloadRule去重新加载,这里如果配置是放在本地。如果想修改,则要去修改target下面的flow.xml + //这里的测试,手动打断点然后去修改,是ok的。但是整个测试,暂且只是为了测试这个功能是否能正常运行 + @Test + public void testReload() throws Exception{ + flowExecutor.reloadRule(); + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); + Assert.assertTrue(response.isSuccess()); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/cmp/ACmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/cmp/ACmp.java new file mode 100644 index 000000000..fcf6fed45 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/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.reload.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("a") +public class ACmp extends NodeComponent { + + @Override + public void process() { + System.out.println("ACmp executed!"); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/cmp/BCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/cmp/BCmp.java new file mode 100644 index 000000000..978235c62 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/cmp/BCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.reload.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("b") +public class BCmp extends NodeComponent { + + @Override + public void process() { + System.out.println("BCmp executed!"); + } + +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/cmp/CCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/cmp/CCmp.java new file mode 100644 index 000000000..48620d98c --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/reload/cmp/CCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.reload.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("c") +public class CCmp extends NodeComponent { + + @Override + public void process() { + System.out.println("CCmp executed!"); + } + +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/ResizeSlotSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/ResizeSlotSpringTest.java new file mode 100644 index 000000000..13af337d6 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/ResizeSlotSpringTest.java @@ -0,0 +1,59 @@ +package com.yomahub.liteflow.test.resizeSlot; + +import cn.hutool.core.util.ReflectUtil; +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.entity.data.DataBus; +import com.yomahub.liteflow.entity.data.DefaultSlot; +import com.yomahub.liteflow.entity.data.LiteflowResponse; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +/** + * springboot环境下slot扩容测试 + * @author Bryan.Zhang + * @since 2.5.0 + */ +@RunWith(SpringRunner.class) +@ContextConfiguration("classpath:/resizeSlot/application.xml") +public class ResizeSlotSpringTest extends BaseTest { + + @Resource + private FlowExecutor flowExecutor; + + @Test + public void testResize() throws Exception{ + ExecutorService pool = Executors.newCachedThreadPool(); + + List>> futureList = new ArrayList<>(); + for (int i = 0; i < 100; i++) { + Future> future = pool.submit(() -> flowExecutor.execute2Resp("chain1", "arg")); + futureList.add(future); + } + + for(Future> future : futureList){ + Assert.assertTrue(future.get().isSuccess()); + } + + //取到static的对象QUEUE + Field field = ReflectUtil.getField(DataBus.class, "QUEUE"); + ConcurrentLinkedQueue queue = (ConcurrentLinkedQueue) ReflectUtil.getStaticFieldValue(field); + + //因为初始slotSize是4,按照0.75的扩容比,要满足100个线程,应该扩容5~6次,5次=65,6次=114 + //为什么不是直接114呢? + //因为在单测中根据机器的性能,在多线程情况下,有些机器跑的慢一点,也就是说65个就足够了。有些机器跑的快一点,是能真正扩容到114个的 + Assert.assertTrue(queue.size() > 4); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/cmp/ACmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/cmp/ACmp.java new file mode 100644 index 000000000..4f466e1c5 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/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.resizeSlot.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-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/cmp/BCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/cmp/BCmp.java new file mode 100644 index 000000000..0c76deae4 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/cmp/BCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.resizeSlot.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-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/cmp/CCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/cmp/CCmp.java new file mode 100644 index 000000000..7dc427c11 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/resizeSlot/cmp/CCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

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

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.resizeSlot.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-springnative/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowTest.java new file mode 100644 index 000000000..7850edb31 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/ImplicitSubFlowTest.java @@ -0,0 +1,43 @@ +package com.yomahub.liteflow.test.subflow; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.entity.data.DefaultSlot; +import com.yomahub.liteflow.entity.data.LiteflowResponse; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; +import java.util.HashSet; +import java.util.Set; + +/** + * 测试隐式调用子流程 + * 单元测试 + * + * @author justin.xu + */ +@RunWith(SpringRunner.class) +@ContextConfiguration("classpath:/subflow/application-implicit.xml") +public class ImplicitSubFlowTest extends BaseTest { + @Resource + private FlowExecutor flowExecutor; + + public static final Set RUN_TIME_SLOT = new HashSet<>(); + + //这里GCmp中隐式的调用chain4,从而执行了h,m + @Test + public void testImplicitSubFlow() { + LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request"); + Assert.assertTrue(response.isSuccess()); + Assert.assertEquals("f==>g==>h==>m", response.getSlot().getExecuteStepStr()); + + // 传递了slotIndex,则set的size==1 + Assert.assertEquals(1, RUN_TIME_SLOT.size()); + // set中第一次设置的requestId和response中的requestId一致 + Assert.assertTrue(RUN_TIME_SLOT.contains(response.getSlot().getRequestId())); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigTest.java new file mode 100644 index 000000000..260b8b101 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowInDifferentConfigTest.java @@ -0,0 +1,44 @@ +package com.yomahub.liteflow.test.subflow; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.entity.data.DefaultSlot; +import com.yomahub.liteflow.entity.data.LiteflowResponse; +import com.yomahub.liteflow.exception.MultipleParsersException; +import com.yomahub.liteflow.property.LiteflowConfig; +import com.yomahub.liteflow.property.LiteflowConfigGetter; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +/** + * 测试主流程与子流程在不同的配置文件的场景 + * + * @author Bryan.Zhang + */ +@RunWith(SpringRunner.class) +@ContextConfiguration("classpath:/subflow/application-subInDifferentConfig1.xml") +public class SubflowInDifferentConfigTest extends BaseTest { + @Resource + private FlowExecutor flowExecutor; + + //是否按照流程定义配置执行 + @Test + public void testExplicitSubFlow1() { + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); + Assert.assertTrue(response.isSuccess()); + Assert.assertEquals("a==>b==>b==>a==>e==>d", response.getSlot().getExecuteStepStr()); + } + + //主要测试有不同的配置类型后会不会报出既定的错误 + @Test(expected = MultipleParsersException.class) + public void testExplicitSubFlow2() { + LiteflowConfig config = LiteflowConfigGetter.get(); + config.setRuleSource("subflow/flow-main.xml,subflow/flow-sub1.xml,subflow/flow-sub2.yml"); + flowExecutor.init(); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonSpringTest.java new file mode 100644 index 000000000..62f12d58f --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowJsonSpringTest.java @@ -0,0 +1,34 @@ +package com.yomahub.liteflow.test.subflow; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.entity.data.DefaultSlot; +import com.yomahub.liteflow.entity.data.LiteflowResponse; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +/** + * 测试显示调用子流程(json) + * 单元测试 + * + * @author justin.xu + */ +@RunWith(SpringRunner.class) +@ContextConfiguration("classpath:/subflow/application-json.xml") +public class SubflowJsonSpringTest extends BaseTest { + @Resource + private FlowExecutor flowExecutor; + + //是否按照流程定义配置执行 + @Test + public void testExplicitSubFlow() { + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); + Assert.assertTrue(response.isSuccess()); + Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getSlot().getExecuteStepStr()); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLSpringTest.java new file mode 100644 index 000000000..bb12eaea3 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowXMLSpringTest.java @@ -0,0 +1,34 @@ +package com.yomahub.liteflow.test.subflow; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.entity.data.DefaultSlot; +import com.yomahub.liteflow.entity.data.LiteflowResponse; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +/** + * 测试显示调用子流程(xml) + * 单元测试 + * + * @author justin.xu + */ +@RunWith(SpringRunner.class) +@ContextConfiguration("classpath:/subflow/application-xml.xml") +public class SubflowXMLSpringTest extends BaseTest { + @Resource + private FlowExecutor flowExecutor; + + //是否按照流程定义配置执行 + @Test + public void testExplicitSubFlow() { + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); + Assert.assertTrue(response.isSuccess()); + Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getSlot().getExecuteStepStr()); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlSpringTest.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlSpringTest.java new file mode 100644 index 000000000..4e8189286 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/SubflowYmlSpringTest.java @@ -0,0 +1,34 @@ +package com.yomahub.liteflow.test.subflow; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.entity.data.DefaultSlot; +import com.yomahub.liteflow.entity.data.LiteflowResponse; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +/** + * 测试显示调用子流程(yml) + * 单元测试 + * + * @author justin.xu + */ +@RunWith(SpringRunner.class) +@ContextConfiguration("classpath:/subflow/application-yml.xml") +public class SubflowYmlSpringTest extends BaseTest { + @Resource + private FlowExecutor flowExecutor; + + //是否按照流程定义配置执行 + @Test + public void testExplicitSubFlowYml() { + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a request"); + Assert.assertTrue(response.isSuccess()); + Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getSlot().getExecuteStepStr()); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java new file mode 100644 index 000000000..75a7fb49b --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ACmp.java @@ -0,0 +1,13 @@ +package com.yomahub.liteflow.test.subflow.cmp1; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + + +@Component("a") +public class ACmp extends NodeComponent { + @Override + public void process() { + System.out.println("Acomp executed!"); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java new file mode 100644 index 000000000..9fb3c9326 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/BCmp.java @@ -0,0 +1,13 @@ +package com.yomahub.liteflow.test.subflow.cmp1; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + + +@Component("b") +public class BCmp extends NodeComponent { + @Override + public void process() { + System.out.println("Bcomp executed!"); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java new file mode 100644 index 000000000..ce8ea149f --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/CCmp.java @@ -0,0 +1,13 @@ +package com.yomahub.liteflow.test.subflow.cmp1; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + + +@Component("c") +public class CCmp extends NodeComponent { + @Override + public void process() throws Exception { + System.out.println("Ccomp executed!"); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java new file mode 100644 index 000000000..309196e9b --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/DCmp.java @@ -0,0 +1,13 @@ +package com.yomahub.liteflow.test.subflow.cmp1; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + + +@Component("d") +public class DCmp extends NodeComponent { + @Override + public void process() throws Exception { + System.out.println("Dcomp executed!"); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java new file mode 100644 index 000000000..b855a1ae0 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp1/ECmp.java @@ -0,0 +1,14 @@ +package com.yomahub.liteflow.test.subflow.cmp1; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + + +@Component("e") +public class ECmp extends NodeComponent { + + @Override + public void process() throws Exception { + System.out.println("Ecomp executed!"); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java new file mode 100644 index 000000000..b9a0d458e --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/FCmp.java @@ -0,0 +1,18 @@ +package com.yomahub.liteflow.test.subflow.cmp2; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowTest.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-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java new file mode 100644 index 000000000..d912c2322 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/GCmp.java @@ -0,0 +1,27 @@ +package com.yomahub.liteflow.test.subflow.cmp2; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.core.NodeComponent; +import com.yomahub.liteflow.entity.data.DefaultSlot; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowTest.RUN_TIME_SLOT; + + +@Component("g") +public class GCmp extends NodeComponent { + + @Autowired + private FlowExecutor flowExecutor; + + @Override + public void process() throws Exception { + + RUN_TIME_SLOT.add(this.getSlot().getRequestId()); + + System.out.println("Gcmp executed!"); + + flowExecutor.invoke("chain4", "it's implicit subflow.", DefaultSlot.class, this.getSlotIndex()); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java new file mode 100644 index 000000000..ee03a9a23 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/HCmp.java @@ -0,0 +1,18 @@ +package com.yomahub.liteflow.test.subflow.cmp2; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowTest.RUN_TIME_SLOT; + + +@Component("h") +public class HCmp extends NodeComponent { + @Override + public void process() throws Exception { + + RUN_TIME_SLOT.add(this.getSlot().getRequestId()); + + System.out.println("Hcomp executed!"); + } +} diff --git a/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java new file mode 100644 index 000000000..e54afd856 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/subflow/cmp2/MCmp.java @@ -0,0 +1,18 @@ +package com.yomahub.liteflow.test.subflow.cmp2; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +import static com.yomahub.liteflow.test.subflow.ImplicitSubFlowTest.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-springnative/src/test/resources/reload/application.xml b/liteflow-testcase-springnative/src/test/resources/reload/application.xml new file mode 100644 index 000000000..0f826a7e8 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/reload/application.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/reload/flow.xml b/liteflow-testcase-springnative/src/test/resources/reload/flow.xml new file mode 100644 index 000000000..22870d94f --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/reload/flow.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/resizeSlot/application.xml b/liteflow-testcase-springnative/src/test/resources/resizeSlot/application.xml new file mode 100644 index 000000000..5335eb54f --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/resizeSlot/application.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/resizeSlot/flow.xml b/liteflow-testcase-springnative/src/test/resources/resizeSlot/flow.xml new file mode 100644 index 000000000..22870d94f --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/resizeSlot/flow.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/application-implicit.xml b/liteflow-testcase-springnative/src/test/resources/subflow/application-implicit.xml new file mode 100644 index 000000000..43af5ec21 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/application-implicit.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/application-json.xml b/liteflow-testcase-springnative/src/test/resources/subflow/application-json.xml new file mode 100644 index 000000000..176c86b42 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/application-json.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/application-subInDifferentConfig1.xml b/liteflow-testcase-springnative/src/test/resources/subflow/application-subInDifferentConfig1.xml new file mode 100644 index 000000000..7ae8f3c5c --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/application-subInDifferentConfig1.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/application-xml.xml b/liteflow-testcase-springnative/src/test/resources/subflow/application-xml.xml new file mode 100644 index 000000000..38b2fafa0 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/application-xml.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/application-yml.xml b/liteflow-testcase-springnative/src/test/resources/subflow/application-yml.xml new file mode 100644 index 000000000..72103c355 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/application-yml.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/flow-implicit.xml b/liteflow-testcase-springnative/src/test/resources/subflow/flow-implicit.xml new file mode 100644 index 000000000..5baca7072 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/flow-implicit.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/flow-main.xml b/liteflow-testcase-springnative/src/test/resources/subflow/flow-main.xml new file mode 100644 index 000000000..0adf54fc4 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/flow-main.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/flow-sub1.xml b/liteflow-testcase-springnative/src/test/resources/subflow/flow-sub1.xml new file mode 100644 index 000000000..471dee3fe --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/flow-sub1.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/flow-sub2.xml b/liteflow-testcase-springnative/src/test/resources/subflow/flow-sub2.xml new file mode 100644 index 000000000..63dd964bf --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/flow-sub2.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/flow-sub2.yml b/liteflow-testcase-springnative/src/test/resources/subflow/flow-sub2.yml new file mode 100644 index 000000000..8ba43c102 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/flow-sub2.yml @@ -0,0 +1,6 @@ +flow: + chain: + - name: chain3 + condition: + - type: then + value: 'e,d' \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/flow.json b/liteflow-testcase-springnative/src/test/resources/subflow/flow.json new file mode 100644 index 000000000..143589315 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/flow.json @@ -0,0 +1,33 @@ +{ + "flow": { + "chain": [ + { + "name": "chain3", + "condition": [ + {"type": "then", "value": "e,d"} + ] + }, + { + "name": "chain2", + "condition": [ + {"type": "then", "value": "b,a"}, + {"type": "then", "value": "chain3"} + ] + }, + { + "name": "chain1", + "condition": [ + {"type": "then", "value": "a,b"}, + {"type": "then", "value": "c"}, + {"type": "then", "value": "chain2"} + ] + }, + { + "name": "c", + "condition": [ + {"type": "then", "value": "d,e"} + ] + } + ] + } +} \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/flow.xml b/liteflow-testcase-springnative/src/test/resources/subflow/flow.xml new file mode 100644 index 000000000..03cf81299 --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/flow.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-springnative/src/test/resources/subflow/flow.yml b/liteflow-testcase-springnative/src/test/resources/subflow/flow.yml new file mode 100644 index 000000000..cdd8de74b --- /dev/null +++ b/liteflow-testcase-springnative/src/test/resources/subflow/flow.yml @@ -0,0 +1,24 @@ +flow: + chain: + - name: chain3 + condition: + - type: then + value: 'e,d' + - name: chain1 + condition: + - type: then + value: 'a,b' + - type: then + value: 'c' + - type: then + value: 'chain2' + - name: c + condition: + - type: then + value: 'd,e' + - name: chain2 + condition: + - type: then + value: 'b,a' + - type: then + value: 'chain3' \ No newline at end of file