From 1114e94924608a3576008cf993f61508ef5dac61 Mon Sep 17 00:00:00 2001 From: liningrui Date: Tue, 16 Mar 2021 18:03:26 +0800 Subject: [PATCH 1/8] First commit --- .gitignore | 21 ++++++ LICENSE | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 17 +++++ pom.xml | 203 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 443 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..fa22f58767 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +.DS_Store +*.iml +*.iws +*.orig +*.rej +**/.keep +*.sdf +*.suo +*.vcxproj.user +*.swp +*.log +*.pyc +.idea +.svn +.classpath +.project +.settings +target +gen-java +build +node* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..e06d208186 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/README.md b/README.md new file mode 100644 index 0000000000..9243acf297 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# HugeGraph-RPC + +HugeGraph Database RPC component, currently it's a wrapper of [Sofa-RPC](https://github.com/sofastack/sofa-rpc) + +## Features + +## Learn More + +The [project homepage](https://hugegraph.github.io/hugegraph-doc/) contains more information on HugeGraph and provides links to documentation, getting-started guides and release downloads. + +## Contributing + +Welcome to contribute to HugeGraph, please see [`How to Contribute`](CONTRIBUTING.md) for more information. + +## License + +HugeGraph is licensed under Apache 2.0 License. diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..1603590fd0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,203 @@ + + + 4.0.0 + + com.baidu.hugegraph + hugegraph-rpc + 1.0.0 + + hugegraph-rpc + https://github.com/hugegraph/hugegraph-rpc + + HugeGraph Database RPC component + + + + org.sonatype.oss + oss-parent + 7 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + https://github.com/hugegraph/hugegraph-rpc + https://github.com/hugegraph/hugegraph-rpc + https://github.com/hugegraph/hugegraph-rpc + + + + UTF-8 + ${project.basedir}/.. + 1.8 + 1.8 + + + + + + com.lmax + disruptor + 3.3.7 + + + com.alipay.sofa + sofa-rpc-all + 5.7.6 + + + io.netty + netty-all + + + org.jboss.resteasy + resteasy-client + + + com.alipay.sofa + bolt + + + org.apache.httpcomponents + httpcore + + + org.apache.httpcomponents + httpmime + + + com.alipay.sofa.common + sofa-common-tools + + + org.jboss.logging + jboss-logging + + + com.alipay.sofa + hessian + + + + + + + + + maven-compiler-plugin + 3.1 + + ${compiler.source} + ${compiler.target} + + 500 + + + -Xlint:unchecked + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + true + + + false + + + true + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.2 + + + pre-unit-test + + prepare-agent + + + + post-unit-test + test + + report + + + ${project.build.directory} + + + + + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + From 3914813fb8244b927cfa6b789bd224946c03c1f2 Mon Sep 17 00:00:00 2001 From: liningrui Date: Wed, 17 Mar 2021 15:21:59 +0800 Subject: [PATCH 2/8] Add checkstyle plugin --- checkstyle.xml | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ pom.xml | 23 ++++++++++++- 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 checkstyle.xml diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000000..9373a70d91 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 1603590fd0..5fdbbe6349 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,28 @@ - + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + + checkstyle.xml + UTF-8 + true + true + false + false + + + + validate + validate + + check + + + + org.apache.maven.plugins maven-jar-plugin From 159143c04dd68f0334f81069ee0d5ce44198ab45 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 23 Mar 2021 18:59:43 +0800 Subject: [PATCH 3/8] add rpc framework based on sofa-rpc (#1) * add rpc framework based on sofa-rpc * allowed to start server or client separately * add destroy() method for rpc client * complete the supplement of test cases * remove sleep in destroy-server and improve comments of test block * add fanout exception test case * travis use oraclejdk8 * fix log4j config and remove test/resources from pom to avoid including log4j2.xml in tar Co-authored-by: Jermy Li Co-authored-by: xuliguov5 --- .travis.yml | 13 + README.md | 2 +- pom.xml | 36 +- .../baidu/hugegraph/config/RpcOptions.java | 149 ++++ .../hugegraph/rpc/RpcClientProvider.java | 75 ++ .../baidu/hugegraph/rpc/RpcCommonConfig.java | 46 ++ .../hugegraph/rpc/RpcConsumerConfig.java | 217 ++++++ .../com/baidu/hugegraph/rpc/RpcException.java | 41 + .../hugegraph/rpc/RpcProviderConfig.java | 85 +++ .../com/baidu/hugegraph/rpc/RpcServer.java | 128 ++++ .../rpc/RpcServiceConfig4Client.java | 37 + .../rpc/RpcServiceConfig4Server.java | 32 + .../baidu/hugegraph/version/RpcVersion.java | 31 + .../baidu/hugegraph/unit/BaseUnitTest.java | 58 ++ .../baidu/hugegraph/unit/ExceptionTest.java | 58 ++ .../hugegraph/unit/ServerClientTest.java | 710 ++++++++++++++++++ .../baidu/hugegraph/unit/UnitTestSuite.java | 32 + .../com/baidu/hugegraph/unit/VersionTest.java | 38 + src/test/resources/log4j2.xml | 26 + src/test/resources/rpc-client-lb.properties | 9 + src/test/resources/rpc-client.properties | 9 + src/test/resources/rpc-client345.properties | 9 + src/test/resources/rpc-client346.properties | 9 + src/test/resources/rpc-client67.properties | 9 + src/test/resources/rpc-server.properties | 9 + .../resources/rpc-server1-client.properties | 9 + .../resources/rpc-server2-client.properties | 9 + src/test/resources/rpc-server3.properties | 9 + src/test/resources/rpc-server4.properties | 9 + src/test/resources/rpc-server5.properties | 9 + 30 files changed, 1901 insertions(+), 12 deletions(-) create mode 100644 .travis.yml create mode 100644 src/main/java/com/baidu/hugegraph/config/RpcOptions.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcException.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcServer.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java create mode 100644 src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java create mode 100644 src/main/java/com/baidu/hugegraph/version/RpcVersion.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java create mode 100644 src/test/java/com/baidu/hugegraph/unit/VersionTest.java create mode 100644 src/test/resources/log4j2.xml create mode 100644 src/test/resources/rpc-client-lb.properties create mode 100644 src/test/resources/rpc-client.properties create mode 100644 src/test/resources/rpc-client345.properties create mode 100644 src/test/resources/rpc-client346.properties create mode 100644 src/test/resources/rpc-client67.properties create mode 100644 src/test/resources/rpc-server.properties create mode 100644 src/test/resources/rpc-server1-client.properties create mode 100644 src/test/resources/rpc-server2-client.properties create mode 100644 src/test/resources/rpc-server3.properties create mode 100644 src/test/resources/rpc-server4.properties create mode 100644 src/test/resources/rpc-server5.properties diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..44711a9074 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: java + +jdk: + - oraclejdk8 + +dist: trusty + +install: mvn compile -Dmaven.javadoc.skip=true + +script: mvn test -Dtest=UnitTestSuite + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 9243acf297..17a17b6eab 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # HugeGraph-RPC -HugeGraph Database RPC component, currently it's a wrapper of [Sofa-RPC](https://github.com/sofastack/sofa-rpc) +HugeGraph Database RPC component, currently it's based on [Sofa-RPC](https://github.com/sofastack/sofa-rpc) ## Features diff --git a/pom.xml b/pom.xml index 5fdbbe6349..c89a586cc7 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,13 @@ + + + com.baidu.hugegraph + hugegraph-common + 1.8.5 + + com.lmax @@ -54,16 +61,20 @@ 5.7.6 - io.netty - netty-all + org.jboss.resteasy + resteasy-client org.jboss.resteasy - resteasy-client + resteasy-netty4 + + + org.jboss.resteasy + resteasy-jackson2-provider - com.alipay.sofa - bolt + org.apache.httpcomponents + httpclient org.apache.httpcomponents @@ -73,17 +84,13 @@ org.apache.httpcomponents httpmime - - com.alipay.sofa.common - sofa-common-tools - org.jboss.logging jboss-logging - com.alipay.sofa - hessian + org.slf4j + slf4j-api @@ -105,6 +112,7 @@ + org.apache.maven.plugins maven-checkstyle-plugin @@ -127,6 +135,7 @@ + org.apache.maven.plugins maven-jar-plugin @@ -142,6 +151,11 @@ true + + + 1.0.0.0 + diff --git a/src/main/java/com/baidu/hugegraph/config/RpcOptions.java b/src/main/java/com/baidu/hugegraph/config/RpcOptions.java new file mode 100644 index 0000000000..482b570580 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/config/RpcOptions.java @@ -0,0 +1,149 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.config; + +import static com.baidu.hugegraph.config.OptionChecker.allowValues; +import static com.baidu.hugegraph.config.OptionChecker.disallowEmpty; +import static com.baidu.hugegraph.config.OptionChecker.rangeInt; + +public class RpcOptions extends OptionHolder { + + private RpcOptions() { + super(); + } + + private static volatile RpcOptions instance; + + public static synchronized RpcOptions instance() { + if (instance == null) { + instance = new RpcOptions(); + instance.registerOptions(); + } + return instance; + } + + public static final ConfigOption RPC_SERVER_HOST = + new ConfigOption<>( + "rpc.server_host", + "The hosts/ips bound by rpc server to provide services, " + + "empty value means not enabled.", + null, + "" + ); + + public static final ConfigOption RPC_SERVER_PORT = + new ConfigOption<>( + "rpc.server_port", + "The port bound by rpc server to provide services.", + rangeInt(1, Integer.MAX_VALUE), + 8090 + ); + + public static final ConfigOption RPC_SERVER_TIMEOUT = + new ConfigOption<>( + "rpc.server_timeout", + "The timeout(in seconds) of rpc server execution.", + rangeInt(1, Integer.MAX_VALUE), + 30 + ); + + public static final ConfigOption RPC_REMOTE_URL = + new ConfigOption<>( + "rpc.remote_url", + "The remote urls of rpc peers, it can be set to " + + "multiple addresses, which are concat by ',', " + + "empty value means not enabled.", + null, + "" + ); + + public static final ConfigOption RPC_CLIENT_CONNECT_TIMEOUT = + new ConfigOption<>( + "rpc.client_connect_timeout", + "The timeout(in seconds) of rpc client connect to rpc " + + "server.", + rangeInt(1, Integer.MAX_VALUE), + 20 + ); + + public static final ConfigOption RPC_CLIENT_RECONNECT_PERIOD = + new ConfigOption<>( + "rpc.client_reconnect_period", + "The period(in seconds) of rpc client reconnect to rpc " + + "server.", + rangeInt(1, Integer.MAX_VALUE), + 10 + ); + + public static final ConfigOption RPC_CLIENT_READ_TIMEOUT = + new ConfigOption<>( + "rpc.client_read_timeout", + "The timeout(in seconds) of rpc client read from rpc " + + "server.", + rangeInt(1, Integer.MAX_VALUE), + 40 + ); + + public static final ConfigOption RPC_CLIENT_RETRIES = + new ConfigOption<>( + "rpc.client_retries", + "Failed retry number of rpc client calls to rpc server.", + rangeInt(0, Integer.MAX_VALUE), + 3 + ); + + public static final ConfigOption RPC_CLIENT_LOAD_BALANCER = + new ConfigOption<>( + "rpc.client_load_balancer", + "The rpc client uses a load-balancing algorithm to " + + "access multiple rpc servers in one cluster. Default " + + "value is 'consistentHash', means forwording by request " + + "parameters.", + allowValues("random", "localPref", "roundRobin", + "consistentHash", "weightRoundRobin"), + "consistentHash" + ); + + public static final ConfigOption RPC_PROTOCOL = + new ConfigOption<>( + "rpc.protocol", + "Rpc communication protocol, client and server need to " + + "be specified the same value.", + allowValues("bolt", "rest", "dubbo", "h2c", "http"), + "bolt" + ); + + public static final ConfigOption RPC_CONFIG_ORDER = + new ConfigOption<>( + "rpc.config_order", + "Sofa rpc configuration file loading order, the larger " + + "the more later loading.", + rangeInt(1, Integer.MAX_VALUE), + 999 + ); + + public static final ConfigOption RPC_LOGGER_IMPL = + new ConfigOption<>( + "rpc.logger_impl", + "Sofa rpc log implementation class.", + disallowEmpty(), + "com.alipay.sofa.rpc.log.SLF4JLoggerImpl" + ); +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java b/src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java new file mode 100644 index 0000000000..6f0eba5a6c --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcClientProvider.java @@ -0,0 +1,75 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.rpc; + +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.Set; + +import com.alipay.sofa.rpc.common.utils.StringUtils; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.RpcOptions; +import com.baidu.hugegraph.util.E; + +public class RpcClientProvider { + + private final RpcConsumerConfig consumerConfig; + + public RpcClientProvider(HugeConfig config) { + // TODO: fetch from registry server + String rpcUrl = config.get(RpcOptions.RPC_REMOTE_URL); + String selfUrl = config.get(RpcOptions.RPC_SERVER_HOST) + ":" + + config.get(RpcOptions.RPC_SERVER_PORT); + rpcUrl = excludeSelfUrl(rpcUrl, selfUrl); + this.consumerConfig = StringUtils.isNotBlank(rpcUrl) ? + new RpcConsumerConfig(config, rpcUrl) : null; + } + public boolean enabled() { + return this.consumerConfig != null; + } + + public RpcConsumerConfig config() { + E.checkArgument(this.consumerConfig != null, + "RpcClient is not enabled, please config option '%s' " + + "and ensure to add an address other than self service", + RpcOptions.RPC_REMOTE_URL.name()); + return this.consumerConfig; + } + + public void unreferAll() { + if (this.consumerConfig != null) { + this.consumerConfig.removeAllServiceProxy(); + } + } + + public void destroy() { + if (this.consumerConfig != null) { + this.consumerConfig.destroy(); + } + } + + protected static String excludeSelfUrl(String rpcUrl, String selfUrl) { + String[] urls = StringUtils.splitWithCommaOrSemicolon(rpcUrl); + // Keep urls order via LinkedHashSet + Set urlSet = new LinkedHashSet<>(Arrays.asList(urls)); + urlSet.remove(selfUrl); + return String.join(",", urlSet); + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java b/src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java new file mode 100644 index 0000000000..4ee50b6826 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcCommonConfig.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.rpc; + +import java.util.Map; + +import com.alipay.sofa.rpc.common.RpcConfigs; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.RpcOptions; + +public class RpcCommonConfig { + + public static void initRpcConfigs(HugeConfig config) { + RpcConfigs.putValue("rpc.config.order", + config.get(RpcOptions.RPC_CONFIG_ORDER)); + RpcConfigs.putValue("logger.impl", + config.get(RpcOptions.RPC_LOGGER_IMPL)); + } + + public static void initRpcConfigs(String key, Object value) { + RpcConfigs.putValue(key, value); + } + + public static void initRpcConfigs(Map conf) { + for (Map.Entry entry : conf.entrySet()) { + RpcConfigs.putValue(entry.getKey(), entry.getValue()); + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java b/src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java new file mode 100644 index 0000000000..c9b28f98e7 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcConsumerConfig.java @@ -0,0 +1,217 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.rpc; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.slf4j.Logger; + +import com.alipay.sofa.rpc.bootstrap.Bootstraps; +import com.alipay.sofa.rpc.bootstrap.ConsumerBootstrap; +import com.alipay.sofa.rpc.client.AbstractCluster; +import com.alipay.sofa.rpc.client.Cluster; +import com.alipay.sofa.rpc.client.ProviderInfo; +import com.alipay.sofa.rpc.config.ConsumerConfig; +import com.alipay.sofa.rpc.core.exception.RpcErrorType; +import com.alipay.sofa.rpc.core.exception.SofaRpcException; +import com.alipay.sofa.rpc.core.request.SofaRequest; +import com.alipay.sofa.rpc.core.response.SofaResponse; +import com.alipay.sofa.rpc.ext.Extension; +import com.alipay.sofa.rpc.ext.ExtensionLoaderFactory; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.RpcOptions; +import com.baidu.hugegraph.util.Log; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + +public class RpcConsumerConfig implements RpcServiceConfig4Client { + + private final HugeConfig conf; + private final String remoteUrls; + private final Map> configs; + private final List> bootstraps; + + static { + ExtensionLoaderFactory.getExtensionLoader(Cluster.class) + .loadExtension(FanoutCluster.class); + } + + public RpcConsumerConfig(HugeConfig config, String remoteUrls) { + RpcCommonConfig.initRpcConfigs(config); + this.conf = config; + this.remoteUrls = remoteUrls; + this.configs = Maps.newHashMap(); + this.bootstraps = Lists.newArrayList(); + } + + @Override + public T serviceProxy(String interfaceId) { + return this.serviceProxy(null, interfaceId); + } + + @Override + public T serviceProxy(String graph, String interfaceId) { + ConsumerConfig config = this.consumerConfig(graph, interfaceId); + ConsumerBootstrap bootstrap = Bootstraps.from(config); + this.bootstraps.add(bootstrap); + return bootstrap.refer(); + } + + @Override + public void removeAllServiceProxy() { + for (ConsumerBootstrap bootstrap : this.bootstraps) { + bootstrap.unRefer(); + } + } + + public void destroy() { + Set clusters = Sets.newHashSet(); + for (ConsumerBootstrap bootstrap : this.bootstraps) { + bootstrap.unRefer(); + clusters.add(bootstrap.getCluster()); + } + for (Cluster cluster : clusters) { + cluster.destroy(); + } + } + + private ConsumerConfig consumerConfig(String graph, + String interfaceId) { + String serviceId; + if (graph != null) { + serviceId = interfaceId + ":" + graph; + } else { + serviceId = interfaceId; + } + + @SuppressWarnings("unchecked") + ConsumerConfig consumerConfig = (ConsumerConfig) + this.configs.get(serviceId); + if (consumerConfig != null) { + return consumerConfig; + } + + assert consumerConfig == null; + consumerConfig = new ConsumerConfig<>(); + + HugeConfig conf = this.conf; + String protocol = conf.get(RpcOptions.RPC_PROTOCOL); + int timeout = conf.get(RpcOptions.RPC_CLIENT_READ_TIMEOUT) * 1000; + int connectTimeout = conf.get(RpcOptions + .RPC_CLIENT_CONNECT_TIMEOUT) * 1000; + int reconnectPeriod = conf.get(RpcOptions + .RPC_CLIENT_RECONNECT_PERIOD) * 1000; + int retries = conf.get(RpcOptions.RPC_CLIENT_RETRIES); + String loadBalancer = conf.get(RpcOptions.RPC_CLIENT_LOAD_BALANCER); + + if (graph != null) { + consumerConfig.setId(serviceId).setUniqueId(graph); + // Default is FailoverCluster, set to FanoutCluster to broadcast + consumerConfig.setCluster("fanout"); + } + consumerConfig.setInterfaceId(interfaceId) + .setProtocol(protocol) + .setDirectUrl(this.remoteUrls) + .setTimeout(timeout) + .setConnectTimeout(connectTimeout) + .setReconnectPeriod(reconnectPeriod) + .setRetries(retries) + .setLoadBalancer(loadBalancer); + + this.configs.put(serviceId, consumerConfig); + return consumerConfig; + } + + @Extension("fanout") + private static class FanoutCluster extends AbstractCluster { + + private static final Logger LOG = Log.logger(FanoutCluster.class); + + public FanoutCluster(ConsumerBootstrap consumerBootstrap) { + super(consumerBootstrap); + } + + @Override + protected SofaResponse doInvoke(SofaRequest request) + throws SofaRpcException { + List providers = this.getRouterChain() + .route(request, null); + List responses = new ArrayList<>(providers.size()); + List excepts = new ArrayList<>(providers.size()); + + for (ProviderInfo provider : providers) { + try { + SofaResponse response = this.doInvoke(request, provider); + responses.add(response); + } catch (SofaRpcException e) { + excepts.add(e); + LOG.warn("{}.(error {})", e.getMessage(), e.getErrorType()); + } + } + + if (responses.size() > 0) { + /* + * Just choose the first one as result to return, ignore others + * TODO: maybe more strategies should be provided + */ + return responses.get(0); + } else if (excepts.size() > 0) { + throw excepts.get(0); + } else { + assert providers.isEmpty(); + String method = methodName(request); + throw new SofaRpcException(RpcErrorType.CLIENT_ROUTER, + "No service provider for " + method); + } + } + + private SofaResponse doInvoke(SofaRequest request, + ProviderInfo providerInfo) { + try { + SofaResponse response = this.filterChain(providerInfo, request); + if (response != null) { + return response; + } + String method = methodName(request); + throw new SofaRpcException(RpcErrorType.CLIENT_UNDECLARED_ERROR, + "Failed to call " + method + " on remote server " + + providerInfo + ", return null response"); + } catch (Exception e) { + int error = RpcErrorType.CLIENT_UNDECLARED_ERROR; + if (e instanceof SofaRpcException) { + error = ((SofaRpcException) e).getErrorType(); + } + String method = methodName(request); + throw new SofaRpcException(error, + "Failed to call " + method + " on remote server " + + providerInfo + ", caused by exception: " + e); + } + } + + private static String methodName(SofaRequest request) { + return request.getInterfaceName() + "." + + request.getMethodName() + "()"; + } + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcException.java b/src/main/java/com/baidu/hugegraph/rpc/RpcException.java new file mode 100644 index 0000000000..2a2675ce43 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcException.java @@ -0,0 +1,41 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.rpc; + +public class RpcException extends RuntimeException { + + private static final long serialVersionUID = -6067652498161184537L; + + public RpcException(String message) { + super(message); + } + + public RpcException(String message, Throwable cause) { + super(message, cause); + } + + public RpcException(String message, Object... args) { + super(String.format(message, args)); + } + + public RpcException(String message, Throwable cause, Object... args) { + super(String.format(message, args), cause); + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java b/src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java new file mode 100644 index 0000000000..8bf0aea3a4 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcProviderConfig.java @@ -0,0 +1,85 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.rpc; + +import java.util.Map; + +import com.alipay.sofa.rpc.config.ProviderConfig; +import com.baidu.hugegraph.util.E; +import com.google.common.collect.Maps; + +public class RpcProviderConfig implements RpcServiceConfig4Server { + + private final Map> configs = Maps.newHashMap(); + + @Override + public String addService(Class clazz, S serviceImpl) { + return this.addService(null, clazz.getName(), serviceImpl); + } + + @Override + public String addService(String graph, + Class clazz, + S serviceImpl) { + return this.addService(graph, clazz.getName(), serviceImpl); + } + + private String addService(String graph, + String interfaceId, + S serviceImpl) { + ProviderConfig providerConfig = new ProviderConfig<>(); + String serviceId; + if (graph != null) { + serviceId = interfaceId + ":" + graph; + providerConfig.setId(serviceId).setUniqueId(graph); + } else { + serviceId = interfaceId; + } + + providerConfig.setInterfaceId(interfaceId) + .setRef(serviceImpl); + + E.checkArgument(!this.configs.containsKey(serviceId), + "Not allowed to add service already exist: '%s'", + serviceId); + this.configs.put(serviceId, providerConfig); + return serviceId; + } + + @Override + public void removeService(String serviceId) { + ProviderConfig config = this.configs.remove(serviceId); + E.checkArgument(config != null, + "The service '%s' doesn't exist", serviceId); + config.unExport(); + } + + @Override + public void removeAllService() { + for (ProviderConfig config : this.configs.values()) { + config.unExport(); + } + this.configs.clear(); + } + + public Map> configs() { + return this.configs; + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java new file mode 100644 index 0000000000..d158aea08f --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java @@ -0,0 +1,128 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.rpc; + +import java.util.Map; + +import org.apache.commons.collections.MapUtils; +import org.slf4j.Logger; + +import com.alipay.sofa.rpc.common.utils.StringUtils; +import com.alipay.sofa.rpc.config.ProviderConfig; +import com.alipay.sofa.rpc.config.ServerConfig; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.RpcOptions; +import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.Log; + +public class RpcServer { + + private static final Logger LOG = Log.logger(RpcServer.class); + + private final HugeConfig conf; + private final RpcProviderConfig configs; + private final ServerConfig serverConfig; + + public RpcServer(HugeConfig config) { + RpcCommonConfig.initRpcConfigs(config); + this.conf = config; + this.configs = new RpcProviderConfig(); + + String host = config.get(RpcOptions.RPC_SERVER_HOST); + if (StringUtils.isNotBlank(host)) { + int port = config.get(RpcOptions.RPC_SERVER_PORT); + this.serverConfig = new ServerConfig(); + this.serverConfig.setProtocol(config.get(RpcOptions.RPC_PROTOCOL)) + .setHost(host).setPort(port) + .setDaemon(false); + } else { + this.serverConfig = null; + } + } + + public boolean enabled() { + return this.serverConfig != null; + } + + public RpcProviderConfig config() { + this.checkEnabled(); + return this.configs; + } + + public String host() { + this.checkEnabled(); + return this.serverConfig.getBoundHost(); + } + + public int port() { + this.checkEnabled(); + return this.serverConfig.getPort(); + } + + public void exportAll() { + this.checkEnabled(); + LOG.debug("RpcServer starting on port {}", this.port()); + Map> configs = this.configs.configs(); + if (MapUtils.isEmpty(configs)) { + LOG.info("RpcServer config is empty, skip starting RpcServer"); + return; + } + int timeout = this.conf.get(RpcOptions.RPC_SERVER_TIMEOUT) * 1000; + for (ProviderConfig providerConfig : configs.values()) { + providerConfig.setServer(this.serverConfig) + .setTimeout(timeout) + .export(); + } + LOG.info("RpcServer started success on port {}", this.port()); + } + + public void unexportAll() { + this.configs.removeAllService(); + } + + public void unexport(String serviceId) { + this.configs.removeService(serviceId); + } + + public void destroy() { + if (!this.enabled()) { + return; + } + LOG.info("RpcServer stop on port {}", this.port()); + for (ProviderConfig config : this.configs.configs().values()) { + Object service = config.getRef(); + if (service instanceof AutoCloseable) { + try { + ((AutoCloseable) service).close(); + } catch (Exception e) { + LOG.warn("Failed to close service {}", service, e); + } + } + } + this.configs.removeAllService(); + this.serverConfig.destroy(); + } + + private void checkEnabled() { + E.checkArgument(this.enabled(), + "RpcServer is not enabled, please config option '%s'", + RpcOptions.RPC_SERVER_HOST.name()); + } +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java new file mode 100644 index 0000000000..13cfca96f0 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Client.java @@ -0,0 +1,37 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.rpc; + +public interface RpcServiceConfig4Client { + + public T serviceProxy(String interfaceId); + + public T serviceProxy(String graph, String interfaceId); + + public default T serviceProxy(Class clazz) { + return this.serviceProxy(clazz.getName()); + } + + public default T serviceProxy(String graph, Class clazz) { + return this.serviceProxy(graph, clazz.getName()); + } + + public void removeAllServiceProxy(); +} diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java new file mode 100644 index 0000000000..7139073cf3 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServiceConfig4Server.java @@ -0,0 +1,32 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.rpc; + +public interface RpcServiceConfig4Server { + + public String addService(Class clazz, S serviceImpl); + + public String addService(String graph, + Class clazz, S serviceImpl); + + public void removeService(String serviceId); + + public void removeAllService(); +} diff --git a/src/main/java/com/baidu/hugegraph/version/RpcVersion.java b/src/main/java/com/baidu/hugegraph/version/RpcVersion.java new file mode 100644 index 0000000000..884cc260e2 --- /dev/null +++ b/src/main/java/com/baidu/hugegraph/version/RpcVersion.java @@ -0,0 +1,31 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.version; + +import com.baidu.hugegraph.util.VersionUtil.Version; + +public class RpcVersion { + + public static final String NAME = "hugegraph-rpc"; + + // The second parameter of Version.of() is for all-in-one JAR + public static final Version VERSION = Version.of(RpcVersion.class, + "1.0.0"); +} diff --git a/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java b/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java new file mode 100644 index 0000000000..cdbdb03b45 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java @@ -0,0 +1,58 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.unit; + +import java.net.URL; + +import org.junit.BeforeClass; + +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.config.OptionSpace; +import com.baidu.hugegraph.rpc.RpcServer; + +public class BaseUnitTest { + + @BeforeClass + public static void initEnv() { + OptionSpace.register("rpc", "com.baidu.hugegraph.config.RpcOptions"); + } + + protected static HugeConfig config(boolean server) { + return config(server ? "server" : "client"); + } + + protected static HugeConfig config(String type) { + String name = String.format("rpc-%s.properties", type); + URL conf = BaseUnitTest.class.getClassLoader().getResource(name); + return new HugeConfig(conf.getPath()); + } + + protected static void startServer(RpcServer rpcServer) { + rpcServer.config().configs().values().forEach(c -> { + c.setRepeatedExportLimit(100); + }); + + rpcServer.exportAll(); + } + + protected static void stopServer(RpcServer rpcServer) { + rpcServer.destroy(); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java b/src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java new file mode 100644 index 0000000000..ade219804b --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/ExceptionTest.java @@ -0,0 +1,58 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.unit; + +import org.junit.Test; + +import com.baidu.hugegraph.rpc.RpcException; +import com.baidu.hugegraph.testutil.Assert; + +public class ExceptionTest { + + @Test + public void testExceptionWithMessage() { + RpcException e = new RpcException("test"); + Assert.assertEquals("test", e.getMessage()); + Assert.assertEquals(null, e.getCause()); + } + + @Test + public void testExceptionWithMessageAndCause() { + Exception cause = new Exception(); + RpcException e = new RpcException("test", cause); + Assert.assertEquals("test", e.getMessage()); + Assert.assertEquals(cause, e.getCause()); + } + + @Test + public void testExceptionWithMessageAndArgs() { + RpcException e = new RpcException("test %s", 168); + Assert.assertEquals("test 168", e.getMessage()); + Assert.assertEquals(null, e.getCause()); + } + + @Test + public void testExceptionWithMessageAndArgsAndCause() { + Exception cause = new Exception(); + RpcException e = new RpcException("test %s", cause, 168); + Assert.assertEquals("test 168", e.getMessage()); + Assert.assertEquals(cause, e.getCause()); + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java b/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java new file mode 100644 index 0000000000..65b24c86ef --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java @@ -0,0 +1,710 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.unit; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.alipay.sofa.rpc.common.RpcOptions; +import com.alipay.sofa.rpc.core.exception.SofaRpcException; +import com.alipay.sofa.rpc.core.exception.SofaRpcRuntimeException; +import com.baidu.hugegraph.config.HugeConfig; +import com.baidu.hugegraph.rpc.RpcClientProvider; +import com.baidu.hugegraph.rpc.RpcCommonConfig; +import com.baidu.hugegraph.rpc.RpcConsumerConfig; +import com.baidu.hugegraph.rpc.RpcProviderConfig; +import com.baidu.hugegraph.rpc.RpcServer; +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.testutil.Whitebox; +import com.baidu.hugegraph.util.E; +import com.google.common.collect.ImmutableMap; + +public class ServerClientTest extends BaseUnitTest { + + private static RpcServer rpcServer; + private static RpcClientProvider rpcClient; + + @BeforeClass + public static void init() { + rpcServer = new RpcServer(config(true)); + rpcClient = new RpcClientProvider(config(false)); + } + + @AfterClass + public static void clear() throws Exception { + if (rpcClient != null) { + rpcClient.destroy(); + } + if (rpcServer != null) { + rpcServer.destroy(); + } + } + + @After + public void teardown() { + if (rpcClient != null) { + rpcClient.unreferAll(); + } + if (rpcServer != null) { + rpcServer.unexportAll(); + } + } + + @Test + public void testSimpleService() { + // Init server + RpcProviderConfig serverConfig = rpcServer.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + startServer(rpcServer); + + // Init client + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + + // Test call + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("tom", client.echo("tom")); + Assert.assertEquals(5.14, client.sum(2, 3.14), 0.00000001d); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + client.hello(""); + }, e -> { + Assert.assertContains("empty hello parameter", e.getMessage()); + }); + } + + @Test + public void testMultiService() { + // Init server + GraphHelloServiceImpl g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl g2 = new GraphHelloServiceImpl("g2"); + GraphHelloServiceImpl g3 = new GraphHelloServiceImpl("g3"); + + RpcProviderConfig serverConfig = rpcServer.config(); + serverConfig.addService(g1.graph(), HelloService.class, g1); + serverConfig.addService(g2.graph(), HelloService.class, g2); + serverConfig.addService(g3.graph(), HelloService.class, g3); + startServer(rpcServer); + + // Init client + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService c1 = clientConfig.serviceProxy("g1", HelloService.class); + HelloService c2 = clientConfig.serviceProxy("g2", HelloService.class); + HelloService c3 = clientConfig.serviceProxy("g3", HelloService.class); + + // Test call + Assert.assertEquals("g1: hello tom!", c1.hello("tom")); + Assert.assertEquals("g1: tom", c1.echo("tom")); + Assert.assertEquals(5.14, c1.sum(2, 3.14), 0.00000001d); + + Assert.assertEquals("g2: hello tom!", c2.hello("tom")); + Assert.assertEquals("g2: tom", c2.echo("tom")); + Assert.assertEquals(6.14, c2.sum(3, 3.14), 0.00000001d); + + Assert.assertEquals("g3: hello tom!", c3.hello("tom")); + Assert.assertEquals("g3: tom", c3.echo("tom")); + Assert.assertEquals(103.14, c3.sum(100, 3.14), 0.00000001d); + + Assert.assertEquals(5.14, g1.result(), 0.00000001d); + Assert.assertEquals(6.14, g2.result(), 0.00000001d); + Assert.assertEquals(103.14, g3.result(), 0.00000001d); + } + + @Test + public void testStartBothServerAndClientThroughSameConfig() { + // Init server1 + HugeConfig server1 = config("server1-client"); + RpcServer rpcServer1 = new RpcServer(server1); + RpcClientProvider rpcClient1 = new RpcClientProvider(server1); + + GraphHelloServiceImpl s1g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s1g2 = new GraphHelloServiceImpl("g2"); + + rpcServer1.config().addService(s1g1.graph(), HelloService.class, s1g1); + rpcServer1.config().addService(s1g2.graph(), HelloService.class, s1g2); + + startServer(rpcServer1); + + // Init server2 + HugeConfig server2 = config("server2-client"); + RpcServer rpcServer2 = new RpcServer(server2); + RpcClientProvider rpcClient2 = new RpcClientProvider(server2); + + GraphHelloServiceImpl s2g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s2g2 = new GraphHelloServiceImpl("g2"); + + rpcServer2.config().addService(s2g1.graph(), HelloService.class, s2g1); + rpcServer2.config().addService(s2g2.graph(), HelloService.class, s2g2); + + startServer(rpcServer2); + + // Init client1 + HelloService s2g1Client = rpcClient1.config().serviceProxy( + "g1", HelloService.class); + HelloService s2g2Client = rpcClient1.config().serviceProxy( + "g2", HelloService.class); + + // Init client2 + HelloService s1g1Client = rpcClient2.config().serviceProxy( + "g1", HelloService.class); + HelloService s1g2Client = rpcClient2.config().serviceProxy( + "g2", HelloService.class); + + // Test call + Assert.assertEquals(2.1, s2g1Client.sum(1, 1.1), 0.00000001d); + Assert.assertEquals(2.2, s2g2Client.sum(1, 1.2), 0.00000001d); + + Assert.assertEquals(1.1, s1g1Client.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(1.2, s1g2Client.sum(0, 1.2), 0.00000001d); + + Assert.assertEquals(1.1, s1g1.result(), 0.00000001d); + Assert.assertEquals(1.2, s1g2.result(), 0.00000001d); + Assert.assertEquals(2.1, s2g1.result(), 0.00000001d); + Assert.assertEquals(2.2, s2g2.result(), 0.00000001d); + + // Destroy all + rpcClient1.destroy(); + rpcClient2.destroy(); + stopServer(rpcServer1); + stopServer(rpcServer2); + } + + @Test + public void testFanoutCallService() { + // Init 3 servers + HugeConfig server3 = config("server3"); + RpcServer rpcServer3 = new RpcServer(server3); + + HugeConfig server4 = config("server4"); + RpcServer rpcServer4 = new RpcServer(server4); + + HugeConfig server5 = config("server5"); + RpcServer rpcServer5 = new RpcServer(server5); + + GraphHelloServiceImpl s3g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s4g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s5g1 = new GraphHelloServiceImpl("g1"); + + rpcServer3.config().addService(s3g1.graph(), HelloService.class, s3g1); + rpcServer4.config().addService(s4g1.graph(), HelloService.class, s4g1); + rpcServer5.config().addService(s5g1.graph(), HelloService.class, s5g1); + + startServer(rpcServer3); + startServer(rpcServer4); + startServer(rpcServer5); + + // Init client + HugeConfig client345 = config("client345"); + RpcClientProvider rpcClient345 = new RpcClientProvider(client345); + + HelloService g1 = rpcClient345.config() + .serviceProxy("g1", HelloService.class); + + // Test fanout + Assert.assertEquals("g1: fanout", g1.echo("fanout")); + Assert.assertEquals(16.8, g1.sum(10, 6.8), 0.00000001d); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + g1.hello(""); + }, e -> { + Assert.assertContains("empty hello parameter", e.getMessage()); + }); + + Assert.assertEquals(16.8, s3g1.result(), 0.00000001d); + Assert.assertEquals(16.8, s4g1.result(), 0.00000001d); + Assert.assertEquals(16.8, s5g1.result(), 0.00000001d); + + // Destroy all + rpcClient345.destroy(); + + stopServer(rpcServer3); + stopServer(rpcServer4); + stopServer(rpcServer5); + } + + @Test + public void testFanoutCallServiceWithError() { + // Init 3 servers + HugeConfig server3 = config("server3"); + RpcServer rpcServer3 = new RpcServer(server3); + + HugeConfig server4 = config("server4"); + RpcServer rpcServer4 = new RpcServer(server4); + + HugeConfig server5 = config("server5"); + RpcServer rpcServer5 = new RpcServer(server5); + + GraphHelloServiceImpl s3g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s4g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s5g1 = new GraphHelloServiceImpl("g1"); + + rpcServer3.config().addService(s3g1.graph(), HelloService.class, s3g1); + rpcServer4.config().addService(s4g1.graph(), HelloService.class, s4g1); + rpcServer5.config().addService(s5g1.graph(), HelloService.class, s5g1); + + startServer(rpcServer3); + startServer(rpcServer4); + startServer(rpcServer5); + + // Init client with one server unavailable + HugeConfig client346 = config("client346"); + RpcClientProvider rpcClient346 = new RpcClientProvider(client346); + + HelloService g1 = rpcClient346.config() + .serviceProxy("g1", HelloService.class); + + // Test fanout with one failed + Assert.assertEquals("g1: fanout", g1.echo("fanout")); + Assert.assertEquals(16.8, g1.sum(10, 6.8), 0.00000001d); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + g1.hello(""); + }, e -> { + Assert.assertContains("empty hello parameter", e.getMessage()); + }); + + Assert.assertEquals(16.8, s3g1.result(), 0.00000001d); + Assert.assertEquals(16.8, s4g1.result(), 0.00000001d); + Assert.assertEquals(0.0, s5g1.result(), 0.00000001d); + + s3g1.resetResult(); + s4g1.resetResult(); + s5g1.resetResult(); + + // Init client with all servers unavailable + HugeConfig client67 = config("client67"); + RpcClientProvider rpcClient67 = new RpcClientProvider(client67); + + HelloService g67 = rpcClient67.config() + .serviceProxy("g1", HelloService.class); + + // Test fanout with all failed + Assert.assertThrows(SofaRpcException.class, () -> { + g67.echo("fanout"); + }, e -> { + Assert.assertContains("Failed to call", e.getMessage()); + Assert.assertContains("echo() on remote server", e.getMessage()); + }); + + Assert.assertEquals(0.0, s3g1.result(), 0.00000001d); + Assert.assertEquals(0.0, s4g1.result(), 0.00000001d); + Assert.assertEquals(0.0, s5g1.result(), 0.00000001d); + + // Init client with none service provider + RpcClientProvider rpcClient0 = new RpcClientProvider(client67); + Whitebox.setInternalState(rpcClient0, "consumerConfig.remoteUrls", + ""); + HelloService g0 = rpcClient0.config() + .serviceProxy("g1", HelloService.class); + + Assert.assertThrows(SofaRpcException.class, () -> { + g0.echo("fanout"); + }, e -> { + Assert.assertContains("No service provider for", e.getMessage()); + }); + + // Destroy all + rpcClient346.destroy(); + rpcClient67.destroy(); + + stopServer(rpcServer3); + stopServer(rpcServer4); + stopServer(rpcServer5); + } + + @Test + public void testLoadBalancer() { + // Init 3 servers + HugeConfig server3 = config("server3"); + RpcServer rpcServer3 = new RpcServer(server3); + + HugeConfig server4 = config("server4"); + RpcServer rpcServer4 = new RpcServer(server4); + + HugeConfig server5 = config("server5"); + RpcServer rpcServer5 = new RpcServer(server5); + + GraphHelloServiceImpl s3g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s4g1 = new GraphHelloServiceImpl("g1"); + GraphHelloServiceImpl s5g1 = new GraphHelloServiceImpl("g1"); + + rpcServer3.config().addService(HelloService.class, s3g1); + rpcServer4.config().addService(HelloService.class, s4g1); + rpcServer5.config().addService(HelloService.class, s5g1); + + startServer(rpcServer3); + startServer(rpcServer4); + startServer(rpcServer5); + + // Test LB "consistentHash" + HugeConfig clientLB = config("client-lb"); + RpcClientProvider rpcClientCHash = new RpcClientProvider(clientLB); + HelloService cHash = rpcClientCHash.config() + .serviceProxy(HelloService.class); + + Assert.assertEquals("g1: load", cHash.echo("load")); + Assert.assertEquals(16.8, cHash.sum(10, 6.8), 0.00000001d); + Assert.assertEquals(16.8, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", cHash.echo("load")); + Assert.assertEquals(16.8, cHash.sum(10, 6.8), 0.00000001d); + Assert.assertEquals(16.8, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", cHash.echo("load")); + Assert.assertEquals(16.8, cHash.sum(10, 6.8), 0.00000001d); + Assert.assertEquals(16.8, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + s3g1.resetResult(); + s4g1.resetResult(); + s5g1.resetResult(); + + // Test LB "roundRobin" + String lbKey = com.baidu.hugegraph.config + .RpcOptions.RPC_CLIENT_LOAD_BALANCER.name(); + clientLB.setProperty(lbKey, "roundRobin"); + RpcClientProvider rpcClientRound = new RpcClientProvider(clientLB); + HelloService round = rpcClientRound.config() + .serviceProxy(HelloService.class); + + Assert.assertEquals("g1: load", round.echo("load")); + Assert.assertEquals(1.1, round.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(1.1, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", round.echo("load")); + Assert.assertEquals(1.1, round.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(2.2, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", round.echo("load")); + Assert.assertEquals(1.1, round.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(3.3, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + s3g1.resetResult(); + s4g1.resetResult(); + s5g1.resetResult(); + + // Test LB "random" + clientLB.setProperty(lbKey, "random"); + RpcClientProvider rpcClientRandom = new RpcClientProvider(clientLB); + HelloService random = rpcClientRandom.config() + .serviceProxy(HelloService.class); + + Assert.assertEquals("g1: load", random.echo("load")); + Assert.assertEquals(1.1, random.sum(1, 0.1), 0.00000001d); + Assert.assertEquals(1.1, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + Assert.assertEquals("g1: load", random.echo("load")); + Assert.assertEquals(1.1, random.sum(1, 0.1), 0.00000001d); + double sum = s3g1.result() + s4g1.result() + s5g1.result(); + Assert.assertTrue(2.2 == sum || 1.1 == sum); + + Assert.assertEquals("g1: load", random.echo("load")); + Assert.assertEquals(1.1, random.sum(1, 0.1), 0.00000001d); + double sum2 = s3g1.result() + s4g1.result() + s5g1.result(); + Assert.assertTrue(sum == sum2 || sum + 1.1 == sum2); + + for (int i = 0; i < 9; i++) { + Assert.assertEquals(1.1, random.sum(1, 0.1), 0.00000001d); + } + Assert.assertEquals(3.3, s3g1.result() + s4g1.result() + s5g1.result(), + 0.00000001d); + + s3g1.resetResult(); + s4g1.resetResult(); + s5g1.resetResult(); + + // Destroy all + rpcClientCHash.destroy(); + rpcClientRound.destroy(); + rpcClientRandom.destroy(); + + stopServer(rpcServer3); + stopServer(rpcServer4); + stopServer(rpcServer5); + } + + @Test + public void testServiceProxy() { + // Init server + RpcProviderConfig serverConfig = rpcServer.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + serverConfig.addService("graph", HelloService.class, + new GraphHelloServiceImpl("graph")); + startServer(rpcServer); + + // Init client + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + HelloService client2 = clientConfig.serviceProxy(HelloService.class); + HelloService clientG = clientConfig.serviceProxy("graph", + HelloService.class); + + // Test call + Assert.assertNotEquals(client, client2); + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("hello tom!", client2.hello("tom")); + Assert.assertEquals("graph: hello tom!", clientG.hello("tom")); + + // Test call after unrefer + rpcClient.unreferAll(); + + Assert.assertThrows(SofaRpcRuntimeException.class, () -> { + client.hello("tom"); + }); + Assert.assertThrows(SofaRpcRuntimeException.class, () -> { + client2.hello("tom"); + }); + Assert.assertThrows(SofaRpcRuntimeException.class, () -> { + clientG.hello("tom"); + }); + } + + @Test + public void testAddServiceMultiTimesOfSameService() { + RpcServer rpcServerExport = new RpcServer(config(true)); + + rpcServerExport.config().addService(HelloService.class, + new HelloServiceImpl()); + + Assert.assertThrows(IllegalArgumentException.class, () -> { + rpcServerExport.config().addService(HelloService.class, + new HelloServiceImpl()); + }, e -> { + Assert.assertContains("Not allowed to add service already exist", + e.getMessage()); + }); + + rpcServerExport.exportAll(); + + stopServer(rpcServerExport); + } + + @Test + public void testExportMultiTimesOfSameServer() { + RpcServer rpcServerExport = new RpcServer(config(true)); + rpcServerExport.config().addService(HelloService.class, + new HelloServiceImpl()); + rpcServerExport.exportAll(); + rpcServerExport.exportAll(); + + stopServer(rpcServerExport); + } + + @Test + public void testExportMultiTimesOfSameService() { + RpcServer rpcServerExport = new RpcServer(config(true)); + rpcServerExport.config().addService(HelloService.class, + new HelloServiceImpl()); + rpcServerExport.exportAll(); + + rpcServerExport.config().addService("graph", HelloService.class, + new HelloServiceImpl()); + rpcServerExport.exportAll(); + + stopServer(rpcServerExport); + } + + @Test + public void testExportNoneService() { + RpcServer rpcServerNoneService = new RpcServer(config(true)); + + // Will be ignored if none service added + rpcServerNoneService.exportAll(); + + stopServer(rpcServerNoneService); + } + + @Test + public void testUnexportService() { + RpcServer rpcServerUnexport = new RpcServer(config(true)); + + RpcProviderConfig serverConfig = rpcServerUnexport.config(); + String service = serverConfig.addService(HelloService.class, + new HelloServiceImpl()); + rpcServerUnexport.exportAll(); + + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + + Assert.assertEquals("hello tom!", client.hello("tom")); + + rpcServerUnexport.unexport(service); + + Assert.assertThrows(SofaRpcException.class, () -> { + client.hello("tom"); + }); + + stopServer(rpcServerUnexport); + } + + @Test + public void testUnexportAllService() { + RpcServer rpcServerUnexport = new RpcServer(config(true)); + + RpcProviderConfig serverConfig = rpcServerUnexport.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + serverConfig.addService("graph", HelloService.class, + new GraphHelloServiceImpl("graph")); + rpcServerUnexport.exportAll(); + + RpcConsumerConfig clientConfig = rpcClient.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + HelloService clientG = clientConfig.serviceProxy("graph", + HelloService.class); + + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("graph: hello tom!", clientG.hello("tom")); + + rpcServerUnexport.unexportAll(); + + Assert.assertThrows(SofaRpcException.class, () -> { + client.hello("tom"); + }); + Assert.assertThrows(SofaRpcException.class, () -> { + clientG.hello("tom"); + }); + + stopServer(rpcServerUnexport); + } + + @Test + public void testUnexportNotExistService() { + Assert.assertThrows(IllegalArgumentException.class, () -> { + rpcServer.unexport("fake"); + }, e -> { + Assert.assertContains("The service 'fake' doesn't exist", + e.getMessage()); + }); + } + + @Test + public void testServerDisabled() { + HugeConfig clientConf = config(false); + RpcServer rpcServerDisabled = new RpcServer(clientConf); + + Assert.assertFalse(rpcServerDisabled.enabled()); + Assert.assertThrows(IllegalArgumentException.class, () -> { + rpcServerDisabled.config(); + }, e -> { + Assert.assertContains("RpcServer is not enabled", e.getMessage()); + }); + + stopServer(rpcServerDisabled); + } + + @Test + public void testClientDisabled() { + HugeConfig serverConf = config(true); + RpcClientProvider rpcClientDisabled = new RpcClientProvider(serverConf); + + Assert.assertFalse(rpcClientDisabled.enabled()); + Assert.assertThrows(IllegalArgumentException.class, () -> { + rpcClientDisabled.config(); + }, e -> { + Assert.assertContains("RpcClient is not enabled", e.getMessage()); + }); + + rpcClientDisabled.destroy(); + } + + @Test + public void testInitRpcConfigs() { + ImmutableMap fixedOptions = ImmutableMap.of( + RpcOptions.PROVIDER_REPEATED_EXPORT_LIMIT, 1); + RpcCommonConfig.initRpcConfigs(fixedOptions); + + RpcCommonConfig.initRpcConfigs(RpcOptions.CONSUMER_RETRIES, 2); + } + + public static interface HelloService { + + public String hello(String string); + + public String echo(String string); + + public double sum(long a, double b); + } + + public static class HelloServiceImpl implements HelloService { + + @Override + public String hello(String string) { + E.checkArgument(!string.isEmpty(), "empty hello parameter"); + return "hello " + string + "!"; + } + + @Override + public String echo(String string) { + return string; + } + + @Override + public double sum(long a, double b) { + return a + b; + } + } + + public static class GraphHelloServiceImpl implements HelloService { + + private final String graph; + private double result; + + public GraphHelloServiceImpl(String graph) { + this.graph = graph; + } + + public String graph() { + return this.graph; + } + + public void resetResult() { + this.result = 0.0; + } + + public double result() { + return this.result; + } + + @Override + public String hello(String string) { + E.checkArgument(!string.isEmpty(), "empty hello parameter"); + return this.graph + ": hello " + string + "!"; + } + + @Override + public String echo(String string) { + return this.graph + ": " + string; + } + + @Override + public double sum(long a, double b) { + this.result = a + b; + return this.result; + } + } +} diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java new file mode 100644 index 0000000000..79446602a9 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java @@ -0,0 +1,32 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.unit; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + VersionTest.class, + ExceptionTest.class, + ServerClientTest.class +}) +public class UnitTestSuite { +} diff --git a/src/test/java/com/baidu/hugegraph/unit/VersionTest.java b/src/test/java/com/baidu/hugegraph/unit/VersionTest.java new file mode 100644 index 0000000000..e603f22ba4 --- /dev/null +++ b/src/test/java/com/baidu/hugegraph/unit/VersionTest.java @@ -0,0 +1,38 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package com.baidu.hugegraph.unit; + +import org.junit.Test; + +import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.util.VersionUtil; +import com.baidu.hugegraph.version.RpcVersion; + +public class VersionTest { + + @Test + public void testGetCommonVersion() { + String pomVersion = VersionUtil.getPomVersion(); + Assert.assertNotNull(pomVersion); + String version = RpcVersion.VERSION.get(); + Assert.assertNotNull(version); + Assert.assertEquals(pomVersion, version); + } +} diff --git a/src/test/resources/log4j2.xml b/src/test/resources/log4j2.xml new file mode 100644 index 0000000000..f69acfd1b7 --- /dev/null +++ b/src/test/resources/log4j2.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/rpc-client-lb.properties b/src/test/resources/rpc-client-lb.properties new file mode 100644 index 0000000000..fb8cad866d --- /dev/null +++ b/src/test/resources/rpc-client-lb.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8093,127.0.0.1:8094,127.0.0.1:8095 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-client.properties b/src/test/resources/rpc-client.properties new file mode 100644 index 0000000000..16b23f333f --- /dev/null +++ b/src/test/resources/rpc-client.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-client345.properties b/src/test/resources/rpc-client345.properties new file mode 100644 index 0000000000..1a4fa00271 --- /dev/null +++ b/src/test/resources/rpc-client345.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8093,127.0.0.1:8094,127.0.0.1:8095 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-client346.properties b/src/test/resources/rpc-client346.properties new file mode 100644 index 0000000000..dbcede57a4 --- /dev/null +++ b/src/test/resources/rpc-client346.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8093,127.0.0.1:8094,127.0.0.1:8096 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-client67.properties b/src/test/resources/rpc-client67.properties new file mode 100644 index 0000000000..692d7cefc9 --- /dev/null +++ b/src/test/resources/rpc-client67.properties @@ -0,0 +1,9 @@ +#rpc.server_host=127.0.0.1 +#rpc.server_port=8090 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8096,127.0.0.1:8097 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server.properties b/src/test/resources/rpc-server.properties new file mode 100644 index 0000000000..a22bf7ee1d --- /dev/null +++ b/src/test/resources/rpc-server.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8090 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server1-client.properties b/src/test/resources/rpc-server1-client.properties new file mode 100644 index 0000000000..a3907584d9 --- /dev/null +++ b/src/test/resources/rpc-server1-client.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8091 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8092 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server2-client.properties b/src/test/resources/rpc-server2-client.properties new file mode 100644 index 0000000000..e0298ed76f --- /dev/null +++ b/src/test/resources/rpc-server2-client.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8092 +#rpc.server_timeout=30 +rpc.remote_url=127.0.0.1:8091 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server3.properties b/src/test/resources/rpc-server3.properties new file mode 100644 index 0000000000..004757cb4b --- /dev/null +++ b/src/test/resources/rpc-server3.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8093 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server4.properties b/src/test/resources/rpc-server4.properties new file mode 100644 index 0000000000..607b751b4d --- /dev/null +++ b/src/test/resources/rpc-server4.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8094 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server5.properties b/src/test/resources/rpc-server5.properties new file mode 100644 index 0000000000..dbeb1e97a2 --- /dev/null +++ b/src/test/resources/rpc-server5.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8095 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash From 6c800388a1f0f9b064b30ba3eca34a0153161f5d Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Thu, 25 Mar 2021 14:06:05 +0800 Subject: [PATCH 4/8] support random port to start rpc server (#2) * add rpc.server_adaptive_port option * use bolt v1.6.2 instead of v1.5.6 to get RemotingServer.port() --- pom.xml | 11 +++ .../baidu/hugegraph/config/RpcOptions.java | 13 +++- .../com/baidu/hugegraph/rpc/RpcServer.java | 21 +++++ .../hugegraph/unit/ServerClientTest.java | 77 +++++++++++++++++++ .../resources/rpc-server-adaptive.properties | 10 +++ .../resources/rpc-server-random.properties | 9 +++ 6 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/rpc-server-adaptive.properties create mode 100644 src/test/resources/rpc-server-random.properties diff --git a/pom.xml b/pom.xml index c89a586cc7..23e13fb8b8 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,17 @@ disruptor 3.3.7 + + com.alipay.sofa + bolt + 1.6.2 + + + org.slf4j + slf4j-api + + + com.alipay.sofa sofa-rpc-all diff --git a/src/main/java/com/baidu/hugegraph/config/RpcOptions.java b/src/main/java/com/baidu/hugegraph/config/RpcOptions.java index 482b570580..d58673cc90 100644 --- a/src/main/java/com/baidu/hugegraph/config/RpcOptions.java +++ b/src/main/java/com/baidu/hugegraph/config/RpcOptions.java @@ -52,10 +52,21 @@ public static synchronized RpcOptions instance() { new ConfigOption<>( "rpc.server_port", "The port bound by rpc server to provide services.", - rangeInt(1, Integer.MAX_VALUE), + rangeInt(0, Integer.MAX_VALUE), 8090 ); + public static final ConfigOption RPC_ADAPTIVE_PORT = + new ConfigOption<>( + "rpc.server_adaptive_port", + "Whether the bound port is adaptive, if it's enabled, " + + "when the port is in use, automatically +1 to detect " + + "the next available port. Note that this process is " + + "not atomic, so there may still be port conflicts.", + disallowEmpty(), + false + ); + public static final ConfigOption RPC_SERVER_TIMEOUT = new ConfigOption<>( "rpc.server_timeout", diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java index d158aea08f..1118d37e02 100644 --- a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java @@ -24,11 +24,15 @@ import org.apache.commons.collections.MapUtils; import org.slf4j.Logger; +import com.alipay.remoting.RemotingServer; import com.alipay.sofa.rpc.common.utils.StringUtils; import com.alipay.sofa.rpc.config.ProviderConfig; import com.alipay.sofa.rpc.config.ServerConfig; +import com.alipay.sofa.rpc.server.Server; +import com.alipay.sofa.rpc.server.bolt.BoltServer; import com.baidu.hugegraph.config.HugeConfig; import com.baidu.hugegraph.config.RpcOptions; +import com.baidu.hugegraph.testutil.Whitebox; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; @@ -48,9 +52,11 @@ public RpcServer(HugeConfig config) { String host = config.get(RpcOptions.RPC_SERVER_HOST); if (StringUtils.isNotBlank(host)) { int port = config.get(RpcOptions.RPC_SERVER_PORT); + boolean adaptivePort = config.get(RpcOptions.RPC_ADAPTIVE_PORT); this.serverConfig = new ServerConfig(); this.serverConfig.setProtocol(config.get(RpcOptions.RPC_PROTOCOL)) .setHost(host).setPort(port) + .setAdaptivePort(adaptivePort) .setDaemon(false); } else { this.serverConfig = null; @@ -73,6 +79,21 @@ public String host() { public int port() { this.checkEnabled(); + Server server = this.serverConfig.getServer(); + if (server instanceof BoltServer && server.isStarted()) { + /* + * When using random port 0, try to fetch the actual port + * NOTE: RemotingServer.port() would return the actual port only + * if sofa-bolt version >= 1.6.1, please see: + * https://github.com/sofastack/sofa-bolt/issues/196 + * TODO: remove this code after adding Server.port() interface: + * https://github.com/sofastack/sofa-rpc/issues/1022 + */ + RemotingServer rs = Whitebox.getInternalState(server, + "remotingServer"); + return rs.port(); + } + // When using random port 0, the returned port is not the actual port return this.serverConfig.getPort(); } diff --git a/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java b/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java index 65b24c86ef..28fe564d8b 100644 --- a/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/ServerClientTest.java @@ -19,6 +19,10 @@ package com.baidu.hugegraph.unit; +import java.io.IOException; +import java.net.InetAddress; +import java.net.ServerSocket; + import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -129,6 +133,79 @@ public void testMultiService() { Assert.assertEquals(103.14, g3.result(), 0.00000001d); } + @Test + public void testStartServerWithRandomPort() { + // Init server + RpcServer rpcServerRandom = new RpcServer(config("server-random")); + RpcProviderConfig serverConfig = rpcServerRandom.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + startServer(rpcServerRandom); + + Assert.assertNotEquals(0, rpcServerRandom.port()); + Assert.assertNotEquals(8090, rpcServerRandom.port()); + + // Init client + HugeConfig config = config(false); + String url = rpcServerRandom.host() + ":" + rpcServerRandom.port(); + String remoteUrlKey = com.baidu.hugegraph.config + .RpcOptions.RPC_REMOTE_URL.name(); + config.setProperty(remoteUrlKey, url); + RpcClientProvider rpcClientRandom = new RpcClientProvider(config); + + RpcConsumerConfig clientConfig = rpcClientRandom.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + + // Test call + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("tom", client.echo("tom")); + Assert.assertEquals(5.14, client.sum(2, 3.14), 0.00000001d); + + // Destroy all + rpcClientRandom.destroy(); + stopServer(rpcServerRandom); + } + + @Test + public void testStartServerWithAdaptivePort() throws IOException { + // Init server + RpcServer rpcServerAdaptive = new RpcServer(config("server-adaptive")); + RpcProviderConfig serverConfig = rpcServerAdaptive.config(); + serverConfig.addService(HelloService.class, new HelloServiceImpl()); + + // Start other server bound the port + int usedPort = rpcServerAdaptive.port(); + InetAddress ip = InetAddress.getByName(rpcServerAdaptive.host()); + ServerSocket inUse = new ServerSocket(usedPort,50, ip); + + // Start server after the port in use + startServer(rpcServerAdaptive); + + Assert.assertNotEquals(0, rpcServerAdaptive.port()); + Assert.assertNotEquals(usedPort, rpcServerAdaptive.port()); + + // Init client + HugeConfig config = config(false); + String url = rpcServerAdaptive.host() + ":" + rpcServerAdaptive.port(); + String remoteUrlKey = com.baidu.hugegraph.config + .RpcOptions.RPC_REMOTE_URL.name(); + config.setProperty(remoteUrlKey, url); + RpcClientProvider rpcClientAdaptive = new RpcClientProvider(config); + + RpcConsumerConfig clientConfig = rpcClientAdaptive.config(); + HelloService client = clientConfig.serviceProxy(HelloService.class); + + // Test call + Assert.assertEquals("hello tom!", client.hello("tom")); + Assert.assertEquals("tom", client.echo("tom")); + Assert.assertEquals(5.14, client.sum(2, 3.14), 0.00000001d); + + // Destroy all + rpcClientAdaptive.destroy(); + stopServer(rpcServerAdaptive); + + inUse.close(); + } + @Test public void testStartBothServerAndClientThroughSameConfig() { // Init server1 diff --git a/src/test/resources/rpc-server-adaptive.properties b/src/test/resources/rpc-server-adaptive.properties new file mode 100644 index 0000000000..ae92732d31 --- /dev/null +++ b/src/test/resources/rpc-server-adaptive.properties @@ -0,0 +1,10 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=8098 +rpc.server_adaptive_port=true +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash diff --git a/src/test/resources/rpc-server-random.properties b/src/test/resources/rpc-server-random.properties new file mode 100644 index 0000000000..5be8331dc7 --- /dev/null +++ b/src/test/resources/rpc-server-random.properties @@ -0,0 +1,9 @@ +rpc.server_host=127.0.0.1 +rpc.server_port=0 +#rpc.server_timeout=30 +#rpc.remote_url=127.0.0.1:8090 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash From 3881b866977e4464ec018709a2a78cd3a5bda091 Mon Sep 17 00:00:00 2001 From: coderzc Date: Wed, 28 Jul 2021 11:23:55 +0800 Subject: [PATCH 5/8] fix: unable to close the rpc thread pool at destroy (#3) --- pom.xml | 2 +- src/main/java/com/baidu/hugegraph/rpc/RpcServer.java | 2 +- src/main/java/com/baidu/hugegraph/version/RpcVersion.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 23e13fb8b8..f650d64406 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.baidu.hugegraph hugegraph-rpc - 1.0.0 + 1.0.1 hugegraph-rpc https://github.com/hugegraph/hugegraph-rpc diff --git a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java index 1118d37e02..a7e0ba9115 100644 --- a/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java +++ b/src/main/java/com/baidu/hugegraph/rpc/RpcServer.java @@ -137,8 +137,8 @@ public void destroy() { } } } - this.configs.removeAllService(); this.serverConfig.destroy(); + this.configs.removeAllService(); } private void checkEnabled() { diff --git a/src/main/java/com/baidu/hugegraph/version/RpcVersion.java b/src/main/java/com/baidu/hugegraph/version/RpcVersion.java index 884cc260e2..cd41fe55be 100644 --- a/src/main/java/com/baidu/hugegraph/version/RpcVersion.java +++ b/src/main/java/com/baidu/hugegraph/version/RpcVersion.java @@ -27,5 +27,5 @@ public class RpcVersion { // The second parameter of Version.of() is for all-in-one JAR public static final Version VERSION = Version.of(RpcVersion.class, - "1.0.0"); + "1.0.1"); } From c572c2bedd2285925e02decc9515c81e80b705da Mon Sep 17 00:00:00 2001 From: imbajin Date: Tue, 30 Nov 2021 15:29:35 +0800 Subject: [PATCH 6/8] first rename --- hugegraph-common/BCLOUD | 1 + LICENSE => hugegraph-common/LICENSE | 0 README.md => hugegraph-common/README.md | 0 build.sh => hugegraph-common/build.sh | 0 checkstyle.xml => hugegraph-common/checkstyle.xml | 0 pom.xml => hugegraph-common/pom.xml | 0 .../com/baidu/hugegraph/concurrent/AtomicLock.java | 0 .../baidu/hugegraph/concurrent/BarrierEvent.java | 0 .../com/baidu/hugegraph/concurrent/KeyLock.java | 0 .../com/baidu/hugegraph/concurrent/LockGroup.java | 0 .../com/baidu/hugegraph/concurrent/LockManager.java | 0 .../concurrent/PausableScheduledThreadPool.java | 0 .../com/baidu/hugegraph/concurrent/RowLock.java | 0 .../baidu/hugegraph/config/ConfigConvOption.java | 0 .../com/baidu/hugegraph/config/ConfigException.java | 0 .../hugegraph/config/ConfigListConvOption.java | 0 .../baidu/hugegraph/config/ConfigListOption.java | 0 .../com/baidu/hugegraph/config/ConfigOption.java | 0 .../java/com/baidu/hugegraph/config/HugeConfig.java | 0 .../com/baidu/hugegraph/config/OptionChecker.java | 0 .../com/baidu/hugegraph/config/OptionHolder.java | 0 .../com/baidu/hugegraph/config/OptionSpace.java | 0 .../com/baidu/hugegraph/config/TypedOption.java | 0 .../com/baidu/hugegraph/date/SafeDateFormat.java | 0 .../main/java/com/baidu/hugegraph/event/Event.java | 0 .../java/com/baidu/hugegraph/event/EventHub.java | 0 .../com/baidu/hugegraph/event/EventListener.java | 0 .../java/com/baidu/hugegraph/func/TriFunction.java | 0 .../hugegraph/iterator/BatchMapperIterator.java | 0 .../java/com/baidu/hugegraph/iterator/CIter.java | 0 .../hugegraph/iterator/ExtendableIterator.java | 0 .../baidu/hugegraph/iterator/FilterIterator.java | 0 .../iterator/FlatMapperFilterIterator.java | 0 .../hugegraph/iterator/FlatMapperIterator.java | 0 .../com/baidu/hugegraph/iterator/LimitIterator.java | 0 .../com/baidu/hugegraph/iterator/ListIterator.java | 0 .../baidu/hugegraph/iterator/MapperIterator.java | 0 .../com/baidu/hugegraph/iterator/Metadatable.java | 0 .../baidu/hugegraph/iterator/WrappedIterator.java | 0 .../hugegraph/license/CommonLicenseManager.java | 0 .../com/baidu/hugegraph/license/ExtraParam.java | 0 .../baidu/hugegraph/license/FileKeyStoreParam.java | 0 .../baidu/hugegraph/license/LicenseCreateParam.java | 0 .../baidu/hugegraph/license/LicenseVerifyParam.java | 0 .../com/baidu/hugegraph/license/MachineInfo.java | 0 .../com/baidu/hugegraph/perf/LightStopwatch.java | 0 .../com/baidu/hugegraph/perf/NormalStopwatch.java | 0 .../java/com/baidu/hugegraph/perf/PerfUtil.java | 0 .../java/com/baidu/hugegraph/perf/Stopwatch.java | 0 .../baidu/hugegraph/rest/AbstractRestClient.java | 0 .../com/baidu/hugegraph/rest/ClientException.java | 0 .../java/com/baidu/hugegraph/rest/RestClient.java | 0 .../java/com/baidu/hugegraph/rest/RestResult.java | 0 .../baidu/hugegraph/rest/SerializeException.java | 0 .../java/com/baidu/hugegraph/testutil/Assert.java | 0 .../java/com/baidu/hugegraph/testutil/Whitebox.java | 0 .../main/java/com/baidu/hugegraph/util/Bytes.java | 0 .../java/com/baidu/hugegraph/util/CheckSocket.java | 0 .../com/baidu/hugegraph/util/CollectionUtil.java | 0 .../java/com/baidu/hugegraph/util/DateUtil.java | 0 .../src}/main/java/com/baidu/hugegraph/util/E.java | 0 .../java/com/baidu/hugegraph/util/ExecutorUtil.java | 0 .../java/com/baidu/hugegraph/util/HashUtil.java | 0 .../baidu/hugegraph/util/InsertionOrderUtil.java | 0 .../main/java/com/baidu/hugegraph/util/Log.java | 0 .../java/com/baidu/hugegraph/util/LongEncoding.java | 0 .../java/com/baidu/hugegraph/util/NumericUtil.java | 0 .../com/baidu/hugegraph/util/OrderLimitMap.java | 0 .../com/baidu/hugegraph/util/ReflectionUtil.java | 0 .../java/com/baidu/hugegraph/util/StringUtil.java | 0 .../java/com/baidu/hugegraph/util/TimeUtil.java | 0 .../java/com/baidu/hugegraph/util/UnitUtil.java | 0 .../java/com/baidu/hugegraph/util/VersionUtil.java | 0 .../com/baidu/hugegraph/version/CommonVersion.java | 0 .../com/baidu/hugegraph/testutil/AssertTest.java | 0 .../com/baidu/hugegraph/testutil/WhiteboxTest.java | 0 .../java/com/baidu/hugegraph/unit/BaseUnitTest.java | 0 .../com/baidu/hugegraph/unit/UnitTestSuite.java | 0 .../hugegraph/unit/concurrent/AtomicLockTest.java | 0 .../hugegraph/unit/concurrent/BarrierEventTest.java | 0 .../hugegraph/unit/concurrent/KeyLockTest.java | 0 .../hugegraph/unit/concurrent/LockGroupTest.java | 0 .../hugegraph/unit/concurrent/LockManagerTest.java | 0 .../concurrent/PausableScheduledThreadPoolTest.java | 0 .../hugegraph/unit/concurrent/RowLockTest.java | 0 .../baidu/hugegraph/unit/config/HugeConfigTest.java | 0 .../hugegraph/unit/config/OptionSpaceTest.java | 0 .../hugegraph/unit/config/test-check-error.conf | 0 .../hugegraph/unit/config/test-list-error.conf | 0 .../hugegraph/unit/config/test-type-error.conf | 0 .../java/com/baidu/hugegraph/unit/config/test.conf | 0 .../hugegraph/unit/date/SafeDateFormatTest.java | 0 .../baidu/hugegraph/unit/event/EventHubTest.java | 0 .../unit/iterator/BatchMapperIteratorTest.java | 0 .../unit/iterator/ExtendableIteratorTest.java | 0 .../hugegraph/unit/iterator/FilterIteratorTest.java | 0 .../unit/iterator/FlatMapperFilterIteratorTest.java | 0 .../unit/iterator/FlatMapperIteratorTest.java | 0 .../hugegraph/unit/iterator/LimitIteratorTest.java | 0 .../hugegraph/unit/iterator/ListIteratorTest.java | 0 .../hugegraph/unit/iterator/MapperIteratorTest.java | 0 .../hugegraph/unit/license/ExtraParamTest.java | 0 .../unit/license/LicenseCreateParamTest.java | 0 .../hugegraph/unit/license/LicenseManagerTest.java | 0 .../unit/license/LicenseVerifyParamTest.java | 0 .../hugegraph/unit/license/MachineInfoTest.java | 0 .../com/baidu/hugegraph/unit/perf/PerfUtilTest.java | 0 .../baidu/hugegraph/unit/perf/StopwatchTest.java | 0 .../hugegraph/unit/perf/testclass/TestClass.java | 0 .../unit/perf/testclass/TestLightClass.java | 0 .../unit/perf/testclass/TestPerfClass.java | 0 .../unit/perf/testclass/TestPerfLightClass.java | 0 .../unit/perf/testclass2/TestClass4Package.java | 0 .../baidu/hugegraph/unit/rest/RestClientTest.java | 0 .../baidu/hugegraph/unit/rest/RestResultTest.java | 0 .../com/baidu/hugegraph/unit/util/BytesTest.java | 0 .../hugegraph/unit/util/CollectionUtilTest.java | 0 .../com/baidu/hugegraph/unit/util/DateUtilTest.java | 0 .../com/baidu/hugegraph/unit/util/EcheckTest.java | 0 .../com/baidu/hugegraph/unit/util/HashUtilTest.java | 0 .../hugegraph/unit/util/InsertionOrderUtilTest.java | 0 .../java/com/baidu/hugegraph/unit/util/LogTest.java | 0 .../baidu/hugegraph/unit/util/LongEncodingTest.java | 0 .../baidu/hugegraph/unit/util/NumericUtilTest.java | 0 .../hugegraph/unit/util/OrderLimitMapTest.java | 0 .../hugegraph/unit/util/ReflectionUtilTest.java | 0 .../baidu/hugegraph/unit/util/StringUtilTest.java | 0 .../com/baidu/hugegraph/unit/util/TimeUtilTest.java | 0 .../com/baidu/hugegraph/unit/util/UnitUtilTest.java | 0 .../baidu/hugegraph/unit/util/VersionUtilTest.java | 0 .../baidu/hugegraph/unit/version/VersionTest.java | 0 .../src}/test/resources/META-INF/MANIFEST.MF | 0 .../src}/test/resources/cacerts.jks | Bin .../src}/test/resources/create-license.json | 0 .../src}/test/resources/log4j2.xml | 0 .../src}/test/resources/privateKeys.store | Bin .../src}/test/resources/publicCerts.store | Bin .../src}/test/resources/verify-license.json | 0 138 files changed, 1 insertion(+) create mode 100644 hugegraph-common/BCLOUD rename LICENSE => hugegraph-common/LICENSE (100%) rename README.md => hugegraph-common/README.md (100%) rename build.sh => hugegraph-common/build.sh (100%) rename checkstyle.xml => hugegraph-common/checkstyle.xml (100%) rename pom.xml => hugegraph-common/pom.xml (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/KeyLock.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/LockGroup.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/LockManager.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/concurrent/RowLock.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigConvOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigException.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigListOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/ConfigOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/HugeConfig.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/OptionChecker.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/OptionHolder.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/OptionSpace.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/config/TypedOption.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/date/SafeDateFormat.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/event/Event.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/event/EventHub.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/event/EventListener.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/func/TriFunction.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/CIter.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/FilterIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/LimitIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/ListIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/MapperIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/Metadatable.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/ExtraParam.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/license/MachineInfo.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/perf/LightStopwatch.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/perf/PerfUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/perf/Stopwatch.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/ClientException.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/RestClient.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/RestResult.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/rest/SerializeException.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/testutil/Assert.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/testutil/Whitebox.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/Bytes.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/CheckSocket.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/CollectionUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/DateUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/E.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/ExecutorUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/HashUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/Log.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/LongEncoding.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/NumericUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/OrderLimitMap.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/ReflectionUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/StringUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/TimeUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/UnitUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/util/VersionUtil.java (100%) rename {src => hugegraph-common/src}/main/java/com/baidu/hugegraph/version/CommonVersion.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/testutil/AssertTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/config/test.conf (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/BytesTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/LogTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java (100%) rename {src => hugegraph-common/src}/test/java/com/baidu/hugegraph/unit/version/VersionTest.java (100%) rename {src => hugegraph-common/src}/test/resources/META-INF/MANIFEST.MF (100%) rename {src => hugegraph-common/src}/test/resources/cacerts.jks (100%) rename {src => hugegraph-common/src}/test/resources/create-license.json (100%) rename {src => hugegraph-common/src}/test/resources/log4j2.xml (100%) rename {src => hugegraph-common/src}/test/resources/privateKeys.store (100%) rename {src => hugegraph-common/src}/test/resources/publicCerts.store (100%) rename {src => hugegraph-common/src}/test/resources/verify-license.json (100%) diff --git a/hugegraph-common/BCLOUD b/hugegraph-common/BCLOUD new file mode 100644 index 0000000000..df3f342be8 --- /dev/null +++ b/hugegraph-common/BCLOUD @@ -0,0 +1 @@ +BUILD_SUBMITTER -x -u ./ -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph-common && mkdir output && sh build.sh" -o output \ No newline at end of file diff --git a/LICENSE b/hugegraph-common/LICENSE similarity index 100% rename from LICENSE rename to hugegraph-common/LICENSE diff --git a/README.md b/hugegraph-common/README.md similarity index 100% rename from README.md rename to hugegraph-common/README.md diff --git a/build.sh b/hugegraph-common/build.sh similarity index 100% rename from build.sh rename to hugegraph-common/build.sh diff --git a/checkstyle.xml b/hugegraph-common/checkstyle.xml similarity index 100% rename from checkstyle.xml rename to hugegraph-common/checkstyle.xml diff --git a/pom.xml b/hugegraph-common/pom.xml similarity index 100% rename from pom.xml rename to hugegraph-common/pom.xml diff --git a/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/AtomicLock.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/BarrierEvent.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/LockManager.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/LockManager.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/PausableScheduledThreadPool.java diff --git a/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/concurrent/RowLock.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigConvOption.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigException.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigException.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigException.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigException.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListConvOption.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigListOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigListOption.java diff --git a/src/main/java/com/baidu/hugegraph/config/ConfigOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/ConfigOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/ConfigOption.java diff --git a/src/main/java/com/baidu/hugegraph/config/HugeConfig.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/HugeConfig.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/HugeConfig.java diff --git a/src/main/java/com/baidu/hugegraph/config/OptionChecker.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionChecker.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/OptionChecker.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionChecker.java diff --git a/src/main/java/com/baidu/hugegraph/config/OptionHolder.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionHolder.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/OptionHolder.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionHolder.java diff --git a/src/main/java/com/baidu/hugegraph/config/OptionSpace.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionSpace.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/OptionSpace.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/OptionSpace.java diff --git a/src/main/java/com/baidu/hugegraph/config/TypedOption.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/config/TypedOption.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/config/TypedOption.java diff --git a/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/date/SafeDateFormat.java diff --git a/src/main/java/com/baidu/hugegraph/event/Event.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/event/Event.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/event/Event.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/event/Event.java diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventHub.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/event/EventHub.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventHub.java diff --git a/src/main/java/com/baidu/hugegraph/event/EventListener.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventListener.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/event/EventListener.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/event/EventListener.java diff --git a/src/main/java/com/baidu/hugegraph/func/TriFunction.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/func/TriFunction.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/func/TriFunction.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/func/TriFunction.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/BatchMapperIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/CIter.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/CIter.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/CIter.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/CIter.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ExtendableIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FilterIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperFilterIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/FlatMapperIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/LimitIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/ListIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/ListIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/MapperIterator.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/Metadatable.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/Metadatable.java diff --git a/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/iterator/WrappedIterator.java diff --git a/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/CommonLicenseManager.java diff --git a/src/main/java/com/baidu/hugegraph/license/ExtraParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/ExtraParam.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/ExtraParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/ExtraParam.java diff --git a/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/FileKeyStoreParam.java diff --git a/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseCreateParam.java diff --git a/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/LicenseVerifyParam.java diff --git a/src/main/java/com/baidu/hugegraph/license/MachineInfo.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/license/MachineInfo.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/license/MachineInfo.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/license/MachineInfo.java diff --git a/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/perf/LightStopwatch.java diff --git a/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/perf/NormalStopwatch.java diff --git a/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/perf/PerfUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/perf/PerfUtil.java diff --git a/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/perf/Stopwatch.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/perf/Stopwatch.java diff --git a/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/AbstractRestClient.java diff --git a/src/main/java/com/baidu/hugegraph/rest/ClientException.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/ClientException.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/ClientException.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/ClientException.java diff --git a/src/main/java/com/baidu/hugegraph/rest/RestClient.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/RestClient.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestClient.java diff --git a/src/main/java/com/baidu/hugegraph/rest/RestResult.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/RestResult.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/RestResult.java diff --git a/src/main/java/com/baidu/hugegraph/rest/SerializeException.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/rest/SerializeException.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/rest/SerializeException.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/rest/SerializeException.java diff --git a/src/main/java/com/baidu/hugegraph/testutil/Assert.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/testutil/Assert.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Assert.java diff --git a/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/testutil/Whitebox.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/testutil/Whitebox.java diff --git a/src/main/java/com/baidu/hugegraph/util/Bytes.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/Bytes.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/Bytes.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/Bytes.java diff --git a/src/main/java/com/baidu/hugegraph/util/CheckSocket.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CheckSocket.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/CheckSocket.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/CheckSocket.java diff --git a/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/CollectionUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/CollectionUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/DateUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/DateUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/DateUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/DateUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/E.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/E.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/E.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/E.java diff --git a/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/HashUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/HashUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/HashUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/HashUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/InsertionOrderUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/Log.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/Log.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/Log.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/Log.java diff --git a/src/main/java/com/baidu/hugegraph/util/LongEncoding.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/LongEncoding.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/LongEncoding.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/LongEncoding.java diff --git a/src/main/java/com/baidu/hugegraph/util/NumericUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/NumericUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/NumericUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/NumericUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java diff --git a/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/ReflectionUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/StringUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/StringUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/StringUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/StringUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/TimeUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/TimeUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/TimeUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/TimeUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/UnitUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/UnitUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/UnitUtil.java diff --git a/src/main/java/com/baidu/hugegraph/util/VersionUtil.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/util/VersionUtil.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/util/VersionUtil.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/util/VersionUtil.java diff --git a/src/main/java/com/baidu/hugegraph/version/CommonVersion.java b/hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java similarity index 100% rename from src/main/java/com/baidu/hugegraph/version/CommonVersion.java rename to hugegraph-common/src/main/java/com/baidu/hugegraph/version/CommonVersion.java diff --git a/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/testutil/AssertTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/AssertTest.java diff --git a/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/testutil/WhiteboxTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/BaseUnitTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/UnitTestSuite.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/AtomicLockTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/BarrierEventTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/KeyLockTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockGroupTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/LockManagerTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/PausableScheduledThreadPoolTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/concurrent/RowLockTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/HugeConfigTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/OptionSpaceTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-check-error.conf diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-list-error.conf diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test-type-error.conf diff --git a/src/test/java/com/baidu/hugegraph/unit/config/test.conf b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test.conf similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/config/test.conf rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/config/test.conf diff --git a/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/date/SafeDateFormatTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/event/EventHubTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/BatchMapperIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ExtendableIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FilterIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperFilterIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/FlatMapperIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/LimitIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/ListIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/iterator/MapperIteratorTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/ExtraParamTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseCreateParamTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseManagerTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/LicenseVerifyParamTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/license/MachineInfoTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/PerfUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/StopwatchTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestClass.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestLightClass.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfClass.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass/TestPerfLightClass.java diff --git a/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/perf/testclass2/TestClass4Package.java diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestClientTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/rest/RestResultTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/BytesTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/CollectionUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/DateUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/EcheckTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/HashUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/InsertionOrderUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/LogTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LogTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/LongEncodingTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/NumericUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/OrderLimitMapTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/ReflectionUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/StringUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/TimeUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/UnitUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/util/VersionUtilTest.java diff --git a/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java b/hugegraph-common/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java similarity index 100% rename from src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java rename to hugegraph-common/src/test/java/com/baidu/hugegraph/unit/version/VersionTest.java diff --git a/src/test/resources/META-INF/MANIFEST.MF b/hugegraph-common/src/test/resources/META-INF/MANIFEST.MF similarity index 100% rename from src/test/resources/META-INF/MANIFEST.MF rename to hugegraph-common/src/test/resources/META-INF/MANIFEST.MF diff --git a/src/test/resources/cacerts.jks b/hugegraph-common/src/test/resources/cacerts.jks similarity index 100% rename from src/test/resources/cacerts.jks rename to hugegraph-common/src/test/resources/cacerts.jks diff --git a/src/test/resources/create-license.json b/hugegraph-common/src/test/resources/create-license.json similarity index 100% rename from src/test/resources/create-license.json rename to hugegraph-common/src/test/resources/create-license.json diff --git a/src/test/resources/log4j2.xml b/hugegraph-common/src/test/resources/log4j2.xml similarity index 100% rename from src/test/resources/log4j2.xml rename to hugegraph-common/src/test/resources/log4j2.xml diff --git a/src/test/resources/privateKeys.store b/hugegraph-common/src/test/resources/privateKeys.store similarity index 100% rename from src/test/resources/privateKeys.store rename to hugegraph-common/src/test/resources/privateKeys.store diff --git a/src/test/resources/publicCerts.store b/hugegraph-common/src/test/resources/publicCerts.store similarity index 100% rename from src/test/resources/publicCerts.store rename to hugegraph-common/src/test/resources/publicCerts.store diff --git a/src/test/resources/verify-license.json b/hugegraph-common/src/test/resources/verify-license.json similarity index 100% rename from src/test/resources/verify-license.json rename to hugegraph-common/src/test/resources/verify-license.json From 24c3390379a284d1da9fc291645d35b9e107810c Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 1 Dec 2021 20:38:09 +0800 Subject: [PATCH 7/8] chore: merge license & checkstyle & ci 1. root pom.xml, license, checkstyle, ci, --- .github/ISSUE_TEMPLATE/bug_report.yml | 4 +- .github/ISSUE_TEMPLATE/question_ask.yml | 4 +- .travis.yml => .github/outdated/.travis.yml | 0 .github/workflows/ci.yml | 2 +- .github/workflows/stale.yml | 8 +- LICENSE | 202 ++++++++++++++++++++ checkstyle.xml | 89 +++++++++ hugegraph-common/BCLOUD | 1 - 8 files changed, 301 insertions(+), 9 deletions(-) rename .travis.yml => .github/outdated/.travis.yml (100%) create mode 100644 LICENSE create mode 100644 checkstyle.xml delete mode 100644 hugegraph-common/BCLOUD diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 780d51efd9..8445d0a52c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -11,7 +11,7 @@ body: ### Note (特别注意) : > 1. 请先**搜索**现有的[Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 - [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有与您相同 + [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有与您相同 / 相关的问题 (请勿重复提交) > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) @@ -35,7 +35,7 @@ body: attributes: label: Before submit options: - - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有相同 / 重复问题 + - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有相同 / 重复问题 required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/question_ask.yml b/.github/ISSUE_TEMPLATE/question_ask.yml index 6a57883ee2..9724e66c47 100644 --- a/.github/ISSUE_TEMPLATE/question_ask.yml +++ b/.github/ISSUE_TEMPLATE/question_ask.yml @@ -9,7 +9,7 @@ body: ### Note (特别注意) : > 1. 请先**搜索**现有的[Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 - [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有与您相同 + [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有与您相同 / 相关的问题 (请勿重复提交) > 2. 我们需要尽可能**详细**的信息来**复现**问题, 越详细的信息 (包括**日志 / 截图 / 配置**等) @@ -33,7 +33,7 @@ body: attributes: label: Before submit options: - - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Common-Issues](https://github.com/hugegraph/hugegraph-common/issues) 中没有相同 / 重复问题 + - label: 我已经确认现有的 [Server-Issues](https://github.com/hugegraph/hugegraph/issues) 与 [Commons-Issues](https://github.com/hugegraph/hugegraph-commons/issues) 中没有相同 / 重复问题 required: true - type: textarea diff --git a/.travis.yml b/.github/outdated/.travis.yml similarity index 100% rename from .travis.yml rename to .github/outdated/.travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5dda16800a..a09093a164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: hugegraph-common ci +name: hugegraph-commons ci on: push: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 1813bd3cb2..5829cb61a9 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -20,17 +20,19 @@ jobs: stale-pr-message: 'Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label' stale-issue-label: 'inactive' stale-pr-label: 'inactive' - exempt-issue-labels: 'feature,bug,enhancement,improvement,wontfix,todo' + exempt-issue-labels: 'feature,bug,enhancement,improvement,wontfix,todo,help wanted' + exempt-pr-labels: 'feature,bug,enhancement,improvement,wontfix,todo,help wanted' + exempt-all-milestones: true days-before-issue-stale: 15 days-before-issue-close: 20 days-before-pr-stale: 30 days-before-pr-close: 180 operations-per-run: 10 - start-date: '2018-12-01T00:00:00Z' + start-date: '2018-10-01T00:00:00Z' exempt-all-assignees: true remove-stale-when-updated: true exempt-all-pr-milestones: true delete-branch: false - enable-statistics: true + enable-statistics: true \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..e06d208186 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000000..9373a70d91 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-common/BCLOUD b/hugegraph-common/BCLOUD deleted file mode 100644 index df3f342be8..0000000000 --- a/hugegraph-common/BCLOUD +++ /dev/null @@ -1 +0,0 @@ -BUILD_SUBMITTER -x -u ./ -e CENTOS6U3 -m baidu/xbu-data/hugegraph-common -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph-common && mkdir output && sh build.sh" -o output \ No newline at end of file From ee087121208ba1f80d3ae4bd5c3a3fd7674aa147 Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 1 Dec 2021 20:40:26 +0800 Subject: [PATCH 8/8] chore: new pom & README for module --- .github/workflows/stale.yml | 2 +- README.md | 23 ++++ hugegraph-common/pom.xml | 66 ++--------- hugegraph-rpc/pom.xml | 40 ++----- pom.xml | 219 ++++++++++++++++++++++++++++++++++++ 5 files changed, 261 insertions(+), 89 deletions(-) create mode 100644 README.md create mode 100644 pom.xml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5829cb61a9..93e1bd1c5e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -35,4 +35,4 @@ jobs: remove-stale-when-updated: true exempt-all-pr-milestones: true delete-branch: false - enable-statistics: true \ No newline at end of file + enable-statistics: true diff --git a/README.md b/README.md new file mode 100644 index 0000000000..3d669ebad8 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# hugegraph-commons + +[![License](https://img.shields.io/badge/license-Apache%202-0E78BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) +[![codecov](https://codecov.io/gh/hugegraph/hugegraph-common/branch/master/graph/badge.svg)](https://codecov.io/gh/hugegraph/hugegraph-common) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.baidu.hugegraph/hugegraph-common/badge.svg)](https://mvnrepository.com/artifact/com.baidu.hugegraph/hugegraph-common) + +hugegraph-commons is a common module for [HugeGraph](https://github.com/hugegraph/hugegraph) and its peripheral components. +hugegraph-commons encapsulates locks, configurations, events, iterators, rest and some +numeric or collection util classes to simplify the development of HugeGraph and +its components. + +## Components + +- Lock: atomic lock, key lock, lock group and lock manger +- Config: register and load config option with security check +- Event: listening and notification, do something asynchronously +- Iterator: some iterators with extra functions, map, filter, extend etc. +- Rest: RESTful client implemented on Jersey, POST, PUT, GET and DELETE +- Util: performance analyzer, version checker, numeric and Collection utils, log and exception utils etc. +- Rpc: rpc component for inner module communication, currently it's based on [Sofa-RPC](https://github.com/sofastack/sofa-rpc) + +## Licence +The same as HugeGraph, hugegraph-commons is also licensed under Apache 2.0 License. diff --git a/hugegraph-common/pom.xml b/hugegraph-common/pom.xml index 7b9e61c712..4b355920d6 100644 --- a/hugegraph-common/pom.xml +++ b/hugegraph-common/pom.xml @@ -3,11 +3,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + com.baidu.hugegraph + hugegraph-commons + 1.8.10 + ../pom.xml + - com.baidu.hugegraph hugegraph-common - 1.8.10 - hugegraph-common https://github.com/hugegraph/hugegraph-common @@ -16,61 +19,8 @@ numeric or collection util classes to simplify the development of HugeGraph and its components. - - org.sonatype.oss - oss-parent - 7 - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - https://github.com/hugegraph/hugegraph-common - https://github.com/hugegraph/hugegraph-common - https://github.com/hugegraph/hugegraph-common - - - - - lizhangmei - javaloveme@gmail.com - - - zhoney - zhangyi89817@126.com - - - liningrui - liningrui@vip.qq.com - - - - UTF-8 - ${project.basedir}/.. - 1.8 - 1.8 - 2.13.3 - 1.10 - 2.1.1 - 3.2.2 - 2.7 - 1.11 - 25.1-jre - 1.0 - 3.0.1 - 3.21.0-GA - 2.22 - 2.27 - 2.12.1 - 4.12 - 2.25.1 + @@ -311,7 +261,7 @@ report - ${project.build.directory} + ${project.parent.build.directory} diff --git a/hugegraph-rpc/pom.xml b/hugegraph-rpc/pom.xml index f650d64406..b06fc89b6e 100644 --- a/hugegraph-rpc/pom.xml +++ b/hugegraph-rpc/pom.xml @@ -3,42 +3,21 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + com.baidu.hugegraph + hugegraph-commons + 1.8.10 + ../pom.xml + - com.baidu.hugegraph hugegraph-rpc 1.0.1 hugegraph-rpc - https://github.com/hugegraph/hugegraph-rpc - - HugeGraph Database RPC component - - - - org.sonatype.oss - oss-parent - 7 - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - https://github.com/hugegraph/hugegraph-rpc - https://github.com/hugegraph/hugegraph-rpc - https://github.com/hugegraph/hugegraph-rpc - + HugeGraph Database RPC component - UTF-8 - ${project.basedir}/.. - 1.8 - 1.8 + @@ -46,6 +25,7 @@ com.baidu.hugegraph hugegraph-common + 1.8.5 @@ -189,7 +169,7 @@ report - ${project.build.directory} + ${project.parent.build.directory} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..771e80737e --- /dev/null +++ b/pom.xml @@ -0,0 +1,219 @@ + + + 4.0.0 + + com.baidu.hugegraph + hugegraph-commons + 1.8.10 + pom + + hugegraph-commons + https://github.com/hugegraph/hugegraph-commons + + hugegraph-commons is a common module for HugeGraph-Common and HugeGraph-Rpc with their peripheral components. + It includes rpc frame, locks, configurations, events, iterators, rest and some + numeric or collection util classes to simplify the development of HugeGraph and its components. + + + + org.sonatype.oss + oss-parent + 7 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + https://github.com/hugegraph/hugegraph-commons + https://github.com/hugegraph/hugegraph-commons + https://github.com/hugegraph/hugegraph-commons + + + + + lizhangmei + javaloveme@gmail.com + + + zhoney + zhangyi89817@126.com + + + liningrui + liningrui@vip.qq.com + + + + + UTF-8 + ${project.basedir}/.. + 1.8 + 1.8 + 2.13.3 + 1.10 + 2.1.1 + 3.2.2 + 2.7 + 1.11 + 25.1-jre + 1.0 + 3.0.1 + 3.21.0-GA + 2.22 + 2.27 + 2.12.1 + 4.12 + 2.25.1 + + + + hugegraph-common + hugegraph-rpc + + + + + + maven-compiler-plugin + 3.1 + + ${compiler.source} + ${compiler.target} + + 500 + + + -Xlint:unchecked + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.0 + + checkstyle.xml + UTF-8 + true + true + false + false + + + + validate + validate + + check + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + true + + + false + + + true + + + + + 1.8.9.0 + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.2 + + + pre-unit-test + + prepare-agent + + + + post-unit-test + test + + report + + + ${project.build.directory} + + + + + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + +