diff --git a/liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/CustomContext.java b/liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/CustomContext.java deleted file mode 100644 index 7af6b2d8b..000000000 --- a/liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/CustomContext.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.yomahub.liteflow.test.executor; - -public class CustomContext { - private String name; - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } -} diff --git a/liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/FlowExecutorTest.java b/liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/FlowExecutorTest.java deleted file mode 100644 index 1014abc09..000000000 --- a/liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/FlowExecutorTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.yomahub.liteflow.test.executor; - -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.property.LiteflowConfig; -import com.yomahub.liteflow.slot.DefaultContext; -import com.yomahub.liteflow.slot.Slot; -import com.yomahub.liteflow.test.BaseTest; -import org.junit.Assert; -import org.junit.Test; -import org.springframework.util.ReflectionUtils; - -/** - * 无spring环境下FlowExecutor - * 调用方法execute、invoke单元测试 - * @author zendwang - * @since 2.5.1 - */ -public class FlowExecutorTest extends BaseTest { - - @Test - public void testMethodExecute2Resp() { - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("executor/flow.json"); - FlowExecutor executor = new FlowExecutor(config); - LiteflowResponse response = executor.execute2Resp("chain1", "test0", CustomContext.class); - CustomContext context = response.getFirstContextBean(); - Assert.assertTrue(response.isSuccess()); - Assert.assertEquals("custom", context.getName()); - } - - @Test(expected=RuntimeException.class) - public void testMethodExecute2RespWithException() throws Exception{ - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("executor/flow0.json"); - FlowExecutor executor = new FlowExecutor(config); - LiteflowResponse response = executor.execute2Resp("chain1", "test1", CustomContext.class); - CustomContext context = response.getFirstContextBean(); - Assert.assertFalse(response.isSuccess()); - ReflectionUtils.rethrowException(response.getCause()); - } - - @Test - public void testMethodExecute() throws Exception { - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("executor/flow.json"); - FlowExecutor executor = new FlowExecutor(config); - LiteflowResponse response = executor.execute2Resp("chain1", "test0", CustomContext.class); - CustomContext context = response.getFirstContextBean(); - Assert.assertEquals("custom", context.getName()); - } - - @Test(expected=RuntimeException.class) - public void testMethodExecuteWithException() throws Exception { - LiteflowConfig config = new LiteflowConfig(); - config.setRuleSource("executor/flow0.json"); - FlowExecutor executor = new FlowExecutor(config); - LiteflowResponse response = executor.execute2Resp("chain1", "test1", CustomContext.class); - if(!response.isSuccess()){ - throw response.getCause(); - } - } -} diff --git a/liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/cmp/ACmp.java b/liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/cmp/ACmp.java deleted file mode 100644 index 18b757503..000000000 --- a/liteflow-testcase-old/liteflow-testcase-springnative/src/test/java/com/yomahub/liteflow/test/executor/cmp/ACmp.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - *

Title: liteflow

- *

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

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

Title: liteflow

- *

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

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

Title: liteflow

- *

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

- * @author Bryan.Zhang - * @email weenyc31@163.com - * @Date 2020/4/1 - */ -package com.yomahub.liteflow.test.executor.cmp; - -import cn.hutool.core.util.StrUtil; -import com.yomahub.liteflow.core.NodeComponent; -import com.yomahub.liteflow.slot.DefaultContext; -import com.yomahub.liteflow.slot.Slot; -import com.yomahub.liteflow.test.executor.CustomContext; -import org.springframework.stereotype.Component; - -@Component("c") -public class CCmp extends NodeComponent { - - @Override - public void process() { - Object bean = this.getFirstContextBean(); - if(bean instanceof CustomContext) { - Slot slot = this.getSlot(); - CustomContext context = slot.getFirstContextBean(); - String str = slot.getRequestData(); - if(StrUtil.isNotBlank(str) && str.equals("test0")) { - context.setName("custom"); - } - if(StrUtil.isNotBlank(str) && str.equals("test1")) { - context.setName("custom"); - throw new RuntimeException("customException"); - } - } - System.out.println("CCmp executed!"); - } - -} diff --git a/liteflow-testcase-old/liteflow-testcase-springnative/src/test/resources/executor/flow.json b/liteflow-testcase-old/liteflow-testcase-springnative/src/test/resources/executor/flow.json deleted file mode 100644 index 300679405..000000000 --- a/liteflow-testcase-old/liteflow-testcase-springnative/src/test/resources/executor/flow.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "flow": { - "nodes": { - "node": [ - { - "id": "a", - "class": "com.yomahub.liteflow.test.executor.cmp.ACmp" - }, - { - "id": "b", - "class": "com.yomahub.liteflow.test.executor.cmp.BCmp" - }, - { - "id": "c", - "class": "com.yomahub.liteflow.test.executor.cmp.CCmp" - } - ] - }, - "chain": [ - { - "name": "chain1", - "condition": [ - {"type": "then", "value": "a,b,c"} - ] - } - ] - } -} \ No newline at end of file