Changeing the imagename
Enabling the possiblity to use trust store again.
Preventing mutiple downloads of files using ftpes.
Change-Id: I7bfb097a70334af2bae4e3374f060427195bad19
diff --git a/datafile/datafile-app-server/pom.xml b/datafile/datafile-app-server/pom.xml
index 15b0e09..21849f4 100644
--- a/datafile/datafile-app-server/pom.xml
+++ b/datafile/datafile-app-server/pom.xml
@@ -248,7 +248,7 @@
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<serverId>${onap.nexus.dockerregistry.daily}</serverId>
- <imageName>${onap.nexus.dockerregistry.daily}/${docker.image.name}</imageName>
+ <imageName>${docker.image.name}</imageName>
<imageTags>
<imageTag>${project.version}-${maven.build.timestamp}Z</imageTag>
<imageTag>${project.version}</imageTag>
@@ -292,4 +292,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpesClient.java b/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpesClient.java
index 2817368..183e1d7 100644
--- a/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpesClient.java
+++ b/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/ftp/FtpesClient.java
@@ -183,10 +183,11 @@
return realResource.getInputStream();
}
- protected OutputStream createOutputStream(Path localFileName) throws IOException {
+ protected OutputStream createOutputStream(Path localFileName) throws IOException, DatafileTaskException {
File localFile = localFileName.toFile();
if (!localFile.createNewFile()) {
- logger.warn("Local file {} already created", localFileName);
+ logger.debug("Local file {} already created", localFileName);
+ throw new NonRetryableDatafileTaskException("Local file already created: " + localFileName);
}
OutputStream output = new FileOutputStream(localFile);
logger.trace("File {} opened xNF", localFileName);
diff --git a/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/http/DfcHttpsClient.java b/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/http/DfcHttpsClient.java
index 910897b..8c04d68 100644
--- a/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/http/DfcHttpsClient.java
+++ b/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/http/DfcHttpsClient.java
@@ -25,7 +25,6 @@
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLPeerUnverifiedException;
-import org.apache.commons.io.FileUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
@@ -173,7 +172,6 @@
}
protected long writeFile(Path localFile, InputStream stream) throws IOException {
- FileUtils.forceMkdirParent(localFile.toFile());
return Files.copy(stream, localFile, StandardCopyOption.REPLACE_EXISTING);
}
diff --git a/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java b/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java
index a50b7ca..32b274f 100644
--- a/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java
+++ b/datafile/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollector.java
@@ -23,6 +23,7 @@
import java.util.Map;
import java.util.Optional;
+import org.apache.commons.io.FileUtils;
import org.onap.dcaegen2.collectors.datafile.commons.FileCollectClient;
import org.onap.dcaegen2.collectors.datafile.commons.Scheme;
import org.onap.dcaegen2.collectors.datafile.configuration.AppConfig;
@@ -114,7 +115,7 @@
try (FileCollectClient currentClient = createClient(fileData)) {
currentClient.open();
- localFile.getParent().toFile().mkdir(); // Create parent directories
+ FileUtils.forceMkdirParent(localFile.toFile());
currentClient.collectFile(remoteFile, localFile);
counters.incNoOfCollectedFiles();
return Mono.just(Optional.of(createFilePublishInformation(fileData)));
diff --git a/datafile/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/MockDatafile.java b/datafile/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/MockDatafile.java
index 6061269..a87a1c4 100644
--- a/datafile/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/MockDatafile.java
+++ b/datafile/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/MockDatafile.java
@@ -59,10 +59,9 @@
"app.ssl.key-store=./config/ftps_keystore.p12", //
"app.ssl.trust-store-password-file=./config/truststore.pass", //
"app.ssl.trust-store=", // No trust validation
+ "app.collected-files-path=/tmp/osc_datafile/", //
"logging.file.name=/tmp/datafile.log", //
- "spring.main.allow-bean-definition-overriding=true"
- // "app.webclient.trust-store=./datafile-app-server/config/truststore.jks", //
-
+ "spring.main.allow-bean-definition-overriding=true" //
})
@SuppressWarnings("squid:S3577") // Not containing any tests since it is a mock.
class MockDatafile {
@@ -73,7 +72,7 @@
private static final String TIME_ZONE_OFFSET = "UTC+05:00";
private static final String PM_FILE_NAME = "PM_FILE_NAME";
- // This can be any downloadable file on the new
+ // This can be any downloadable file on the net
private static final String LOCATION =
"https://launchpad.net/ubuntu/+source/perf-tools-unstable/1.0+git7ffb3fd-1ubuntu1/+build/13630748/+files/perf-tools-unstable_1.0+git7ffb3fd-1ubuntu1_all.deb";
private static final String GZIP_COMPRESSION = "gzip";