diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml
new file mode 100644
index 00000000..41f59c9d
--- /dev/null
+++ b/.github/workflows/ant.yml
@@ -0,0 +1,22 @@
+name: Java CI
+
+on: [push]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v1
+ - name: Set up JDK 11
+ uses: actions/setup-java@v1
+ with:
+ java-version: 11
+ - name: Install and run ipfs
+ run: ./install-run-ipfs.sh
+ - name: Build with Ant
+ run: ant -noinput -buildfile build.xml dist
+ - name: Run tests
+ timeout-minutes: 10
+ run: ant -noinput -buildfile build.xml test
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index aa6cdc8f..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: java
-jdk:
- - oraclejdk8
-before_script:
- - wget https://dist.ipfs.io/go-ipfs/v0.4.16/go-ipfs_v0.4.16_linux-amd64.tar.gz -O /tmp/go-ipfs_linux-amd64.tar.gz
- - tar -xvf /tmp/go-ipfs_linux-amd64.tar.gz
- - export PATH=$PATH:$PWD/go-ipfs/
- - ipfs init
- - ipfs daemon --enable-pubsub-experiment &
-script:
- - mvn clean verify
diff --git a/build.xml b/build.xml
index 71df3a6e..457962cc 100644
--- a/build.xml
+++ b/build.xml
@@ -40,26 +40,29 @@
-
+
-
+
-
+
-
-
-
+
+
+
-
+
+
+
+
diff --git a/docker-compose.yml b/docker-compose.yml
index c721af0e..55e521e1 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,7 +1,7 @@
version: '2'
services:
ipfs-daemon:
- image: 'ipfs/go-ipfs:v0.4.16'
+ image: 'ipfs/go-ipfs:v0.6.0'
ports:
- "4001:4001"
- "5001:5001"
diff --git a/install-run-ipfs.sh b/install-run-ipfs.sh
new file mode 100755
index 00000000..0a17de7a
--- /dev/null
+++ b/install-run-ipfs.sh
@@ -0,0 +1,6 @@
+#! /bin/sh
+wget https://dist.ipfs.io/go-ipfs/v0.6.0/go-ipfs_v0.6.0_linux-amd64.tar.gz -O /tmp/go-ipfs_linux-amd64.tar.gz
+tar -xvf /tmp/go-ipfs_linux-amd64.tar.gz
+export PATH=$PATH:$PWD/go-ipfs/
+ipfs init
+ipfs daemon --enable-pubsub-experiment --routing=dhtclient &
diff --git a/lib/cid.jar b/lib/cid.jar
index 675b8cd9..71caf698 100644
Binary files a/lib/cid.jar and b/lib/cid.jar differ
diff --git a/lib/multiaddr.jar b/lib/multiaddr.jar
index 1370bbbc..c8ff06eb 100644
Binary files a/lib/multiaddr.jar and b/lib/multiaddr.jar differ
diff --git a/lib/multibase.jar b/lib/multibase.jar
index 8aeceb09..234da675 100644
Binary files a/lib/multibase.jar and b/lib/multibase.jar differ
diff --git a/lib/multihash.jar b/lib/multihash.jar
index d4787eee..bb0cf54f 100644
Binary files a/lib/multihash.jar and b/lib/multihash.jar differ
diff --git a/pom.xml b/pom.xml
index 73ecd7e0..55396cb1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.github.ipfs
java-ipfs-http-client
- v1.2.3
+ v1.3.0
jar
java-ipfs-http-client
@@ -34,7 +34,7 @@
UTF-8
4.12
1.3
- v1.3.1
+ v1.4.1
diff --git a/print_test_errors.sh b/print_test_errors.sh
new file mode 100755
index 00000000..b81620ad
--- /dev/null
+++ b/print_test_errors.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+#
+# Read junit test-reports and print a summary of the error-cases, including the stack trace.
+# Will exit with status 1 if there are any errors, otherwise exit status 0.
+#
+# By default will scan all files in "./test.reports".
+#
+# Usage "./print_test_errors.sh
+#
+awk '/<(failure|error)/,/\/(failure|error)/ {print prev; has_err=1} {prev=$0} END {exit has_err}' ${1:-test.reports/*}
diff --git a/src/main/java/io/ipfs/api/IPFS.java b/src/main/java/io/ipfs/api/IPFS.java
index 8c638e39..dbe46dc4 100755
--- a/src/main/java/io/ipfs/api/IPFS.java
+++ b/src/main/java/io/ipfs/api/IPFS.java
@@ -18,13 +18,15 @@ public class IPFS {
public enum PinType {all, direct, indirect, recursive}
public List ObjectTemplates = Arrays.asList("unixfs-dir");
public List ObjectPatchTypes = Arrays.asList("add-link", "rm-link", "set-data", "append-data");
- private static final int DEFAULT_TIMEOUT = 0;
+ private static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 10_000;
+ private static final int DEFAULT_READ_TIMEOUT_MILLIS = 60_000;
public final String host;
public final int port;
public final String protocol;
private final String version;
- private int timeout = DEFAULT_TIMEOUT;
+ private final int connectTimeoutMillis;
+ private final int readTimeoutMillis;
public final Key key = new Key();
public final Pin pin = new Pin();
public final Repo repo = new Repo();
@@ -56,10 +58,18 @@ public IPFS(MultiAddress addr) {
}
public IPFS(String host, int port, String version, boolean ssl) {
+ this(host, port, version, DEFAULT_CONNECT_TIMEOUT_MILLIS, DEFAULT_READ_TIMEOUT_MILLIS, ssl);
+ }
+
+ public IPFS(String host, int port, String version, int connectTimeoutMillis, int readTimeoutMillis, boolean ssl) {
+ if (connectTimeoutMillis < 0) throw new IllegalArgumentException("connect timeout must be zero or positive");
+ if (readTimeoutMillis < 0) throw new IllegalArgumentException("read timeout must be zero or positive");
this.host = host;
this.port = port;
+ this.connectTimeoutMillis = connectTimeoutMillis;
+ this.readTimeoutMillis = readTimeoutMillis;
- if(ssl) {
+ if (ssl) {
this.protocol = "https";
} else {
this.protocol = "http";
@@ -82,9 +92,7 @@ public IPFS(String host, int port, String version, boolean ssl) {
* @return current IPFS object with configured timeout
*/
public IPFS timeout(int timeout) {
- if(timeout < 0) throw new IllegalArgumentException("timeout must be zero or positive");
- this.timeout = timeout;
- return this;
+ return new IPFS(host, port, version, connectTimeoutMillis, readTimeoutMillis, protocol.equals("https"));
}
public List add(NamedStreamable file) throws IOException {
@@ -206,10 +214,10 @@ public List rm(Multihash hash, boolean recursive) throws IOException
return ((List