bryan31 vor 3 Jahren
Ursprung
Commit
94760b9f21

+ 2 - 2
liteflow-testcase-script-groovy/src/test/java/com/yomahub/liteflow/test/script/groovy/LiteflowJsonScriptFileGroovyTest.java

@@ -73,7 +73,7 @@ public class LiteflowJsonScriptFileGroovyTest extends BaseTest {
     public void testScript4() throws Exception{
         new Thread(() -> {
             try{
-                Thread.sleep(1000L);
+                Thread.sleep(2000L);
                 //更改规则,重新加载,更改的规则内容从flow_update.xml里读取,这里只是为了模拟下获取新的内容。不一定是从文件中读取
                 String newContent = ResourceUtil.readUtf8Str("classpath: /json-script-file/flow_update.json");
                 //进行刷新
@@ -83,7 +83,7 @@ public class LiteflowJsonScriptFileGroovyTest extends BaseTest {
             }
         }).start();
 
-        for (int i = 0; i < 500; i++) {
+        for (int i = 0; i < 300; i++) {
             LiteflowResponse<DefaultSlot> responseNew = flowExecutor.execute2Resp("chain2", "arg");
             Assert.assertTrue(responseNew.isSuccess());
             Thread.sleep(10L);

+ 2 - 2
liteflow-testcase-script-groovy/src/test/java/com/yomahub/liteflow/test/script/groovy/LiteflowXmlScriptFileGroovyTest.java

@@ -73,7 +73,7 @@ public class LiteflowXmlScriptFileGroovyTest extends BaseTest {
     public void testScript4() throws Exception{
         new Thread(() -> {
             try{
-                Thread.sleep(1000L);
+                Thread.sleep(2000L);
                 //更改规则,重新加载,更改的规则内容从flow_update.xml里读取,这里只是为了模拟下获取新的内容。不一定是从文件中读取
                 String newContent = ResourceUtil.readUtf8Str("classpath: /xml-script-file/flow_update.xml");
                 //进行刷新
@@ -83,7 +83,7 @@ public class LiteflowXmlScriptFileGroovyTest extends BaseTest {
             }
         }).start();
 
-        for (int i = 0; i < 500; i++) {
+        for (int i = 0; i < 300; i++) {
             LiteflowResponse<DefaultSlot> responseNew = flowExecutor.execute2Resp("chain2", "arg");
             Assert.assertTrue(responseNew.isSuccess());
             Thread.sleep(10L);

+ 2 - 2
liteflow-testcase-script-qlexpress/src/test/java/com/yomahub/liteflow/test/script/qlexpress/LiteflowJsonScriptFileQLExpressTest.java

@@ -72,7 +72,7 @@ public class LiteflowJsonScriptFileQLExpressTest extends BaseTest {
     public void testScript4() throws Exception{
         new Thread(() -> {
             try{
-                Thread.sleep(1000L);
+                Thread.sleep(2000L);
                 //更改规则,重新加载,更改的规则内容从flow_update.xml里读取,这里只是为了模拟下获取新的内容。不一定是从文件中读取
                 String newContent = ResourceUtil.readUtf8Str("classpath: /json-script-file/flow_update.json");
                 //进行刷新
@@ -82,7 +82,7 @@ public class LiteflowJsonScriptFileQLExpressTest extends BaseTest {
             }
         }).start();
 
-        for (int i = 0; i < 500; i++) {
+        for (int i = 0; i < 300; i++) {
             LiteflowResponse<DefaultSlot> responseNew = flowExecutor.execute2Resp("chain2", "arg");
             Assert.assertTrue(responseNew.isSuccess());
             Thread.sleep(10L);

+ 2 - 2
liteflow-testcase-script-qlexpress/src/test/java/com/yomahub/liteflow/test/script/qlexpress/LiteflowXmlScriptFileQLExpressTest.java

@@ -72,7 +72,7 @@ public class LiteflowXmlScriptFileQLExpressTest extends BaseTest {
     public void testScript4() throws Exception{
         new Thread(() -> {
             try{
-                Thread.sleep(1000L);
+                Thread.sleep(2000L);
                 //更改规则,重新加载,更改的规则内容从flow_update.xml里读取,这里只是为了模拟下获取新的内容。不一定是从文件中读取
                 String newContent = ResourceUtil.readUtf8Str("classpath: /xml-script-file/flow_update.xml");
                 //进行刷新
@@ -82,7 +82,7 @@ public class LiteflowXmlScriptFileQLExpressTest extends BaseTest {
             }
         }).start();
 
-        for (int i = 0; i < 500; i++) {
+        for (int i = 0; i < 300; i++) {
             LiteflowResponse<DefaultSlot> responseNew = flowExecutor.execute2Resp("chain2", "arg");
             Assert.assertTrue(responseNew.isSuccess());
             Thread.sleep(10L);

+ 8 - 0
liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/WhenTimeOutSpringbootTest.java

@@ -1,12 +1,15 @@
 package com.yomahub.liteflow.test.whenTimeOut;
 
 import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.core.NodeComponent;
 import com.yomahub.liteflow.entity.data.DefaultSlot;
 import com.yomahub.liteflow.entity.data.LiteflowResponse;
 import com.yomahub.liteflow.test.BaseTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.ComponentScan;
@@ -27,12 +30,17 @@ import javax.annotation.Resource;
 @ComponentScan({"com.yomahub.liteflow.test.whenTimeOut.cmp"})
 public class WhenTimeOutSpringbootTest extends BaseTest {
 
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
     @Resource
     private FlowExecutor flowExecutor;
 
     @Test
     public void testWhenTimeOut() throws Exception{
         LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain1", "arg");
+        if (!response.isSuccess()){
+            log.error(response.getMessage(),response.getCause());
+        }
         Assert.assertTrue(response.isSuccess());
     }
 }

+ 1 - 1
liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/BCmp.java

@@ -16,7 +16,7 @@ public class BCmp extends NodeComponent {
 	@Override
 	public void process() {
 		try {
-			Thread.sleep(6000);
+			Thread.sleep(4000);
 		}catch (Exception ignored){
 
 		}

+ 1 - 1
liteflow-testcase-springboot/src/test/java/com/yomahub/liteflow/test/whenTimeOut/cmp/CCmp.java

@@ -16,7 +16,7 @@ public class CCmp extends NodeComponent {
 	@Override
 	public void process() {
 		try {
-			Thread.sleep(8000);
+			Thread.sleep(3500);
 		}catch (Exception ignored){
 
 		}

+ 1 - 1
liteflow-testcase-springboot/src/test/resources/whenTimeOut/application.properties

@@ -1,2 +1,2 @@
 liteflow.rule-source=whenTimeOut/flow.xml
-liteflow.when-max-wait-seconds=5
+liteflow.when-max-wait-seconds=3