mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
优化测试用例
This commit is contained in:
@@ -13,6 +13,12 @@
|
||||
"name": "条件脚本",
|
||||
"type": "cond_script",
|
||||
"value": "count = slot.getData(\"count\");if(count > 100){return \"a\";}else{return \"b\";}"
|
||||
},
|
||||
{
|
||||
"id": "s3",
|
||||
"name": "普通脚本2",
|
||||
"type": "script",
|
||||
"value": "def a=30;def b=2;slot.setData(\"s1\",a*b);"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<nodes>
|
||||
<node id="s1" name="普通脚本" type="script">
|
||||
<node id="s1" name="普通脚本1" type="script">
|
||||
<![CDATA[
|
||||
def a=3;
|
||||
def b=2;
|
||||
@@ -19,6 +19,15 @@
|
||||
}
|
||||
]]>
|
||||
</node>
|
||||
|
||||
<!-- 定义s3的目的是验证在多个脚本节点同时存在情况下的运行情况是否正确,本身s3不会被引用到 -->
|
||||
<node id="s3" name="普通脚本2" type="script">
|
||||
<![CDATA[
|
||||
def a=30;
|
||||
def b=2;
|
||||
slot.setData("s1",a*b);
|
||||
]]>
|
||||
</node>
|
||||
</nodes>
|
||||
|
||||
<chain name="chain1">
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
"name": "条件脚本",
|
||||
"type": "cond_script",
|
||||
"value": "count = slot.getData(\"count\");if(count > 100){return \"a\";}else{return \"b\";}"
|
||||
},
|
||||
{
|
||||
"id": "s3",
|
||||
"name": "普通脚本2",
|
||||
"type": "script",
|
||||
"value": "a=30;b=2;slot.setData(\"s1\",a*b);"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -19,6 +19,15 @@
|
||||
}
|
||||
]]>
|
||||
</node>
|
||||
|
||||
<!-- 定义s3的目的是验证在多个脚本节点同时存在情况下的运行情况是否正确,本身s3不会被引用到 -->
|
||||
<node id="s3" name="普通脚本2" type="script">
|
||||
<![CDATA[
|
||||
a=30;
|
||||
b=2;
|
||||
slot.setData("s1",a*b);
|
||||
]]>
|
||||
</node>
|
||||
</nodes>
|
||||
|
||||
<chain name="chain1">
|
||||
|
||||
@@ -26,6 +26,7 @@ import javax.annotation.Resource;
|
||||
@TestPropertySource(value = "classpath:/customNodes/application.properties")
|
||||
@SpringBootTest(classes = CustomNodesSpringbootTest.class)
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan({"com.yomahub.liteflow.test.customNodes.domain"})
|
||||
public class CustomNodesSpringbootTest extends BaseTest {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@@ -10,7 +10,6 @@ package com.yomahub.liteflow.test.customNodes.cmp;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("a")
|
||||
public class ACmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,13 +8,20 @@
|
||||
package com.yomahub.liteflow.test.customNodes.cmp;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.test.customNodes.domain.DemoDomain;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("b")
|
||||
import javax.annotation.Resource;
|
||||
|
||||
public class BCmp extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private DemoDomain demoDomain;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
demoDomain.sayHi();
|
||||
System.out.println("BCmp executed!");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ package com.yomahub.liteflow.test.customNodes.cmp;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("c")
|
||||
public class CCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,6 @@ package com.yomahub.liteflow.test.customNodes.cmp;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("d")
|
||||
public class DCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,13 +8,20 @@
|
||||
package com.yomahub.liteflow.test.customNodes.cmp;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.test.customNodes.domain.DemoDomain;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("e")
|
||||
import javax.annotation.Resource;
|
||||
|
||||
public class ECmp extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private DemoDomain demoDomain;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
demoDomain.sayHi();
|
||||
System.out.println("ECmp executed!");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ package com.yomahub.liteflow.test.customNodes.cmp;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("f")
|
||||
public class FCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.yomahub.liteflow.test.customNodes.domain;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class DemoDomain {
|
||||
|
||||
public void sayHi(){
|
||||
System.out.println("hi");
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ package com.yomahub.liteflow.test.flowmeta.cmp2;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("d")
|
||||
public class DCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user