summaryrefslogtreecommitdiffstats
path: root/datafile-app-server/src/test/java
diff options
context:
space:
mode:
authorburdziak <olaf.burdziakowski@nokia.com>2019-10-16 15:21:59 +0200
committerburdziak <olaf.burdziakowski@nokia.com>2019-10-16 15:21:59 +0200
commitd063203fe3379ff84059c1cf98b67faa75183465 (patch)
treeb4807ab0fb3f7e1f8301e2b5600fcd6ec048d168 /datafile-app-server/src/test/java
parent23b56c6b8fc256e5a070cfefe31c90b1fbe46bce (diff)
DataFileCollector use wrong KeyManagerFactory
Issue-ID: DCAEGEN2-1854 Signed-off-by: burdziak <olaf.burdziakowski@nokia.com> Change-Id: I71c7526097014e10d0ef091e38a929b81ba1f627
Diffstat (limited to 'datafile-app-server/src/test/java')
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpsClientTest.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpsClientTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpsClientTest.java
index a747701a..11a428bc 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpsClientTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpsClientTest.java
@@ -75,7 +75,7 @@ public class FtpsClientTest {
@BeforeEach
protected void setUp() throws Exception {
- clientUnderTestSpy = spy(new FtpsClient(createFileServerData(), FTP_KEY_PATH, FTP_KEY_PASSWORD, TRUSTED_CA_PATH,
+ clientUnderTestSpy = spy(new FtpsClient(createFileServerData(), Paths.get(FTP_KEY_PATH), FTP_KEY_PASSWORD, TRUSTED_CA_PATH,
TRUSTED_CA_PASSWORD));
clientUnderTestSpy.realFtpsClient = ftpsClientMock;
}
@@ -101,7 +101,7 @@ public class FtpsClientTest {
@Test
public void collectFile_allOk() throws Exception {
- doReturn(keyManagerMock).when(clientUnderTestSpy).createKeyManager(FTP_KEY_PATH, FTP_KEY_PASSWORD);
+ doReturn(keyManagerMock).when(clientUnderTestSpy).getKeyManager(Paths.get(FTP_KEY_PATH), FTP_KEY_PASSWORD);
doReturn(trustManagerMock).when(clientUnderTestSpy).getTrustManager(TRUSTED_CA_PATH, TRUSTED_CA_PASSWORD);
doReturn(outputStreamMock).when(clientUnderTestSpy).createOutputStream(LOCAL_FILE_PATH);
doReturn(true).when(ftpsClientMock).login(USERNAME, PASSWORD);
@@ -141,7 +141,7 @@ public class FtpsClientTest {
@Test
public void collectFileFaultTrustedCA_shouldFail_no_trustedCA_file() throws Exception {
- doReturn(keyManagerMock).when(clientUnderTestSpy).createKeyManager(FTP_KEY_PATH, FTP_KEY_PASSWORD);
+ doReturn(keyManagerMock).when(clientUnderTestSpy).getKeyManager(Paths.get(FTP_KEY_PATH), FTP_KEY_PASSWORD);
doThrow(new IOException("problem")).when(clientUnderTestSpy).createInputStream(TRUSTED_CA_PATH);
assertThatThrownBy(() -> clientUnderTestSpy.open())
@@ -151,7 +151,7 @@ public class FtpsClientTest {
@Test
public void collectFileFaultTrustedCA_shouldFail_empty_trustedCA_file() throws Exception {
- doReturn(keyManagerMock).when(clientUnderTestSpy).createKeyManager(FTP_KEY_PATH, FTP_KEY_PASSWORD);
+ doReturn(keyManagerMock).when(clientUnderTestSpy).getKeyManager(Paths.get(FTP_KEY_PATH), FTP_KEY_PASSWORD);
doReturn(inputStreamMock).when(clientUnderTestSpy).createInputStream(TRUSTED_CA_PATH);
assertThatThrownBy(() -> clientUnderTestSpy.open())
@@ -161,7 +161,7 @@ public class FtpsClientTest {
@Test
public void collectFileFaultyLogin_shouldFail() throws Exception {
- doReturn(keyManagerMock).when(clientUnderTestSpy).createKeyManager(FTP_KEY_PATH, FTP_KEY_PASSWORD);
+ doReturn(keyManagerMock).when(clientUnderTestSpy).getKeyManager(Paths.get(FTP_KEY_PATH), FTP_KEY_PASSWORD);
doReturn(trustManagerMock).when(clientUnderTestSpy).getTrustManager(TRUSTED_CA_PATH, TRUSTED_CA_PASSWORD);
doReturn(outputStreamMock).when(clientUnderTestSpy).createOutputStream(LOCAL_FILE_PATH);
doReturn(false).when(ftpsClientMock).login(USERNAME, PASSWORD);
@@ -177,7 +177,7 @@ public class FtpsClientTest {
@Test
public void collectFileBadRequestResponse_shouldFail() throws Exception {
- doReturn(keyManagerMock).when(clientUnderTestSpy).createKeyManager(FTP_KEY_PATH, FTP_KEY_PASSWORD);
+ doReturn(keyManagerMock).when(clientUnderTestSpy).getKeyManager(Paths.get(FTP_KEY_PATH), FTP_KEY_PASSWORD);
doReturn(trustManagerMock).when(clientUnderTestSpy).getTrustManager(TRUSTED_CA_PATH, TRUSTED_CA_PASSWORD);
doReturn(outputStreamMock).when(clientUnderTestSpy).createOutputStream(LOCAL_FILE_PATH);
doReturn(true).when(ftpsClientMock).login(USERNAME, PASSWORD);
@@ -197,7 +197,7 @@ public class FtpsClientTest {
@Test
public void collectFile_shouldFail() throws Exception {
- doReturn(keyManagerMock).when(clientUnderTestSpy).createKeyManager(FTP_KEY_PATH, FTP_KEY_PASSWORD);
+ doReturn(keyManagerMock).when(clientUnderTestSpy).getKeyManager(Paths.get(FTP_KEY_PATH), FTP_KEY_PASSWORD);
doReturn(trustManagerMock).when(clientUnderTestSpy).getTrustManager(TRUSTED_CA_PATH, TRUSTED_CA_PASSWORD);
doReturn(outputStreamMock).when(clientUnderTestSpy).createOutputStream(LOCAL_FILE_PATH);
doReturn(true).when(ftpsClientMock).login(USERNAME, PASSWORD);
@@ -216,7 +216,7 @@ public class FtpsClientTest {
@Test
public void collectFile_shouldFail_ioexception() throws Exception {
- doReturn(keyManagerMock).when(clientUnderTestSpy).createKeyManager(FTP_KEY_PATH, FTP_KEY_PASSWORD);
+ doReturn(keyManagerMock).when(clientUnderTestSpy).getKeyManager(Paths.get(FTP_KEY_PATH), FTP_KEY_PASSWORD);
doReturn(trustManagerMock).when(clientUnderTestSpy).getTrustManager(TRUSTED_CA_PATH, TRUSTED_CA_PASSWORD);
doReturn(outputStreamMock).when(clientUnderTestSpy).createOutputStream(LOCAL_FILE_PATH);
doReturn(true).when(ftpsClientMock).login(USERNAME, PASSWORD);