mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-15 12:32:09 +08:00
feature #I5M34O 支持在流程执行前就传入一个初始化好的context对象的特性
This commit is contained in:
@@ -51,4 +51,18 @@ public class MultiContextELSpringbootTest extends BaseTest {
|
||||
DefaultContext context = response.getContextBean(DefaultContext.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPassInitializedContextBean() throws Exception{
|
||||
OrderContext orderContext = new OrderContext();
|
||||
orderContext.setOrderNo("SO11223344");
|
||||
CheckContext checkContext = new CheckContext();
|
||||
checkContext.setSign("987654321d");
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain2", null, orderContext, checkContext);
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
OrderContext context1 = response.getContextBean(OrderContext.class);
|
||||
CheckContext context2 = response.getContextBean(CheckContext.class);
|
||||
Assert.assertEquals("SO11223344", context1.getOrderNo());
|
||||
Assert.assertEquals("987654321d", context2.getSign());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.test.multiContext.cmp;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.test.multiContext.CheckContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("e")
|
||||
public class ECmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.test.multiContext.cmp;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("f")
|
||||
public class FCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,8 @@
|
||||
<chain name="chain1">
|
||||
THEN(a, b, WHEN(c, d));
|
||||
</chain>
|
||||
|
||||
<chain name="chain2">
|
||||
THEN(e, f);
|
||||
</chain>
|
||||
</flow>
|
||||
Reference in New Issue
Block a user