Skip to content

Commit 7efe0b6

Browse files
committed
[#79] Failure with recursive add with binary in sub directory
1 parent 6cd98d1 commit 7efe0b6

File tree

9 files changed

+98
-3
lines changed

9 files changed

+98
-3
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.classpath
2+
.project
3+
.settings
4+
.DS_Store
15
*.class
26
*.log
37
dist/*

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ for Maven, add the following sections to your pom.xml (replacing $LATEST_VERSION
3838
3939
<dependencies>
4040
<dependency>
41-
<groupId>com.github.ipfs</groupId>
41+
<groupId>io.ipfs</groupId>
4242
<artifactId>java-ipfs-api</artifactId>
4343
<version>$LATEST_VERSION</version>
4444
</dependency>
@@ -49,7 +49,7 @@ for Maven, add the following sections to your pom.xml (replacing $LATEST_VERSION
4949

5050
* Clone this repository
5151
* Run `ant dist`
52-
* Copy `dist/ipfs.jar` into your project. Appropriate versions of other [dependencies](#Dependencies) are also included in `dist/lib/`.
52+
* Copy `dist/ipfs.jar` into your project. Appropriate versions of other [dependencies](#dependencies) are also included in `dist/lib/`.
5353
* Run tests using `ant test`.
5454

5555
### Running tests

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>io.ipfs</groupId>
66
<artifactId>api</artifactId>
7-
<version>v1.2.0</version>
7+
<version>v1.2.1-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

1010
<name>java-ipfs-api</name>

src/test/java/io/ipfs/api/APITest.java

+2
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ public void fileContentsTest() throws IOException {
585585
}
586586

587587
@Test
588+
@Ignore("name test may hang forever")
588589
public void nameTest() throws IOException {
589590
MerkleNode pointer = new MerkleNode("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB");
590591
Map pub = ipfs.name.publish(pointer.hash);
@@ -605,6 +606,7 @@ public void mountTest() throws IOException {
605606
}
606607

607608
@Test
609+
@Ignore("dht test may hang forever")
608610
public void dhtTest() throws IOException {
609611
Multihash pointer = Multihash.fromBase58("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB");
610612
Map get = ipfs.dht.get(pointer);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.ipfs.api;
2+
3+
import java.nio.file.Path;
4+
import java.nio.file.Paths;
5+
6+
import org.junit.Assert;
7+
import org.junit.Test;
8+
9+
import io.ipfs.multiaddr.MultiAddress;
10+
11+
public class RecursiveAddTest {
12+
13+
private final IPFS ipfs = new IPFS(new MultiAddress("/ip4/127.0.0.1/tcp/5001"));
14+
15+
@Test
16+
public void testAdd() throws Exception {
17+
18+
String TEST_HASH = "QmWVMRbFTrA6pMhsfXzsyoWqmrhy5FPd4VitfX79R5bguw";
19+
20+
System.out.println("ipfs version: " + ipfs.version());
21+
22+
Path path = Paths.get("src/test/resources/html");
23+
MerkleNode node = ipfs.add(new NamedStreamable.FileWrapper(path.toFile())).get(0);
24+
Assert.assertEquals(TEST_HASH, node.hash.toBase58());
25+
}
26+
}

src/test/resources/html/README.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>IPFS</title>
5+
<meta charset="utf-8" />
6+
<link rel="stylesheet" href="./css/default.css">
7+
</head>
8+
<body>
9+
<p><img src="img/logo.png" alt="logo" /> <a href="README.html">Home</a></p>
10+
<p><a href="chap/ch01.html">chapter one</a></p>
11+
</body>
12+
</html>
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>IPFS</title>
5+
<meta charset="utf-8" />
6+
<link rel="stylesheet" href="./../css/default.css">
7+
</head>
8+
<body>
9+
<p><img src="../img/logo.png" alt="logo" /> <a href="../README.html">Home</a></p>
10+
<h2>Chapter 01</h2>
11+
<p>Yada yada</p>
12+
</body>
13+
</html>
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
body {
2+
font-family: "Verdana";
3+
color: #137cb9
4+
}
5+
6+
a {
7+
#text-decoration: none;
8+
color: #137cb9
9+
}
10+
11+
a.gray {
12+
color: gray;
13+
}
14+
15+
h1 {
16+
font-weight: normal;
17+
font-size: 20px;
18+
}
19+
20+
h2 {
21+
font-weight: normal;
22+
font-size: 15px;
23+
}
24+
25+
th {
26+
text-align: left;
27+
font-weight: normal;
28+
font-size: 14px;
29+
color: gray;
30+
}
31+
32+
td.gray {
33+
color: gray;
34+
}
35+
tr.gray {
36+
color: gray;
37+
}
38+

src/test/resources/html/img/logo.png

6.56 KB
Loading

0 commit comments

Comments
 (0)