From e29308950e7848c4f9c558f998f291083be18dd0 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Thu, 10 Aug 2023 23:04:06 +0800 Subject: [PATCH 01/16] =?UTF-8?q?feat:=E5=86=85=E5=B5=8C=20arthas=20?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hugegraph-api/pom.xml | 11 ++ .../hugegraph/api/arthas/ArthasAPI.java | 104 ++++++++++++++++++ .../hugegraph/config/ServerOptions.java | 31 ++++++ .../src/assembly/static/conf/arthas.yaml | 9 ++ .../static/conf/rest-server.properties | 6 + .../apache/hugegraph/api/ArthasApiTest.java | 17 +++ 6 files changed, 178 insertions(+) create mode 100644 hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java create mode 100644 hugegraph-dist/src/assembly/static/conf/arthas.yaml create mode 100644 hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java diff --git a/hugegraph-api/pom.xml b/hugegraph-api/pom.xml index 2d7370056e..5d8977d525 100644 --- a/hugegraph-api/pom.xml +++ b/hugegraph-api/pom.xml @@ -153,6 +153,17 @@ swagger-jaxrs2-jakarta 2.1.9 + + + com.taobao.arthas + arthas-agent-attach + 3.6.4 + + + com.taobao.arthas + arthas-packaging + 3.6.4 + diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java new file mode 100644 index 0000000000..63cc00a708 --- /dev/null +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java @@ -0,0 +1,104 @@ +/* + * 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 org.apache.hugegraph.api.arthas; + +import java.util.HashMap; + +import org.apache.hugegraph.api.API; +import org.apache.hugegraph.config.HugeConfig; +import org.apache.hugegraph.config.ServerOptions; +import org.apache.hugegraph.util.JsonUtil; + +import com.codahale.metrics.annotation.Timed; +import com.taobao.arthas.agent.attach.ArthasAgent; + +import jakarta.inject.Singleton; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; + +@Path("arthasstart") +@Singleton +public class ArthasAPI extends API { + + @Context + private jakarta.inject.Provider configProvider; + + @GET + @Timed + @Produces(APPLICATION_JSON_WITH_CHARSET) + public Object arthasOp(@Context HttpServletRequest request) { + HugeConfig config = this.configProvider.get(); + HashMap configMap = new HashMap<>(); + /* + * Default arthas configuration: + * telnetPort = "8562"; + * httpPort = "8561"; + * arthasip = "0.0.0.0"; + * disCmd = "jad"; + */ + configMap.put("arthas.telnetPort", config.get(ServerOptions.ARTHAS_TELNET_PORT)); + configMap.put("arthas.httpPort", config.get(ServerOptions.ARTHAS_HTTP_PORT)); + configMap.put("arthas.ip", config.get(ServerOptions.ARTHAS_IP)); + configMap.put("arthas.disabledCommands", + config.get(ServerOptions.ARTHAS_DISABLED_COMMANDS)); + ArthasAgent.attach(configMap); + + DashResponse retPose = new DashResponse(); + retPose.setData(JsonUtil.toJson(configMap)); + retPose.setStatus(200); + retPose.setMessage("arthas 启动成功"); + return retPose; + } + + public static class DashResponse { + + private String data; + private int status; + private String message; + + public DashResponse() { + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + } +} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index 95a53faa39..1a489c6a90 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -264,4 +264,35 @@ public static synchronized ServerOptions instance() { disallowEmpty(), true ); + + + public static final ConfigOption ARTHAS_TELNET_PORT = + new ConfigOption<>( + "arthas.telnetPort", + "arthas provides telnet ports to the outside", + disallowEmpty(), + "8562" + ); + public static final ConfigOption ARTHAS_HTTP_PORT = + new ConfigOption<>( + "arthas.httpPort", + "arthas provides http ports to the outside", + disallowEmpty(), + "8561" + ); + public static final ConfigOption ARTHAS_IP = + new ConfigOption<>( + "arthas.ip", + "arthas bound ip", + disallowEmpty(), + "0.0.0.0" + ); + public static final ConfigOption ARTHAS_DISABLED_COMMANDS = + new ConfigOption<>( + "arthas.disabledCommands", + "arthas disabled commands", + disallowEmpty(), + "jad" + ); + } diff --git a/hugegraph-dist/src/assembly/static/conf/arthas.yaml b/hugegraph-dist/src/assembly/static/conf/arthas.yaml new file mode 100644 index 0000000000..3559ce4bce --- /dev/null +++ b/hugegraph-dist/src/assembly/static/conf/arthas.yaml @@ -0,0 +1,9 @@ +arthas: + # 通过 http 访问的端口 + httpPort: 8561 + # 通过 telnet 访问的端口 + telnetPort: 8562 + session-timeout: 1800 + disabledCommands: jad + # 绑定的 ip + ip: 0.0.0.0 \ No newline at end of file diff --git a/hugegraph-dist/src/assembly/static/conf/rest-server.properties b/hugegraph-dist/src/assembly/static/conf/rest-server.properties index 794caec84d..76b50848a2 100644 --- a/hugegraph-dist/src/assembly/static/conf/rest-server.properties +++ b/hugegraph-dist/src/assembly/static/conf/rest-server.properties @@ -9,6 +9,12 @@ graphs=./conf/graphs batch.max_write_ratio=80 batch.max_write_threads=0 +# configuration of arthas +arthas.telnetPort=8562 +arthas.httpPort=8561 +arthas.ip=0.0.0.0 +arthas.disabledCommands=jad + # authentication configs # choose 'org.apache.hugegraph.auth.StandardAuthenticator' or # 'org.apache.hugegraph.auth.ConfigAuthenticator' diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java new file mode 100644 index 0000000000..c9d8eb24cd --- /dev/null +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java @@ -0,0 +1,17 @@ +package org.apache.hugegraph.api; + +import org.junit.Test; + +import jakarta.ws.rs.core.Response; + +public class ArthasApiTest extends BaseApiTest { + + + private static final String path = "/arthasstart"; + + @Test + public void testMetricsAll() { + Response r = client().get(path); + assertResponseStatus(200, r); + } +} From 9d51b063e1cb5d265023c97abdd684007c39254f Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Sat, 12 Aug 2023 17:47:32 +0800 Subject: [PATCH 02/16] format code --- .../org/apache/hugegraph/api/arthas/ArthasAPI.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java index 63cc00a708..04390042d5 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java @@ -28,13 +28,12 @@ import com.taobao.arthas.agent.attach.ArthasAgent; import jakarta.inject.Singleton; -import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Context; -@Path("arthasstart") +@Path("arthas") @Singleton public class ArthasAPI extends API { @@ -44,16 +43,9 @@ public class ArthasAPI extends API { @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) - public Object arthasOp(@Context HttpServletRequest request) { + public Object arthasStart() { HugeConfig config = this.configProvider.get(); - HashMap configMap = new HashMap<>(); - /* - * Default arthas configuration: - * telnetPort = "8562"; - * httpPort = "8561"; - * arthasip = "0.0.0.0"; - * disCmd = "jad"; - */ + HashMap configMap = new HashMap<>(4); configMap.put("arthas.telnetPort", config.get(ServerOptions.ARTHAS_TELNET_PORT)); configMap.put("arthas.httpPort", config.get(ServerOptions.ARTHAS_HTTP_PORT)); configMap.put("arthas.ip", config.get(ServerOptions.ARTHAS_IP)); From 5ed2dfd978cd44eb6d5388d1b54ed27942269827 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Sat, 12 Aug 2023 18:01:01 +0800 Subject: [PATCH 03/16] update arthas version --- hugegraph-api/pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hugegraph-api/pom.xml b/hugegraph-api/pom.xml index 5d8977d525..10f0bca900 100644 --- a/hugegraph-api/pom.xml +++ b/hugegraph-api/pom.xml @@ -15,8 +15,8 @@ License for the specific language governing permissions and limitations under the License. --> - org.apache.hugegraph @@ -157,12 +157,12 @@ com.taobao.arthas arthas-agent-attach - 3.6.4 + 3.6.9 com.taobao.arthas arthas-packaging - 3.6.4 + 3.6.9 From 78592e59d8606562cc7dce4fc87b187b6cfe0243 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Tue, 15 Aug 2023 22:58:14 +0800 Subject: [PATCH 04/16] add arthas test --- .../src/assembly/static/conf/arthas.yaml | 9 ------ .../apache/hugegraph/api/ArthasApiTest.java | 30 ++++++++++++++++--- 2 files changed, 26 insertions(+), 13 deletions(-) delete mode 100644 hugegraph-dist/src/assembly/static/conf/arthas.yaml diff --git a/hugegraph-dist/src/assembly/static/conf/arthas.yaml b/hugegraph-dist/src/assembly/static/conf/arthas.yaml deleted file mode 100644 index 3559ce4bce..0000000000 --- a/hugegraph-dist/src/assembly/static/conf/arthas.yaml +++ /dev/null @@ -1,9 +0,0 @@ -arthas: - # 通过 http 访问的端口 - httpPort: 8561 - # 通过 telnet 访问的端口 - telnetPort: 8562 - session-timeout: 1800 - disabledCommands: jad - # 绑定的 ip - ip: 0.0.0.0 \ No newline at end of file diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java index c9d8eb24cd..2ef11ae73d 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java @@ -1,17 +1,39 @@ package org.apache.hugegraph.api; +import org.junit.Before; import org.junit.Test; import jakarta.ws.rs.core.Response; public class ArthasApiTest extends BaseApiTest { + private static final String ARTHAS_START_PATH = "/arthas"; + private static final String ARTHAS_API_BASE_URL = "http://127.0.0.1:8561"; + private static final String ARTHAS_API_PATH = "/api"; - private static final String path = "/arthasstart"; + @Before + public void testArthasStart() { + Response r = client().get(ARTHAS_START_PATH); + assertResponseStatus(200, r); + } @Test - public void testMetricsAll() { - Response r = client().get(path); - assertResponseStatus(200, r); + public void testArthasApi() { + + String body = "{\n" + + " \"action\": \"exec\",\n" + + " \"requestId\": \"req112\",\n" + + " \"sessionId\": \"\",\n" + + " \"consumerId\": \"955dbd1325334a84972b0f3ac19de4f7_2\",\n" + + " \"command\": \"version\",\n" + + " \"execTimeout\": \"10000\"\n" + + "}"; + RestClient arthasApiClient = new RestClient(ARTHAS_API_BASE_URL); + Response r = arthasApiClient.post(ARTHAS_API_PATH, body); + String result = assertResponseStatus(200, r); + assertJsonContains(result, "state"); + assertJsonContains(result, "requestId"); + assertJsonContains(result, "sessionId"); + assertJsonContains(result, "body"); } } From d5503044bcbc674ebb6a2c745b5d23a935219c24 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Thu, 17 Aug 2023 22:50:17 +0800 Subject: [PATCH 05/16] license info --- .../licenses/LICENSE-arthas-agent-attach.txt | 202 ++++++++++++++++++ .../licenses/LICENSE-arthas-packaging.txt | 202 ++++++++++++++++++ .../LICENSE-byte-buddy-agent-1.11.6.txt | 176 +++++++++++++++ .../release-docs/licenses/LICENSE-zt-zip.txt | 202 ++++++++++++++++++ .../apache/hugegraph/api/ArthasApiTest.java | 17 ++ 5 files changed, 799 insertions(+) create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-arthas-agent-attach.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-arthas-packaging.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent-1.11.6.txt create mode 100644 hugegraph-dist/release-docs/licenses/LICENSE-zt-zip.txt diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-arthas-agent-attach.txt b/hugegraph-dist/release-docs/licenses/LICENSE-arthas-agent-attach.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-arthas-agent-attach.txt @@ -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/hugegraph-dist/release-docs/licenses/LICENSE-arthas-packaging.txt b/hugegraph-dist/release-docs/licenses/LICENSE-arthas-packaging.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-arthas-packaging.txt @@ -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/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent-1.11.6.txt b/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent-1.11.6.txt new file mode 100644 index 0000000000..d0381d6d04 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-byte-buddy-agent-1.11.6.txt @@ -0,0 +1,176 @@ +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 diff --git a/hugegraph-dist/release-docs/licenses/LICENSE-zt-zip.txt b/hugegraph-dist/release-docs/licenses/LICENSE-zt-zip.txt new file mode 100644 index 0000000000..a250c1a8c1 --- /dev/null +++ b/hugegraph-dist/release-docs/licenses/LICENSE-zt-zip.txt @@ -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 2012 ZeroTurnaround LLC. + + 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/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java index 2ef11ae73d..12051a35c5 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java @@ -1,3 +1,20 @@ +/* + * 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 org.apache.hugegraph.api; import org.junit.Before; From 17f8e74d301c21c78a1a8de9a4e3ade29876b189 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Thu, 17 Aug 2023 22:56:42 +0800 Subject: [PATCH 06/16] license info --- hugegraph-dist/release-docs/NOTICE | 38 +++++++++++++++++++ .../scripts/dependency/known-dependencies.txt | 4 ++ 2 files changed, 42 insertions(+) diff --git a/hugegraph-dist/release-docs/NOTICE b/hugegraph-dist/release-docs/NOTICE index 101ea81f45..39922da249 100644 --- a/hugegraph-dist/release-docs/NOTICE +++ b/hugegraph-dist/release-docs/NOTICE @@ -2058,3 +2058,41 @@ HPPC borrowed code, ideas or both from: (Apache license) * Koloboke, https://github.com/OpenHFT/Koloboke (Apache license) + + + +======================================================================== + +Arthas NOTICE + +======================================================================== + + +Arthas +Copyright 2018 Alibaba Group + +This product includes software developed at +Alibaba Group (https://www.alibabagroup.com/en/global/home). + +This product contains code form the greys-anatomy Project: + +The greys-anatomy Project +================= +Please visit Github for more information: +* https://github.com/oldmanpushcart/greys-anatomy + + +------------------------------------------------------------------------------- +This product contains a modified portion of 'Apache Commons Lang': +* LICENSE: + * Apache License 2.0 +* HOMEPAGE: + * https://commons.apache.org/proper/commons-lang/ + + +This product contains a modified portion of 'Apache Commons Net': +* LICENSE: + * Apache License 2.0 +* HOMEPAGE: + * https://commons.apache.org/proper/commons-net/ + diff --git a/hugegraph-dist/scripts/dependency/known-dependencies.txt b/hugegraph-dist/scripts/dependency/known-dependencies.txt index 5e50bdb4a0..dfb4aa9d07 100644 --- a/hugegraph-dist/scripts/dependency/known-dependencies.txt +++ b/hugegraph-dist/scripts/dependency/known-dependencies.txt @@ -7,6 +7,8 @@ annotations-4.1.1.4.jar ansj_seg-5.1.6.jar antlr-runtime-3.5.2.jar aopalliance-repackaged-3.0.1.jar +arthas-agent-attach-3.6.9.jar +arthas-packaging-3.6.9.jar asm-5.0.4.jar asm-6.0.jar asm-analysis-5.0.3.jar @@ -18,6 +20,7 @@ audience-annotations-0.5.0.jar bolt-1.6.4.jar byte-buddy-1.10.5.jar byte-buddy-agent-1.10.5.jar +byte-buddy-agent-1.11.6.jar caffeine-2.2.6.jar caffeine-2.3.1.jar cassandra-all-3.11.12.jar @@ -261,3 +264,4 @@ tracer-core-3.0.8.jar translation-1.0.4.jar util-9.0-9.0.20190305.jar validation-api-1.1.0.Final.jar +zt-zip-1.14.jar From 88e08437fee662e5040d96ae8bb3ed3176ea6765 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Sat, 9 Sep 2023 01:20:57 +0800 Subject: [PATCH 07/16] better code --- .../hugegraph/api/arthas/ArthasAPI.java | 53 +++---------------- .../hugegraph/config/ServerOptions.java | 11 ++-- .../static/conf/rest-server.properties | 6 +-- .../apache/hugegraph/api/ArthasApiTest.java | 1 - 4 files changed, 16 insertions(+), 55 deletions(-) diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java index 04390042d5..5681b29996 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java @@ -28,7 +28,7 @@ import com.taobao.arthas.agent.attach.ArthasAgent; import jakarta.inject.Singleton; -import jakarta.ws.rs.GET; +import jakarta.ws.rs.PUT; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Context; @@ -40,57 +40,18 @@ public class ArthasAPI extends API { @Context private jakarta.inject.Provider configProvider; - @GET + @PUT @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) - public Object arthasStart() { + public Object startArthas() { HugeConfig config = this.configProvider.get(); HashMap configMap = new HashMap<>(4); - configMap.put("arthas.telnetPort", config.get(ServerOptions.ARTHAS_TELNET_PORT)); - configMap.put("arthas.httpPort", config.get(ServerOptions.ARTHAS_HTTP_PORT)); + configMap.put("arthas.telnet_ort", config.get(ServerOptions.ARTHAS_TELNET_PORT)); + configMap.put("arthas.http_port", config.get(ServerOptions.ARTHAS_HTTP_PORT)); configMap.put("arthas.ip", config.get(ServerOptions.ARTHAS_IP)); - configMap.put("arthas.disabledCommands", + configMap.put("arthas.disabled_commands", config.get(ServerOptions.ARTHAS_DISABLED_COMMANDS)); ArthasAgent.attach(configMap); - - DashResponse retPose = new DashResponse(); - retPose.setData(JsonUtil.toJson(configMap)); - retPose.setStatus(200); - retPose.setMessage("arthas 启动成功"); - return retPose; - } - - public static class DashResponse { - - private String data; - private int status; - private String message; - - public DashResponse() { - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } + return JsonUtil.toJson(configMap); } } diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index fafb582345..25f288d5e4 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -265,21 +265,22 @@ public static synchronized ServerOptions instance() { true ); - public static final ConfigOption ARTHAS_TELNET_PORT = new ConfigOption<>( - "arthas.telnetPort", + "arthas.telnet_port", "arthas provides telnet ports to the outside", disallowEmpty(), "8562" ); + public static final ConfigOption ARTHAS_HTTP_PORT = new ConfigOption<>( - "arthas.httpPort", + "arthas.http_port", "arthas provides http ports to the outside", disallowEmpty(), "8561" ); + public static final ConfigOption ARTHAS_IP = new ConfigOption<>( "arthas.ip", @@ -287,12 +288,12 @@ public static synchronized ServerOptions instance() { disallowEmpty(), "0.0.0.0" ); + public static final ConfigOption ARTHAS_DISABLED_COMMANDS = new ConfigOption<>( - "arthas.disabledCommands", + "arthas.disabled_commands", "arthas disabled commands", disallowEmpty(), "jad" ); - } \ No newline at end of file diff --git a/hugegraph-dist/src/assembly/static/conf/rest-server.properties b/hugegraph-dist/src/assembly/static/conf/rest-server.properties index 76b50848a2..f6444f84fb 100644 --- a/hugegraph-dist/src/assembly/static/conf/rest-server.properties +++ b/hugegraph-dist/src/assembly/static/conf/rest-server.properties @@ -10,10 +10,10 @@ batch.max_write_ratio=80 batch.max_write_threads=0 # configuration of arthas -arthas.telnetPort=8562 -arthas.httpPort=8561 +arthas.telnet_port=8562 +arthas.http_port=8561 arthas.ip=0.0.0.0 -arthas.disabledCommands=jad +arthas.disabled_commands=jad # authentication configs # choose 'org.apache.hugegraph.auth.StandardAuthenticator' or diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java index 12051a35c5..5d73fb5fee 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java @@ -36,7 +36,6 @@ public void testArthasStart() { @Test public void testArthasApi() { - String body = "{\n" + " \"action\": \"exec\",\n" + " \"requestId\": \"req112\",\n" + From b62010215bbca8be3b343b9a8fa6478b2e8f495f Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Tue, 12 Sep 2023 22:33:51 +0800 Subject: [PATCH 08/16] better code --- .../org/apache/hugegraph/api/arthas/ArthasAPI.java | 7 +++---- .../org/apache/hugegraph/config/ServerOptions.java | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java index 5681b29996..58ae3257e4 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java @@ -46,11 +46,10 @@ public class ArthasAPI extends API { public Object startArthas() { HugeConfig config = this.configProvider.get(); HashMap configMap = new HashMap<>(4); - configMap.put("arthas.telnet_ort", config.get(ServerOptions.ARTHAS_TELNET_PORT)); - configMap.put("arthas.http_port", config.get(ServerOptions.ARTHAS_HTTP_PORT)); + configMap.put("arthas.telnetPort", config.get(ServerOptions.ARTHAS_TELNET_PORT)); + configMap.put("arthas.httpPort", config.get(ServerOptions.ARTHAS_HTTP_PORT)); configMap.put("arthas.ip", config.get(ServerOptions.ARTHAS_IP)); - configMap.put("arthas.disabled_commands", - config.get(ServerOptions.ARTHAS_DISABLED_COMMANDS)); + configMap.put("arthas.disabledCommands",config.get(ServerOptions.ARTHAS_DISABLED_COMMANDS)); ArthasAgent.attach(configMap); return JsonUtil.toJson(configMap); } diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index 25f288d5e4..73231e95a6 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -268,7 +268,7 @@ public static synchronized ServerOptions instance() { public static final ConfigOption ARTHAS_TELNET_PORT = new ConfigOption<>( "arthas.telnet_port", - "arthas provides telnet ports to the outside", + "arthas provides telnet port to the outside", disallowEmpty(), "8562" ); @@ -276,7 +276,7 @@ public static synchronized ServerOptions instance() { public static final ConfigOption ARTHAS_HTTP_PORT = new ConfigOption<>( "arthas.http_port", - "arthas provides http ports to the outside", + "arthas provides http port to the outside", disallowEmpty(), "8561" ); @@ -284,7 +284,7 @@ public static synchronized ServerOptions instance() { public static final ConfigOption ARTHAS_IP = new ConfigOption<>( "arthas.ip", - "arthas bound ip", + "arthas bound ip for access", disallowEmpty(), "0.0.0.0" ); @@ -292,8 +292,8 @@ public static synchronized ServerOptions instance() { public static final ConfigOption ARTHAS_DISABLED_COMMANDS = new ConfigOption<>( "arthas.disabled_commands", - "arthas disabled commands", - disallowEmpty(), + "arthas disabled commands due to high risk", + allowValues("jad"), "jad" ); } \ No newline at end of file From 4a0ec4e2c8eab75ab6a7c040861e05e6c93d7df2 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Sat, 16 Sep 2023 19:36:05 +0800 Subject: [PATCH 09/16] better code --- .../main/java/org/apache/hugegraph/config/ServerOptions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index 73231e95a6..4cfbf3086c 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -276,7 +276,7 @@ public static synchronized ServerOptions instance() { public static final ConfigOption ARTHAS_HTTP_PORT = new ConfigOption<>( "arthas.http_port", - "arthas provides http port to the outside", + "The HTTP port provided by Arthas, it can be accessible from the outside.", disallowEmpty(), "8561" ); @@ -293,7 +293,7 @@ public static synchronized ServerOptions instance() { new ConfigOption<>( "arthas.disabled_commands", "arthas disabled commands due to high risk", - allowValues("jad"), + null, "jad" ); } \ No newline at end of file From 984caacd65674020f051104cb1dd7f90b27408bb Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Sat, 16 Sep 2023 22:04:55 +0800 Subject: [PATCH 10/16] better code --- .../java/org/apache/hugegraph/api/arthas/ArthasAPI.java | 2 +- .../java/org/apache/hugegraph/config/ServerOptions.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java index 58ae3257e4..549f9de0a8 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/api/arthas/ArthasAPI.java @@ -49,7 +49,7 @@ public Object startArthas() { configMap.put("arthas.telnetPort", config.get(ServerOptions.ARTHAS_TELNET_PORT)); configMap.put("arthas.httpPort", config.get(ServerOptions.ARTHAS_HTTP_PORT)); configMap.put("arthas.ip", config.get(ServerOptions.ARTHAS_IP)); - configMap.put("arthas.disabledCommands",config.get(ServerOptions.ARTHAS_DISABLED_COMMANDS)); + configMap.put("arthas.disabledCommands", config.get(ServerOptions.ARTHAS_DISABLED_COMMANDS)); ArthasAgent.attach(configMap); return JsonUtil.toJson(configMap); } diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index 4cfbf3086c..f025cbab4f 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -268,7 +268,7 @@ public static synchronized ServerOptions instance() { public static final ConfigOption ARTHAS_TELNET_PORT = new ConfigOption<>( "arthas.telnet_port", - "arthas provides telnet port to the outside", + "The telnet port provided by Arthas, it can be accessible from the outside.", disallowEmpty(), "8562" ); @@ -284,7 +284,7 @@ public static synchronized ServerOptions instance() { public static final ConfigOption ARTHAS_IP = new ConfigOption<>( "arthas.ip", - "arthas bound ip for access", + "The IP provided by Arthas, it can be accessible from the outside.", disallowEmpty(), "0.0.0.0" ); @@ -292,7 +292,7 @@ public static synchronized ServerOptions instance() { public static final ConfigOption ARTHAS_DISABLED_COMMANDS = new ConfigOption<>( "arthas.disabled_commands", - "arthas disabled commands due to high risk", + "The disabled Arthas commands due to high risk.", null, "jad" ); From d85886f907d61f47df5455acd3d39e50a51e4253 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Wed, 20 Sep 2023 21:51:56 +0800 Subject: [PATCH 11/16] arthas version better code --- hugegraph-api/pom.xml | 4 ++-- .../main/java/org/apache/hugegraph/config/ServerOptions.java | 2 +- pom.xml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hugegraph-api/pom.xml b/hugegraph-api/pom.xml index 10f0bca900..b99cde52cf 100644 --- a/hugegraph-api/pom.xml +++ b/hugegraph-api/pom.xml @@ -157,12 +157,12 @@ com.taobao.arthas arthas-agent-attach - 3.6.9 + ${arthas.version} com.taobao.arthas arthas-packaging - 3.6.9 + ${arthas.version} diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java index f025cbab4f..4606ec631f 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java @@ -296,4 +296,4 @@ public static synchronized ServerOptions instance() { null, "jad" ); -} \ No newline at end of file +} diff --git a/pom.xml b/pom.xml index 719328316c..92f17dbc5a 100644 --- a/pom.xml +++ b/pom.xml @@ -115,6 +115,7 @@ 1.47.0 3.21.7 1.36 + 3.6.9 From cf0c99b17707fb070aa959779a122cddbdd7756d Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Wed, 20 Sep 2023 23:00:23 +0800 Subject: [PATCH 12/16] arthas version better code --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 92f17dbc5a..8b1ac31f5f 100644 --- a/pom.xml +++ b/pom.xml @@ -115,7 +115,7 @@ 1.47.0 3.21.7 1.36 - 3.6.9 + 3.7.1 From 65c712034f5907891790df096edb11c38f11f6df Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Thu, 21 Sep 2023 22:02:41 +0800 Subject: [PATCH 13/16] dep version update --- hugegraph-dist/scripts/dependency/known-dependencies.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hugegraph-dist/scripts/dependency/known-dependencies.txt b/hugegraph-dist/scripts/dependency/known-dependencies.txt index dfb4aa9d07..b5f5036617 100644 --- a/hugegraph-dist/scripts/dependency/known-dependencies.txt +++ b/hugegraph-dist/scripts/dependency/known-dependencies.txt @@ -7,8 +7,8 @@ annotations-4.1.1.4.jar ansj_seg-5.1.6.jar antlr-runtime-3.5.2.jar aopalliance-repackaged-3.0.1.jar -arthas-agent-attach-3.6.9.jar -arthas-packaging-3.6.9.jar +arthas-agent-attach-3.7.1.jar +arthas-packaging-3.7.1.jar asm-5.0.4.jar asm-6.0.jar asm-analysis-5.0.3.jar From b0ea4e7f146f866998876bf053b95ac55d6931e0 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Tue, 10 Oct 2023 22:28:58 +0800 Subject: [PATCH 14/16] fix(api): test arthas for arthas auth --- .../apache/hugegraph/api/ApiTestSuite.java | 3 +- .../apache/hugegraph/api/ArthasApiTest.java | 15 ++++++++-- .../org/apache/hugegraph/api/BaseApiTest.java | 30 +++++++++++++------ 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java index a5830a4336..26e00e227a 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ApiTestSuite.java @@ -40,7 +40,8 @@ LoginApiTest.class, ProjectApiTest.class, TraversersApiTestSuite.class, - CypherApiTest.class + CypherApiTest.class, + ArthasApiTest.class }) public class ApiTestSuite { diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java index 5d73fb5fee..3b44721191 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java @@ -20,6 +20,8 @@ import org.junit.Before; import org.junit.Test; +import com.google.common.collect.ImmutableMap; + import jakarta.ws.rs.core.Response; public class ArthasApiTest extends BaseApiTest { @@ -30,7 +32,7 @@ public class ArthasApiTest extends BaseApiTest { @Before public void testArthasStart() { - Response r = client().get(ARTHAS_START_PATH); + Response r = client().put(ARTHAS_START_PATH, "", "", ImmutableMap.of()); assertResponseStatus(200, r); } @@ -39,17 +41,24 @@ public void testArthasApi() { String body = "{\n" + " \"action\": \"exec\",\n" + " \"requestId\": \"req112\",\n" + - " \"sessionId\": \"\",\n" + " \"consumerId\": \"955dbd1325334a84972b0f3ac19de4f7_2\",\n" + " \"command\": \"version\",\n" + " \"execTimeout\": \"10000\"\n" + "}"; - RestClient arthasApiClient = new RestClient(ARTHAS_API_BASE_URL); + RestClient arthasApiClient = new RestClient(ARTHAS_API_BASE_URL,false); + // If request header contains basic auth, and if we are not set auth when arthas attach hg, + // arthas will auth it and return 401. ref:https://arthas.aliyun.com/en/doc/auth.html#configure-username-and-password Response r = arthasApiClient.post(ARTHAS_API_PATH, body); String result = assertResponseStatus(200, r); assertJsonContains(result, "state"); assertJsonContains(result, "requestId"); assertJsonContains(result, "sessionId"); assertJsonContains(result, "body"); + + RestClient arthasApiClientWithAuth = new RestClient(ARTHAS_API_BASE_URL); + // If request header contains basic auth, and if we are not set auth when arthas attach hg, + // arthas will auth it and return 401. ref:https://arthas.aliyun.com/en/doc/auth.html#configure-username-and-password + r = arthasApiClientWithAuth.post(ARTHAS_API_PATH, body); + assertResponseStatus(401, r); } } diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java index 83c1dcebe0..472c867abb 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java @@ -27,13 +27,10 @@ import java.util.function.Consumer; import java.util.stream.Collectors; -import jakarta.ws.rs.client.Client; -import jakarta.ws.rs.client.ClientBuilder; -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; import org.apache.http.util.TextUtils; +import org.apache.hugegraph.HugeException; +import org.apache.hugegraph.util.CollectionUtil; +import org.apache.hugegraph.util.JsonUtil; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.glassfish.jersey.client.filter.EncodingFilter; import org.glassfish.jersey.message.GZipEncoder; @@ -42,9 +39,6 @@ import org.junit.Assert; import org.junit.BeforeClass; -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.util.CollectionUtil; -import org.apache.hugegraph.util.JsonUtil; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -52,6 +46,13 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; + public class BaseApiTest { private static final String BASE_URL = "http://127.0.0.1:8080"; @@ -111,6 +112,17 @@ public RestClient(String url) { PASSWORD)); this.target = this.client.target(url); } + public RestClient(String url,Boolean useAuth) { + this.client = ClientBuilder.newClient(); + this.client.register(EncodingFilter.class); + this.client.register(GZipEncoder.class); + if(useAuth){ + this.client.register(HttpAuthenticationFeature.basic(USERNAME, + PASSWORD)); + } + + this.target = this.client.target(url); + } public void close() { this.client.close(); From 564cdc3aa69c186091b403c922fa2626b4fc85e3 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Sun, 15 Oct 2023 21:01:10 +0800 Subject: [PATCH 15/16] chore(api): code style for arthas test --- .../org/apache/hugegraph/api/ArthasApiTest.java | 2 +- .../java/org/apache/hugegraph/api/BaseApiTest.java | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java index 3b44721191..0bff5c3258 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java @@ -45,7 +45,7 @@ public void testArthasApi() { " \"command\": \"version\",\n" + " \"execTimeout\": \"10000\"\n" + "}"; - RestClient arthasApiClient = new RestClient(ARTHAS_API_BASE_URL,false); + RestClient arthasApiClient = new RestClient(ARTHAS_API_BASE_URL, false); // If request header contains basic auth, and if we are not set auth when arthas attach hg, // arthas will auth it and return 401. ref:https://arthas.aliyun.com/en/doc/auth.html#configure-username-and-password Response r = arthasApiClient.post(ARTHAS_API_PATH, body); diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java index 472c867abb..24b19ba1ea 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java @@ -105,22 +105,17 @@ public static class RestClient { private WebTarget target; public RestClient(String url) { - this.client = ClientBuilder.newClient(); - this.client.register(EncodingFilter.class); - this.client.register(GZipEncoder.class); - this.client.register(HttpAuthenticationFeature.basic(USERNAME, - PASSWORD)); - this.target = this.client.target(url); + this(url, true); } - public RestClient(String url,Boolean useAuth) { + + public RestClient(String url,Boolean enableAuth) { this.client = ClientBuilder.newClient(); this.client.register(EncodingFilter.class); this.client.register(GZipEncoder.class); - if(useAuth){ + if(enableAuth) { this.client.register(HttpAuthenticationFeature.basic(USERNAME, PASSWORD)); } - this.target = this.client.target(url); } From f3f9d488af7bed481a6f6025ffbbcf8cebe3d396 Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Sun, 15 Oct 2023 21:04:28 +0800 Subject: [PATCH 16/16] chore(api): code style for arthas test --- .../src/main/java/org/apache/hugegraph/api/ArthasApiTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java index 0bff5c3258..174b665fea 100644 --- a/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java +++ b/hugegraph-test/src/main/java/org/apache/hugegraph/api/ArthasApiTest.java @@ -56,8 +56,6 @@ public void testArthasApi() { assertJsonContains(result, "body"); RestClient arthasApiClientWithAuth = new RestClient(ARTHAS_API_BASE_URL); - // If request header contains basic auth, and if we are not set auth when arthas attach hg, - // arthas will auth it and return 401. ref:https://arthas.aliyun.com/en/doc/auth.html#configure-username-and-password r = arthasApiClientWithAuth.post(ARTHAS_API_PATH, body); assertResponseStatus(401, r); }