bug #IA5PAK ELBus串行编排不支持对每个节点进行超时配置

This commit is contained in:
everywhere.z
2024-07-01 16:33:17 +08:00
parent 3f808dee0c
commit a6f0835e54
3 changed files with 70 additions and 7 deletions

View File

@@ -1,22 +1,72 @@
package com.yomahub.liteflow.test.builder;
import com.yomahub.liteflow.builder.el.ELBus;
import com.yomahub.liteflow.builder.el.LiteFlowChainELBuilder;
import com.yomahub.liteflow.builder.el.NodeELWrapper;
import com.yomahub.liteflow.builder.el.*;
import com.yomahub.liteflow.test.BaseTest;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest(classes = MaxWaitSecondBuilderTest.class)
@EnableAutoConfiguration
public class MaxWaitSecondBuilderTest {
public class MaxWaitSecondBuilderTest extends BaseTest {
@BeforeAll
public static void init(){
ELBus.setNodeWrapper(false);
}
// node层面
@Test
public void testMaxWaitSecond1(){
NodeELWrapper nodeA = ELBus.node("a").maxWaitSeconds(4);
NodeELWrapper nodeB = ELBus.node("b").maxWaitSeconds(4);
System.out.println(ELBus.when(nodeA, nodeB).toEL(true));
WhenELWrapper whenELWrapper = ELBus.when(nodeA, nodeB);
Assertions.assertEquals("WHEN(a.maxWaitSeconds(4),b.maxWaitSeconds(4));", whenELWrapper.toEL());
}
// when层面
@Test
public void testMaxWaitSecond2(){
WhenELWrapper whenELWrapper = ELBus.when("a", "b").maxWaitSeconds(4);
Assertions.assertEquals("WHEN(a,b).maxWaitSeconds(4);", whenELWrapper.toEL());
ParELWrapper parELWrapper = ELBus.par("a", "b").maxWaitSeconds(4);
Assertions.assertEquals("PAR(a,b).maxWaitSeconds(4);", parELWrapper.toEL());
}
// then层面
@Test
public void testMaxWaitSecond3(){
ThenELWrapper thenELWrapper = ELBus.then("a", "b").maxWaitSeconds(4);
Assertions.assertEquals("THEN(a,b).maxWaitSeconds(4);", thenELWrapper.toEL());
SerELWrapper serELWrapper = ELBus.ser("a", "b").maxWaitSeconds(4);
Assertions.assertEquals("SER(a,b).maxWaitSeconds(4);", serELWrapper.toEL());
}
// if层面
@Test
public void testMaxWaitSecond4(){
IfELWrapper ifELWrapper = ELBus.ifOpt(ELBus.and("x1",ELBus.or("x2", "x3")), ELBus.then("a", "b"), ELBus.when("c", "d")).maxWaitSeconds(5);
Assertions.assertEquals("IF(AND(x1,OR(x2,x3)),THEN(a,b),WHEN(c,d)).maxWaitSeconds(5);", ifELWrapper.toEL());
}
// switch层面
@Test
public void testMaxWaitSecond5(){
SwitchELWrapper switchELWrapper = ELBus.switchOpt("a").to("b","c").maxWaitSeconds(5);
Assertions.assertEquals("SWITCH(a).TO(b,c).maxWaitSeconds(5);", switchELWrapper.toEL());
}
// 循环层面
@Test
public void testMaxWaitSecond6(){
ForELWrapper forELWrapper = ELBus.forOpt(3).doOpt("a").maxWaitSeconds(5);
Assertions.assertEquals("FOR(3).DO(a).maxWaitSeconds(5);", forELWrapper.toEL());
WhileELWrapper whileELWrapper = ELBus.whileOpt("w").doOpt("a").maxWaitSeconds(5);
Assertions.assertEquals("WHILE(w).DO(a).maxWaitSeconds(5);", whileELWrapper.toEL());
IteratorELWrapper iteratorELWrapper = ELBus.iteratorOpt("i").doOpt("a").maxWaitSeconds(5);
Assertions.assertEquals("ITERATOR(i).DO(a).maxWaitSeconds(5);", iteratorELWrapper.toEL());
}
}