You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by vg...@apache.org on 2024/03/22 11:07:29 UTC

(incubator-hugegraph) 01/01: refactor

This is an automated email from the ASF dual-hosted git repository.

vgalaxies pushed a commit to branch fix-pd-test
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git

commit 2314461e2e4065ae506accb2d13b488c491cf2f3
Author: VGalaxies <vg...@apache.org>
AuthorDate: Fri Mar 22 18:35:04 2024 +0800

    refactor
---
 .github/workflows/pd-store.yml                     |   4 -
 .../apache/hugegraph/pd/client/ClientCache.java    |  11 +-
 hugegraph-pd/hg-pd-clitools/pom.xml                |  74 -----------
 .../org/apache/hugegraph/pd/clitools/Main.java     |  85 ------------
 .../java/org/apache/hugegraph/pd/UnitTestBase.java |  34 -----
 .../apache/hugegraph/pd/client/BaseClientTest.java |  11 +-
 .../apache/hugegraph/pd/client/ChangingLeader.java |  58 ++++++++
 .../pd/client/DiscoveryClientImplTest.java         | 147 ---------------------
 .../hugegraph/pd/client/DiscoveryClientTest.java   |  79 -----------
 .../apache/hugegraph/pd/client/KvClientTest.java   |   3 -
 .../hugegraph/pd/client/LicenseClientImplTest.java | 127 ------------------
 .../hugegraph/pd/client/PDClientSuiteTest.java     |   4 +-
 .../apache/hugegraph/pd/client/PDClientTest.java   |  30 ++---
 .../apache/hugegraph/pd/client/PDPulseTest.java    |  34 ++---
 .../apache/hugegraph/pd/client/PDWatchTest.java    |  20 ++-
 .../hugegraph/pd/client/StoreRegisterTest.java     |  34 +++--
 .../hugegraph/pd/client/test/HgPDTestUtil.java     |  92 -------------
 .../hugegraph/pd/clitools/BaseCliToolsTest.java    |  34 -----
 .../hugegraph/pd/clitools/CliToolsSuiteTest.java   |  35 -----
 .../org/apache/hugegraph/pd/clitools/MainTest.java |  91 -------------
 .../apache/hugegraph/pd/common/BaseCommonTest.java |  33 -----
 .../hugegraph/pd/common/CommonSuiteTest.java       |   3 -
 .../apache/hugegraph/pd/common/HgAssertTest.java   |   2 -
 .../org/apache/hugegraph/pd/common/KVPairTest.java |   1 -
 .../hugegraph/pd/common/PartitionCacheTest.java    |   1 -
 .../hugegraph/pd/common/PartitionUtilsTest.java    |  10 +-
 hugegraph-pd/pom.xml                               |  26 ----
 27 files changed, 124 insertions(+), 959 deletions(-)

diff --git a/.github/workflows/pd-store.yml b/.github/workflows/pd-store.yml
index b3abff59d..884868316 100644
--- a/.github/workflows/pd-store.yml
+++ b/.github/workflows/pd-store.yml
@@ -62,10 +62,6 @@ jobs:
         run: |
           mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-client-test
 
-      - name: Run cli-tools test
-        run: |
-          mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-cli-tools-test
-
       - name: Run rest test
         run: |
           mvn test -pl hugegraph-pd/hg-pd-test -am -P pd-rest-test
diff --git a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java
index d4fd50ffe..868f8fae3 100644
--- a/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java
+++ b/hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/ClientCache.java
@@ -73,8 +73,15 @@ public class ClientCache {
         try {
             GraphCache graph = initGraph(graphName);
             Partition partition = graph.getPartition(partId);
-            Shard shard = groups.get(partId).getValue();
-            if (partition == null || shard == null) {
+            if (partition == null) {
+                return null;
+            }
+            KVPair<ShardGroup, Shard> group = groups.get(partId);
+            if (group == null) {
+                return null;
+            }
+            Shard shard = group.getValue();
+            if (shard == null) {
                 return null;
             }
             return new KVPair<>(partition, shard);
diff --git a/hugegraph-pd/hg-pd-clitools/pom.xml b/hugegraph-pd/hg-pd-clitools/pom.xml
deleted file mode 100644
index b6178530e..000000000
--- a/hugegraph-pd/hg-pd-clitools/pom.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xmlns="http://maven.apache.org/POM/4.0.0"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>hugegraph-pd</artifactId>
-        <groupId>org.apache.hugegraph</groupId>
-        <version>${revision}</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>hg-pd-clitools</artifactId>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.hugegraph</groupId>
-            <artifactId>hg-pd-client</artifactId>
-            <version>${revision}</version>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.13.2</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <archive>
-                                <manifest>
-                                    <mainClass>
-                                        org.apache.hugegraph.pd.clitools.Main
-                                    </mainClass>
-                                </manifest>
-                            </archive>
-                            <descriptorRefs>
-                                <descriptorRef>jar-with-dependencies</descriptorRef>
-                            </descriptorRefs>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>
diff --git a/hugegraph-pd/hg-pd-clitools/src/main/java/org/apache/hugegraph/pd/clitools/Main.java b/hugegraph-pd/hg-pd-clitools/src/main/java/org/apache/hugegraph/pd/clitools/Main.java
deleted file mode 100644
index 440ec2e5f..000000000
--- a/hugegraph-pd/hg-pd-clitools/src/main/java/org/apache/hugegraph/pd/clitools/Main.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.pd.clitools;
-
-import org.apache.hugegraph.pd.client.PDClient;
-import org.apache.hugegraph.pd.client.PDConfig;
-import org.apache.hugegraph.pd.common.PDException;
-import org.apache.hugegraph.pd.grpc.Metapb;
-
-public class Main {
-
-    public static void main(String[] args) throws PDException {
-        if (args.length < 3) {
-            String error = " usage: pd-address config key[=value] \n key list: " +
-                           "\n\tenableBatchLoad";
-            System.out.println(error);
-            System.exit(0);
-        }
-        String pd = args[0];
-        String cmd = args[1];
-        String param = args[2];
-        System.out.println(pd + " " + cmd + " " + param);
-        System.out.println("Result: \n");
-        switch (cmd) {
-            case "config":
-                doConfig(pd, param);
-            case "change_raft":
-                doChangeRaft(pd, param);
-        }
-    }
-
-    private static void doChangeRaft(String pd, String param) throws PDException {
-        PDClient pdClient = PDClient.create(PDConfig.of(pd));
-        pdClient.updatePdRaft(param);
-    }
-
-    public static void doConfig(String pd, String param) throws PDException {
-        PDClient pdClient = PDClient.create(PDConfig.of(pd));
-        String[] pair = param.split("=");
-        String key = pair[0].trim();
-        Object value = null;
-        if (pair.length > 1) {
-            value = pair[1].trim();
-        }
-        if (value == null) {
-            Metapb.PDConfig pdConfig = pdClient.getPDConfig();
-            switch (key) {
-                case "enableBatchLoad":
-                    //    value = pdConfig.getEnableBatchLoad();
-                    break;
-                case "shardCount":
-                    value = pdConfig.getShardCount();
-                    break;
-            }
-
-            System.out.println("Get config " + key + "=" + value);
-        } else {
-            Metapb.PDConfig.Builder builder = Metapb.PDConfig.newBuilder();
-            switch (key) {
-                case "enableBatchLoad":
-                    //   builder.setEnableBatchLoad(Boolean.valueOf((String)value));
-                case "shardCount":
-                    builder.setShardCount(Integer.valueOf((String) value));
-            }
-            pdClient.setPDConfig(builder.build());
-            System.out.println("Set config " + key + "=" + value);
-        }
-    }
-
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/UnitTestBase.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/UnitTestBase.java
deleted file mode 100644
index e1ca5adaf..000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/UnitTestBase.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.pd;
-
-import java.io.File;
-
-import org.apache.hugegraph.pd.common.Useless;
-
-@Useless
-public class UnitTestBase {
-    public static boolean deleteDir(File dir) {
-        if (dir.isDirectory()) {
-            for (File file : dir.listFiles()) {
-                deleteDir(file);
-            }
-        }
-        return dir.delete();
-    }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/BaseClientTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/BaseClientTest.java
index 3fca39ade..ef3152fa1 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/BaseClientTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/BaseClientTest.java
@@ -24,21 +24,18 @@ import org.mockito.runners.MockitoJUnitRunner;
 
 @RunWith(MockitoJUnitRunner.class)
 public class BaseClientTest {
-    public static PDClient pdClient;
-    public final String storeAddr = "localhost";
-    public final String graphName = "default/hugegraph/g";
-    public long storeId = 0;
+
+    protected static PDClient pdClient;
 
     @BeforeClass
-    public static void beforeClass() throws Exception {
+    public static void beforeClass() {
         PDConfig config = PDConfig.of("localhost:8686");
-//        PDConfig config = PDConfig.of("10.81.116.77:8986");
         config.setEnableCache(true);
         pdClient = PDClient.create(config);
     }
 
     @After
-    public void teardown() throws Exception {
+    public void teardown() {
         // pass
     }
 }
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/ChangingLeader.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/ChangingLeader.java
new file mode 100644
index 000000000..afc3d20ed
--- /dev/null
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/ChangingLeader.java
@@ -0,0 +1,58 @@
+/*
+ * 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.pd.client;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hugegraph.pd.common.Useless;
+
+import com.alipay.sofa.jraft.CliService;
+import com.alipay.sofa.jraft.RaftServiceFactory;
+import com.alipay.sofa.jraft.Status;
+import com.alipay.sofa.jraft.conf.Configuration;
+import com.alipay.sofa.jraft.entity.PeerId;
+import com.alipay.sofa.jraft.option.CliOptions;
+
+@Useless("used for development")
+public class ChangingLeader {
+
+    private static final CliService cliService =
+            RaftServiceFactory.createAndInitCliService(new CliOptions());
+
+    public static void main(String[] args) {
+        var conf = new Configuration();
+        conf.addPeer(PeerId.parsePeer("127.0.0.1:8610"));
+        conf.addPeer(PeerId.parsePeer("127.0.0.1:8611"));
+        conf.addPeer(PeerId.parsePeer("127.0.0.1:8612"));
+        CountDownLatch latch = new CountDownLatch(100);
+
+        Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> {
+            Status status = cliService.transferLeader("pd_raft", conf, PeerId.ANY_PEER);
+            System.out.println("trigger change leader status: " + status);
+            latch.countDown();
+        }, 1, 3, TimeUnit.SECONDS);
+
+        try {
+            latch.await();
+        } catch (Exception e) {
+            System.out.println(e);
+        }
+    }
+}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java
deleted file mode 100644
index 6d42c5ea7..000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientImplTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.pd.client;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Vector;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.hugegraph.pd.grpc.discovery.NodeInfos;
-import org.apache.hugegraph.pd.grpc.discovery.Query;
-import org.junit.Assert;
-
-public class DiscoveryClientImplTest {
-
-    private static final AtomicLong label = new AtomicLong();
-    String address = "localhost:80";
-    int delay = 1000;
-    int wait = delay * 3 + 500;
-
-    // @Test
-    public void registerStore() throws InterruptedException {
-
-        HashMap<String, String> labels = new HashMap<>();
-
-        labels.put("metrics", "/actuator/prometheus");
-        labels.put("target", "10.81.116.77:8520");
-        labels.put("scheme", "http");
-        labels.put("__relabeling", "http");
-        labels.put("no_relabeling", "http");
-        getClient("store", "address1", labels);
-
-        labels.put("metrics", "/actuator/prometheus");
-        labels.put("target", "10.81.116.78:8520");
-        labels.put("scheme", "http");
-        getClient("store", "address2", labels);
-
-        labels.put("metrics", "/actuator/prometheus");
-        labels.put("target", "10.81.116.79:8520");
-        labels.put("scheme", "http");
-        getClient("store", "address3", labels);
-
-        labels.put("metrics", "/actuator/prometheus");
-        labels.put("target", "10.81.116.78:8620");
-        labels.put("scheme", "http");
-        getClient("pd", "address1", labels);
-
-        labels.put("metrics", "/graph/metrics");
-        labels.put("target", "10.37.1.1:9200");
-        labels.put("scheme", "https");
-        getClient("hugegraph", "address1", labels);
-    }
-
-    // @Test
-    public void testNodes() throws InterruptedException {
-        String appName = "hugegraph";
-        register(appName, address);
-    }
-
-    // @Test
-    public void testMultiNode() throws InterruptedException {
-        for (int i = 0; i < 2; i++) {
-            register("app" + i, address + i);
-        }
-    }
-
-    // @Test
-    public void testParallelMultiNode() throws InterruptedException {
-        CountDownLatch latch = new CountDownLatch(30);
-        Vector<Exception> exceptions = new Vector<>();
-        for (int i = 0; i < 30; i++) {
-            int finalI = i;
-            new Thread(() -> {
-                try {
-                    for (int j = 0; j < 3; j++) {
-                        register("app" + finalI, address + j);
-                    }
-                } catch (Exception e) {
-                    exceptions.add(e);
-                } finally {
-                    latch.countDown();
-                }
-            }).start();
-        }
-        latch.await();
-        Assert.assertEquals(0, exceptions.size());
-    }
-
-    private void register(String appName, String address) throws InterruptedException {
-
-        HashMap<String, String> labels = new HashMap<>();
-        String labelValue = String.valueOf(label.incrementAndGet());
-        labels.put("address", labelValue);
-        labels.put("address1", labelValue);
-        Query query = Query.newBuilder().setAppName(
-                appName).setVersion("0.13.0").putAllLabels(labels).build();
-        DiscoveryClientImpl discoveryClient = getClient(appName, address, labels);
-        Thread.sleep(10000);
-        NodeInfos nodeInfos1 = discoveryClient.getNodeInfos(query);
-        Assert.assertEquals(1, nodeInfos1.getInfoCount());
-        DiscoveryClientImpl discoveryClient1 = getClient(appName, address + 0, labels);
-        Thread.sleep(10000);
-        Assert.assertEquals(2, discoveryClient.getNodeInfos(query).getInfoCount());
-        Query query1 = Query.newBuilder().setAppName(
-                appName).setVersion("0.12.0").putAllLabels(labels).build();
-        Assert.assertEquals(0, discoveryClient.getNodeInfos(query1).getInfoCount());
-        discoveryClient.cancelTask();
-        discoveryClient1.cancelTask();
-        Thread.sleep(wait);
-        NodeInfos nodeInfos = discoveryClient.getNodeInfos(query);
-        System.out.println(nodeInfos);
-        Assert.assertEquals(0, nodeInfos.getInfoCount());
-        discoveryClient.close();
-        discoveryClient1.close();
-    }
-
-    private DiscoveryClientImpl getClient(String appName, String address, Map labels) {
-        DiscoveryClientImpl discoveryClient = null;
-        try {
-            discoveryClient = DiscoveryClientImpl.newBuilder().setCenterAddress(
-                    "localhost:8687,localhost:8686,localhost:8688").setAddress(address).setAppName(
-                    appName).setDelay(delay).setVersion("0.13.0").setId(
-                    "0").setLabels(labels).build();
-            discoveryClient.scheduleTask();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        return discoveryClient;
-    }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientTest.java
deleted file mode 100644
index 928f1dcba..000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/DiscoveryClientTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.pd.client;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Consumer;
-
-import org.apache.hugegraph.pd.client.DiscoveryClientImpl;
-import org.apache.hugegraph.pd.grpc.discovery.NodeInfo;
-import org.apache.hugegraph.pd.grpc.discovery.Query;
-import org.junit.Before;
-import org.junit.Test;
-
-public class DiscoveryClientTest {
-
-    private DiscoveryClientImpl client;
-
-    @Before
-    public void setUp() {
-        this.client = getClient("appName", "localhost:8654", new HashMap());
-    }
-
-    @Test
-    public void testGetRegisterNode() {
-        // Setup
-        try {
-            Consumer result = this.client.getRegisterConsumer();
-            final NodeInfo expectedResult = NodeInfo.newBuilder()
-                                                    .setAppName("appName")
-                                                    .build();
-
-            Thread.sleep(3000);
-            Query query = Query.newBuilder().setAppName("appName")
-                               .setVersion("0.13.0").build();
-
-            // Run the test
-            this.client.getNodeInfos(query);
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        } finally {
-            this.client.close();
-        }
-
-    }
-
-    private DiscoveryClientImpl getClient(String appName, String address,
-                                          Map labels) {
-        DiscoveryClientImpl discoveryClient = null;
-        try {
-            discoveryClient = DiscoveryClientImpl.newBuilder().setCenterAddress(
-                                                         "localhost:8686").setAddress(address).setAppName(appName)
-                                                 .setDelay(2000)
-                                                 .setVersion("0.13.0")
-                                                 .setId("0").setLabels(labels)
-                                                 .build();
-            discoveryClient.scheduleTask();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        return discoveryClient;
-    }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/KvClientTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/KvClientTest.java
index c61413b8c..66993f281 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/KvClientTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/KvClientTest.java
@@ -23,8 +23,6 @@ import static org.mockito.Mockito.mock;
 import java.util.function.Consumer;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.hugegraph.pd.client.KvClient;
-import org.apache.hugegraph.pd.client.PDConfig;
 import org.apache.hugegraph.pd.grpc.kv.KResponse;
 import org.apache.hugegraph.pd.grpc.kv.ScanPrefixResponse;
 import org.apache.hugegraph.pd.grpc.kv.WatchEvent;
@@ -59,7 +57,6 @@ public class KvClientTest extends BaseClientTest {
 
         }
 
-
         // Verify the results
     }
 
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java
deleted file mode 100644
index 4ed11b9b2..000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/LicenseClientImplTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.pd.client;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.hugegraph.pd.grpc.Pdpb;
-import org.apache.hugegraph.pd.grpc.kv.KResponse;
-import org.apache.hugegraph.pd.grpc.kv.KvResponse;
-import org.yaml.snakeyaml.Yaml;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class LicenseClientImplTest {
-
-    // @Test
-    public void putLicense() {
-        PDConfig pdConfig = PDConfig.of("localhost:8686,localhost:8687,localhost:8688");
-        //PDConfig pdConfig = PDConfig.of("localhost:8686");
-        pdConfig.setEnableCache(true);
-        try (LicenseClient c = new LicenseClient(pdConfig)) {
-            File file = new File("../conf/hugegraph.license");
-            byte[] bytes = FileUtils.readFileToByteArray(file);
-            Pdpb.PutLicenseResponse putLicenseResponse = c.putLicense(bytes);
-            Pdpb.Error error = putLicenseResponse.getHeader().getError();
-            log.info(error.getMessage());
-            assert error.getType().equals(Pdpb.ErrorType.OK);
-        } catch (Exception e) {
-            log.error("put license with error: ", e);
-        }
-    }
-
-    // @Test
-    public void getKv() {
-        PDConfig pdConfig = PDConfig.of("10.157.12.36:8686");
-        pdConfig.setEnableCache(true);
-        try (KvClient c = new KvClient(pdConfig)) {
-            KResponse kResponse = c.get("S:FS");
-            Pdpb.Error error = kResponse.getHeader().getError();
-            log.info(error.getMessage());
-            assert error.getType().equals(Pdpb.ErrorType.OK);
-            Properties ymlConfig = getYmlConfig(kResponse.getValue());
-            Object property = ymlConfig.get("rocksdb.write_buffer_size");
-            assert property.toString().equals("32000000");
-        } catch (Exception e) {
-            log.error("put license with error: ", e);
-        }
-    }
-
-    // @Test
-    public void putKv() {
-        PDConfig pdConfig = PDConfig.of("127.0.0.1.70:8688");
-        pdConfig.setEnableCache(true);
-        try (KvClient c = new KvClient(pdConfig)) {
-            long l = System.currentTimeMillis();
-            KvResponse kvResponse = c.put("S:Timestamp", String.valueOf(l));
-            Pdpb.Error error = kvResponse.getHeader().getError();
-            log.info(error.getMessage());
-            assert error.getType().equals(Pdpb.ErrorType.OK);
-        } catch (Exception e) {
-            log.error("put license with error: ", e);
-        }
-    }
-
-    // @Test
-    public void putKvLocal() {
-        PDConfig pdConfig = PDConfig.of("localhost:8686");
-        pdConfig.setEnableCache(true);
-        try (KvClient c = new KvClient(pdConfig)) {
-            long l = System.currentTimeMillis();
-            KvResponse kvResponse = c.put("S:Timestamp", String.valueOf(l));
-            Pdpb.Error error = kvResponse.getHeader().getError();
-            log.info(error.getMessage());
-            assert error.getType().equals(Pdpb.ErrorType.OK);
-        } catch (Exception e) {
-            log.error("put license with error: ", e);
-        }
-    }
-
-    private Properties getYmlConfig(String yml) {
-        Yaml yaml = new Yaml();
-        Iterable<Object> load = yaml.loadAll(yml);
-        Iterator<Object> iterator = load.iterator();
-        Properties properties = new Properties();
-        while (iterator.hasNext()) {
-            Map<String, Object> next = (Map<String, Object>) iterator.next();
-            map2Properties(next, "", properties);
-        }
-        return properties;
-    }
-
-    private void map2Properties(Map<String, Object> map, String prefix, Properties properties) {
-
-        for (Map.Entry<String, Object> entry : map.entrySet()) {
-            String key = entry.getKey();
-            String newPrefix = prefix == null || prefix.length() == 0 ? key : prefix + "." + key;
-            Object value = entry.getValue();
-            if (!(value instanceof Map)) {
-                properties.put(newPrefix, value);
-            } else {
-                map2Properties((Map<String, Object>) value, newPrefix, properties);
-            }
-
-        }
-    }
-
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientSuiteTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientSuiteTest.java
index a9d3ae140..ce27623c9 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientSuiteTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientSuiteTest.java
@@ -22,14 +22,12 @@ import org.junit.runners.Suite;
 
 import lombok.extern.slf4j.Slf4j;
 
-
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
         PDClientTest.class,
         KvClientTest.class,
-        DiscoveryClientTest.class
+        StoreRegisterTest.class,
 })
-
 @Slf4j
 public class PDClientSuiteTest {
 
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientTest.java
index 470e3548f..c745f4235 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDClientTest.java
@@ -25,23 +25,20 @@ import org.apache.hugegraph.pd.common.PDException;
 import org.apache.hugegraph.pd.grpc.MetaTask;
 import org.apache.hugegraph.pd.grpc.Metapb;
 import org.apache.hugegraph.pd.grpc.Pdpb;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Mockito;
 
+// TODO: Exceptions should be thrown rather than silenced.
 public class PDClientTest extends BaseClientTest {
+
     @Test
     public void testDbCompaction() {
-        System.out.println("testDbCompaction start");
-
         try {
             pdClient.dbCompaction("");
             pdClient.dbCompaction();
         } catch (PDException e) {
             e.printStackTrace();
         }
-
-        System.out.println("pdclienttest testDbCompaction end");
     }
 
     @Test
@@ -110,15 +107,15 @@ public class PDClientTest extends BaseClientTest {
         }
     }
 
-//    @Test
-//    public void testStoreHeartbeat(){
-//        Metapb.StoreStats stats = Metapb.StoreStats.newBuilder().build();
-//        try {
-//            pdClient.storeHeartbeat(stats);
-//        } catch (PDException e) {
-//            e.printStackTrace();
-//        }
-//    }
+    @Test
+    public void testStoreHeartbeat() {
+        Metapb.StoreStats stats = Metapb.StoreStats.newBuilder().build();
+        try {
+            pdClient.storeHeartbeat(stats);
+        } catch (PDException e) {
+            e.printStackTrace();
+        }
+    }
 
     @Test
     public void testKeyToCode() {
@@ -162,11 +159,8 @@ public class PDClientTest extends BaseClientTest {
         }
     }
 
-    @Ignore
     @Test
     public void testUpdatePartitionLeader() {
-        System.out.println("updatePartitionLeader start");
-
         pdClient.updatePartitionLeader("aaa", 0, 0L);
     }
 
@@ -362,7 +356,6 @@ public class PDClientTest extends BaseClientTest {
         }
     }
 
-
     @Test
     public void testBalanceLeaders() {
         try {
@@ -400,7 +393,6 @@ public class PDClientTest extends BaseClientTest {
         }
     }
 
-    @Ignore
     @Test
     public void testDelPartition() {
         try {
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDPulseTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDPulseTest.java
index d27c4b5e1..7b3825c13 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDPulseTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDPulseTest.java
@@ -20,18 +20,16 @@ package org.apache.hugegraph.pd.client;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.hugegraph.pd.client.test.HgPDTestUtil;
+import org.apache.hugegraph.pd.common.Useless;
 import org.apache.hugegraph.pd.grpc.pulse.PartitionHeartbeatRequest;
 import org.apache.hugegraph.pd.pulse.PulseServerNotice;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+@Useless("used for development")
 public class PDPulseTest {
-    private static PDClient pdClient;
 
-    private final long storeId = 0;
-    private final String storeAddress = "localhost";
-    private final String graphName = "graph1";
+    private static PDClient pdClient;
 
     @BeforeClass
     public static void beforeClass() throws Exception {
@@ -43,29 +41,26 @@ public class PDPulseTest {
 
     @Test
     public void listen() {
-
         PDPulse pulse = new PDPulseImpl(pdClient.getLeaderIp());
         CountDownLatch latch = new CountDownLatch(60);
 
         PDPulse.Notifier<PartitionHeartbeatRequest.Builder> notifier1 =
-                pulse.connectPartition(new PulseListener(latch, "listener1"));
+                pulse.connectPartition(new PulseListener<>(latch, "listener1"));
         PDPulse.Notifier<PartitionHeartbeatRequest.Builder> notifier2 =
-                pulse.connectPartition(new PulseListener(latch, "listener2"));
+                pulse.connectPartition(new PulseListener<>(latch, "listener2"));
         PDPulse.Notifier<PartitionHeartbeatRequest.Builder> notifier3 =
-                pulse.connectPartition(new PulseListener(latch, "listener3"));
+                pulse.connectPartition(new PulseListener<>(latch, "listener3"));
 
         try {
             latch.await(120, TimeUnit.SECONDS);
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+
         PartitionHeartbeatRequest.Builder builder = PartitionHeartbeatRequest.newBuilder();
 
         notifier1.notifyServer(builder);
-
-
         notifier2.notifyServer(builder);
-
         notifier3.notifyServer(builder);
 
         notifier1.close();
@@ -73,10 +68,10 @@ public class PDPulseTest {
         notifier3.close();
     }
 
+    private static class PulseListener<T> implements PDPulse.Listener<T> {
 
-    private class PulseListener<T> implements PDPulse.Listener<T> {
         private final String listenerName;
-        CountDownLatch latch = new CountDownLatch(10);
+        private final CountDownLatch latch;
 
         private PulseListener(CountDownLatch latch, String listenerName) {
             this.latch = latch;
@@ -85,26 +80,25 @@ public class PDPulseTest {
 
         @Override
         public void onNext(T response) {
-            // println(this.listenerName+" res: "+response);
-            // this.latch.countDown();
+            System.out.println(this.listenerName + " ---> res: " + response);
+            this.latch.countDown();
         }
 
         @Override
         public void onNotice(PulseServerNotice<T> notice) {
-            HgPDTestUtil.println(this.listenerName + " ---> res: " + notice.getContent());
-
+            System.out.println(this.listenerName + " ---> res: " + notice.getContent());
             notice.ack();
             this.latch.countDown();
         }
 
         @Override
         public void onError(Throwable throwable) {
-            HgPDTestUtil.println(this.listenerName + " error: " + throwable.toString());
+            System.out.println(this.listenerName + " error: " + throwable.toString());
         }
 
         @Override
         public void onCompleted() {
-            HgPDTestUtil.println(this.listenerName + " is completed");
+            System.out.println(this.listenerName + " is completed");
         }
     }
 }
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDWatchTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDWatchTest.java
index 180b72555..5af89b539 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDWatchTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/PDWatchTest.java
@@ -20,21 +20,18 @@ package org.apache.hugegraph.pd.client;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.hugegraph.pd.client.test.HgPDTestUtil;
+import org.apache.hugegraph.pd.common.Useless;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-@Deprecated
+@Useless("used for development")
 public class PDWatchTest {
-    private static PDClient pdClient;
 
-    private final long storeId = 0;
-    private final String storeAddr = "localhost";
-    private final String graphName = "graph1";
+    private static PDClient pdClient;
 
     @BeforeClass
     public static void beforeClass() {
-        pdClient = PDClient.create(PDConfig.of("localhost:9000"));
+        pdClient = PDClient.create(PDConfig.of("localhost:8686"));
     }
 
     @Test
@@ -46,8 +43,6 @@ public class PDWatchTest {
         PDWatch.Watcher watcher2 = watch.watchPartition(new WatchListener<>(latch, "watcher2"));
         PDWatch.Watcher watcher3 = watch.watchPartition(new WatchListener<>(latch, "watcher3"));
 
-        PDWatch.Watcher nodeWatcher1 = watch.watchNode(new WatchListener<>(latch, "nodeWatcher1"));
-
         try {
             latch.await(15, TimeUnit.SECONDS);
         } catch (InterruptedException e) {
@@ -59,6 +54,7 @@ public class PDWatchTest {
     }
 
     private class WatchListener<T> implements PDWatch.Listener<T> {
+
         private final String watcherName;
         CountDownLatch latch;
 
@@ -69,18 +65,18 @@ public class PDWatchTest {
 
         @Override
         public void onNext(T response) {
-            HgPDTestUtil.println(this.watcherName + " res: " + response);
+            System.out.println(this.watcherName + " res: " + response);
             this.latch.countDown();
         }
 
         @Override
         public void onError(Throwable throwable) {
-            HgPDTestUtil.println(this.watcherName + " error: " + throwable.toString());
+            System.out.println(this.watcherName + " error: " + throwable.toString());
         }
 
         @Override
         public void onCompleted() {
-            HgPDTestUtil.println(this.watcherName + " is completed");
+            System.out.println(this.watcherName + " is completed");
         }
     }
 }
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/StoreRegisterTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/StoreRegisterTest.java
index 5826b3858..55e59d574 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/StoreRegisterTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/StoreRegisterTest.java
@@ -28,32 +28,31 @@ import org.apache.hugegraph.pd.grpc.pulse.PulseResponse;
 import org.apache.hugegraph.pd.pulse.PulseServerNotice;
 import org.junit.Assert;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
 
 public class StoreRegisterTest {
+
     private static PDClient pdClient;
     private final String storeAddr = "localhost";
     private final String graphName = "default/hugegraph/g";
     private long storeId = 0;
 
     @BeforeClass
-    public static void beforeClass() throws Exception {
+    public static void beforeClass() {
         PDConfig config = PDConfig.of("localhost:8686");
         config.setEnableCache(true);
         pdClient = PDClient.create(config);
     }
 
-    // @Test
+    @Test
     public void testRegisterStore() throws PDException {
         Metapb.Store store = Metapb.Store.newBuilder().setAddress(storeAddr).build();
-        try {
-            storeId = pdClient.registerStore(store);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+        storeId = pdClient.registerStore(store);
         Assert.assertTrue("RegisterStore store_id = " + storeId, storeId != 0);
     }
 
-    // @Test
+    @Test
     public void testGetStore() throws PDException {
         testRegisterStore();
         Metapb.Store store = pdClient.getStore(storeId);
@@ -61,7 +60,8 @@ public class StoreRegisterTest {
         System.out.println(store);
     }
 
-    // @Test
+    @Ignore // no active store
+    @Test
     public void testGetActiveStores() throws PDException {
         testRegisterStore();
         List<Metapb.Store> stores = pdClient.getActiveStores(graphName);
@@ -71,8 +71,8 @@ public class StoreRegisterTest {
         });
     }
 
-
-    // @Test
+    @Ignore // no active store
+    @Test
     public void testStoreHeartbeat() throws PDException {
         testRegisterStore();
         Metapb.StoreStats stats = Metapb.StoreStats.newBuilder().setStoreId(storeId).build();
@@ -88,14 +88,14 @@ public class StoreRegisterTest {
         Assert.assertTrue(exist);
     }
 
-
-    // @Test
-    public void testPartitionHeartbeat() throws InterruptedException, PDException {
+    @Ignore // no active store
+    @Test
+    public void testPartitionHeartbeat() throws PDException {
         testRegisterStore();
         PDPulse pdPulse = new PDPulseImpl(pdClient.getLeaderIp());
 
         PDPulse.Notifier<PartitionHeartbeatRequest.Builder> notifier = pdPulse.connectPartition(
-                new PDPulse.Listener<PulseResponse>() {
+                new PDPulse.Listener<>() {
 
                     @Override
                     public void onNext(PulseResponse response) {
@@ -123,9 +123,5 @@ public class StoreRegisterTest {
                 Metapb.PartitionStats.newBuilder().addGraphName("test")
                                      .setId(partShard.getKey().getId())
                                      .setLeader(Metapb.Shard.newBuilder().setStoreId(1).build())));
-
-
-        Thread.sleep(10000);
     }
-
 }
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/test/HgPDTestUtil.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/test/HgPDTestUtil.java
deleted file mode 100644
index 2c581ea6f..000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/client/test/HgPDTestUtil.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.pd.client.test;
-
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.Iterator;
-import java.util.List;
-
-public class HgPDTestUtil {
-
-    public static void println(Object str) {
-        System.out.println(str);
-    }
-
-    public static String toStr(byte[] b) {
-        if (b == null) return "";
-        if (b.length == 0) return "";
-        return new String(b, StandardCharsets.UTF_8);
-    }
-
-    public static byte[] toBytes(String str) {
-        if (str == null) return null;
-        return str.getBytes(StandardCharsets.UTF_8);
-    }
-
-    public static byte[] toBytes(long l) {
-        ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
-        buffer.putLong(l);
-        return buffer.array();
-    }
-
-    private static byte[] toBytes(final int i) {
-        ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
-        buffer.putInt(i);
-        return buffer.array();
-    }
-
-    public static long toLong(byte[] bytes) {
-        ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
-        buffer.put(bytes);
-        buffer.flip();//need flip
-        return buffer.getLong();
-    }
-
-    public static long toInt(byte[] bytes) {
-        ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
-        buffer.put(bytes);
-        buffer.flip();//need flip
-        return buffer.getInt();
-    }
-
-    public static String padLeftZeros(String str, int n) {
-        return String.format("%1$" + n + "s", str).replace(' ', '0');
-    }
-
-    public static String toSuffix(int num, int length) {
-        return "-" + padLeftZeros(String.valueOf(num), length);
-    }
-
-    public static int amountOf(List list) {
-        if (list == null) {
-            return 0;
-        }
-        return list.size();
-    }
-
-    public static int amountOf(Iterator iterator) {
-        if (iterator == null) return 0;
-        int count = 0;
-        while (iterator.hasNext()) {
-            iterator.next();
-            count++;
-        }
-        return count;
-    }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/clitools/BaseCliToolsTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/clitools/BaseCliToolsTest.java
deleted file mode 100644
index 146cffb13..000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/clitools/BaseCliToolsTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.pd.clitools;
-
-import org.junit.After;
-import org.junit.BeforeClass;
-
-
-public class BaseCliToolsTest {
-    @BeforeClass
-    public static void init() {
-
-    }
-
-    @After
-    public void teardown() {
-        // pass
-    }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/clitools/CliToolsSuiteTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/clitools/CliToolsSuiteTest.java
deleted file mode 100644
index abdcbea08..000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/clitools/CliToolsSuiteTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.pd.clitools;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-import lombok.extern.slf4j.Slf4j;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-        MainTest.class
-})
-
-@Slf4j
-public class CliToolsSuiteTest {
-
-
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/clitools/MainTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/clitools/MainTest.java
deleted file mode 100644
index 8b2f5f831..000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/clitools/MainTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.pd.clitools;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.hugegraph.pd.common.PDException;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class MainTest extends BaseCliToolsTest {
-
-
-    public static boolean test2sup(List<Integer> arrays, int tail, int res) {
-        System.out.printf("%d %d%n", tail, res);
-        if (tail == 0) {
-            System.out.printf("a = %d %d%n", tail, res);
-            return false;
-        } else if (tail == 1) {
-            System.out.printf("b = %d %d%n", arrays.get(0), res);
-            return (arrays.get(0) == res);
-        } else if (tail == 2) {
-            System.out.printf("c = %d %d %d%n", arrays.get(0), arrays.get(1), res);
-            return (arrays.get(0) + arrays.get(1) == Math.abs(res)) ||
-                   (Math.abs(arrays.get(0) - arrays.get(1)) == Math.abs(res));
-        } else {
-            return test2sup(arrays, tail - 1, res + arrays.get(tail - 1)) ||
-                   test2sup(arrays, tail - 1, res - arrays.get(tail - 1));
-        }
-    }
-
-    @Ignore
-    @Test
-    public void getConfig() throws PDException {
-        Main.main(new String[]{"127.0.0.1:8686", "config", "enableBatchLoad"});
-    }
-
-    // @Test
-    public void setBatchTrue() throws PDException {
-        Main.main(new String[]{"127.0.0.1:8686", "config", "enableBatchLoad= true "});
-    }
-
-    //    @Test
-    public void setBatchFalse() throws PDException {
-        Main.main(new String[]{"127.0.0.1:8686", "config", "enableBatchLoad=false"});
-    }
-
-    @Ignore
-    @Test
-    public void getConfig2() throws PDException {
-        Main.main(new String[]{"127.0.0.1:8686", "config", "shardCount"});
-    }
-
-    //    @Test
-    public void setShardCount1() throws PDException {
-        Main.main(new String[]{"127.0.0.1:8686", "config", "shardCount=1"});
-    }
-
-    //    @Test
-    public void setShardCount3() throws PDException {
-        Main.main(new String[]{"127.0.0.1:8686", "config", "shardCount=3"});
-    }
-
-    @Test
-    public void test2() {
-        Integer[] a = new Integer[]{1, 0, 3, 2};
-        List<Integer> aa = Arrays.asList(a);
-        System.out.printf(test2sup(aa, aa.size(), 0) ? "TRUE" : "FALSE");
-    }
-
-
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/BaseCommonTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/BaseCommonTest.java
deleted file mode 100644
index 591779c0d..000000000
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/BaseCommonTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.pd.common;
-
-import org.junit.After;
-import org.junit.BeforeClass;
-
-public class BaseCommonTest {
-    @BeforeClass
-    public static void init() {
-
-    }
-
-    @After
-    public void teardown() {
-        // pass
-    }
-}
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/CommonSuiteTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/CommonSuiteTest.java
index 0395711ca..fde560d78 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/CommonSuiteTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/CommonSuiteTest.java
@@ -22,7 +22,6 @@ import org.junit.runners.Suite;
 
 import lombok.extern.slf4j.Slf4j;
 
-
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
         PartitionUtilsTest.class,
@@ -30,9 +29,7 @@ import lombok.extern.slf4j.Slf4j;
         HgAssertTest.class,
         KVPairTest.class,
 })
-
 @Slf4j
 public class CommonSuiteTest {
 
-
 }
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/HgAssertTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/HgAssertTest.java
index 253a9c67a..3e61dd0a9 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/HgAssertTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/HgAssertTest.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTrue;
 import java.util.ArrayList;
 import java.util.HashMap;
 
-import org.apache.hugegraph.pd.common.HgAssert;
 import org.junit.Test;
 
 public class HgAssertTest {
@@ -78,7 +77,6 @@ public class HgAssertTest {
         HgAssert.isNotNull(null, "");
     }
 
-
     @Test
     public void testIsInvalid() {
         assertFalse(HgAssert.isInvalid("abc", "test"));
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/KVPairTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/KVPairTest.java
index b3e1c15ad..9fb676d39 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/KVPairTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/KVPairTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.hugegraph.pd.common;
 
-import static org.junit.Assert.assertTrue;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.junit.Assert;
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/PartitionCacheTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/PartitionCacheTest.java
index d4126967f..c070c80e0 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/PartitionCacheTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/PartitionCacheTest.java
@@ -230,7 +230,6 @@ public class PartitionCacheTest {
         var partition6 = createPartition(1, "graph0", 0, 1);
         this.cache.updatePartition(partition6);
 
-
         System.out.println(this.cache.debugCacheByGraphName("graph0"));
 
         var partition5 = createPartition(1, "graph0", 0, 3);
diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/PartitionUtilsTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/PartitionUtilsTest.java
index 551bd40ec..198d18b83 100644
--- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/PartitionUtilsTest.java
+++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/common/PartitionUtilsTest.java
@@ -18,13 +18,14 @@
 package org.apache.hugegraph.pd.common;
 
 import java.nio.charset.StandardCharsets;
-import lombok.extern.slf4j.Slf4j;
+
 import org.junit.Assert;
 import org.junit.Test;
 
+import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
-public class PartitionUtilsTest extends BaseCommonTest {
+public class PartitionUtilsTest {
 
     @Test
     public void testCalcHashcode() {
@@ -33,7 +34,7 @@ public class PartitionUtilsTest extends BaseCommonTest {
         Assert.assertEquals(code, 31912L);
     }
 
-    // @Test
+    @Test
     public void testHashCode() {
         int partCount = 10;
         int partSize = PartitionUtils.MAX_VALUE / partCount + 1;
@@ -41,11 +42,8 @@ public class PartitionUtilsTest extends BaseCommonTest {
         for (int i = 0; i < 10000; i++) {
             String s = String.format("BATCH-GET-UNIT-%02d", i);
             int c = PartitionUtils.calcHashcode(s.getBytes(StandardCharsets.UTF_8));
-
             counter[c / partSize]++;
-
         }
-
         for (int i = 0; i < counter.length; i++) {
             System.out.println(i + " " + counter[i]);
         }
diff --git a/hugegraph-pd/pom.xml b/hugegraph-pd/pom.xml
index 11b508024..a43767cce 100644
--- a/hugegraph-pd/pom.xml
+++ b/hugegraph-pd/pom.xml
@@ -38,9 +38,7 @@
         <module>hg-pd-service</module>
         <module>hg-pd-common</module>
         <module>hg-pd-dist</module>
-        <module>hg-pd-clitools</module>
         <module>hg-pd-test</module>
-
     </modules>
 
     <properties>
@@ -196,30 +194,6 @@
                 </plugins>
             </build>
         </profile>
-        <profile>
-            <id>pd-cli-tools-test</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-surefire-plugin</artifactId>
-                        <version>2.20</version>
-                        <executions>
-                            <execution>
-                                <id>pd-cli-tools-test</id>
-                                <goals>
-                                    <goal>test</goal>
-                                </goals>
-                                <phase>test</phase>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
         <profile>
             <id>pd-common-test</id>
             <activation>