From c1942a0171603f6618e5a6fcd9409c389001b756 Mon Sep 17 00:00:00 2001 From: bryan31 Date: Fri, 3 Jun 2022 00:34:00 +0800 Subject: [PATCH] =?UTF-8?q?enhancement=20#I588BO=20=E5=AF=B9Slot=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E9=87=8D=E6=9E=84=EF=BC=8C=E5=9C=A8=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BD=BF=E7=94=A8=E4=B8=AD=E5=8E=BB=E9=99=A4Slot?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=9A=84=E6=A6=82=E5=BF=B5=EF=BC=8C=E5=BC=95?= =?UTF-8?q?=E5=85=A5=E4=B8=8A=E4=B8=8B=E6=96=87=E7=9A=84=E6=A6=82=E5=BF=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yomahub/liteflow/core/FlowExecutor.java | 10 +++++----- .../liteflow/test/executor/FlowExecutorTest.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) 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)