LiteflowResponse增加获取步骤的方法,屏蔽Slot

This commit is contained in:
bryan31
2022-05-28 23:51:34 +08:00
parent 084d84b48a
commit b7465779d6
83 changed files with 183 additions and 157 deletions

View File

@@ -41,7 +41,7 @@ public class AsyncNodeSpringbootTest extends BaseTest {
public void testAsyncFlow1() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "it's a base request");
Assert.assertTrue(response.isSuccess());
System.out.println(response.getSlot().getExecuteStepStr());
System.out.println(response.getExecuteStepStr());
}
//这个和test1有点类似只不过进一步验证了步骤
@@ -51,7 +51,7 @@ public class AsyncNodeSpringbootTest extends BaseTest {
Assert.assertTrue(ListUtil.toList("b==>j==>g==>f==>h","b==>j==>g==>h==>f",
"b==>j==>h==>g==>f","b==>j==>h==>f==>g",
"b==>j==>f==>h==>g","b==>j==>f==>g==>h"
).contains(response.getSlot().getExecuteStepStr()));
).contains(response.getExecuteStepStr()));
}
//测试errorResume,默认的errorResume为false这里测试默认的

View File

@@ -91,7 +91,7 @@ public class BuilderSpringbootTest1 extends BaseTest {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a[组件A]==>b[组件B]==>e[组件E]==>c[组件C]==>d[组件D]", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a[组件A]==>b[组件B]==>e[组件E]==>c[组件C]==>d[组件D]", response.getExecuteStepStr());
}
//基于普通组件的builder模式测试
@@ -149,7 +149,7 @@ public class BuilderSpringbootTest1 extends BaseTest {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a[组件A]==>b[组件B]==>e[组件E]==>c[组件C]==>d[组件D]", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a[组件A]==>b[组件B]==>e[组件E]==>c[组件C]==>d[组件D]", response.getExecuteStepStr());
}
@@ -218,6 +218,6 @@ public class BuilderSpringbootTest1 extends BaseTest {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a[组件A]==>b[组件B]==>e[组件E]==>c[组件C]==>d[组件D]", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a[组件A]==>b[组件B]==>e[组件E]==>c[组件C]==>d[组件D]", response.getExecuteStepStr());
}
}

View File

@@ -36,6 +36,6 @@ public class BuilderSpringbootTest2 extends BaseTest {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("h==>i==>j", response.getSlot().getExecuteStepStr());
Assert.assertEquals("h==>i==>j", response.getExecuteStepStr());
}
}

View File

@@ -36,7 +36,7 @@ public class LiteflowRetrySpringbootTest extends BaseTest {
public void testRetry1() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>b==>b", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>b==>b==>b", response.getExecuteStepStr());
}
//单个组件重试配置测试
@@ -44,7 +44,7 @@ public class LiteflowRetrySpringbootTest extends BaseTest {
public void testRetry2() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain2", "arg");
Assert.assertFalse(response.isSuccess());
Assert.assertEquals("c==>c==>c==>c==>c==>c", response.getSlot().getExecuteStepStr());
Assert.assertEquals("c==>c==>c==>c==>c==>c", response.getExecuteStepStr());
}
//单个组件指定异常,但抛出的并不是指定异常的场景测试
@@ -59,6 +59,6 @@ public class LiteflowRetrySpringbootTest extends BaseTest {
public void testRetry4() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain4", "arg");
Assert.assertFalse(response.isSuccess());
Assert.assertEquals("e==>e==>e==>e==>e==>e", response.getSlot().getExecuteStepStr());
Assert.assertEquals("e==>e==>e==>e==>e==>e", response.getExecuteStepStr());
}
}

View File

@@ -65,7 +65,7 @@ public class FlowExecutorSpringbootTest extends BaseTest {
public void testIsEnd() throws Exception {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain4", 10);
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("d",response.getSlot().getExecuteStepStr());
Assert.assertEquals("d",response.getExecuteStepStr());
}
//setIsEnd方法的功能点测试
@@ -73,7 +73,7 @@ public class FlowExecutorSpringbootTest extends BaseTest {
public void testSetIsEnd1() throws Exception {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain5", 10);
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("e",response.getSlot().getExecuteStepStr());
Assert.assertEquals("e",response.getExecuteStepStr());
}
//条件组件的功能点测试
@@ -88,7 +88,7 @@ public class FlowExecutorSpringbootTest extends BaseTest {
public void testSetIsEnd2() throws Exception {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain7", 10);
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("g",response.getSlot().getExecuteStepStr());
Assert.assertEquals("g",response.getExecuteStepStr());
}
}

View File

@@ -33,9 +33,9 @@ public class LiteflowConfigSpringbootTest2 extends BaseTest {
@Test
public void testRuleSourceMatch() {
LiteflowResponse<DefaultContext> response0 = flowExecutor.execute2Resp("chain1", "arg");
Assert.assertEquals("a==>b==>c", response0.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>b==>c", response0.getExecuteStepStr());
LiteflowResponse<DefaultContext> response1 = flowExecutor.execute2Resp("chain2", "arg");
Assert.assertEquals("a==>c==>b==>d", response1.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>c==>b==>d", response1.getExecuteStepStr());
}
}

View File

@@ -33,6 +33,6 @@ public class FlowMetaSpringbootTest extends BaseTest {
FlowBus.addCommonNode("d", "d组件", DCmp.class);
LiteflowResponse<DefaultContext> response= flowExecutor.execute2Resp("chain1", "it's a request");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>c==>d[d组件]", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>b==>c==>d[d组件]", response.getExecuteStepStr());
}
}

View File

@@ -34,6 +34,6 @@ public class LiteflowComponentSpringbootTest extends BaseTest {
public void testConfig() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a[A组件]==>b[B组件]==>c[C组件]==>b[B组件]==>a[A组件]==>d", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a[A组件]==>b[B组件]==>c[C组件]==>b[B组件]==>a[A组件]==>d", response.getExecuteStepStr());
}
}

View File

@@ -34,9 +34,9 @@ public class LiteflowMultipleTypeSpringbootTest extends BaseTest {
public void testMultipleType() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>c==>b==>a", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>b==>c==>b==>a", response.getExecuteStepStr());
response = flowExecutor.execute2Resp("chain3", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>c", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>b==>c", response.getExecuteStepStr());
}
}

View File

@@ -38,7 +38,7 @@ public class LiteflowNodeExecutorSpringbootTest extends BaseTest {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals(CustomerDefaultNodeExecutor.class, response.getContextBean().getData("customerDefaultNodeExecutor"));
Assert.assertEquals("a", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a", response.getExecuteStepStr());
}
//默认执行器测试+全局重试配置测试
@@ -47,7 +47,7 @@ public class LiteflowNodeExecutorSpringbootTest extends BaseTest {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain2", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals(CustomerDefaultNodeExecutor.class, response.getContextBean().getData("customerDefaultNodeExecutor"));
Assert.assertEquals("b==>b==>b", response.getSlot().getExecuteStepStr());
Assert.assertEquals("b==>b==>b", response.getExecuteStepStr());
}
//自定义执行器测试
@@ -55,7 +55,7 @@ public class LiteflowNodeExecutorSpringbootTest extends BaseTest {
public void testCustomerExecutor() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain3", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("c", response.getSlot().getExecuteStepStr());
Assert.assertEquals("c", response.getExecuteStepStr());
}
//自定义执行器测试+全局重试配置测试
@@ -64,6 +64,6 @@ public class LiteflowNodeExecutorSpringbootTest extends BaseTest {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain4", "arg");
Assert.assertFalse(response.isSuccess());
Assert.assertEquals(CustomerNodeExecutorAndCustomRetry.class, response.getContextBean().getData("retryLogic"));
Assert.assertEquals("d==>d==>d==>d==>d==>d", response.getSlot().getExecuteStepStr());
Assert.assertEquals("d==>d==>d==>d==>d==>d", response.getExecuteStepStr());
}
}

View File

@@ -35,7 +35,7 @@ public class PreAndFinallySpringbootTest extends BaseTest {
public void testPreAndFinally1() throws Exception{
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("p1==>p2==>a==>b==>c==>f1==>f2",response.getSlot().getExecuteStepStr());
Assert.assertEquals("p1==>p2==>a==>b==>c==>f1==>f2",response.getExecuteStepStr());
}
//测试pre和finally节点不放在开头和结尾的情况
@@ -43,7 +43,7 @@ public class PreAndFinallySpringbootTest extends BaseTest {
public void testPreAndFinally2() throws Exception{
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain2", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("p1==>p2==>a==>b==>c==>f1==>f2",response.getSlot().getExecuteStepStr());
Assert.assertEquals("p1==>p2==>a==>b==>c==>f1==>f2",response.getExecuteStepStr());
}
//测试有节点报错是否还执行finally节点的情况其中d节点会报错但依旧执行f1,f2节点
@@ -51,7 +51,7 @@ public class PreAndFinallySpringbootTest extends BaseTest {
public void testPreAndFinally3() throws Exception{
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain3", "arg");
Assert.assertFalse(response.isSuccess());
Assert.assertEquals("p1==>p2==>a==>d==>f1==>f2", response.getSlot().getExecuteStepStr());
Assert.assertEquals("p1==>p2==>a==>d==>f1==>f2", response.getExecuteStepStr());
}
//测试在finally节点里是否能获取exception

View File

@@ -39,7 +39,7 @@ public class ImplicitSubFlowSpringbootTest extends BaseTest {
public void testImplicitSubFlow() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain3", "it's a request");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("f==>g==>h==>m", response.getSlot().getExecuteStepStr());
Assert.assertEquals("f==>g==>h==>m", response.getExecuteStepStr());
// 传递了slotIndex则set的size==1
Assert.assertEquals(1, RUN_TIME_SLOT.size());

View File

@@ -38,7 +38,7 @@ public class SubflowInDifferentConfigSpringbootTest extends BaseTest {
public void testExplicitSubFlow1() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "it's a request");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>b==>a==>e==>d", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>b==>b==>a==>e==>d", response.getExecuteStepStr());
}
@Autowired

View File

@@ -35,6 +35,6 @@ public class SubflowJsonSpringBootTest extends BaseTest {
public void testExplicitSubFlow() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "it's a request");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr());
}
}

View File

@@ -35,6 +35,6 @@ public class SubflowXMLSpringBootTest extends BaseTest {
public void testExplicitSubFlow() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "it's a request");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr());
}
}

View File

@@ -35,6 +35,6 @@ public class SubflowYmlSpringBootTest extends BaseTest {
public void testExplicitSubFlowYml() {
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain1", "it's a request");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getExecuteStepStr());
}
}

View File

@@ -42,7 +42,7 @@ public class NodeTagSpringbootJsonTest extends BaseTest {
public void testTag2() throws Exception{
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain2", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>a==>a==>c==>e", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>a==>a==>c==>e", response.getExecuteStepStr());
}
//测试多线程when情况下的tag取值是否正确
@@ -62,6 +62,6 @@ public class NodeTagSpringbootJsonTest extends BaseTest {
public void testTag4() throws Exception{
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain4", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("g", response.getSlot().getExecuteStepStr());
Assert.assertEquals("g", response.getExecuteStepStr());
}
}

View File

@@ -42,7 +42,7 @@ public class NodeTagSpringbootXmlTest extends BaseTest {
public void testTag2() throws Exception{
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain2", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>a==>a==>c==>e", response.getSlot().getExecuteStepStr());
Assert.assertEquals("a==>a==>a==>c==>e", response.getExecuteStepStr());
}
//测试多线程when情况下的tag取值是否正确
@@ -62,6 +62,6 @@ public class NodeTagSpringbootXmlTest extends BaseTest {
public void testTag4() throws Exception{
LiteflowResponse<DefaultContext> response = flowExecutor.execute2Resp("chain4", "arg");
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("g", response.getSlot().getExecuteStepStr());
Assert.assertEquals("g", response.getExecuteStepStr());
}
}