|
@@ -38,14 +38,14 @@ public class AsyncNodeSpringbootTest extends BaseTest {
|
|
|
* 验证了默认参数情况下 when可以加载执行
|
|
|
* **/
|
|
|
@Test
|
|
|
- public void testBaseConditionFlow1() {
|
|
|
+ public void testAsyncFlow1() {
|
|
|
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain1", "it's a base request");
|
|
|
Assert.assertTrue(response.isSuccess());
|
|
|
System.out.println(response.getSlot().printStep());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testBaseConditionFlow2() {
|
|
|
+ public void testAsyncFlow2() {
|
|
|
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain2", "it's a base request");
|
|
|
Assert.assertTrue(ListUtil.toList("b==>j==>g==>f==>h","b==>j==>g==>h==>f",
|
|
|
"b==>j==>h==>g==>f","b==>j==>h==>f==>g",
|
|
@@ -55,7 +55,7 @@ public class AsyncNodeSpringbootTest extends BaseTest {
|
|
|
|
|
|
//相同group的并行组,会合并,并且errorResume根据第一个when来,这里第一个when配置了不抛错
|
|
|
@Test
|
|
|
- public void testBaseErrorResumeConditionFlow4() {
|
|
|
+ public void testAsyncFlow4() {
|
|
|
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain4", "it's a base request");
|
|
|
//因为不记录错误,所以最终结果是true
|
|
|
Assert.assertTrue(response.isSuccess());
|
|
@@ -68,7 +68,7 @@ public class AsyncNodeSpringbootTest extends BaseTest {
|
|
|
|
|
|
//相同group的并行组,会合并,并且errorResume根据第一个when来,这里第一个when配置了会抛错
|
|
|
@Test
|
|
|
- public void testBaseErrorResumeConditionFlow5() throws Exception {
|
|
|
+ public void testAsyncFlow5() throws Exception {
|
|
|
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain5", "it's a base request");
|
|
|
//整个并行组是报错的,所以最终结果是false
|
|
|
Assert.assertFalse(response.isSuccess());
|
|
@@ -81,7 +81,7 @@ public class AsyncNodeSpringbootTest extends BaseTest {
|
|
|
|
|
|
//不同group的并行组,不会合并,第一个when的errorResume是false,会抛错,那第二个when就不会执行
|
|
|
@Test
|
|
|
- public void testBaseErrorResumeConditionFlow6() throws Exception {
|
|
|
+ public void testAsyncFlow6() throws Exception {
|
|
|
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain6", "it's a base request");
|
|
|
//第一个when会抛错,所以最终结果是false
|
|
|
Assert.assertFalse(response.isSuccess());
|
|
@@ -94,7 +94,7 @@ public class AsyncNodeSpringbootTest extends BaseTest {
|
|
|
|
|
|
//不同group的并行组,不会合并,第一个when的errorResume是true,不会报错,那第二个when还会继续执行,但是第二个when的errorResume是false,所以第二个when会报错
|
|
|
@Test
|
|
|
- public void testBaseErrorResumeConditionFlow7() throws Exception {
|
|
|
+ public void testAsyncFlow7() throws Exception {
|
|
|
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain7", "it's a base request");
|
|
|
//第二个when会抛错,所以最终结果是false
|
|
|
Assert.assertFalse(response.isSuccess());
|
|
@@ -104,4 +104,13 @@ public class AsyncNodeSpringbootTest extends BaseTest {
|
|
|
//第一个when会报错,所以最终response的cause里应该会有TestException
|
|
|
Assert.assertEquals(TestException.class, response.getCause().getClass());
|
|
|
}
|
|
|
+
|
|
|
+ //d g h并行,配置了any=true,其中d耗时3秒,g耗时1秒,其他都不设耗时
|
|
|
+ //最终执行效果应该是h先返回,然后执行abc,最后gd
|
|
|
+ //这里要注意的是,由于step是先加入,所以step的打印顺序并不是这样的。但是实际执行是正确的
|
|
|
+ @Test
|
|
|
+ public void testAsyncFlow8() throws Exception {
|
|
|
+ LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain8", "it's a base request");
|
|
|
+ Assert.assertTrue(response.isSuccess());
|
|
|
+ }
|
|
|
}
|