aboutsummaryrefslogtreecommitdiffstats
path: root/datafile-app-server/src
diff options
context:
space:
mode:
authorburdziak <olaf.burdziakowski@nokia.com>2019-09-16 12:56:44 +0200
committerburdziak <olaf.burdziakowski@nokia.com>2019-09-18 15:47:56 +0200
commitf15306304a747922990eeabbedea63ae6e277149 (patch)
tree4d47c370cffbb26566c9090717c25f33b2ade774 /datafile-app-server/src
parentaf6d2dcfe0ae6534380e21d81658347da7a38d96 (diff)
Personalized client certificate authentication via FTPes in 5G Bulk PM usecase doesn't work
Issue-ID: DCAEGEN2-1754 Signed-off-by: burdziak <olaf.burdziakowski@nokia.com> Change-Id: Idec3efce8412dd175ecf75f55790a24cec651104
Diffstat (limited to 'datafile-app-server/src')
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/model/FileData.java6
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/model/FileDataTest.java27
2 files changed, 33 insertions, 0 deletions
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/model/FileData.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/model/FileData.java
index 8cafd0c4..4805cb47 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/model/FileData.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/model/FileData.java
@@ -130,6 +130,12 @@ public abstract class FileData {
String[] userAndPassword = userInfoString.split(":");
if (userAndPassword.length == 2) {
return Optional.of(userAndPassword);
+ }else if(userAndPassword.length == 1)//if just user
+ {
+ String[] tab = new String[2];
+ tab[0] = userAndPassword[0];
+ tab[1] = "";//add empty password
+ return Optional.of(tab);
}
}
return Optional.empty();
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/model/FileDataTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/model/FileDataTest.java
index 35894f9c..10a84e76 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/model/FileDataTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/model/FileDataTest.java
@@ -37,6 +37,8 @@ public class FileDataTest {
private static final int PORT_22 = 22;
private static final String LOCATION_WITH_USER =
FTPES_SCHEME + USER + ":" + PWD + "@" + SERVER_ADDRESS + ":" + PORT_22 + REMOTE_FILE_LOCATION;
+ private static final String LOCATION_WITH_USER_NO_PASSWORD =
+ FTPES_SCHEME + USER + "@" + SERVER_ADDRESS + ":" + PORT_22 + REMOTE_FILE_LOCATION;
private static final String LOCATION_WITHOUT_USER =
FTPES_SCHEME + SERVER_ADDRESS + ":" + PORT_22 + REMOTE_FILE_LOCATION;
@@ -65,6 +67,18 @@ public class FileDataTest {
.build();
}
+ private FileData properFileDataWithUserNoPassword() {
+ return ImmutableFileData.builder() //
+ .name("name") //
+ .location(LOCATION_WITH_USER_NO_PASSWORD) //
+ .compression("comp") //
+ .fileFormatType("type") //
+ .fileFormatVersion("version") //
+ .scheme(Scheme.FTPS) //
+ .messageMetaData(messageMetaData()) //
+ .build();
+ }
+
private FileData properFileDataWithoutUser() {
return ImmutableFileData.builder() //
.name("name") //
@@ -91,6 +105,19 @@ public class FileDataTest {
}
@Test
+ public void fileServerData_properLocationWithUserNoPassword() {
+ ImmutableFileServerData expectedFileServerData = ImmutableFileServerData.builder() //
+ .serverAddress(SERVER_ADDRESS) //
+ .port(PORT_22) //
+ .userId(USER) //
+ .password("") //
+ .build();
+
+ FileServerData actualFileServerData = properFileDataWithUserNoPassword().fileServerData();
+ assertEquals(expectedFileServerData, actualFileServerData);
+ }
+
+ @Test
public void fileServerData_properLocationWithoutUser() {
ImmutableFileServerData expectedFileServerData = ImmutableFileServerData.builder() //
.serverAddress(SERVER_ADDRESS) //