mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-06-10 03:07:32 +08:00
enhancement #ID8XF9 对QLExpress4的支持
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
<!DOCTYPE flow PUBLIC "liteflow" "liteflow.dtd">
|
||||
<flow>
|
||||
<chain name="chain1">
|
||||
THEN(a);
|
||||
THEN(a,b,c);
|
||||
</chain>
|
||||
</flow>
|
||||
Reference in New Issue
Block a user