mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
加入格式化代码插件,并提交格式化后的代码
This commit is contained in:
@@ -10,13 +10,14 @@ import org.junit.AfterClass;
|
||||
|
||||
public class BaseTest {
|
||||
|
||||
@AfterClass
|
||||
public static void cleanScanCache(){
|
||||
ComponentScanner.cleanCache();
|
||||
FlowBus.cleanCache();
|
||||
ExecutorHelper.loadInstance().clearExecutorServiceMap();
|
||||
SpiFactoryCleaner.clean();
|
||||
LiteflowConfigGetter.clean();
|
||||
FlowInitHook.cleanHook();
|
||||
}
|
||||
@AfterClass
|
||||
public static void cleanScanCache() {
|
||||
ComponentScanner.cleanCache();
|
||||
FlowBus.cleanCache();
|
||||
ExecutorHelper.loadInstance().clearExecutorServiceMap();
|
||||
SpiFactoryCleaner.clean();
|
||||
LiteflowConfigGetter.clean();
|
||||
FlowInitHook.cleanHook();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* 测试springboot下的python脚本组件,基于xml配置
|
||||
*
|
||||
* @author Bryan.Zhang
|
||||
* @since 2.9.5
|
||||
*/
|
||||
@@ -25,19 +25,20 @@ import javax.annotation.Resource;
|
||||
@TestPropertySource(value = "classpath:/common/application.properties")
|
||||
@SpringBootTest(classes = ScriptPythonCommonELTest.class)
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan({"com.yomahub.liteflow.test.script.python.common.cmp"})
|
||||
@ComponentScan({ "com.yomahub.liteflow.test.script.python.common.cmp" })
|
||||
public class ScriptPythonCommonELTest extends BaseTest {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
// 测试普通脚本节点
|
||||
@Test
|
||||
public void testCommon1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
|
||||
DefaultContext context = response.getFirstContextBean();
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
Assert.assertEquals(Integer.valueOf(30), context.getData("s1"));
|
||||
Assert.assertEquals("杰克", context.getData("name"));
|
||||
}
|
||||
|
||||
//测试普通脚本节点
|
||||
@Test
|
||||
public void testCommon1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
|
||||
DefaultContext context = response.getFirstContextBean();
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
Assert.assertEquals(Integer.valueOf(30), context.getData("s1"));
|
||||
Assert.assertEquals("杰克", context.getData("name"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,5 @@ public class ACmp extends NodeComponent {
|
||||
public void process() {
|
||||
System.out.println("ACmp executed!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class DCmp extends NodeComponent {
|
||||
@Override
|
||||
public void process() {
|
||||
DefaultContext context = this.getFirstContextBean();
|
||||
context.setData("count",198);
|
||||
context.setData("count", 198);
|
||||
System.out.println("DCmp executed!");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,35 +21,38 @@ import javax.annotation.Resource;
|
||||
@TestPropertySource(value = "classpath:/contextbean/application.properties")
|
||||
@SpringBootTest(classes = LiteFlowScriptContextbeanPythonTest.class)
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan({"com.yomahub.liteflow.test.script.python.contextbean.cmp","com.yomahub.liteflow.test.script.python.contextbean.bean"})
|
||||
@ComponentScan({ "com.yomahub.liteflow.test.script.python.contextbean.cmp",
|
||||
"com.yomahub.liteflow.test.script.python.contextbean.bean" })
|
||||
public class LiteFlowScriptContextbeanPythonTest extends BaseTest {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Test
|
||||
public void testContextBean1() throws Exception{
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg", OrderContext.class, CheckContext.class, Order2Context.class);
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
OrderContext orderContext = response.getContextBean(OrderContext.class);
|
||||
CheckContext checkContext = response.getContextBean(CheckContext.class);
|
||||
Order2Context order2Context = response.getContextBean(Order2Context.class);
|
||||
Assert.assertEquals(30, orderContext.getOrderType());
|
||||
Assert.assertEquals("d", checkContext.getSign());
|
||||
Assert.assertEquals("order2", order2Context.getOrderNo());
|
||||
}
|
||||
@Test
|
||||
public void testContextBean1() throws Exception {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg", OrderContext.class, CheckContext.class,
|
||||
Order2Context.class);
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
OrderContext orderContext = response.getContextBean(OrderContext.class);
|
||||
CheckContext checkContext = response.getContextBean(CheckContext.class);
|
||||
Order2Context order2Context = response.getContextBean(Order2Context.class);
|
||||
Assert.assertEquals(30, orderContext.getOrderType());
|
||||
Assert.assertEquals("d", checkContext.getSign());
|
||||
Assert.assertEquals("order2", order2Context.getOrderNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContextBean2() throws Exception{
|
||||
OrderContext orderContext = new OrderContext();
|
||||
orderContext.setOrderNo("order1");
|
||||
CheckContext checkContext = new CheckContext();
|
||||
checkContext.setSign("sign1");
|
||||
Order2Context orderContext2 = new Order2Context();
|
||||
orderContext2.setOrderNo("order2");
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain2", null, orderContext, checkContext, orderContext2);
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
@Test
|
||||
public void testContextBean2() throws Exception {
|
||||
OrderContext orderContext = new OrderContext();
|
||||
orderContext.setOrderNo("order1");
|
||||
CheckContext checkContext = new CheckContext();
|
||||
checkContext.setSign("sign1");
|
||||
Order2Context orderContext2 = new Order2Context();
|
||||
orderContext2.setOrderNo("order2");
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain2", null, orderContext, checkContext,
|
||||
orderContext2);
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,23 +5,24 @@ import com.yomahub.liteflow.context.ContextBean;
|
||||
@ContextBean
|
||||
public class CheckContext {
|
||||
|
||||
private String sign;
|
||||
private String sign;
|
||||
|
||||
private int randomId;
|
||||
private int randomId;
|
||||
|
||||
public String getSign() {
|
||||
return sign;
|
||||
}
|
||||
public String getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(String sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
public void setSign(String sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public int getRandomId() {
|
||||
return randomId;
|
||||
}
|
||||
public int getRandomId() {
|
||||
return randomId;
|
||||
}
|
||||
|
||||
public void setRandomId(int randomId) {
|
||||
this.randomId = randomId;
|
||||
}
|
||||
|
||||
public void setRandomId(int randomId) {
|
||||
this.randomId = randomId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,33 +4,34 @@ import java.util.Date;
|
||||
|
||||
public class Order2Context {
|
||||
|
||||
private String orderNo;
|
||||
private String orderNo;
|
||||
|
||||
private int orderType;
|
||||
private int orderType;
|
||||
|
||||
private Date createTime;
|
||||
private Date createTime;
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public int getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
public int getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
|
||||
public void setOrderType(int orderType) {
|
||||
this.orderType = orderType;
|
||||
}
|
||||
public void setOrderType(int orderType) {
|
||||
this.orderType = orderType;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,33 +7,34 @@ import java.util.Date;
|
||||
@ContextBean("order")
|
||||
public class OrderContext {
|
||||
|
||||
private String orderNo;
|
||||
private String orderNo;
|
||||
|
||||
private int orderType;
|
||||
private int orderType;
|
||||
|
||||
private Date createTime;
|
||||
private Date createTime;
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public int getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
public int getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
|
||||
public void setOrderType(int orderType) {
|
||||
this.orderType = orderType;
|
||||
}
|
||||
public void setOrderType(int orderType) {
|
||||
this.orderType = orderType;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,5 @@ public class ACmp extends NodeComponent {
|
||||
public void process() {
|
||||
System.out.println("ACmp executed!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user