support #I3CT01 帮liteflow增加单元测试

This commit is contained in:
徐佳
2021-04-06 18:17:56 +08:00
parent f78af82539
commit b21d1bb215
7 changed files with 13 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ package com.yomahub.liteflow.test.subflow;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.entity.data.LiteflowResponse;
import com.yomahub.liteflow.entity.data.Slot;
import com.yomahub.liteflow.test.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -27,11 +28,11 @@ import java.util.Set;
@SpringBootTest(classes = ImplicitSubFlowTest.class)
@EnableAutoConfiguration
@ComponentScan({"com.yomahub.liteflow.test.subflow.cmp2"})
public class ImplicitSubFlowTest {
public class ImplicitSubFlowTest extends BaseTest {
@Resource
private FlowExecutor flowExecutor;
public static final Set<Integer> RUN_TIME_SLOT = new HashSet<>();
public static final Set<String> RUN_TIME_SLOT = new HashSet<>();
//这里GCmp中隐式的调用chain4从而执行了hm
@Test
@@ -42,5 +43,7 @@ public class ImplicitSubFlowTest {
// 传递了slotIndex则set的size==1
Assert.assertEquals(1, RUN_TIME_SLOT.size());
// set中第一次设置的requestId和response中的requestId一致
Assert.assertTrue(RUN_TIME_SLOT.contains(response.getData().getRequestId()));
}
}

View File

@@ -3,6 +3,7 @@ package com.yomahub.liteflow.test.subflow;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.entity.data.LiteflowResponse;
import com.yomahub.liteflow.entity.data.Slot;
import com.yomahub.liteflow.test.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -25,7 +26,7 @@ import javax.annotation.Resource;
@SpringBootTest(classes = SubflowXMLSpringBootTest.class)
@EnableAutoConfiguration
@ComponentScan({"com.yomahub.liteflow.test.subflow.cmp1"})
public class SubflowXMLSpringBootTest {
public class SubflowXMLSpringBootTest extends BaseTest {
@Resource
private FlowExecutor flowExecutor;

View File

@@ -3,7 +3,7 @@ package com.yomahub.liteflow.test.subflow;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.entity.data.LiteflowResponse;
import com.yomahub.liteflow.entity.data.Slot;
import com.yomahub.liteflow.test.parser.LFParserXmlSpringbootTest;
import com.yomahub.liteflow.test.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -26,7 +26,7 @@ import javax.annotation.Resource;
@SpringBootTest(classes = SubflowYmlSpringBootTest.class)
@EnableAutoConfiguration
@ComponentScan({"com.yomahub.liteflow.test.subflow.cmp1"})
public class SubflowYmlSpringBootTest {
public class SubflowYmlSpringBootTest extends BaseTest {
@Resource
private FlowExecutor flowExecutor;
@@ -37,6 +37,4 @@ public class SubflowYmlSpringBootTest {
Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>c==>b==>a==>e==>d", response.getData().printStep());
}
}

View File

@@ -11,7 +11,7 @@ public class FCmp extends NodeComponent {
@Override
public void process() throws Exception {
RUN_TIME_SLOT.add(this.getSlotIndex());
RUN_TIME_SLOT.add(this.getSlot().getRequestId());
System.out.println("Fcomp executed!");
}

View File

@@ -19,7 +19,7 @@ public class GCmp extends NodeComponent {
@Override
public void process() throws Exception {
RUN_TIME_SLOT.add(this.getSlotIndex());
RUN_TIME_SLOT.add(this.getSlot().getRequestId());
System.out.println("Gcomp executed!");

View File

@@ -11,7 +11,7 @@ public class HCmp extends NodeComponent {
@Override
public void process() throws Exception {
RUN_TIME_SLOT.add(this.getSlotIndex());
RUN_TIME_SLOT.add(this.getSlot().getRequestId());
System.out.println("Hcomp executed!");
}

View File

@@ -11,7 +11,7 @@ public class MCmp extends NodeComponent {
@Override
public void process() throws Exception {
RUN_TIME_SLOT.add(this.getSlotIndex());
RUN_TIME_SLOT.add(this.getSlot().getRequestId());
System.out.println("Mcomp executed!");
}