mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
enhancement #I4FSHW 优雅刷新配置的支持
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.yomahub.liteflow.test;
|
||||
|
||||
import com.yomahub.liteflow.entity.data.DataBus;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
import com.yomahub.liteflow.spring.ComponentScanner;
|
||||
import org.junit.AfterClass;
|
||||
|
||||
@@ -33,11 +33,38 @@ public class RefreshRuleSpringbootTest extends BaseTest {
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
//测试普通刷新流程的场景
|
||||
@Test
|
||||
public void testRefresh() throws Exception{
|
||||
String content = ResourceUtil.readUtf8Str("classpath: /refreshRule/flow.xml");
|
||||
public void testRefresh1() throws Exception{
|
||||
String content = ResourceUtil.readUtf8Str("classpath: /refreshRule/flow_update.xml");
|
||||
FlowBus.refreshFlowMetaData(FlowParserTypeEnum.TYPE_XML, content);
|
||||
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain1", "arg");
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
}
|
||||
|
||||
//测试优雅刷新的场景
|
||||
@Test
|
||||
public void testRefresh2() throws Exception{
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
String content = ResourceUtil.readUtf8Str("classpath: /refreshRule/flow_update.xml");
|
||||
FlowBus.refreshFlowMetaData(FlowParserTypeEnum.TYPE_XML, content);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}).start();
|
||||
|
||||
for (int i = 0; i < 500; i++) {
|
||||
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain1", "arg");
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
try {
|
||||
Thread.sleep(10L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
liteflow.rule-source=refreshRule/flow.xml
|
||||
liteflow.parse-on-start=false
|
||||
liteflow.rule-source=refreshRule/flow.xml
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<chain name="chain1">
|
||||
<then value="c,b,a"/>
|
||||
</chain>
|
||||
</flow>
|
||||
Reference in New Issue
Block a user