mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
test #I7SVZF 补全springboot下抽象chain解析相关测试用例
This commit is contained in:
@@ -28,10 +28,26 @@ public class AbstractChainJsonELSpringBootTest extends BaseTest {
|
||||
|
||||
// 是否按照流程定义配置执行
|
||||
@Test
|
||||
public void testExplicitSubFlow() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("implA", "it's a request");
|
||||
public void test1() throws Exception {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("implA", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>b==>c==>d==>f==>j", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
//测试嵌套继承的baseChain是否重复解析
|
||||
@Test
|
||||
public void test2() throws Exception {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("implB", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>b==>a==>b==>a==>b==>f==>j", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
//测试嵌套继承的baseChain是否重复解析
|
||||
@Test
|
||||
public void test3() throws Exception {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("implC", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>b==>a==>b==>a==>b==>f==>a==>b", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ import javax.annotation.Resource;
|
||||
* @author Bryan.Zhang
|
||||
*/
|
||||
@TestPropertySource(value = "classpath:/abstractChain/application.properties")
|
||||
@SpringBootTest(classes = AbstractChainXMLELSpringbootTest.class)
|
||||
@SpringBootTest(classes = AbstractChainXmlELSpringbootTest.class)
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan({ "com.yomahub.liteflow.test.abstractChain.cmp" })
|
||||
public class AbstractChainXMLELSpringbootTest extends BaseTest {
|
||||
public class AbstractChainXmlELSpringbootTest extends BaseTest {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.yomahub.liteflow.test.abstractChain;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||
import com.yomahub.liteflow.test.BaseTest;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 测试显示调用子流程(yml) 单元测试
|
||||
*
|
||||
* @author justin.xu
|
||||
*/
|
||||
@TestPropertySource(value = "classpath:/abstractChain/application-yml.properties")
|
||||
@SpringBootTest(classes = AbstractChainYmlELSpringBootTest.class)
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan({ "com.yomahub.liteflow.test.abstractChain.cmp" })
|
||||
public class AbstractChainYmlELSpringBootTest extends BaseTest {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
// 是否按照流程定义配置执行
|
||||
// XML文件基本继承测试
|
||||
@Test
|
||||
public void test1() throws Exception {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("implA", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>b==>c==>d==>f==>j", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
//测试嵌套继承的baseChain是否重复解析
|
||||
@Test
|
||||
public void test2() throws Exception {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("implB", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>b==>a==>b==>a==>b==>f==>j", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
//测试嵌套继承的baseChain是否重复解析
|
||||
@Test
|
||||
public void test3() throws Exception {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("implC", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("a==>b==>a==>b==>a==>b==>f==>a==>b", response.getExecuteStepStrWithoutTime());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
liteflow.rule-source=abstractChain/flow.el.yml
|
||||
@@ -2,14 +2,30 @@
|
||||
"flow": {
|
||||
"chain": [
|
||||
{
|
||||
"name": "base",
|
||||
"id": "implB",
|
||||
"extends": "base2",
|
||||
"value": "{3}=THEN(a,b);\n {4}=j;"
|
||||
},
|
||||
{
|
||||
"id": "implC",
|
||||
"extends": "base2",
|
||||
"value": "{3}=THEN(a,b);\n {4}=THEN(a,b).id(\"j\");"
|
||||
},
|
||||
{
|
||||
"id": "base",
|
||||
"abstract": true,
|
||||
"value": "THEN(a, b, {0}, {1});"
|
||||
},
|
||||
{
|
||||
"name": "implA",
|
||||
"id": "implA",
|
||||
"extends": "base",
|
||||
"value": "{0}=IF(c, d, e);\n {1}=SWITCH(f).to(j,k);"
|
||||
},
|
||||
{
|
||||
"id": "base2",
|
||||
"extends": "base",
|
||||
"abstract": true,
|
||||
"value": "{0}=THEN(a,b,{3});\n {1}=SWITCH(f).to({4},k);"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
{4}=THEN(a,b).id("j");
|
||||
</chain>
|
||||
|
||||
<chain abstract="true" id="base">
|
||||
<chain abstract="true" name="base">
|
||||
THEN(a, b, {0}, {1})
|
||||
</chain>
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
flow:
|
||||
chain:
|
||||
- id: implB
|
||||
extends: base2
|
||||
value: "{3}=THEN(a,b);\n {4}=j;"
|
||||
- id: implC
|
||||
extends: base2
|
||||
value: "{3}=THEN(a,b);\n {4}=THEN(a,b).id(\"j\");"
|
||||
- id: base
|
||||
abstract: true
|
||||
value: "THEN(a, b, {0}, {1});"
|
||||
- id: implA
|
||||
extends: base
|
||||
value: "{0}=IF(c, d, e);\n {1}=SWITCH(f).to(j,k);"
|
||||
- id: base2
|
||||
extends: base
|
||||
abstract: true
|
||||
value: "{0}=THEN(a,b,{3});\n {1}=SWITCH(f).to({4},k);"
|
||||
Reference in New Issue
Block a user