bug #I4XRBA 关于when和then混合使用时(有any和isAccess的情况下),then的节点先执行的问题

This commit is contained in:
bryan31
2022-06-05 15:40:23 +08:00
parent 84ce849a61
commit 8b7a40e4b6
20 changed files with 192 additions and 15 deletions

View File

@@ -16,9 +16,9 @@ import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
/**
* springboot环境最普通的例子测试
* springboot环境step的测试例子
* @author Bryan.Zhang
* @since 2.6.4
* @since 2.7.0
*/
@RunWith(SpringRunner.class)
@TestPropertySource(value = "classpath:/cmpStep/application.properties")
@@ -33,7 +33,7 @@ public class CmpStepSpringbootTest extends BaseTest {
//ab串行
//cd并行都抛错,其中c耗时2秒
@Test
public void testStep() throws Exception{
public void testStep1() throws Exception{
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "arg");
Assert.assertFalse(response.isSuccess());
Assert.assertTrue(response.getExecuteSteps().get("a").isSuccess());
@@ -45,4 +45,11 @@ public class CmpStepSpringbootTest extends BaseTest {
Assert.assertEquals(RuntimeException.class, response.getExecuteSteps().get("d").getException().getClass());
}
@Test
public void testStep2() throws Exception{
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain2", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b", response.getExecuteStepStrWithoutTime());
}
}

View File

@@ -14,7 +14,8 @@ import org.springframework.stereotype.Component;
public class ACmp extends NodeComponent {
@Override
public void process() {
public void process() throws Exception{
Thread.sleep(5000L);
System.out.println("ACmp executed!");
}
}

View File

@@ -0,0 +1,25 @@
/**
* <p>Title: liteflow</p>
* <p>Description: 轻量级的组件式流程框架</p>
* @author Bryan.Zhang
* @email weenyc31@163.com
* @Date 2020/4/1
*/
package com.yomahub.liteflow.test.cmpStep.cmp;
import com.yomahub.liteflow.core.NodeComponent;
import org.springframework.stereotype.Component;
@Component("e")
public class ECmp extends NodeComponent {
@Override
public void process() {
System.out.println("ECmp executed!");
}
@Override
public boolean isAccess() {
return false;
}
}

View File

@@ -4,4 +4,9 @@
<then value="a,b"/>
<when value="c,d"/>
</chain>
<chain name="chain2">
<when value="e,a" any="true"/>
<then value="b"/>
</chain>
</flow>