zyxxoo commented on code in PR #2615:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1716248035


##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hugegraph.it.node;
+
+import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR;
+import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD;
+import static org.apache.hugegraph.it.base.ClusterConstant.STORE_JAR_PREFIX;
+import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir;
+import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+
+public class StoreNodeWrapper extends AbstractNodeWrapper {

Review Comment:
   the nodeWrap look like a proxy or endpoint for remote server, so maybe can 
name to xxxProxy direct.



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hugegraph.it.node;
+
+import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR;
+import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD;
+import static org.apache.hugegraph.it.base.ClusterConstant.PD_JAR_PREFIX;
+import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir;
+import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+
+public class PDNodeWrapper extends AbstractNodeWrapper {
+
+    public PDNodeWrapper(String host, int grpcPort, int clusterIndex, int cnt) 
{
+        super(host, grpcPort, clusterIndex, cnt);
+    }
+
+    public PDNodeWrapper(int clusterId, int cnt) {
+        this.clusterIndex = clusterId;
+        this.cnt = cnt;
+    }
+
+    /*
+    workPath is path of JAR package, configPath is path of config files
+     */
+    @Override
+    public void start() {
+        try {
+            File stdoutFile = new File(getLogPath());
+            List<String> startCmd = new ArrayList<>();
+            startCmd.add(JAVA_CMD);
+            if (!isJava11OrHigher()) {
+                LOG.error("Please make sure that the JDK is installed and the 
version >= 11");
+                return;
+            }
+            String pdNodeJarPath = getFileInDir(workPath, PD_JAR_PREFIX);
+            startCmd.addAll(
+                    Arrays.asList(
+                            "-Dname=HugeGraphPD" + this.cnt,
+                            "-Xms512m",
+                            "-Xmx4g",
+                            "-XX:+HeapDumpOnOutOfMemoryError",
+                            "-XX:HeapDumpPath=" + configPath + "logs",
+                            "-Dlog4j.configurationFile=" + configPath + 
CONF_DIR + File.separator +
+                            "log4j2.xml",
+                            "-Dspring.config.location=" + configPath + 
CONF_DIR + File.separator +
+                            "application.yml",
+                            "-jar", pdNodeJarPath));
+            FileUtils.write(
+                    stdoutFile, String.join(" ", startCmd) + "\n\n", 
StandardCharsets.UTF_8, true);
+            ProcessBuilder processBuilder =
+                    new ProcessBuilder(startCmd)
+                            
.redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile))
+                            
.redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile));

Review Comment:
   redict to log and stdio is perfect



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hugegraph.it.node;
+
+public interface BaseNodeWrapper {
+
+    void createNodeDir();

Review Comment:
   should the log dir been delete with external tools?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to