mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-06-10 19:26:54 +08:00
support #I3CT01 帮liteflow增加单元测试
This commit is contained in:
@@ -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,从而执行了h,m
|
||||
@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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user