Skip to content

Commit 1b85b7f

Browse files
committed
Added fstat unit test
1 parent e37a8a0 commit 1b85b7f

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

src/test/java/com/nerox/client/AppTest.java

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.io.FileInputStream;
66
import java.io.FileNotFoundException;
77
import java.io.ByteArrayInputStream;
8-
import java.util.Arrays;
98

109
import com.nerox.client.keepalives.UDPKeepAlive;
1110
import com.nerox.client.security.Cryptography;
@@ -24,8 +23,14 @@ public AppTest(){
2423
String path = System.getProperty("basedir");
2524
try{
2625
FileInputStream fis = new FileInputStream(this.joinPaths(path, "src/test/files/PublicKey.pem"));
27-
this.tfprotocol = new Tfprotocol("localhost", 10345, fis,
28-
"testhash", 36, "0.0", callback);
26+
this.tfprotocol = new Tfprotocol(
27+
"localhost",
28+
10345,
29+
fis,
30+
"testhash",
31+
36,
32+
"0.0",
33+
callback);
2934
}catch(FileNotFoundException ignored){
3035
assertTrue("File not found", false);
3136
}
@@ -37,6 +42,7 @@ public AppTest(){
3742
private String normalizePath(String path){
3843
return this.normalizePath(path, "/");
3944
}
45+
4046
private String normalizePath(String path, String usingSeparator){
4147
String sep = System.getProperty("file.separator");
4248
return path.replace(usingSeparator, sep);
@@ -57,12 +63,12 @@ private String joinPaths(String ...paths){
5763
}
5864
@Test
5965
public void runAllTests(){
60-
this.tfprotocolDoesConnect();
61-
this.loginCommand();
62-
//this.setfsidCommand();
63-
//this.setfspermCommand();
64-
this.supCommand();
65-
66+
this.tfprotocolDoesConnect();
67+
//this.loginCommand();
68+
//this.setfsidCommand();
69+
//this.setfspermCommand();
70+
this.supCommand();
71+
this.statCommand();
6672
}
6773

6874
public void tfprotocolDoesConnect()
@@ -83,7 +89,15 @@ public void setfspermCommand(){
8389
}
8490

8591
public void supCommand(){
86-
ByteArrayInputStream stream = new ByteArrayInputStream(Cryptography.getRandomBytes(99));
87-
this.tfprotocol.supCommand("test", stream, 0);
92+
ByteArrayInputStream stream = new ByteArrayInputStream(Cryptography.getRandomBytes(99));
93+
assertTrue(
94+
this.tfprotocol.supCommand(
95+
"operadores/34f5e8394fced10a0df515647ed582b93b5aa7cb743ce93ec7a287b15aa63014.sd/34f5e8394fced10a0df515647ed582b93b5aa7cb743ce93ec7a287b15aa63014.json",
96+
stream,
97+
0)
98+
);
99+
}
100+
public void statCommand(){
101+
this.tfprotocol.fstatCommand("operadores/34f5e8394fced10a0df515647ed582b93b5aa7cb743ce93ec7a287b15aa63014.sd/34f5e8394fced10a0df515647ed582b93b5aa7cb743ce93ec7a287b15aa63014.json");
88102
}
89103
}

src/test/java/com/nerox/client/Callback.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public void tlbCallback(StatusInfo tlb) {
102102

103103
@Override
104104
public void supCallback(StatusInfo sup) {
105+
System.out.println("Sup Callback");
105106
this.statusServer(sup);
106107
}
107108

0 commit comments

Comments
 (0)