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 9aa03992b..7578a18f2 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 @@ -280,25 +280,25 @@ public class FlowExecutor { node.execute(slotIndex); } - public Slot execute(String chainId) throws Exception { + public DefaultContext execute(String chainId) throws Exception { return this.execute(chainId, null, DefaultContext.class, null, false); } - public Slot execute(String chainId, Object param) throws Exception { + public DefaultContext execute(String chainId, Object param) throws Exception { return this.execute(chainId, param, DefaultContext.class, null, false); } - public Slot execute(String chainId, Object param, Class contextBeanClazz) throws Exception { + public T execute(String chainId, Object param, Class contextBeanClazz) throws Exception { return this.execute(chainId, param, contextBeanClazz, null, false); } - public Slot execute(String chainId, Object param, Class contextBeanClazz, + public T execute(String chainId, Object param, Class contextBeanClazz, Integer slotIndex, boolean isInnerChain) throws Exception { Slot slot = this.doExecute(chainId, param, contextBeanClazz, slotIndex, isInnerChain); if (ObjectUtil.isNotNull(slot.getException())) { throw slot.getException(); } else { - return slot; + return slot.getContextBean(); } } 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 ec613669a..01cd56364 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 @@ -42,8 +42,8 @@ public class FlowExecutorTest extends BaseTest { LiteflowConfig config = new LiteflowConfig(); config.setRuleSource("executor/flow.json"); FlowExecutor executor = new FlowExecutor(config); - Slot slot = executor.execute("chain1", "test0", CustomContext.class); - Assert.assertEquals("custom", slot.getContextBean().getName()); + CustomContext context = executor.execute("chain1", "test0", CustomContext.class); + Assert.assertEquals("custom", context.getName()); } @Test(expected=RuntimeException.class)