diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/annotation/LiteflowMethod.java b/liteflow-core/src/main/java/com/yomahub/liteflow/annotation/LiteflowMethod.java index 1327e561d..4da9bf677 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/annotation/LiteflowMethod.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/annotation/LiteflowMethod.java @@ -18,8 +18,8 @@ public @interface LiteflowMethod { String nodeId() default ""; /** - * cmp定义 - * + * CMP类型定义 + * @return AnnotationNodeTypeEnum */ AnnotationNodeTypeEnum nodeType() default AnnotationNodeTypeEnum.COMMON; } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/enums/AnnotationNodeTypeEnum.java b/liteflow-core/src/main/java/com/yomahub/liteflow/enums/AnnotationNodeTypeEnum.java index 6661d793c..e6ad007a2 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/enums/AnnotationNodeTypeEnum.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/enums/AnnotationNodeTypeEnum.java @@ -39,8 +39,7 @@ public enum AnnotationNodeTypeEnum { /** * 得到Node定义类 - * - * @return {@link Class}<{@link ?} {@link extends} {@link NodeComponent}> + * @return node定义类 */ public Class getCmpClass() { return cmpClass; diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/helper/ParserHelper.java b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/helper/ParserHelper.java index 43fd55c61..6d18e2d9e 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/helper/ParserHelper.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/helper/ParserHelper.java @@ -331,8 +331,7 @@ public class ParserHelper { } /** * 解析一个chain的过程 - *

- * param e chain 节点 + * @param e chain 节点 */ public static void parseOneChain(Element e) { String condValueStr; diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/util/SerialsUtil.java b/liteflow-core/src/main/java/com/yomahub/liteflow/util/SerialsUtil.java index 4cd90c6b3..de9f3bec0 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/util/SerialsUtil.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/util/SerialsUtil.java @@ -55,6 +55,8 @@ public class SerialsUtil { /** * 生成一个12位随机数 + * @param seed 种子值 + * @return String 随机数 */ public static String randomNum12(long seed) { // 被除数 @@ -64,6 +66,8 @@ public class SerialsUtil { /** * 生成一个8位随机数 + * @param seed 种子值 + * @return String 随机数 */ public static String randomNum8(long seed) { // 被除数 diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithJsonELDeclSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithJsonELDeclSpringbootTest.java deleted file mode 100644 index 9c4081e83..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithJsonELDeclSpringbootTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.yomahub.liteflow.test.zookeeper; - -import cn.hutool.core.io.resource.ResourceUtil; -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.test.BaseTest; -import org.I0Itec.zkclient.ZkClient; -import org.I0Itec.zkclient.exception.ZkMarshallingError; -import org.I0Itec.zkclient.serialize.ZkSerializer; -import org.apache.curator.test.TestingServer; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -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; -import java.nio.charset.Charset; -import java.util.concurrent.CountDownLatch; - -/** - * springboot环境下的zk配置源功能测试 - * ZK节点存储数据的格式为json文件 - * @author zendwang - * @since 2.5.0 - */ -@RunWith(SpringRunner.class) -@TestPropertySource(value = "classpath:/zookeeper/application-json.properties") -@SpringBootTest(classes = ZkNodeWithJsonELDeclSpringbootTest.class) -@EnableAutoConfiguration -@ComponentScan({"com.yomahub.liteflow.test.zookeeper.cmp"}) -public class ZkNodeWithJsonELDeclSpringbootTest extends BaseTest { - - private static final String ZK_NODE_PATH = "/lite-flow/flow"; - - private static TestingServer zkServer; - - @Resource - private FlowExecutor flowExecutor; - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - zkServer = new TestingServer(21810); - CountDownLatch latch = new CountDownLatch(1); - new Thread(() -> { - String data = ResourceUtil.readUtf8Str("zookeeper/flow.json"); - ZkClient zkClient = new ZkClient("127.0.0.1:21810"); - zkClient.setZkSerializer(new ZkSerializer() { - @Override - public byte[] serialize(final Object o) throws ZkMarshallingError { - return o.toString().getBytes(Charset.forName("UTF-8")); - } - - @Override - public Object deserialize(final byte[] bytes) throws ZkMarshallingError { - return new String(bytes, Charset.forName("UTF-8")); - } - }); - zkClient.createPersistent(ZK_NODE_PATH, true); - zkClient.writeData(ZK_NODE_PATH, data); - zkClient.close(); - latch.countDown(); - }).start(); - latch.await(); - } - - @Test - public void testZkNodeWithJson() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assert.assertTrue(response.isSuccess()); - } - - @AfterClass - public static void tearDown() throws Exception { - zkServer.stop(); - } -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithXmlELDeclSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithXmlELDeclSpringbootTest.java deleted file mode 100644 index d578554ad..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithXmlELDeclSpringbootTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.yomahub.liteflow.test.zookeeper; - -import cn.hutool.core.io.resource.ResourceUtil; -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.test.BaseTest; -import org.I0Itec.zkclient.ZkClient; -import org.I0Itec.zkclient.exception.ZkMarshallingError; -import org.I0Itec.zkclient.serialize.ZkSerializer; -import org.apache.curator.test.TestingServer; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -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; -import java.nio.charset.Charset; -import java.util.concurrent.CountDownLatch; - -/** - * springboot环境下的zk配置源功能测试 - * ZK节点存储数据的格式为xml文件 - * @author zendwang - * @since 2.5.0 - */ -@RunWith(SpringRunner.class) -@TestPropertySource(value = "classpath:/zookeeper/application-xml.properties") -@SpringBootTest(classes = ZkNodeWithXmlELDeclSpringbootTest.class) -@EnableAutoConfiguration -@ComponentScan({"com.yomahub.liteflow.test.zookeeper.cmp"}) -public class ZkNodeWithXmlELDeclSpringbootTest extends BaseTest { - - private static final String ZK_NODE_PATH = "/lite-flow/flow"; - - private static TestingServer zkServer; - - @Resource - private FlowExecutor flowExecutor; - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - zkServer = new TestingServer(21810); - CountDownLatch latch = new CountDownLatch(1); - new Thread(() -> { - String data = ResourceUtil.readUtf8Str("zookeeper/flow.xml"); - ZkClient zkClient = new ZkClient("127.0.0.1:21810"); - zkClient.setZkSerializer(new ZkSerializer() { - @Override - public byte[] serialize(final Object o) throws ZkMarshallingError { - return o.toString().getBytes(Charset.forName("UTF-8")); - } - - @Override - public Object deserialize(final byte[] bytes) throws ZkMarshallingError { - return new String(bytes, Charset.forName("UTF-8")); - } - }); - zkClient.createPersistent(ZK_NODE_PATH, true); - zkClient.writeData(ZK_NODE_PATH, data); - zkClient.close(); - latch.countDown(); - }).start(); - latch.await(); - } - - @Test - public void testZkNodeWithXml() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assert.assertTrue(response.isSuccess()); - } - - @AfterClass - public static void tearDown() throws Exception { - zkServer.stop(); - } -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithYmlELDeclSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithYmlELDeclSpringbootTest.java deleted file mode 100644 index 4776d94ea..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/ZkNodeWithYmlELDeclSpringbootTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.yomahub.liteflow.test.zookeeper; - -import cn.hutool.core.io.resource.ResourceUtil; -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.flow.LiteflowResponse; -import com.yomahub.liteflow.test.BaseTest; -import org.I0Itec.zkclient.ZkClient; -import org.I0Itec.zkclient.exception.ZkMarshallingError; -import org.I0Itec.zkclient.serialize.ZkSerializer; -import org.apache.curator.test.TestingServer; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -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; -import java.nio.charset.Charset; -import java.util.concurrent.CountDownLatch; - -/** - * springboot环境下的zk配置源功能测试 - * ZK节点存储数据的格式为yml文件 - * @author zendwang - * @since 2.5.0 - */ -@RunWith(SpringRunner.class) -@TestPropertySource(value = "classpath:/zookeeper/application-yml.properties") -@SpringBootTest(classes = ZkNodeWithYmlELDeclSpringbootTest.class) -@EnableAutoConfiguration -@ComponentScan({"com.yomahub.liteflow.test.zookeeper.cmp"}) -public class ZkNodeWithYmlELDeclSpringbootTest extends BaseTest { - - private static final String ZK_NODE_PATH = "/lite-flow/flow"; - - private static TestingServer zkServer; - - @Resource - private FlowExecutor flowExecutor; - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - zkServer = new TestingServer(21810); - CountDownLatch latch = new CountDownLatch(1); - new Thread(() -> { - String data = ResourceUtil.readUtf8Str("zookeeper/flow.yml"); - ZkClient zkClient = new ZkClient("127.0.0.1:21810"); - zkClient.setZkSerializer(new ZkSerializer() { - @Override - public byte[] serialize(final Object o) throws ZkMarshallingError { - return o.toString().getBytes(Charset.forName("UTF-8")); - } - - @Override - public Object deserialize(final byte[] bytes) throws ZkMarshallingError { - return new String(bytes, Charset.forName("UTF-8")); - } - }); - zkClient.createPersistent(ZK_NODE_PATH, true); - zkClient.writeData(ZK_NODE_PATH, data); - zkClient.close(); - latch.countDown(); - }).start(); - latch.await(); - } - - @Test - public void testZkNodeWithYml() { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assert.assertTrue(response.isSuccess()); - } - - @AfterClass - public static void tearDown() throws Exception { - zkServer.stop(); - } -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/cmp/CmpConfig.java b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/cmp/CmpConfig.java deleted file mode 100644 index 5c3ff98a6..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/zookeeper/cmp/CmpConfig.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.yomahub.liteflow.test.zookeeper.cmp; - -import com.yomahub.liteflow.annotation.LiteflowComponent; -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 = "a") - public void processA(NodeComponent bindCmp) { - System.out.println("ACmp executed!"); - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS,nodeId = "b") - public void processB(NodeComponent bindCmp) { - System.out.println("BCmp executed!"); - - } - - @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS,nodeId = "c") - public void processC(NodeComponent bindCmp) { - System.out.println("CCmp executed!"); - - } -} diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/application-json.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/application-json.properties deleted file mode 100644 index e8d44c429..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/application-json.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=el_json:127.0.0.1:21810 \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/application-xml.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/application-xml.properties deleted file mode 100644 index e3a6e33db..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/application-xml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=el_xml:127.0.0.1:21810 \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/application-yml.properties b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/application-yml.properties deleted file mode 100644 index 8022eb56f..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/application-yml.properties +++ /dev/null @@ -1 +0,0 @@ -liteflow.rule-source=el_yml:127.0.0.1:21810 \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/flow.json b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/flow.json deleted file mode 100644 index e78b1e919..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/flow.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "flow": { - "chain": [ - { - "name": "chain1", - "value": "THEN(a, b, c);" - } - ] - } -} \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/flow.xml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/flow.xml deleted file mode 100644 index 049210cf4..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/flow.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - THEN(a, b, c); - - \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/flow.yml b/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/flow.yml deleted file mode 100644 index 2b7bfd1dc..000000000 --- a/liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/zookeeper/flow.yml +++ /dev/null @@ -1,4 +0,0 @@ -flow: - chain: - - name: chain1 - value: "THEN(a, b, c);" \ No newline at end of file