You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2023/01/16 15:32:11 UTC

[incubator-hugegraph-computer] branch remove-jar created (now 64ffc728)

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

jin pushed a change to branch remove-jar
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-computer.git


      at 64ffc728 chore: remove the archive jar file & download it

This branch includes the following new commits:

     new 64ffc728 chore: remove the archive jar file & download it

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-hugegraph-computer] 01/01: chore: remove the archive jar file & download it

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jin pushed a commit to branch remove-jar
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-computer.git

commit 64ffc728027adcf9259d0cd5f756f85baf4f6826
Author: imbajin <ji...@apache.org>
AuthorDate: Mon Jan 16 23:31:52 2023 +0800

    chore: remove the archive jar file & download it
---
 computer-test/conf/images/test.jar                 | Bin 1576 -> 0 bytes
 .../computer/k8s/KubernetesDriverTest.java         |  37 ++++++++++++++-------
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/computer-test/conf/images/test.jar b/computer-test/conf/images/test.jar
deleted file mode 100644
index 3b0502e8..00000000
Binary files a/computer-test/conf/images/test.jar and /dev/null differ
diff --git a/computer-test/src/main/java/org/apache/hugegraph/computer/k8s/KubernetesDriverTest.java b/computer-test/src/main/java/org/apache/hugegraph/computer/k8s/KubernetesDriverTest.java
index 8dd50535..ccaefc3f 100644
--- a/computer-test/src/main/java/org/apache/hugegraph/computer/k8s/KubernetesDriverTest.java
+++ b/computer-test/src/main/java/org/apache/hugegraph/computer/k8s/KubernetesDriverTest.java
@@ -23,6 +23,7 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -148,13 +149,14 @@ public class KubernetesDriverTest extends AbstractK8sTest {
 
     @Test
     public void testUploadAlgorithmJar() throws FileNotFoundException {
-        Whitebox.setInternalState(this.driver, "bashPath",
-                                  "conf/images/docker_push_test.sh");
-        Whitebox.setInternalState(this.driver, "registry",
-                                  "registry.hub.docker.com");
-
-        InputStream inputStream = new FileInputStream(
-                                      "conf/images/test.jar");
+        Whitebox.setInternalState(this.driver, "bashPath", "conf/images/docker_push_test.sh");
+        Whitebox.setInternalState(this.driver, "registry", "registry.hub.docker.com");
+        String url = "https://github.com/apache/hugegraph-doc/raw/" +
+                     "binary-1.0/dist/computer/test.jar";
+        String path = "conf/images/test.jar";
+        downloadFileByUrl(url, path);
+
+        InputStream inputStream = new FileInputStream(path);
         this.driver.uploadAlgorithmJar("PageRank", inputStream);
 
         File file = new File("/tmp/upload.txt");
@@ -167,12 +169,13 @@ public class KubernetesDriverTest extends AbstractK8sTest {
 
     @Test
     public void testUploadAlgorithmJarWithError() throws FileNotFoundException {
-        Whitebox.setInternalState(this.driver, "bashPath",
-                                  "conf/images/upload_test-x.sh");
-
-        InputStream inputStream = new FileInputStream(
-                                      "conf/images/test.jar");
+        Whitebox.setInternalState(this.driver, "bashPath", "conf/images/upload_test-x.sh");
+        String url = "https://github.com/apache/hugegraph-doc/raw/" +
+                     "binary-1.0/dist/computer/test.jar";
+        String path = "conf/images/test.jar";
+        downloadFileByUrl(url, path);
 
+        InputStream inputStream = new FileInputStream(path);
         Assert.assertThrows(ComputerDriverException.class, () -> {
             this.driver.uploadAlgorithmJar("PageRank", inputStream);
         }, e -> {
@@ -316,4 +319,14 @@ public class KubernetesDriverTest extends AbstractK8sTest {
             );
         });
     }
+
+    public static void downloadFileByUrl(String url, String destPath) {
+        int connectTimeout = 5000;
+        int readTimeout = 10000;
+        try {
+            FileUtils.copyURLToFile(new URL(url), new File(destPath), connectTimeout, readTimeout);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
 }