From 8d0a193a39e86643806b079bd1acd86b6aea8a5d Mon Sep 17 00:00:00 2001 From: "everywhere.z" Date: Wed, 9 Oct 2024 12:51:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../liteflow/test/ScriptJavaxTest.java | 72 ------------------- .../test/fallback/FallbackELSpringTest.java | 3 +- 2 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 liteflow-benchmark/liteflow-benchmark-script-javax/src/test/java/com/yomahub/liteflow/test/ScriptJavaxTest.java diff --git a/liteflow-benchmark/liteflow-benchmark-script-javax/src/test/java/com/yomahub/liteflow/test/ScriptJavaxTest.java b/liteflow-benchmark/liteflow-benchmark-script-javax/src/test/java/com/yomahub/liteflow/test/ScriptJavaxTest.java deleted file mode 100644 index 2d8183146..000000000 --- a/liteflow-benchmark/liteflow-benchmark-script-javax/src/test/java/com/yomahub/liteflow/test/ScriptJavaxTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.yomahub.liteflow.test; - -import cn.hutool.core.io.resource.ResourceUtil; -import com.yomahub.liteflow.builder.LiteFlowNodeBuilder; -import com.yomahub.liteflow.builder.el.LiteFlowChainELBuilder; -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.flow.FlowBus; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.slot.DefaultContext; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.openjdk.jmh.annotations.*; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.RunnerException; -import org.openjdk.jmh.runner.options.Options; -import org.openjdk.jmh.runner.options.OptionsBuilder; -import org.openjdk.jmh.runner.options.TimeValue; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.PropertySource; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import javax.annotation.Resource; -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicLong; - -@ExtendWith(SpringExtension.class) -@TestPropertySource(value = "classpath:application.properties") -@SpringBootTest(classes = ScriptJavaxTest.class) -@EnableAutoConfiguration -@ComponentScan({ "com.yomahub.liteflow.benchmark.cmp" }) -public class ScriptJavaxTest { - - @Resource - private FlowExecutor flowExecutor; - - // 测试普通脚本节点 - @Test - public void test1() { - ExecutorService executorService = new ThreadPoolExecutor(100, 100, 60, - TimeUnit.SECONDS, new ArrayBlockingQueue<>(500), new ThreadFactory() { - private final AtomicLong number = new AtomicLong(); - - @Override - public Thread newThread(Runnable r) { - Thread newThread = Executors.defaultThreadFactory().newThread(r); - newThread.setName("LF" + number.getAndIncrement()); - newThread.setDaemon(false); - return newThread; - } - }, new ThreadPoolExecutor.CallerRunsPolicy()); - - for (int i = 0; i < 10000; i++) { - executorService.submit(() -> { - String scriptContent = ResourceUtil.readUtf8Str("classpath:javaxScript.java"); - LiteFlowNodeBuilder.createScriptNode().setId("ds").setScript(scriptContent).build(); - - if(!FlowBus.containChain("chain2")){ - LiteFlowChainELBuilder.createChain().setChainId("chain2").setEL("THEN(ds)").build(); - } - LiteflowResponse response = flowExecutor.execute2Resp("chain2"); - DefaultContext context = response.getFirstContextBean(); - System.out.println(context.getData("salary").toString()); - }); - } - } -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/fallback/FallbackELSpringTest.java b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/fallback/FallbackELSpringTest.java index 31a6ec754..c22d85146 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/fallback/FallbackELSpringTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-springnative/src/test/java/com/yomahub/liteflow/test/fallback/FallbackELSpringTest.java @@ -168,7 +168,8 @@ public class FallbackELSpringTest extends BaseTest { LiteflowResponse response = flowExecutor.execute2Resp("concurrent2", "arg"); Assertions.assertTrue(response.isSuccess()); String stepStr = response.getExecuteStepStrWithoutTime(); - Assertions.assertTrue("fb_comm_cmp==>fb_bool_cmp".equals(stepStr) || "ifn2==>c".equals(stepStr)); + Assertions.assertTrue("fb_comm_cmp==>fb_bool_cmp".equals(stepStr) || "fb_bool_cmp==>fb_comm_cmp".equals(stepStr) || "ifn2==>c".equals(stepStr)); + } @Test