From a71c269f866777cd8c77eb004c5ca6020ddb6819 Mon Sep 17 00:00:00 2001 From: JisoLya <523420504@qq.com> Date: Tue, 16 Dec 2025 17:08:21 +0800 Subject: [PATCH 1/7] chore: update comment format --- .../hugegraph-clustertest-dist/pom.xml | 28 ++++---- .../src/assembly/descriptor/assembly.xml | 28 ++++---- .../hugegraph-clustertest-minicluster/pom.xml | 29 ++++---- .../hugegraph-clustertest-test/pom.xml | 70 +++++++++++++++---- .../BaseMultiClusterTest.java | 2 +- .../SimpleClusterTest/BaseSimpleTest.java | 2 +- hugegraph-cluster-test/pom.xml | 28 ++++---- 7 files changed, 114 insertions(+), 73 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml index 7ec79efba0..e318f06bd0 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml @@ -1,19 +1,19 @@ diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml index 8feb6181f2..b59648304f 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml @@ -1,19 +1,19 @@ 11 11 UTF-8 - 2.17.0 diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index c888404545..735ea66b43 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -1,19 +1,19 @@ 4.13.2 compile + + jakarta.ws.rs + jakarta.ws.rs-api + 3.0.0 + + + org.glassfish.jersey.inject + jersey-hk2 + 3.0.3 + test + + + org.glassfish.jersey.core + jersey-client + 3.0.3 + compile + @@ -92,6 +109,31 @@ + + org.apache.maven.plugins + maven-resources-plugin + + + generate-version + process-resources + + copy-resources + + + ${project.build.directory}/classes + + + src/main/resources + true + + jar.txt + + + + + + + diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java index 59394101c2..55ce8742df 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -30,7 +30,7 @@ * MultiNode Test generate the cluster env with 3 pd node + 3 store node + 3 server node. * Or you can set different num of nodes by using env = new MultiNodeEnv(pdNum, storeNum, serverNum) * All nodes are deployed in ports generated randomly, the application of nodes are stored - * in /apache-hugegraph-ct-incubating-1.5.0, you can visit each node with rest api. + * in /apache-hugegraph-ct-incubating-1.7.0, you can visit each node with rest api. */ public class BaseMultiClusterTest { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java index 61954de811..ef75964046 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java @@ -31,7 +31,7 @@ /** * Simple Test generate the cluster env with 1 pd node + 1 store node + 1 server node. * All nodes are deployed in ports generated randomly; The application of nodes is stored - * in /apache-hugegraph-ct-incubating-1.5.0, you can visit each node with rest api. + * in /apache-hugegraph-ct-incubating-1.7.0, you can visit each node with rest api. */ public class BaseSimpleTest { diff --git a/hugegraph-cluster-test/pom.xml b/hugegraph-cluster-test/pom.xml index fcc409d6ad..ecb47b7970 100644 --- a/hugegraph-cluster-test/pom.xml +++ b/hugegraph-cluster-test/pom.xml @@ -1,19 +1,19 @@ Date: Tue, 16 Dec 2025 17:09:27 +0800 Subject: [PATCH 2/7] update(cluster-test): Bump cluster-test version to 1.7.0 --- .../static/conf/hugegraph.properties.template | 3 +- .../conf/rest-server.properties.template | 7 +- .../hugegraph/ct/node/ServerNodeWrapper.java | 40 +++- .../BaseMultiClusterTest.java | 56 +++++ .../MultiClusterDeployTest.java | 202 +++++------------- .../SimpleClusterTest/BaseSimpleTest.java | 126 ++++++++++- .../SimpleClusterDeployTest.java | 202 +++++------------- .../src/main/resources/jar.txt | 14 ++ 8 files changed, 358 insertions(+), 292 deletions(-) create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/hugegraph.properties.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/hugegraph.properties.template index 2a086bd325..005031fe60 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/hugegraph.properties.template +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/hugegraph.properties.template @@ -16,8 +16,7 @@ # # gremlin entrance to create graph -# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy -gremlin.graph=org.apache.hugegraph.HugeFactory +gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy # cache config #schema.cache_capacity=100000 diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/rest-server.properties.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/rest-server.properties.template index 8f4e9bf616..9077039d4c 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/rest-server.properties.template +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/rest-server.properties.template @@ -36,7 +36,12 @@ arthas.disabled_commands=jad # authentication configs # choose 'org.apache.hugegraph.auth.StandardAuthenticator' or # 'org.apache.hugegraph.auth.ConfigAuthenticator' -#auth.authenticator= +auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator +# true if using hstore mode +usePD=true + +# default password +auth.admin_pa=pa # for StandardAuthenticator mode #auth.graph_store=hugegraph diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index e39bc39557..debf19415f 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -34,8 +34,12 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; @@ -43,6 +47,7 @@ public class ServerNodeWrapper extends AbstractNodeWrapper { + private static List hgJars = new ArrayList<>(); public ServerNodeWrapper(int clusterIndex, int index) { super(clusterIndex, index); this.fileNames = new ArrayList<>( @@ -54,6 +59,7 @@ public ServerNodeWrapper(int clusterIndex, int index) { this.startLine = "INFO: [HttpServer] Started."; createNodeDir(Paths.get(SERVER_PACKAGE_PATH), getNodePath()); createLogDir(); + loadHgJars(); } private static void addJarsToClasspath(File directory, List classpath) { @@ -67,6 +73,36 @@ private static void addJarsToClasspath(File directory, List classpath) { } } + private static void addCpJarsToClasspath(File directory, List classpath) { + // Add jar starts with hugegraph in proper order + String path = directory.getAbsolutePath(); + for (String jar : hgJars) { + classpath.add(path + File.separator + jar); + } + if (directory.exists() && directory.isDirectory()) { + File[] files = + directory.listFiles((dir, name) -> name.endsWith(".jar") && !name.contains( + "hugegraph")); + if (files != null) { + for (File file : files) { + classpath.add(file.getAbsolutePath()); + } + } + } + } + + private void loadHgJars(){ + try (InputStream is = ServerNodeWrapper.class.getResourceAsStream("/jar.txt"); + BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { + String line; + while ((line = reader.readLine()) != null) { + hgJars.add(line); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + @Override public void start() { try { @@ -79,7 +115,7 @@ public void start() { } List classpath = new ArrayList<>(); - addJarsToClasspath(new File(workPath + LIB_DIR), classpath); + addCpJarsToClasspath(new File(workPath + LIB_DIR), classpath); addJarsToClasspath(new File(workPath + EXT_DIR), classpath); addJarsToClasspath(new File(workPath + PLUGINS_DIR), classpath); String storeClassPath = String.join(":", classpath); @@ -87,6 +123,8 @@ public void start() { startCmd.addAll(Arrays.asList( "-Dname=HugeGraphServer" + this.index, "--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED", + "--add-modules=jdk.unsupported", + "--add-exports=java.base/sun.nio.ch=ALL-UNNAMED", "-cp", storeClassPath, "org.apache.hugegraph.dist.HugeGraphServer", "./conf/gremlin-server.yaml", diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java index 55ce8742df..be42ec1f06 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -20,12 +20,20 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; +import org.apache.hugegraph.SimpleClusterTest.BaseSimpleTest; +import org.apache.hugegraph.SimpleClusterTest.BaseSimpleTest.RestClient; import org.apache.hugegraph.ct.env.BaseEnv; import org.apache.hugegraph.ct.env.MultiNodeEnv; +import org.apache.hugegraph.serializer.direct.util.HugeException; import org.junit.AfterClass; +import org.junit.Assert; import org.junit.BeforeClass; +import jakarta.ws.rs.core.Response; + /** * MultiNode Test generate the cluster env with 3 pd node + 3 store node + 3 server node. * Or you can set different num of nodes by using env = new MultiNodeEnv(pdNum, storeNum, serverNum) @@ -36,16 +44,47 @@ public class BaseMultiClusterTest { protected static BaseEnv env; protected static Process p; + protected static List clients = new ArrayList<>(); + protected static String BASE_URL = "http://"; + protected static final String GRAPH = "hugegraphapi"; + protected static final String URL_PREFIX = "graphspaces/DEFAULT/graphs/" + GRAPH; + protected static final String SCHEMA_PKS = "/schema/propertykeys"; @BeforeClass public static void initEnv() { env = new MultiNodeEnv(); env.startCluster(); + for (String addr : env.getServerRestAddrs()) { + clients.add(new RestClient(BASE_URL + addr)); + } + initGraph(); } @AfterClass public static void clearEnv() { env.stopCluster(); + for (RestClient client : clients) { + client.close(); + } + } + + protected static void initGraph() { + BaseSimpleTest.RestClient client = clients.get(0); + Response r = clients.get(0).get(URL_PREFIX); + if (r.getStatus() != 200) { + String body = "{\n" + + " \"backend\": \"hstore\",\n" + + " \"serializer\": \"binary\",\n" + + " \"store\": \"hugegraphapi\",\n" + + " \"search.text_analyzer\": \"jieba\",\n" + + " \"search.text_analyzer_mode\": \"INDEX\"\n" + + "}"; + r = client.post(URL_PREFIX, body); + if (r.getStatus() != 201) { + throw new HugeException("Failed to create graph: " + GRAPH + + r.readEntity(String.class)); + } + } } protected String execCmd(String[] cmds) throws IOException { @@ -61,4 +100,21 @@ protected String execCmd(String[] cmds) throws IOException { p.destroy(); return builder.toString(); } + + protected static String assertResponseStatus(int status, + Response response) { + String content = response.readEntity(String.class); + String message = String.format("Response with status %s and content %s", + response.getStatus(), content); + Assert.assertEquals(message, status, response.getStatus()); + return content; + } + + public static Response createAndAssert(RestClient client, String path, + String body, + int status) { + Response r = client.post(path, body); + assertResponseStatus(status, r); + return r; + } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java index 0318df1ad0..4229fc35f5 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java @@ -18,22 +18,12 @@ package org.apache.hugegraph.MultiClusterTest; import java.io.IOException; -import java.util.Iterator; import java.util.List; -import org.apache.hugegraph.driver.GraphManager; -import org.apache.hugegraph.driver.GremlinManager; -import org.apache.hugegraph.driver.HugeClient; -import org.apache.hugegraph.driver.SchemaManager; +import org.apache.hugegraph.SimpleClusterTest.BaseSimpleTest.RestClient; 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.structure.constant.T; -import org.apache.hugegraph.structure.graph.Edge; -import org.apache.hugegraph.structure.graph.Path; -import org.apache.hugegraph.structure.graph.Vertex; -import org.apache.hugegraph.structure.gremlin.Result; -import org.apache.hugegraph.structure.gremlin.ResultSet; import org.junit.Assert; import org.junit.Test; @@ -59,11 +49,6 @@ public void testStoreNodesDeployment() throws IOException { List addrs = env.getStoreRestAddrs(); for (String addr : addrs) { String[] cmds = {"curl", addr}; - // TODO: why not use the sb param? - StringBuilder sb = new StringBuilder(); - for (String cmd : cmds) { - sb.append(cmd).append(" "); - } String responseMsg = execCmd(cmds); Assert.assertTrue(responseMsg.startsWith("{")); } @@ -71,133 +56,64 @@ public void testStoreNodesDeployment() throws IOException { @Test public void testServerNodesDeployment() { - List addrs = env.getServerRestAddrs(); - for (String addr : addrs) { - HugeClient hugeClient = HugeClient.builder("http://" + addr, "hugegraph") - .build(); - SchemaManager schema = hugeClient.schema(); - - schema.propertyKey("name").asText().ifNotExist().create(); - schema.propertyKey("age").asInt().ifNotExist().create(); - schema.propertyKey("city").asText().ifNotExist().create(); - schema.propertyKey("weight").asDouble().ifNotExist().create(); - schema.propertyKey("lang").asText().ifNotExist().create(); - schema.propertyKey("date").asDate().ifNotExist().create(); - schema.propertyKey("price").asInt().ifNotExist().create(); - - schema.vertexLabel("person") - .properties("name", "age", "city") - .primaryKeys("name") - .ifNotExist() - .create(); - - schema.vertexLabel("software") - .properties("name", "lang", "price") - .primaryKeys("name") - .ifNotExist() - .create(); - - schema.indexLabel("personByCity") - .onV("person") - .by("city") - .secondary() - .ifNotExist() - .create(); - - schema.indexLabel("personByAgeAndCity") - .onV("person") - .by("age", "city") - .secondary() - .ifNotExist() - .create(); - - schema.indexLabel("softwareByPrice") - .onV("software") - .by("price") - .range() - .ifNotExist() - .create(); - - schema.edgeLabel("knows") - .sourceLabel("person") - .targetLabel("person") - .properties("date", "weight") - .ifNotExist() - .create(); - - schema.edgeLabel("created") - .sourceLabel("person").targetLabel("software") - .properties("date", "weight") - .ifNotExist() - .create(); - - schema.indexLabel("createdByDate") - .onE("created") - .by("date") - .secondary() - .ifNotExist() - .create(); - - schema.indexLabel("createdByWeight") - .onE("created") - .by("weight") - .range() - .ifNotExist() - .create(); - - schema.indexLabel("knowsByWeight") - .onE("knows") - .by("weight") - .range() - .ifNotExist() - .create(); - - GraphManager graph = hugeClient.graph(); - Vertex marko = graph.addVertex(T.LABEL, "person", "name", "marko", - "age", 29, "city", "Beijing"); - Vertex vadas = graph.addVertex(T.LABEL, "person", "name", "vadas", - "age", 27, "city", "Hongkong"); - Vertex lop = graph.addVertex(T.LABEL, "software", "name", "lop", - "lang", "java", "price", 328); - Vertex josh = graph.addVertex(T.LABEL, "person", "name", "josh", - "age", 32, "city", "Beijing"); - Vertex ripple = graph.addVertex(T.LABEL, "software", "name", "ripple", - "lang", "java", "price", 199); - Vertex peter = graph.addVertex(T.LABEL, "person", "name", "peter", - "age", 35, "city", "Shanghai"); - - marko.addEdge("knows", vadas, "date", "2016-01-10", "weight", 0.5); - marko.addEdge("knows", josh, "date", "2013-02-20", "weight", 1.0); - marko.addEdge("created", lop, "date", "2017-12-10", "weight", 0.4); - josh.addEdge("created", lop, "date", "2009-11-11", "weight", 0.4); - josh.addEdge("created", ripple, "date", "2017-12-10", "weight", 1.0); - peter.addEdge("created", lop, "date", "2017-03-24", "weight", 0.2); - - GremlinManager gremlin = hugeClient.gremlin(); - System.out.println("==== Path ===="); - ResultSet resultSet = gremlin.gremlin("g.V().outE().path()").execute(); - Iterator results = resultSet.iterator(); - results.forEachRemaining(result -> { - System.out.println(result.getObject().getClass()); - Object object = result.getObject(); - if (object instanceof Vertex) { - System.out.println(((Vertex) object).id()); - } else if (object instanceof Edge) { - System.out.println(((Edge) object).id()); - } else if (object instanceof Path) { - List elements = ((Path) object).objects(); - elements.forEach(element -> { - System.out.println(element.getClass()); - System.out.println(element); - }); - } else { - System.out.println(object); - } - }); - - hugeClient.close(); - assert true; - break; + for (RestClient client : clients) { + String path = URL_PREFIX + SCHEMA_PKS; + createAndAssert(client, path, "{\n" + + "\"name\": \"name\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(client, path, "{\n" + + "\"name\": \"age\",\n" + + "\"data_type\": \"INT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(client, path, "{\n" + + "\"name\": \"city\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(client, path, "{\n" + + "\"name\": \"lang\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(client, path, "{\n" + + "\"name\": \"date\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(client, path, "{\n" + + "\"name\": \"price\",\n" + + "\"data_type\": \"INT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(client, path, "{\n" + + "\"name\": \"weight\",\n" + + "\"data_type\": \"DOUBLE\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(client, path, "{\n" + + "\"name\": \"rank\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); } } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java index ef75964046..849b4b835f 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java @@ -20,14 +20,28 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.util.Map; import org.apache.hugegraph.ct.env.BaseEnv; import org.apache.hugegraph.ct.env.SimpleEnv; -import org.apache.hugegraph.driver.HugeClient; import org.apache.hugegraph.pd.client.PDClient; +import org.apache.hugegraph.serializer.direct.util.HugeException; +import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; +import org.glassfish.jersey.client.filter.EncodingFilter; +import org.glassfish.jersey.message.GZipEncoder; import org.junit.AfterClass; +import org.junit.Assert; import org.junit.BeforeClass; +import com.google.common.collect.Multimap; + +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; + /** * Simple Test generate the cluster env with 1 pd node + 1 store node + 1 server node. * All nodes are deployed in ports generated randomly; The application of nodes is stored @@ -38,18 +52,29 @@ public class BaseSimpleTest { protected static BaseEnv env; protected static Process p; protected static PDClient pdClient; - protected static HugeClient hugeClient; + + protected static String BASE_URL = "http://"; + protected static final String GRAPH = "hugegraphapi"; + protected static final String USERNAME = "admin"; + private static final String PASSWORD = "pa"; + + protected static final String URL_PREFIX = "graphspaces/DEFAULT/graphs/" + GRAPH; + protected static final String SCHEMA_PKS = "/schema/propertykeys"; + protected static RestClient client; @BeforeClass public static void initEnv() { env = new SimpleEnv(); env.startCluster(); + client = new RestClient(BASE_URL + env.getServerRestAddrs().get(0)); + initGraph(); } @AfterClass public static void clearEnv() throws InterruptedException { env.stopCluster(); Thread.sleep(2000); + client.close(); } protected String execCmd(String[] cmds) throws IOException { @@ -66,4 +91,101 @@ protected String execCmd(String[] cmds) throws IOException { return builder.toString(); } + protected static void initGraph() { + Response r = client.get(URL_PREFIX); + if (r.getStatus() != 200) { + String body = "{\n" + + " \"backend\": \"hstore\",\n" + + " \"serializer\": \"binary\",\n" + + " \"store\": \"hugegraphapi\",\n" + + " \"search.text_analyzer\": \"jieba\",\n" + + " \"search.text_analyzer_mode\": \"INDEX\"\n" + + "}"; + r = client.post(URL_PREFIX, body); + if (r.getStatus() != 201) { + throw new HugeException("Failed to create graph: " + GRAPH + + r.readEntity(String.class)); + } + } + } + + public static class RestClient { + + private final Client client; + private final WebTarget target; + + public RestClient(String url) { + this.client = ClientBuilder.newClient(); + this.client.register(EncodingFilter.class); + this.client.register(GZipEncoder.class); + this.client.register(HttpAuthenticationFeature.basic(USERNAME, + PASSWORD)); + this.target = this.client.target(url); + } + + public void close() { + this.client.close(); + } + + public WebTarget target() { + return this.target; + } + + public WebTarget target(String url) { + return this.client.target(url); + } + + public Response get(String path) { + return this.target.path(path).request().get(); + } + + public Response get(String path, String id) { + return this.target.path(path).path(id).request().get(); + } + + public Response get(String path, + MultivaluedMap headers) { + return this.target.path(path).request().headers(headers).get(); + } + + public Response get(String path, Multimap params) { + WebTarget target = this.target.path(path); + for (Map.Entry entries : params.entries()) { + target = target.queryParam(entries.getKey(), entries.getValue()); + } + return target.request().get(); + } + + public Response get(String path, Map params) { + WebTarget target = this.target.path(path); + for (Map.Entry i : params.entrySet()) { + target = target.queryParam(i.getKey(), i.getValue()); + } + return target.request().get(); + } + + public Response post(String path, String content) { + return this.post(path, Entity.json(content)); + } + + public Response post(String path, Entity entity) { + return this.target.path(path).request().post(entity); + } + } + + protected static String assertResponseStatus(int status, + Response response) { + String content = response.readEntity(String.class); + String message = String.format("Response with status %s and content %s", + response.getStatus(), content); + Assert.assertEquals(message, status, response.getStatus()); + return content; + } + + public static Response createAndAssert(String path, String body, + int status) { + Response r = client.post(path, body); + assertResponseStatus(status, r); + return r; + } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java index 61a73ff0f4..267e186f9e 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java @@ -18,22 +18,11 @@ package org.apache.hugegraph.SimpleClusterTest; import java.io.IOException; -import java.util.Iterator; import java.util.List; -import org.apache.hugegraph.driver.GraphManager; -import org.apache.hugegraph.driver.GremlinManager; -import org.apache.hugegraph.driver.HugeClient; -import org.apache.hugegraph.driver.SchemaManager; 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.structure.constant.T; -import org.apache.hugegraph.structure.graph.Edge; -import org.apache.hugegraph.structure.graph.Path; -import org.apache.hugegraph.structure.graph.Vertex; -import org.apache.hugegraph.structure.gremlin.Result; -import org.apache.hugegraph.structure.gremlin.ResultSet; import org.junit.Assert; import org.junit.Test; @@ -44,7 +33,7 @@ public void testPDNodesDeployment() { try { List addrs = env.getPDGrpcAddrs(); for (String addr : addrs) { - PDConfig pdConfig = PDConfig.of(addr); + PDConfig pdConfig = PDConfig.of(addr, Long.MAX_VALUE); pdClient = PDClient.create(pdConfig); pdClient.dbCompaction(); } @@ -59,142 +48,69 @@ public void testStoreNodesDeployment() throws IOException { List addrs = env.getStoreRestAddrs(); for (String addr : addrs) { String[] cmds = {"curl", addr}; - // TODO: what's the purpose of this? - StringBuilder sb = new StringBuilder(); - for (String cmd : cmds) { - sb.append(cmd).append(" "); - } String responseMsg = execCmd(cmds); Assert.assertTrue(responseMsg.startsWith("{")); } } @Test - public void testServerNodesDeployment() { - List addrs = env.getServerRestAddrs(); - for (String addr : addrs) { - hugeClient = HugeClient.builder("http://" + addr, "hugegraph").build(); - SchemaManager schema = hugeClient.schema(); - - schema.propertyKey("name").asText().ifNotExist().create(); - schema.propertyKey("age").asInt().ifNotExist().create(); - schema.propertyKey("city").asText().ifNotExist().create(); - schema.propertyKey("weight").asDouble().ifNotExist().create(); - schema.propertyKey("lang").asText().ifNotExist().create(); - schema.propertyKey("date").asDate().ifNotExist().create(); - schema.propertyKey("price").asInt().ifNotExist().create(); - - schema.vertexLabel("person") - .properties("name", "age", "city") - .primaryKeys("name") - .ifNotExist() - .create(); - - schema.vertexLabel("software") - .properties("name", "lang", "price") - .primaryKeys("name") - .ifNotExist() - .create(); - - schema.indexLabel("personByCity") - .onV("person") - .by("city") - .secondary() - .ifNotExist() - .create(); - - schema.indexLabel("personByAgeAndCity") - .onV("person") - .by("age", "city") - .secondary() - .ifNotExist() - .create(); - - schema.indexLabel("softwareByPrice") - .onV("software") - .by("price") - .range() - .ifNotExist() - .create(); - - schema.edgeLabel("knows") - .sourceLabel("person") - .targetLabel("person") - .properties("date", "weight") - .ifNotExist() - .create(); - - schema.edgeLabel("created") - .sourceLabel("person").targetLabel("software") - .properties("date", "weight") - .ifNotExist() - .create(); - - schema.indexLabel("createdByDate") - .onE("created") - .by("date") - .secondary() - .ifNotExist() - .create(); - - schema.indexLabel("createdByWeight") - .onE("created") - .by("weight") - .range() - .ifNotExist() - .create(); - - schema.indexLabel("knowsByWeight") - .onE("knows") - .by("weight") - .range() - .ifNotExist() - .create(); - - GraphManager graph = hugeClient.graph(); - Vertex marko = graph.addVertex(T.LABEL, "person", "name", "marko", - "age", 29, "city", "Beijing"); - Vertex vadas = graph.addVertex(T.LABEL, "person", "name", "vadas", - "age", 27, "city", "Hongkong"); - Vertex lop = graph.addVertex(T.LABEL, "software", "name", "lop", - "lang", "java", "price", 328); - Vertex josh = graph.addVertex(T.LABEL, "person", "name", "josh", - "age", 32, "city", "Beijing"); - Vertex ripple = graph.addVertex(T.LABEL, "software", "name", "ripple", - "lang", "java", "price", 199); - Vertex peter = graph.addVertex(T.LABEL, "person", "name", "peter", - "age", 35, "city", "Shanghai"); - - marko.addEdge("knows", vadas, "date", "2016-01-10", "weight", 0.5); - marko.addEdge("knows", josh, "date", "2013-02-20", "weight", 1.0); - marko.addEdge("created", lop, "date", "2017-12-10", "weight", 0.4); - josh.addEdge("created", lop, "date", "2009-11-11", "weight", 0.4); - josh.addEdge("created", ripple, "date", "2017-12-10", "weight", 1.0); - peter.addEdge("created", lop, "date", "2017-03-24", "weight", 0.2); - - GremlinManager gremlin = hugeClient.gremlin(); - System.out.println("==== Path ===="); - ResultSet resultSet = gremlin.gremlin("g.V().outE().path()").execute(); - Iterator results = resultSet.iterator(); - results.forEachRemaining(result -> { - System.out.println(result.getObject().getClass()); - Object object = result.getObject(); - if (object instanceof Vertex) { - System.out.println(((Vertex) object).id()); - } else if (object instanceof Edge) { - System.out.println(((Edge) object).id()); - } else if (object instanceof Path) { - List elements = ((Path) object).objects(); - elements.forEach(element -> { - System.out.println(element.getClass()); - System.out.println(element); - }); - } else { - System.out.println(object); - } - }); - - hugeClient.close(); - } + public void testServerNode() { + String path = URL_PREFIX + SCHEMA_PKS; + createAndAssert(path, "{\n" + + "\"name\": \"name\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(path, "{\n" + + "\"name\": \"age\",\n" + + "\"data_type\": \"INT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(path, "{\n" + + "\"name\": \"city\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(path, "{\n" + + "\"name\": \"lang\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(path, "{\n" + + "\"name\": \"date\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(path, "{\n" + + "\"name\": \"price\",\n" + + "\"data_type\": \"INT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(path, "{\n" + + "\"name\": \"weight\",\n" + + "\"data_type\": \"DOUBLE\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); + createAndAssert(path, "{\n" + + "\"name\": \"rank\",\n" + + "\"data_type\": \"TEXT\",\n" + + "\"cardinality\": \"SINGLE\",\n" + + "\"check_exist\": false,\n" + + "\"properties\":[]\n" + + "}", 202); } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt new file mode 100644 index 0000000000..7a566545ce --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt @@ -0,0 +1,14 @@ +hugegraph-api-${revision}.jar +hugegraph-cassandra-${revision}.jar +hugegraph-common-${revision}.jar +hugegraph-core-${revision}.jar +hugegraph-dist-${revision}.jar +hugegraph-hbase-${revision}.jar +hugegraph-hstore-${revision}.jar +hugegraph-mysql-${revision}.jar +hugegraph-palo-${revision}.jar +hugegraph-postgresql-${revision}.jar +hugegraph-rocksdb-${revision}.jar +hugegraph-rpc-${revision}.jar +hugegraph-scylladb-${revision}.jar +hugegraph-struct-${revision}.jar From f1ad9a8eaa96cbe6479e56a1b341141c9746626b Mon Sep 17 00:00:00 2001 From: JisoLya <523420504@qq.com> Date: Tue, 16 Dec 2025 17:41:38 +0800 Subject: [PATCH 3/7] fix(cluster): clear static object before run tests --- .../apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java index be42ec1f06..787d05c820 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -54,6 +54,7 @@ public class BaseMultiClusterTest { public static void initEnv() { env = new MultiNodeEnv(); env.startCluster(); + clients.clear(); for (String addr : env.getServerRestAddrs()) { clients.add(new RestClient(BASE_URL + addr)); } From 81b1480b0ec949d042bf5fc72d71ff9796bd1b6a Mon Sep 17 00:00:00 2001 From: JisoLya <523420504@qq.com> Date: Thu, 18 Dec 2025 12:58:20 +0800 Subject: [PATCH 4/7] dep: add javassist-3.25.0-GA --- .../licenses/LICENSE-javassist-3.25.0-GA.txt | 202 ++++++++++++++++++ .../scripts/dependency/known-dependencies.txt | 1 + 2 files changed, 203 insertions(+) create mode 100644 install-dist/release-docs/licenses/LICENSE-javassist-3.25.0-GA.txt diff --git a/install-dist/release-docs/licenses/LICENSE-javassist-3.25.0-GA.txt b/install-dist/release-docs/licenses/LICENSE-javassist-3.25.0-GA.txt new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/install-dist/release-docs/licenses/LICENSE-javassist-3.25.0-GA.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/install-dist/scripts/dependency/known-dependencies.txt b/install-dist/scripts/dependency/known-dependencies.txt index dda176954c..86831bff86 100644 --- a/install-dist/scripts/dependency/known-dependencies.txt +++ b/install-dist/scripts/dependency/known-dependencies.txt @@ -226,6 +226,7 @@ java-cup-runtime-11b-20160615.jar javapoet-1.8.0.jar javassist-3.21.0-GA.jar javassist-3.24.0-GA.jar +javassist-3.25.0-GA.jar javassist-3.28.0-GA.jar javatuples-1.2.jar javax-websocket-client-impl-9.4.46.v20220331.jar From c13ea0d4db18f75cfece9a39f61eccb96e445eea Mon Sep 17 00:00:00 2001 From: Soyaazz <523420504@qq.com> Date: Sun, 4 Jan 2026 21:19:33 +0800 Subject: [PATCH 5/7] Update hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java index 787d05c820..d52b766847 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -71,7 +71,7 @@ public static void clearEnv() { protected static void initGraph() { BaseSimpleTest.RestClient client = clients.get(0); - Response r = clients.get(0).get(URL_PREFIX); + Response r = client.get(URL_PREFIX); if (r.getStatus() != 200) { String body = "{\n" + " \"backend\": \"hstore\",\n" + From 418c6de2357dda98f8ac99523a13f91b09a3edef Mon Sep 17 00:00:00 2001 From: JisoLya <523420504@qq.com> Date: Sun, 4 Jan 2026 21:36:39 +0800 Subject: [PATCH 6/7] chore: add more clear error message and rename method --- .../java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java | 4 ++-- .../hugegraph/MultiClusterTest/BaseMultiClusterTest.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index debf19415f..50919b5eea 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -73,7 +73,7 @@ private static void addJarsToClasspath(File directory, List classpath) { } } - private static void addCpJarsToClasspath(File directory, List classpath) { + private static void addOrderedJarsToClasspath(File directory, List classpath) { // Add jar starts with hugegraph in proper order String path = directory.getAbsolutePath(); for (String jar : hgJars) { @@ -115,7 +115,7 @@ public void start() { } List classpath = new ArrayList<>(); - addCpJarsToClasspath(new File(workPath + LIB_DIR), classpath); + addOrderedJarsToClasspath(new File(workPath + LIB_DIR), classpath); addJarsToClasspath(new File(workPath + EXT_DIR), classpath); addJarsToClasspath(new File(workPath + PLUGINS_DIR), classpath); String storeClassPath = String.join(":", classpath); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java index d52b766847..af640b3a94 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -82,8 +82,9 @@ protected static void initGraph() { "}"; r = client.post(URL_PREFIX, body); if (r.getStatus() != 201) { - throw new HugeException("Failed to create graph: " + GRAPH + - r.readEntity(String.class)); + throw new HugeException(String.format( + "Failed to initialize graph %s %s",GRAPH, r.readEntity(String.class) + )); } } } From e570cd9022a1c5bc8388f84aa373319f93eeebe0 Mon Sep 17 00:00:00 2001 From: JisoLya <523420504@qq.com> Date: Sun, 4 Jan 2026 21:42:34 +0800 Subject: [PATCH 7/7] fix: avoid load strings to array list multiple times --- .../apache/hugegraph/ct/node/ServerNodeWrapper.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 50919b5eea..e16b96781e 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -43,11 +43,12 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; public class ServerNodeWrapper extends AbstractNodeWrapper { - private static List hgJars = new ArrayList<>(); + private static List hgJars = loadHgJarsOnce(); public ServerNodeWrapper(int clusterIndex, int index) { super(clusterIndex, index); this.fileNames = new ArrayList<>( @@ -59,7 +60,6 @@ public ServerNodeWrapper(int clusterIndex, int index) { this.startLine = "INFO: [HttpServer] Started."; createNodeDir(Paths.get(SERVER_PACKAGE_PATH), getNodePath()); createLogDir(); - loadHgJars(); } private static void addJarsToClasspath(File directory, List classpath) { @@ -91,16 +91,18 @@ private static void addOrderedJarsToClasspath(File directory, List class } } - private void loadHgJars(){ + private static List loadHgJarsOnce(){ + ArrayList jars = new ArrayList<>(); try (InputStream is = ServerNodeWrapper.class.getResourceAsStream("/jar.txt"); BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { - hgJars.add(line); + jars.add(line); } } catch (IOException e) { e.printStackTrace(); } + return Collections.unmodifiableList(jars); } @Override