-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MARP-434 Authentication SSH & Multi connection (#39)
* MARP-434 auth by ssh keypair & adapt multi sftp connection
- Loading branch information
Showing
22 changed files
with
598 additions
and
193 deletions.
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
6 changes: 6 additions & 0 deletions
6
sftp-connector-demo/src/com/axonivy/connector/sftp/demo/Constants.java
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,6 @@ | ||
package com.axonivy.connector.sftp.demo; | ||
|
||
public class Constants { | ||
public static final String TEST_SFTP_SERVER_NAME = "dummy"; | ||
|
||
} |
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
2 changes: 2 additions & 0 deletions
2
...or-demo/src_hd/com/axonivy/connector/sftp/demo/SftpClientDemo/SftpClientDemoData.ivyClass
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
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
Binary file modified
BIN
+12 KB
(200%)
sftp-connector-product/images/RebexTinySftpServer.exe.config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions
34
sftp-connector-test/src_test/com/axonivy/connector/sftp/test/BaseTest.java
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,34 @@ | ||
package com.axonivy.connector.sftp.test; | ||
|
||
import ch.ivyteam.ivy.bpm.engine.client.element.BpmProcess; | ||
import ch.ivyteam.ivy.environment.Ivy; | ||
import ch.ivyteam.ivy.environment.IvyTest; | ||
|
||
@IvyTest | ||
public class BaseTest { | ||
protected static final String TEST_SFTP_SERVER_NAME = "dummy"; | ||
protected static final String TEST_SFTP_SSH_SERVER_NAME = "dummy_ssh"; | ||
|
||
protected static final BpmProcess TEST_HELPER_PROCESS = BpmProcess.path("Sftp/SftpHelper"); | ||
protected static final BpmProcess TEST_UPLOAD_FILE_PROCESS = BpmProcess.path("Sftp/SftpUploadFile"); | ||
protected static final BpmProcess TEST_DOWNLOAD_FILE_PROCESS = BpmProcess.path("Sftp/SftpDownloadFile"); | ||
|
||
protected static final String PREFIX = "com.axonivy.connector.sftp.server"; | ||
protected static final String TEST_FILE_NAME = "market_market_connector_sftp.pdf"; | ||
protected static final long TEST_FILE_SIZE = 207569L; | ||
|
||
protected static void setVarForSFTPName(String sftpServerName, String username, String auth, String password, String sshKeyFilePath, String sshpassphrase) { | ||
setVar(sftpServerName, "host", "localhost"); | ||
setVar(sftpServerName, "username", username); | ||
setVar(sftpServerName, "port", "22"); | ||
setVar(sftpServerName, "auth", auth); | ||
setVar(sftpServerName, "password", password); | ||
setVar(sftpServerName, "sshkeyFilePath", sshKeyFilePath); | ||
setVar(sftpServerName, "sshPassphraseSecret", sshpassphrase); | ||
} | ||
|
||
private static void setVar(String sftpServerName, String var, String value) { | ||
Ivy.var().set(String.format("%s.%s.%s", PREFIX, sftpServerName, var), value); | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
sftp-connector-test/src_test/com/axonivy/connector/sftp/test/SftpMultiConnectionTest.java
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,42 @@ | ||
package com.axonivy.connector.sftp.test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.IOException; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import com.axonivy.connector.sftp.service.SftpClientService; | ||
|
||
import ch.ivyteam.ivy.bpm.engine.client.BpmClient; | ||
import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; | ||
|
||
|
||
/** | ||
* This SftpMultiConnectionTest creates 2 sFTP connections | ||
*/ | ||
@IvyProcessTest(enableWebServer = true) | ||
public class SftpMultiConnectionTest extends BaseTest { | ||
|
||
private static final String SFTP_NAME = "dummy"; | ||
private static final String SFTP_SSH_NAME = "dummy_ssh"; | ||
|
||
@BeforeEach | ||
public void preInit() throws Exception { | ||
setVarForSFTPName(TEST_SFTP_SERVER_NAME, "usr", "password", "pwd", "", ""); | ||
String keyPath = SftpProcessSSHTest.class.getResource("sftptest").getPath(); | ||
setVarForSFTPName(TEST_SFTP_SSH_SERVER_NAME, "usr2ssh", "ssh", "", keyPath, "123456"); | ||
} | ||
|
||
@Test | ||
public void callOpenConnection(BpmClient bpmClient) throws IOException { | ||
SftpClientService sftpClient = new SftpClientService(SFTP_NAME); | ||
SftpClientService sftpSSHClient = new SftpClientService(SFTP_SSH_NAME); | ||
|
||
assertThat(sftpClient).isNotNull(); | ||
assertThat(sftpSSHClient).isNotNull(); | ||
sftpClient.close(); | ||
sftpSSHClient.close(); | ||
} | ||
} |
Oops, something went wrong.