more work on FTP
This commit is contained in:
parent
f91aa8f3da
commit
434124d766
|
@ -36,7 +36,11 @@ public class FTPClient {
|
|||
protected FTPClient(String server, int port, String path, String user, String password) {
|
||||
this.server = server;
|
||||
this.port = port;
|
||||
this.path = path;
|
||||
if (path.endsWith("/")) {
|
||||
this.path = path;
|
||||
} else {
|
||||
this.path = path + "/";
|
||||
}
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
|
||||
|
@ -77,7 +81,7 @@ public class FTPClient {
|
|||
}
|
||||
|
||||
private String resolveRemotePath(String path) {
|
||||
return String.join("/", this.path, path);
|
||||
return String.join("", this.path, path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -130,6 +130,25 @@ public class FTPClientTest implements ResourceLoaderTests {
|
|||
return client;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDelete2() throws IOException {
|
||||
|
||||
FTPClient client = connectToFTPClient2();
|
||||
|
||||
String deleteFilePath = dummyFileToDeletePath.toFile().getAbsolutePath();
|
||||
assertTrue(fakeFtpServer.getFileSystem().exists(deleteFilePath));
|
||||
|
||||
client.delete( RELATIVE_PATH_2 + "/" + DUMMY_FILE_TO_DELETE);
|
||||
assertFalse(fakeFtpServer.getFileSystem().exists(deleteFilePath));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static FTPClient connectToFTPClient2() throws IOException {
|
||||
FTPClient client = new FTPClient("localhost", FAKE_FTP_PORT, RELATIVE_PATH_1, DUMMY_USER, DUMMY_PASSWORD);
|
||||
client.connect();
|
||||
return client;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpload() throws IOException {
|
||||
|
||||
|
|
Loading…
Reference in New Issue