增加异步多嵌套WHEN多线程测试用例

This commit is contained in:
everywhere.z
2023-10-13 00:20:41 +08:00
parent e464c7ace5
commit bd5ac00662
8 changed files with 42 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ import javax.annotation.Resource;
*
* @author ssss
*/
@TestPropertySource(value = "classpath:/asyncNode/application.properties")
@TestPropertySource(value = "classpath:/asyncNode/application1.properties")
@SpringBootTest(classes = AsyncNodeELSpringbootTest.class)
@EnableAutoConfiguration
@ComponentScan({ "com.yomahub.liteflow.test.asyncNode.cmp" })

View File

@@ -0,0 +1,28 @@
package com.yomahub.liteflow.test.asyncNode;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
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;
@TestPropertySource(value = "classpath:/asyncNode/application2.properties")
@SpringBootTest(classes = AsyncNodeThreadPoolELSpringbootTest.class)
@EnableAutoConfiguration
@ComponentScan({ "com.yomahub.liteflow.test.asyncNode.cmp" })
public class AsyncNodeThreadPoolELSpringbootTest {
@Resource
private FlowExecutor flowExecutor;
@Test
public void testAsyncFlow1() {
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "it's a base request");
Assertions.assertTrue(response.isSuccess());
}
}

View File

@@ -8,6 +8,7 @@ public class FCmp extends NodeComponent {
@Override
public void process() throws Exception {
Thread.sleep(1500);
System.out.println("Fcomp executed!");
}

View File

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

View File

@@ -0,0 +1 @@
liteflow.rule-source=asyncNode/flow1.xml

View File

@@ -0,0 +1,4 @@
liteflow.rule-source=asyncNode/flow2.xml
liteflow.when-max-workers=4
liteflow.when-max-wait-time=20
liteflow.when-max-wait-time-unit=SECONDS

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<!-- base test -->
<chain name="chain1">
WHEN(f, f, WHEN(f, WHEN(f, f, f, f, WHEN(f, f, f, f, f, f, f))), f, f);
</chain>
</flow>