enhancement #ID8XF9 对QLExpress4的支持

This commit is contained in:
everywhere.z
2025-12-01 15:46:01 +08:00
parent b26e91a3fd
commit 1b07db84c8
6 changed files with 97 additions and 3 deletions

View File

@@ -1,10 +1,13 @@
package com.yomahub.liteflow.benchmark;
import cn.hutool.core.io.resource.ResourceUtil;
import com.yomahub.liteflow.benchmark.cmp.TestContext;
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.openjdk.jmh.annotations.*;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
@@ -42,7 +45,12 @@ public class CommonBenchmark {
@Benchmark
public void test1(){
flowExecutor.execute2Resp("chain1");
TestContext context = new TestContext();
context.setName("tom");
context.setAge(21);
DefaultContext defaultContext = new DefaultContext();
flowExecutor.execute2Resp("chain1", null, context,defaultContext);
}
public static void main(String[] args) throws RunnerException {

View File

@@ -0,0 +1,41 @@
package com.yomahub.liteflow.benchmark;
import cn.hutool.core.io.resource.ResourceUtil;
import com.yomahub.liteflow.benchmark.cmp.TestContext;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import com.yomahub.liteflow.slot.DefaultContext;
import com.yomahub.liteflow.util.JsonUtil;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
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 org.springframework.test.context.junit.jupiter.SpringExtension;
import javax.annotation.Resource;
@ExtendWith(SpringExtension.class)
@TestPropertySource(value = "classpath:application.properties")
@SpringBootTest(classes = CommonTest.class)
@EnableAutoConfiguration
@ComponentScan({ "com.yomahub.liteflow.benchmark.cmp" })
public class CommonTest {
@Resource
private FlowExecutor flowExecutor;
@Test
public void test1() throws Exception {
TestContext context = new TestContext();
context.setName("tom");
context.setAge(21);
DefaultContext defaultContext = new DefaultContext();
LiteflowResponse response = flowExecutor.execute2Resp("chain1", null, context,defaultContext);
if (!response.isSuccess()){
throw response.getCause();
}
}
}

View File

@@ -22,7 +22,7 @@ public class ACmp extends NodeComponent {
public void process() {
int v1 = 2;
int v2 = 3;
DefaultContext ctx = this.getFirstContextBean();
DefaultContext ctx = this.getContextBean(DefaultContext.class);
ctx.setData("s1", v1 * v2);
TestDomain domain = ContextAwareHolder.loadContextAware().getBean(TestDomain.class);

View File

@@ -0,0 +1,21 @@
package com.yomahub.liteflow.benchmark.cmp;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowFact;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
@LiteflowComponent
public class CmpConfig {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "b")
public void processA(NodeComponent bindCmp, @LiteflowFact("name") String name) {
System.out.println(name);
}
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "c")
public void processB(NodeComponent bindCmp, @LiteflowFact("age") int age) {
System.out.println(age);
}
}

View File

@@ -0,0 +1,24 @@
package com.yomahub.liteflow.benchmark.cmp;
public class TestContext {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}

View File

@@ -2,6 +2,6 @@
<!DOCTYPE flow PUBLIC "liteflow" "liteflow.dtd">
<flow>
<chain name="chain1">
THEN(a);
THEN(a,b,c);
</chain>
</flow>