-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marlon Rubio de Carvalho Franco
committed
Sep 4, 2019
1 parent
6c0163a
commit 5ec169f
Showing
5 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ void write() { | |
} | ||
} | ||
|
||
@Test | ||
@Test | ||
void copyFileTo() { | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package tests; | ||
|
||
import com.marlonrcfranco.IJcon; | ||
import com.marlonrcfranco.Jcon; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Arrays; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class JconTest { | ||
|
||
private Jcon jcon; | ||
private String response; | ||
private String ip; | ||
private String user; | ||
private String password; | ||
private IJcon.types type; | ||
private String basePath; | ||
private String remoteFilePath= "/Teste/arquivo123.xml"; | ||
private String remoteImagePath= "/Teste/images.png"; | ||
private String remotePDFPath= "/Teste/images.png"; | ||
private String localFilePath= "/Teste/images.png"; | ||
private String localImagePath= "/Teste/images.png"; | ||
private String localPDFPath= "C:\\Users\\marlon.franco\\Documents\\DOUX - Agosto.pdf"; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
ip = "192.168.35.17"; | ||
user = "Adapcon"; | ||
password = "1nfr4#2017"; | ||
type = IJcon.types.SMB23; | ||
basePath = "Marlon"; | ||
this.jcon = new Jcon(type); | ||
this.response=""; | ||
} | ||
@Test | ||
void read() { | ||
} | ||
|
||
@Test | ||
void write() { | ||
String localBasePath = "C:\\Users\\marlon.franco\\"; | ||
try { | ||
|
||
/** Test with txt file*/ | ||
byte[] TextContent = new Jcon(IJcon.types.FILESYSTEM).readBytes("",localBasePath+"Documents\\teste.txt","",""); | ||
this.response = new String(new Jcon(IJcon.types.SMB23).writeBytes(ip,basePath+"/Teste/text.txt",user,password,TextContent)); | ||
System.out.println(response); | ||
// read to check if it was written correctly | ||
byte[] TextContent2 = (new Jcon(IJcon.types.SMB23).readBytes(ip,basePath+"/Teste/text.txt",user,password)); | ||
assert Arrays.equals(TextContent, TextContent2); | ||
|
||
/** Test with PDF file*/ | ||
byte[] PDFcontent = new Jcon(IJcon.types.FILESYSTEM).readBytes("",localBasePath+"Documents\\DOUX - Agosto.pdf","",""); | ||
this.response = new String(new Jcon(IJcon.types.SMB23).writeBytes(ip,basePath+"/Teste/arquivo.pdf",user,password,PDFcontent)); | ||
System.out.println(response); | ||
// read to check if it was written correctly | ||
byte[] PDFcontent2 = (new Jcon(IJcon.types.SMB23).readBytes(ip,basePath+"/Teste/arquivo.pdf",user,password)); | ||
assert Arrays.equals(PDFcontent, PDFcontent2); | ||
|
||
/** Test with png file*/ | ||
byte[] ImageContent = new Jcon(IJcon.types.FILESYSTEM).readBytes("",localBasePath+"Documents\\images.png","",""); | ||
this.response = new String(new Jcon(IJcon.types.SMB23).writeBytes(ip,basePath+"/Teste/imageCopy.png",user,password,ImageContent)); | ||
System.out.println(response); | ||
// read to check if it was written correctly | ||
byte[] ImageContent2 = (new Jcon(IJcon.types.SMB23).readBytes(ip,basePath+"/Teste/imageCopy.png",user,password)); | ||
assert Arrays.equals(ImageContent, ImageContent2); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.