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