From fa92d2e03582e4feb745ebe18e913514ab7aa2be Mon Sep 17 00:00:00 2001 From: "everywhere.z" Date: Fri, 17 Jun 2022 19:01:29 +0800 Subject: [PATCH] =?UTF-8?q?feature=20#I5CW7I=20=E3=80=90=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=89=B9=E6=80=A7=E3=80=91=E6=9E=84=E9=80=A0=E5=85=A8=E6=96=B0?= =?UTF-8?q?=E7=9A=84EL=E8=A7=84=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteflow-testcase-el-springboot/pom.xml | 63 +++++++++++++++++++ .../com/yomahub/liteflow/test/BaseTest.java | 20 ++++++ .../test/base/BaseELSpringbootTest.java | 38 +++++++++++ .../yomahub/liteflow/test/base/cmp/ACmp.java | 20 ++++++ .../yomahub/liteflow/test/base/cmp/BCmp.java | 21 +++++++ .../yomahub/liteflow/test/base/cmp/CCmp.java | 21 +++++++ .../yomahub/liteflow/test/base/cmp/DCmp.java | 21 +++++++ .../resources/base/application.properties | 1 + .../src/test/resources/base/flow.el.xml | 7 +++ 9 files changed, 212 insertions(+) create mode 100644 liteflow-testcase-el-springboot/pom.xml create mode 100644 liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/BaseTest.java create mode 100644 liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/BaseELSpringbootTest.java create mode 100644 liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/ACmp.java create mode 100644 liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/BCmp.java create mode 100644 liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/CCmp.java create mode 100644 liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/DCmp.java create mode 100644 liteflow-testcase-el-springboot/src/test/resources/base/application.properties create mode 100644 liteflow-testcase-el-springboot/src/test/resources/base/flow.el.xml diff --git a/liteflow-testcase-el-springboot/pom.xml b/liteflow-testcase-el-springboot/pom.xml new file mode 100644 index 000000000..5a527282e --- /dev/null +++ b/liteflow-testcase-el-springboot/pom.xml @@ -0,0 +1,63 @@ + + + + liteflow + com.yomahub + 2.7.3 + + 4.0.0 + + liteflow-testcase-el-springboot + + + + com.yomahub + liteflow-spring-boot-starter + ${project.version} + + + + org.springframework.boot + spring-boot-starter-test + ${springboot.version} + test + + + org.aspectj + aspectjweaver + 1.8.13 + test + + + org.apache.curator + curator-test + test + + + com.101tec + zkclient + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${springboot.version} + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + true + + + + + + \ No newline at end of file diff --git a/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/BaseTest.java b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/BaseTest.java new file mode 100644 index 000000000..64886670f --- /dev/null +++ b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/BaseTest.java @@ -0,0 +1,20 @@ +package com.yomahub.liteflow.test; + +import com.yomahub.liteflow.flow.FlowBus; +import com.yomahub.liteflow.property.LiteflowConfigGetter; +import com.yomahub.liteflow.spi.holder.SpiFactoryCleaner; +import com.yomahub.liteflow.spring.ComponentScanner; +import com.yomahub.liteflow.thread.ExecutorHelper; +import org.junit.AfterClass; + +public class BaseTest { + + @AfterClass + public static void cleanScanCache(){ + ComponentScanner.cleanCache(); + FlowBus.cleanCache(); + ExecutorHelper.loadInstance().clearExecutorServiceMap(); + SpiFactoryCleaner.clean(); + LiteflowConfigGetter.clean(); + } +} diff --git a/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/BaseELSpringbootTest.java b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/BaseELSpringbootTest.java new file mode 100644 index 000000000..123f10fe8 --- /dev/null +++ b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/BaseELSpringbootTest.java @@ -0,0 +1,38 @@ +package com.yomahub.liteflow.test.base; + +import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.flow.LiteflowResponse; +import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +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.junit4.SpringRunner; + +import javax.annotation.Resource; + +/** + * springboot环境最普通的例子测试 + * @author Bryan.Zhang + * @since 2.6.4 + */ +@RunWith(SpringRunner.class) +@TestPropertySource(value = "classpath:/base/application.properties") +@SpringBootTest(classes = BaseELSpringbootTest.class) +@EnableAutoConfiguration +@ComponentScan({"com.yomahub.liteflow.test.base.cmp"}) +public class BaseELSpringbootTest extends BaseTest { + + @Resource + private FlowExecutor flowExecutor; + + @Test + public void testBase() throws Exception{ + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); + Assert.assertTrue(response.isSuccess()); + } + +} diff --git a/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/ACmp.java b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/ACmp.java new file mode 100644 index 000000000..c33792217 --- /dev/null +++ b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/ACmp.java @@ -0,0 +1,20 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.base.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("a") +public class ACmp extends NodeComponent { + + @Override + public void process() { + System.out.println("ACmp executed!"); + } +} diff --git a/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/BCmp.java b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/BCmp.java new file mode 100644 index 000000000..f537308c7 --- /dev/null +++ b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/BCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.base.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("b") +public class BCmp extends NodeComponent { + + @Override + public void process() { + System.out.println("BCmp executed!"); + } + +} diff --git a/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/CCmp.java b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/CCmp.java new file mode 100644 index 000000000..6b6f84b41 --- /dev/null +++ b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/CCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.base.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("c") +public class CCmp extends NodeComponent { + + @Override + public void process() { + System.out.println("CCmp executed!"); + } + +} diff --git a/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/DCmp.java b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/DCmp.java new file mode 100644 index 000000000..ab0317f69 --- /dev/null +++ b/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/base/cmp/DCmp.java @@ -0,0 +1,21 @@ +/** + *

Title: liteflow

+ *

Description: 轻量级的组件式流程框架

+ * @author Bryan.Zhang + * @email weenyc31@163.com + * @Date 2020/4/1 + */ +package com.yomahub.liteflow.test.base.cmp; + +import com.yomahub.liteflow.core.NodeComponent; +import org.springframework.stereotype.Component; + +@Component("d") +public class DCmp extends NodeComponent { + + @Override + public void process() { + System.out.println("CCmp executed!"); + } + +} diff --git a/liteflow-testcase-el-springboot/src/test/resources/base/application.properties b/liteflow-testcase-el-springboot/src/test/resources/base/application.properties new file mode 100644 index 000000000..1f5b49a07 --- /dev/null +++ b/liteflow-testcase-el-springboot/src/test/resources/base/application.properties @@ -0,0 +1 @@ +liteflow.rule-source=base/flow.el.xml \ No newline at end of file diff --git a/liteflow-testcase-el-springboot/src/test/resources/base/flow.el.xml b/liteflow-testcase-el-springboot/src/test/resources/base/flow.el.xml new file mode 100644 index 000000000..7068d6cee --- /dev/null +++ b/liteflow-testcase-el-springboot/src/test/resources/base/flow.el.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file