summaryrefslogtreecommitdiffstats
path: root/filedistribution
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2021-12-13 12:01:09 +0100
committerHarald Musum <musum@yahooinc.com>2021-12-13 12:01:09 +0100
commit05d0ca3c8f0b6d91adf358d1de41cdedc9bf1c90 (patch)
tree472ab7a36153d1d48770de5cae0bf1c7c977bd70 /filedistribution
parent49dd2469b58193513332f5e93133f882eea87001 (diff)
Simplify and reorder arguments, no functional changes
Diffstat (limited to 'filedistribution')
-rw-r--r--filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java8
-rw-r--r--filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java6
2 files changed, 5 insertions, 9 deletions
diff --git a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java
index 796f6ad2ebf..8d6f428eaef 100644
--- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java
+++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownload.java
@@ -18,15 +18,11 @@ public class FileReferenceDownload {
private final boolean downloadFromOtherSourceIfNotFound;
private final String client;
- public FileReferenceDownload(FileReference fileReference) {
- this(fileReference, true, "unknown");
- }
-
public FileReferenceDownload(FileReference fileReference, String client) {
- this(fileReference, true, client);
+ this(fileReference, client, true);
}
- public FileReferenceDownload(FileReference fileReference, boolean downloadFromOtherSourceIfNotFound, String client) {
+ public FileReferenceDownload(FileReference fileReference, String client, boolean downloadFromOtherSourceIfNotFound) {
Objects.requireNonNull(fileReference, "file reference cannot be null");
this.fileReference = fileReference;
this.future = new CompletableFuture<>();
diff --git a/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java b/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java
index 3655285efbe..e8bd63fc083 100644
--- a/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java
+++ b/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java
@@ -207,7 +207,7 @@ public class FileDownloaderTest {
FileReference fileReference = new FileReference("fileReference123");
File fileReferenceFullPath = fileReferenceFullPath(downloadDir, fileReference);
- FileReferenceDownload fileReferenceDownload = new FileReferenceDownload(fileReference);
+ FileReferenceDownload fileReferenceDownload = new FileReferenceDownload(fileReference, "test");
Future<Future<Optional<File>>> future1 = executor.submit(() -> fileDownloader.getFutureFile(fileReferenceDownload));
do {
@@ -242,13 +242,13 @@ public class FileDownloaderTest {
FileDownloader fileDownloader = new FileDownloader(connectionPool, supervisor, downloadDir, timeout, sleepBetweenRetries);
FileReference xyzzy = new FileReference("xyzzy");
// Should download since we do not have the file on disk
- fileDownloader.downloadIfNeeded(new FileReferenceDownload(xyzzy));
+ fileDownloader.downloadIfNeeded(new FileReferenceDownload(xyzzy, "test"));
assertTrue(fileDownloader.isDownloading(xyzzy));
assertFalse(getFile(xyzzy).isPresent());
// Receive files to simulate download
receiveFile(xyzzy, "xyzzy.jar", FileReferenceData.Type.file, "content");
// Should not download, since file has already been downloaded
- fileDownloader.downloadIfNeeded(new FileReferenceDownload(xyzzy));
+ fileDownloader.downloadIfNeeded(new FileReferenceDownload(xyzzy, "test"));
// and file should be available
assertTrue(getFile(xyzzy).isPresent());
}