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

pengjunzhi pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-hugegraph-toolchain.git


The following commit(s) were added to refs/heads/master by this push:
     new 2c4c0401 refactor(loader): adjust LoadContext to 1.7.0 version (#687)
2c4c0401 is described below

commit 2c4c0401478276d67e222aaa6d89cd7a29d0e510
Author: Duoduo Wang <[email protected]>
AuthorDate: Fri Oct 31 21:59:07 2025 +0800

    refactor(loader): adjust LoadContext to 1.7.0 version (#687)
---
 .github/workflows/loader-ci.yml                    |  10 +-
 .../org/apache/hugegraph/api/graphs/GraphsAPI.java |  94 +++-----
 .../org/apache/hugegraph/driver/GraphsManager.java |  20 --
 .../travis/install-hugegraph-from-source.sh        |  10 +-
 .../loader/test/functional/FileLoadTest.java       | 256 +++++++++++----------
 .../loader/test/functional/HDFSLoadTest.java       |  42 ++--
 .../loader/test/functional/JDBCLoadTest.java       |  10 +-
 .../loader/test/functional/KafkaLoadTest.java      |  21 +-
 .../hugegraph/loader/test/functional/LoadTest.java |  25 +-
 9 files changed, 240 insertions(+), 248 deletions(-)

diff --git a/.github/workflows/loader-ci.yml b/.github/workflows/loader-ci.yml
index 058b2d38..b3e62b2f 100644
--- a/.github/workflows/loader-ci.yml
+++ b/.github/workflows/loader-ci.yml
@@ -27,8 +27,8 @@ jobs:
       TRAVIS_DIR: hugegraph-loader/assembly/travis
       STATIC_DIR: hugegraph-loader/assembly/static
       # TODO: replace it with the (latest - n) commit id (n >= 15)
-      # hugegraph commit date: 2024-12-09
-      COMMIT_ID: f838897
+      # hugegraph commit date: 2025-10-30
+      COMMIT_ID: 5b3d295
       DB_USER: root
       DB_PASS: root
       DB_DATABASE: load_test
@@ -43,13 +43,13 @@ jobs:
           fetch-depth: 2
 
       - name: Install JDK 11
-        uses: actions/setup-java@v3
+        uses: actions/setup-java@v4
         with:
           java-version: ${{ matrix.JAVA_VERSION }}
           distribution: 'adopt'
 
       - name: Cache Maven packages
-        uses: actions/cache@v3
+        uses: actions/cache@v4
         with:
           path: ~/.m2
           key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
@@ -81,7 +81,7 @@ jobs:
           mvn test -P kafka
 
       - name: Upload coverage to Codecov
-        uses: codecov/codecov-action@v3
+        uses: codecov/codecov-action@v4
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           file: target/jacoco.xml
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java
index 0c9eb741..17d0a537 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java
@@ -136,14 +136,8 @@ public class GraphsAPI extends API {
     }
 
     public void clear(String graph, String message) {
-        clear(null, graph, message);
-    }
-
-    public void clear(String graphSpace, String graph, String message) {
-        String path = (graphSpace == null)
-                      ? joinPath(this.path(), graph, CLEAR)
-                      : joinPath(this.path(), graphSpace, graph, CLEAR);
-        this.client.delete(path, ImmutableMap.of(CONFIRM_MESSAGE, message));
+        this.client.delete(joinPath(this.path(), graph, CLEAR),
+                           ImmutableMap.of(CONFIRM_MESSAGE, message));
     }
 
     public Map<String, String> update(String name, String nickname) {
@@ -204,85 +198,51 @@ public class GraphsAPI extends API {
     }
 
     public void mode(String graph, GraphMode mode) {
-        mode(null, graph, mode);
-    }
-
-    public void mode(String graphSpace, String graph, GraphMode mode) {
         // NOTE: Must provide id for PUT. If you use "graph/mode", "/" will
         // be encoded to "%2F". So use "mode" here, although inaccurate.
-        if (graphSpace == null) {
-            this.client.put(joinPath(this.path(), graph, MODE), null, mode);
-            return;
-        }
-        this.client.put(joinPath(this.path(), graphSpace, graph, MODE), null, 
mode);
+        this.client.put(joinPath(this.path(), graph, MODE), null, mode);
     }
 
-    public void readMode(String graph, GraphReadMode readMode) {
-        readMode(null, graph, readMode);
+    public GraphMode mode(String graph) {
+        RestResult result = this.client.get(joinPath(this.path(), graph), 
MODE);
+        @SuppressWarnings("unchecked")
+        Map<String, String> mode = result.readObject(Map.class);
+        String value = mode.get(MODE);
+        if (value == null) {
+            throw new InvalidResponseException("Invalid response, expect 
'mode' in response");
+        }
+        try {
+            return GraphMode.valueOf(value);
+        } catch (IllegalArgumentException e) {
+            throw new InvalidResponseException("Invalid GraphMode value '%s'", 
value);
+        }
     }
 
-
-    public void readMode(String graphSpace, String graph, GraphReadMode 
readMode) {
+    public void readMode(String graph, GraphReadMode readMode) {
         this.client.checkApiVersion("0.59", "graph read mode");
         // NOTE: Must provide id for PUT. If you use "graph/graph_read_mode", 
"/"
         // will be encoded to "%2F". So use "graph_read_mode" here, although
         // inaccurate.
-        if (graphSpace == null) {
-            this.client.put(joinPath(this.path(), graph, GRAPH_READ_MODE), 
null, readMode);
-            return;
-        }
-        this.client.put(joinPath(this.path(), graphSpace, graph, 
GRAPH_READ_MODE), null, readMode);
+        this.client.put(joinPath(this.path(), graph, GRAPH_READ_MODE), null, 
readMode);
     }
 
-    /**
-     * Get graph mode value from server response
-     *
-     * @param graphSpace the graph space name, null for non-graphspace mode
-     * @param graph the graph name
-     * @param modeKey the mode key in response (MODE or GRAPH_READ_MODE)
-     * @param enumClass the enum class type
-     * @return the mode enum value
-     */
-    private <T extends Enum<T>> T getModeValue(String graphSpace, String graph,
-                                              String modeKey, Class<T> 
enumClass) {
-        String path = (graphSpace != null)
-                      ? joinPath(this.path(), graphSpace, graph)
-                      : joinPath(this.path(), graph);
-
-        RestResult result = this.client.get(path, modeKey);
+    public GraphReadMode readMode(String graph) {
+        this.client.checkApiVersion("0.59", "graph read mode");
+        RestResult result = this.client.get(joinPath(this.path(), graph), 
GRAPH_READ_MODE);
         @SuppressWarnings("unchecked")
-        Map<String, String> map = result.readObject(Map.class);
-        String value = map.get(modeKey);
-
+        Map<String, String> readMode = result.readObject(Map.class);
+        String value = readMode.get(GRAPH_READ_MODE);
         if (value == null) {
-            throw new InvalidResponseException(
-                    "Invalid response, expect '%s' in response", modeKey);
+            throw new InvalidResponseException("Invalid response, expect 
'graph_read_mode' " +
+                                               "in response");
         }
         try {
-            return Enum.valueOf(enumClass, value);
+            return GraphReadMode.valueOf(value);
         } catch (IllegalArgumentException e) {
-            throw new InvalidResponseException(
-                    "Invalid %s value '%s'", enumClass.getSimpleName(), value);
+            throw new InvalidResponseException("Invalid GraphReadMode value 
'%s'", value);
         }
     }
 
-    public GraphMode mode(String graphSpace, String graph) {
-        return getModeValue(graphSpace, graph, MODE, GraphMode.class);
-    }
-
-    public GraphMode mode(String graph) {
-        return mode(null, graph);
-    }
-
-    public GraphReadMode readMode(String graphSpace, String graph) {
-        this.client.checkApiVersion("0.59", "graph read mode");
-        return getModeValue(graphSpace, graph, GRAPH_READ_MODE, 
GraphReadMode.class);
-    }
-
-    public GraphReadMode readMode(String graph) {
-        return readMode(null, graph);
-    }
-
     public String clone(String graph, Map<String, Object> body) {
         RestResult result = this.client.post(joinPath(this.path(), graph,
                                                       "clone"), body);
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphsManager.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphsManager.java
index 4f1fffe8..aacf261f 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphsManager.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphsManager.java
@@ -94,10 +94,6 @@ public class GraphsManager {
         this.graphsAPI.clear(graph, message);
     }
 
-    public void clearGraph(String graphSpace, String graph, String message) {
-        this.graphsAPI.clear(graphSpace, graph, message);
-    }
-
     public void update(String graph, String nickname) {
         this.graphsAPI.update(graph, nickname);
     }
@@ -119,30 +115,14 @@ public class GraphsManager {
         this.graphsAPI.mode(graph, mode);
     }
 
-    public void mode(String graphSpace, String graph, GraphMode mode) {
-        this.graphsAPI.mode(graphSpace, graph, mode);
-    }
-
     public GraphMode mode(String graph) {
         return this.graphsAPI.mode(graph);
     }
 
-    public GraphMode mode(String graphSpace, String graph) {
-        return this.graphsAPI.mode(graphSpace, graph);
-    }
-
-    public void readMode(String graphSpace, String graph, GraphReadMode 
readMode) {
-        this.graphsAPI.readMode(graphSpace, graph, readMode);
-    }
-
     public void readMode(String graph, GraphReadMode readMode) {
         this.graphsAPI.readMode(graph, readMode);
     }
 
-    public GraphReadMode readMode(String graphSpace, String graph) {
-        return this.graphsAPI.readMode(graphSpace, graph);
-    }
-
     public GraphReadMode readMode(String graph) {
         return this.graphsAPI.readMode(graph);
     }
diff --git a/hugegraph-loader/assembly/travis/install-hugegraph-from-source.sh 
b/hugegraph-loader/assembly/travis/install-hugegraph-from-source.sh
index 61ea1c04..3cba191f 100755
--- a/hugegraph-loader/assembly/travis/install-hugegraph-from-source.sh
+++ b/hugegraph-loader/assembly/travis/install-hugegraph-from-source.sh
@@ -41,7 +41,10 @@ mkdir ${HTTPS_SERVER_DIR}
 cp -r apache-hugegraph-*/. ${HTTPS_SERVER_DIR}
 cd "$(find apache-hugegraph-* | head -1)"
 # start HugeGraphServer with http protocol
-bin/init-store.sh || exit 1
+sed -i 
's|gremlin.graph=org.apache.hugegraph.HugeFactory|gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy|'
 conf/graphs/hugegraph.properties
+sed -i 
's|#auth.authenticator=.*|auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator|'
 conf/rest-server.properties
+sed -i 's|#auth.admin_pa=.*|auth.admin_pa=pa|' conf/rest-server.properties
+echo -e "pa" | bin/init-store.sh || exit 1
 bin/start-hugegraph.sh || exit 1
 
 cd ../${HTTPS_SERVER_DIR}
@@ -53,6 +56,9 @@ sed -i "s/#port: 8182/port: 8282/g" "$GREMLIN_SERVER_CONFIG"
 echo "gremlinserver.url=http://127.0.0.1:8282"; >> ${REST_SERVER_CONFIG}
 
 # start HugeGraphServer with https protocol
-bin/init-store.sh
+sed -i 
's|gremlin.graph=org.apache.hugegraph.HugeFactory|gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy|'
 conf/graphs/hugegraph.properties
+sed -i 
's|#auth.authenticator=.*|auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator|'
 conf/rest-server.properties
+sed -i 's|#auth.admin_pa=.*|auth.admin_pa=pa|' conf/rest-server.properties
+echo -e "pa" | bin/init-store.sh || exit 1
 bin/start-hugegraph.sh
 cd ../
diff --git 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/FileLoadTest.java
 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/FileLoadTest.java
index 3698c62a..d069aaec 100644
--- 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/FileLoadTest.java
+++ 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/FileLoadTest.java
@@ -102,7 +102,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2"
         };
 
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<PropertyKey> propertyKeys = CLIENT.schema().getPropertyKeys();
         propertyKeys.forEach(pkey -> {
@@ -172,7 +172,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -219,7 +219,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(LoadException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
     }
 
@@ -229,6 +229,8 @@ public class FileLoadTest extends LoadTest {
         options.host = Constants.HTTP_PREFIX + SERVER;
         options.port = PORT;
         options.graph = GRAPH;
+        options.username = "admin";
+        options.password = "pa";
         HugeClient client = HugeClientHolder.create(options);
         SchemaManager schema = client.schema();
         schema.propertyKey("name").asText().ifNotExist().create();
@@ -246,15 +248,16 @@ public class FileLoadTest extends LoadTest {
                      "josh,32,Beijing",
                      "peter,35,Shanghai",
                      "\"li,nary\",26,\"Wu,han\"");
-        String[] args1 = new String[]{
+        List<String> argsList1 = new ArrayList<>(Arrays.asList(
                 "-f", structPath("clear_schema_before_load/struct.json"),
                 "-g", GRAPH,
                 "-h", SERVER,
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
-        };
+        ));
+        argsList1.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader loader = new HugeGraphLoader(args1);
+            HugeGraphLoader loader = new HugeGraphLoader(argsList1.toArray(new 
String[0]));
             loader.load();
             loader.shutdown();
         }, (e) -> {
@@ -263,7 +266,7 @@ public class FileLoadTest extends LoadTest {
             Assert.assertTrue(msg.endsWith("to Number"));
         });
 
-        String[] args2 = new String[]{
+        List<String> argsList2 = new ArrayList<>(Arrays.asList(
                 "-f", structPath("clear_schema_before_load/struct.json"),
                 "-s", configPath("clear_schema_before_load/schema.groovy"),
                 "-g", GRAPH,
@@ -271,8 +274,9 @@ public class FileLoadTest extends LoadTest {
                 "--clear-all-data", "true",
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
-        };
-        HugeGraphLoader loader = new HugeGraphLoader(args2);
+        ));
+        argsList2.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+        HugeGraphLoader loader = new HugeGraphLoader(argsList2.toArray(new 
String[0]));
         loader.load();
         loader.shutdown();
         List<Vertex> vertices = CLIENT.graph().listVertices();
@@ -312,7 +316,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        authmain(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -344,7 +348,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
@@ -373,7 +377,7 @@ public class FileLoadTest extends LoadTest {
         };
         // Bytes encoded in utf-8 exceed 128
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
     }
 
@@ -395,7 +399,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(5, vertices.size());
@@ -419,7 +423,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
     }
 
@@ -438,7 +442,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
@@ -459,7 +463,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -484,7 +488,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -508,7 +512,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -553,7 +557,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         }, (e) -> {
             Assert.assertTrue(e.getMessage().contains("Parse line '' error"));
         });
@@ -583,7 +587,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Edge> edges = CLIENT.graph().listEdges();
         Assert.assertEquals(1, edges.size());
@@ -611,7 +615,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Edge> edges = CLIENT.graph().listEdges();
         Assert.assertEquals(1, edges.size());
@@ -644,7 +648,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Edge> edges = CLIENT.graph().listEdges();
         Assert.assertEquals(1, edges.size());
@@ -677,7 +681,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -707,7 +711,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -759,7 +763,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        authmain(args);
+        loadWithAuth(args);
 
         List<Edge> edges = CLIENT.graph().listEdges();
         Assert.assertEquals(1, edges.size());
@@ -793,7 +797,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(4, vertices.size());
@@ -821,7 +825,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(8, vertices.size());
@@ -844,7 +848,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
@@ -866,7 +870,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -888,7 +892,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
@@ -909,7 +913,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -935,7 +939,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(3, vertices.size());
@@ -956,7 +960,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(3, vertices.size());
@@ -975,7 +979,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
 
@@ -1003,7 +1007,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1028,7 +1032,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1073,7 +1077,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1096,7 +1100,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(3, vertices.size());
@@ -1117,7 +1121,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(3, vertices.size());
@@ -1143,7 +1147,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(3, vertices.size());
@@ -1175,7 +1179,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(LoadException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
     }
 
@@ -1195,7 +1199,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1216,7 +1220,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1239,7 +1243,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1255,7 +1259,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(0, vertices.size());
@@ -1272,7 +1276,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(0, vertices.size());
@@ -1291,7 +1295,7 @@ public class FileLoadTest extends LoadTest {
         };
 
         Assert.assertThrows(LoadException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
     }
 
@@ -1330,7 +1334,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(5, vertices.size());
@@ -1350,7 +1354,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1371,7 +1375,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
@@ -1394,7 +1398,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1419,7 +1423,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1444,7 +1448,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1476,7 +1480,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1515,7 +1519,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1549,7 +1553,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -1578,7 +1582,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1604,7 +1608,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(LoadException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
     }
 
@@ -1626,7 +1630,7 @@ public class FileLoadTest extends LoadTest {
                 "-h", SERVER,
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -1646,7 +1650,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1666,7 +1670,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1686,7 +1690,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1706,7 +1710,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1726,7 +1730,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1746,7 +1750,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1769,7 +1773,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1789,7 +1793,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1809,7 +1813,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1829,7 +1833,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -1852,7 +1856,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--max-parse-errors", "3"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
     }
 
     @Test
@@ -1871,7 +1875,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--max-parse-errors", "1"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
     }
 
     @Test
@@ -1891,7 +1895,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--check-vertex", "false"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -1929,7 +1933,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--check-vertex", "false"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -1970,7 +1974,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         });
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
@@ -1997,7 +2001,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--check-vertex", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Edge> edges = CLIENT.graph().listEdges();
 
@@ -2045,7 +2049,7 @@ public class FileLoadTest extends LoadTest {
                      "ripple,java,199");
 
         // 1st time
-        String[] args = new String[] {
+        List<String> argsList = new ArrayList<>(Arrays.asList(
                 "-f",
                 structPath("incremental_mode_and_load_failure/struct.json"),
                 "-s",
@@ -2055,8 +2059,10 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--max-parse-errors", "1",
                 "--test-mode", "false"
-        };
-        HugeGraphLoader loader = new HugeGraphLoader(args);
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+
+        HugeGraphLoader loader = new HugeGraphLoader(argsList.toArray(new 
String[0]));
         loader.load();
         loader.shutdown();
         LoadContext context = Whitebox.getInternalState(loader, "context");
@@ -2100,7 +2106,7 @@ public class FileLoadTest extends LoadTest {
                             personFailureLines.get(1));
 
         // 2nd time, incremental-mode
-        args = new String[]{
+        argsList = new ArrayList<>(Arrays.asList(
                 "-f",
                 structPath("incremental_mode_and_load_failure/struct.json"),
                 "-g", GRAPH,
@@ -2110,8 +2116,10 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--max-parse-errors", "2",
                 "--test-mode", "false"
-        };
-        loader = new HugeGraphLoader(args);
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+
+        loader = new HugeGraphLoader(argsList.toArray(new String[0]));
         loader.load();
         loader.shutdown();
         context = Whitebox.getInternalState(loader, "context");
@@ -2179,7 +2187,7 @@ public class FileLoadTest extends LoadTest {
         FileUtils.writeLines(softwareFailureFile, softwareFailureLines, false);
 
         // 3rd time, --failure-mode
-        args = new String[]{
+        argsList = new ArrayList<>(Arrays.asList(
                 "-f",
                 structPath("incremental_mode_and_load_failure/struct.json"),
                 "-g", GRAPH,
@@ -2189,8 +2197,9 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--max-parse-errors", "2",
                 "--test-mode", "false"
-        };
-        loader = new HugeGraphLoader(args);
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+        loader = new HugeGraphLoader(argsList.toArray(new String[0]));
         loader.load();
         loader.shutdown();
         context = Whitebox.getInternalState(loader, "context");
@@ -2243,7 +2252,7 @@ public class FileLoadTest extends LoadTest {
                      "\"vadas1\", \"date\": \"2013-02-20 13:00:00\"," +
                      "\"weight\": 1.0}");
 
-        String[] args = new String[]{
+        List<String> argsList = new ArrayList<>(Arrays.asList(
                 "-f", structPath("reload_json_failure_files/struct.json"),
                 "-s", configPath("reload_json_failure_files/schema.groovy"),
                 "-g", GRAPH,
@@ -2251,8 +2260,9 @@ public class FileLoadTest extends LoadTest {
                 "--check-vertex", "true",
                 "--batch-insert-threads", "2",
                 "--test-mode", "false"
-        };
-        HugeGraphLoader loader = new HugeGraphLoader(args);
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+        HugeGraphLoader loader = new HugeGraphLoader(argsList.toArray(new 
String[0]));
         loader.load();
         loader.shutdown();
         LoadContext context = Whitebox.getInternalState(loader, "context");
@@ -2280,7 +2290,7 @@ public class FileLoadTest extends LoadTest {
         });
 
         // Load failure data without modification
-        args = new String[]{
+        argsList = new ArrayList<>(Arrays.asList(
                 "-f", structPath("reload_json_failure_files/struct.json"),
                 "-g", GRAPH,
                 "-h", SERVER,
@@ -2288,9 +2298,9 @@ public class FileLoadTest extends LoadTest {
                 "--check-vertex", "true",
                 "--batch-insert-threads", "2",
                 "--test-mode", "false"
-        };
-        // No exception throw, but error line still exist
-        loader = new HugeGraphLoader(args);
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+        loader = new HugeGraphLoader(argsList.toArray(new String[0]));
         loader.load();
         loader.shutdown();
 
@@ -2321,7 +2331,7 @@ public class FileLoadTest extends LoadTest {
         FileUtils.writeLines(knowsFailureFile, failureLines, false);
 
         // No exception throw, and error line doesn't exist
-        loader = new HugeGraphLoader(args);
+        loader = new HugeGraphLoader(argsList.toArray(new String[0]));
         loader.load();
         loader.shutdown();
 
@@ -2356,7 +2366,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -2408,7 +2418,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(1, vertices.size());
@@ -2450,7 +2460,7 @@ public class FileLoadTest extends LoadTest {
                                          
"src/test/resources/parquet_compress_file/vertex_person.parquet");
             hdfsUtil.copy(path, 
"hdfs://localhost:8020/files/vertex_person.parquet");
         }
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(5, vertices.size());
@@ -2476,7 +2486,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -2517,7 +2527,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         }, e -> {
             String msgSuffix = "check whether the headers or field_mapping " +
                                "are configured correctly";
@@ -2548,16 +2558,18 @@ public class FileLoadTest extends LoadTest {
                      "josh,ripple,20171210,1.0",
                      "peter,lop,20170324,0.2");
 
-        String[] args = new String[]{
+        List<String> argsList = new ArrayList<>(Arrays.asList(
                 "-f", structPath("source_or_target_pk_value_null/struct.json"),
                 "-s", 
configPath("source_or_target_pk_value_null/schema.groovy"),
                 "-g", GRAPH,
                 "-h", SERVER,
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
-        };
+        ));
+
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
         AsyncThrowsAssert.assertThrows(RuntimeException.class, () -> {
-            HugeGraphLoader loader = new HugeGraphLoader(args);
+            HugeGraphLoader loader = new HugeGraphLoader(argsList.toArray(new 
String[0]));
             loader.load();
             loader.shutdown();
         }, e -> {
@@ -2565,10 +2577,8 @@ public class FileLoadTest extends LoadTest {
                                "are configured correctly";
             Assert.assertTrue(e.getMessage().endsWith(msgSuffix));
         });
-
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
-
         Assert.assertEquals(7, vertices.size());
         Assert.assertEquals(0, edges.size());
     }
@@ -2590,7 +2600,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(3, vertices.size());
@@ -2624,7 +2634,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -2651,7 +2661,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(3, vertices.size());
@@ -2674,7 +2684,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Edge> edges = CLIENT.graph().listEdges();
         Assert.assertEquals(1, edges.size());
@@ -2697,7 +2707,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(6, vertices.size());
@@ -2721,7 +2731,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(10, vertices.size());
@@ -2754,7 +2764,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(10, vertices.size());
@@ -2785,7 +2795,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(10, vertices.size());
@@ -2818,7 +2828,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(10, vertices.size());
@@ -2851,7 +2861,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         }, e -> {
             String msg = "In case unfold is true, just supported " +
                          "a single primary key";
@@ -2883,7 +2893,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
     }
 
     @Test
@@ -2907,7 +2917,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -2939,7 +2949,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -2970,7 +2980,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -3002,7 +3012,7 @@ public class FileLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
         Assert.assertThrows(ParseException.class, () -> {
-            HugeGraphLoader.main(args);
+            loadWithAuth(args);
         }, e -> {
             String msg = "The elements number of source and target must be: " +
                          "1 to n, n to 1, n to n";
@@ -3039,7 +3049,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(4, vertices.size());
@@ -3053,7 +3063,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(6, vertices.size());
@@ -3078,11 +3088,12 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         HugeClient httpsClient = null;
         try {
             httpsClient = HugeClient.builder(HTTPS_URL, GRAPH)
+                                    .configUser("admin", "pa")
                                     .configSSL(TRUST_STORE_PATH, "hugegraph")
                                     .build();
             List<Vertex> vertices = httpsClient.graph().listVertices();
@@ -3111,7 +3122,7 @@ public class FileLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         LoadOptions options = new LoadOptions();
         options.host = SERVER;
@@ -3120,7 +3131,8 @@ public class FileLoadTest extends LoadTest {
         options.protocol = HTTPS_PROTOCOL;
         options.trustStoreFile = TRUST_STORE_PATH;
         options.trustStoreToken = "hugegraph";
-
+        options.username = "admin";
+        options.password = "pa";
         HugeClient httpsClient = null;
         try {
             httpsClient = HugeClientHolder.create(options);
diff --git 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/HDFSLoadTest.java
 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/HDFSLoadTest.java
index fdedcb69..70c3fab1 100644
--- 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/HDFSLoadTest.java
+++ 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/HDFSLoadTest.java
@@ -18,6 +18,8 @@
 package org.apache.hugegraph.loader.test.functional;
 
 import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.commons.lang3.StringUtils;
@@ -58,15 +60,17 @@ public class HDFSLoadTest extends FileLoadTest {
                      "peter,35,Shanghai",
                      "\"li,nary\",26,\"Wu,han\"");
 
-        String[] args = new String[]{
+        List<String> argsList = new ArrayList<>(Arrays.asList(
                 "-f", structPath("hdfs_with_core_site_path/struct.json"),
                 "-s", configPath("hdfs_with_core_site_path/schema.groovy"),
                 "-g", GRAPH,
                 "-h", SERVER,
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
-        };
-        HugeGraphLoader loader = new HugeGraphLoader(args);
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+
+        HugeGraphLoader loader = new HugeGraphLoader(argsList.toArray(new 
String[0]));
         loader.load();
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(5, vertices.size());
@@ -85,15 +89,17 @@ public class HDFSLoadTest extends FileLoadTest {
                      "peter,35,Shanghai",
                      "\"li,nary\",26,\"Wu,han\"");
 
-        String[] args = new String[]{
+        List<String> argsList = new ArrayList<>(Arrays.asList(
                 "-f", structPath("hdfs_file_with_prefix/struct.json"),
                 "-s", configPath("hdfs_file_with_prefix/schema.groovy"),
                 "-g", GRAPH,
                 "-h", SERVER,
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
-        };
-        HugeGraphLoader loader = new HugeGraphLoader(args);
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+
+        HugeGraphLoader loader = new HugeGraphLoader(argsList.toArray(new 
String[0]));
         loader.load();
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(5, vertices.size());
@@ -109,16 +115,18 @@ public class HDFSLoadTest extends FileLoadTest {
                      "peter,35,Shanghai",
                      "\"li,nary\",26,\"Wu,han\"");
 
-        String[] args = new String[]{
+        List<String> argsList = new ArrayList<>(Arrays.asList(
                 "-f", structPath("hdfs_with_empty_core_site_path/struct.json"),
                 "-s", 
configPath("hdfs_with_empty_core_site_path/schema.groovy"),
                 "-g", GRAPH,
                 "-h", SERVER,
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
-        };
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+
         Assert.assertThrows(LoadException.class, () -> {
-            HugeGraphLoader loader = new HugeGraphLoader(args);
+            HugeGraphLoader loader = new HugeGraphLoader(argsList.toArray(new 
String[0]));
             loader.load();
         });
     }
@@ -133,16 +141,18 @@ public class HDFSLoadTest extends FileLoadTest {
                      "peter,35,Shanghai",
                      "\"li,nary\",26,\"Wu,han\"");
 
-        String[] args = new String[]{
+        List<String> argsList = new ArrayList<>(Arrays.asList(
                 "-f", 
structPath("hdfs_with_invalid_core_site_path/struct.json"),
                 "-s", 
configPath("hdfs_with_invalid_core_site_path/schema.groovy"),
                 "-g", GRAPH,
                 "-h", SERVER,
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
-        };
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+
         Assert.assertThrows(LoadException.class, () -> {
-            HugeGraphLoader loader = new HugeGraphLoader(args);
+            HugeGraphLoader loader = new HugeGraphLoader(argsList.toArray(new 
String[0]));
             loader.load();
         }, e -> {
             String message = "Failed to init";
@@ -160,16 +170,18 @@ public class HDFSLoadTest extends FileLoadTest {
                      "peter,35,Shanghai",
                      "\"li,nary\",26,\"Wu,han\"");
 
-        String[] args = new String[]{
+        List<String> argsList = new ArrayList<>(Arrays.asList(
                 "-f", 
structPath("hdfs_with_unexist_core_site_path/struct.json"),
                 "-s", 
configPath("hdfs_with_unexist_core_site_path/schema.groovy"),
                 "-g", GRAPH,
                 "-h", SERVER,
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
-        };
+        ));
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
+
         Assert.assertThrows(LoadException.class, () -> {
-            HugeGraphLoader loader = new HugeGraphLoader(args);
+            HugeGraphLoader loader = new HugeGraphLoader(argsList.toArray(new 
String[0]));
             loader.load();
         }, e -> {
             Throwable t = e.getCause();
diff --git 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/JDBCLoadTest.java
 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/JDBCLoadTest.java
index 58a6b83d..0e3c26f5 100644
--- 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/JDBCLoadTest.java
+++ 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/JDBCLoadTest.java
@@ -167,7 +167,7 @@ public class JDBCLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -195,7 +195,7 @@ public class JDBCLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -219,7 +219,7 @@ public class JDBCLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -252,7 +252,7 @@ public class JDBCLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
 
@@ -281,7 +281,7 @@ public class JDBCLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
 
diff --git 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/KafkaLoadTest.java
 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/KafkaLoadTest.java
index 82331493..c6c31520 100644
--- 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/KafkaLoadTest.java
+++ 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/KafkaLoadTest.java
@@ -17,6 +17,8 @@
 
 package org.apache.hugegraph.loader.test.functional;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -86,7 +88,7 @@ public class KafkaLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
 
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         List<Edge> edges = CLIENT.graph().listEdges();
@@ -115,7 +117,7 @@ public class KafkaLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
 
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
         List<Vertex> vertices = CLIENT.graph().listVertices();
 
         Assert.assertEquals(7, vertices.size());
@@ -137,7 +139,7 @@ public class KafkaLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
 
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -147,7 +149,7 @@ public class KafkaLoadTest extends LoadTest {
 
     @Test
     public void testKafkaFormatNotSupport() {
-        String[] args = new String[]{
+        List<String> argsList = new ArrayList<>(Arrays.asList(
                 "-f", configPath("kafka_format_not_support/struct.json"),
                 "-s", configPath("kafka_format_not_support/schema.groovy"),
                 "-g", GRAPH,
@@ -155,10 +157,12 @@ public class KafkaLoadTest extends LoadTest {
                 "-p", String.valueOf(PORT),
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
-        };
+        ));
+
+        argsList.addAll(Arrays.asList("--username", "admin", "--password", 
"pa"));
 
         Assert.assertThrows(SerializeException.class, () -> {
-            HugeGraphLoader loader = new HugeGraphLoader(args);
+            HugeGraphLoader loader = new HugeGraphLoader(argsList.toArray(new 
String[0]));
             loader.load();
             loader.shutdown();
         });
@@ -176,7 +180,7 @@ public class KafkaLoadTest extends LoadTest {
                 "--test-mode", "true"
         };
 
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
@@ -196,8 +200,7 @@ public class KafkaLoadTest extends LoadTest {
                 "--batch-insert-threads", "2",
                 "--test-mode", "true"
         };
-
-        HugeGraphLoader.main(args);
+        loadWithAuth(args);
 
         List<Vertex> vertices = CLIENT.graph().listVertices();
         Assert.assertEquals(2, vertices.size());
diff --git 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/LoadTest.java
 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/LoadTest.java
index eabe4878..e52e42c8 100644
--- 
a/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/LoadTest.java
+++ 
b/hugegraph-loader/src/test/java/org/apache/hugegraph/loader/test/functional/LoadTest.java
@@ -146,12 +146,31 @@ public class LoadTest {
         Assert.assertEquals(expectTimeStamp, actualTimeStamp);
     }
 
-    public static void authmain(String[] args) {
-        ArrayList list = new ArrayList(Arrays.asList(args));
+    /**
+     * Entry point for running the HugeGraphLoader with authentication 
parameters.
+     * This method appends authentication arguments (username and password) to 
the
+     * provided command-line arguments and then invokes {@link 
HugeGraphLoader#main(String[])}
+     * to start the data loading process.
+     * Specifically, it appends:
+     * --username admin
+     * --password pa
+     * to the end of the original argument list before delegating to 
HugeGraphLoader.
+     * <p>
+     * <b>Note:</b> The password "pa" is a simplified test password used only 
for testing purposes.
+     * It is a placeholder and <b>must be changed</b> in production 
environments to a secure value.
+     * The choice of "pa" is arbitrary and intended to facilitate automated 
testing.
+     * @param args the original command-line arguments passed to the program.
+     *             These arguments are extended with authentication information
+     *             before being passed to {@code HugeGraphLoader.main()}.
+     *
+     * @see HugeGraphLoader#main(String[])
+     */
+    public static void loadWithAuth(String[] args) {
+        ArrayList<String> list = new ArrayList<>(Arrays.asList(args));
         list.add("--username");
         list.add("admin");
         list.add("--password");
-        list.add("admin");
+        list.add("pa");
         args = (String[]) list.toArray(new String[list.size()]);
 
         HugeGraphLoader.main(args);

Reply via email to