<parent>
<groupId>org.onap.dcaegen2.collectors</groupId>
<artifactId>datafile</artifactId>
- <version>1.2.2-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.collectors.datafile</groupId>
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();
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;
.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") //
assertEquals(expectedFileServerData, actualFileServerData);
}
+ @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() //
<groupId>org.onap.dcaegen2.collectors</groupId>
<artifactId>datafile</artifactId>
- <version>1.2.2-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<name>dcaegen2-collectors.datafile</name>
<description>datafile collector</description>