test #I7SVZF 添加XML中Chain的测试用例

This commit is contained in:
zy
2023-09-18 21:11:07 +08:00
parent e55dbb42e1
commit d72fb33a81
11 changed files with 163 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
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;
/**
* springboot环境EL常规的例子测试
*
* @author Bryan.Zhang
*/
@TestPropertySource(value = "classpath:/abstractChain/application.properties")
@SpringBootTest(classes = AbstractChainELSpringbootTest.class)
@EnableAutoConfiguration
@ComponentScan({ "com.yomahub.liteflow.test.abstractChain.cmp" })
public class AbstractChainELSpringbootTest 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());
}
}

View File

@@ -0,0 +1,14 @@
package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeComponent;
import org.springframework.stereotype.Component;
@Component("a")
public class ACmp extends NodeComponent {
@Override
public void process() {
System.out.println("ACmp executed!");
}
}

View File

@@ -0,0 +1,16 @@
package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeComponent;
import org.springframework.stereotype.Component;
@Component("b")
public class BCmp extends NodeComponent {
@Override
public void process() {
System.out.println("BCmp executed!");
}
}

View File

@@ -0,0 +1,15 @@
package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeIfComponent;
import org.springframework.stereotype.Component;
@Component("c")
public class CCmp extends NodeIfComponent {
@Override
public boolean processIf() throws Exception {
//do your biz
return true;
}
}

View File

@@ -0,0 +1,14 @@
package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeComponent;
import org.springframework.stereotype.Component;
@Component("d")
public class DCmp extends NodeComponent {
@Override
public void process() {
System.out.println("DCmp executed!");
}
}

View File

@@ -0,0 +1,14 @@
package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeComponent;
import org.springframework.stereotype.Component;
@Component("e")
public class ECmp extends NodeComponent {
@Override
public void process() {
System.out.println("ECmp executed!");
}
}

View File

@@ -0,0 +1,14 @@
package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeSwitchComponent;
import org.springframework.stereotype.Component;
@Component("f")
public class FSwitchCmp extends NodeSwitchComponent {
@Override
public String processSwitch() throws Exception {
return "j";
}
}

View File

@@ -0,0 +1,14 @@
package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeComponent;
import org.springframework.stereotype.Component;
@Component("j")
public class JCmp extends NodeComponent {
@Override
public void process() {
System.out.println("JCmp executed!");
}
}

View File

@@ -0,0 +1,14 @@
package com.yomahub.liteflow.test.abstractChain.cmp;
import com.yomahub.liteflow.core.NodeComponent;
import org.springframework.stereotype.Component;
@Component("k")
public class KCmp extends NodeComponent {
@Override
public void process() {
System.out.println("KCmp executed!");
}
}

View File

@@ -0,0 +1 @@
liteflow.rule-source=abstractChain/flow.el.xml

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<chain abstract="true" id="base">
THEN(a, b, {0}, {1})
</chain>
<chain id="implA" extends="base">
{0}=IF(c, d, e);
{1}=SWITCH(f).to(j,k);
</chain>
</flow>