feature #I5M34O 支持在流程执行前就传入一个初始化好的context对象的特性

This commit is contained in:
everywhere.z
2022-08-16 09:20:41 +01:00
parent efc2d4beec
commit cc7af44d45
4 changed files with 57 additions and 0 deletions

View File

@@ -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());
}
}

View File

@@ -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() {
}
}

View File

@@ -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() {
}
}

View File

@@ -3,4 +3,8 @@
<chain name="chain1">
THEN(a, b, WHEN(c, d));
</chain>
<chain name="chain2">
THEN(e, f);
</chain>
</flow>