Skip to content

Commit ec5417c

Browse files
committed
Implement multifile downloads
1 parent d70b23c commit ec5417c

1 file changed

Lines changed: 40 additions & 56 deletions

File tree

src/test/java/io/github/jpmorganchase/fusion/FusionTest.java

Lines changed: 40 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,11 @@ public void testFileDownloadInteraction() throws Exception {
231231
doNothing()
232232
.when(apiManager)
233233
.callAPIFileDownload(
234-
String.format(
235-
"%scatalogs/%s/datasets/%s/datasetseries/%s/distributions/%s?file=%s",
236-
config.getRootURL(), "common", "sample_dataset", "20230308", "csv", "file1"),
237-
String.format("%s/%s", TMP_PATH, "file1.csv"),
238-
"common",
239-
"sample_dataset",
240-
new HashMap<>());
234+
anyString(),
235+
eq(String.format("%s/%s", TMP_PATH, "file1.csv")),
236+
eq("common"),
237+
eq("sample_dataset"),
238+
eq(new HashMap<>()));
241239

242240
f.download("common", "sample_dataset", "20230308", "csv", TMP_PATH);
243241
}
@@ -255,13 +253,11 @@ public void testFileDownloadInteractionWithDefaultPath() throws Exception {
255253
doNothing()
256254
.when(apiManager)
257255
.callAPIFileDownload(
258-
String.format(
259-
"%scatalogs/%s/datasets/%s/datasetseries/%s/distributions/%s?file=%s",
260-
config.getRootURL(), "common", "sample_dataset", "20230308", "csv", "file1"),
261-
String.format("%s/%s", "downloads", "file1.csv"),
262-
"common",
263-
"sample_dataset",
264-
new HashMap<>());
256+
anyString(),
257+
eq(String.format("%s/%s", "downloads", "file1.csv")),
258+
eq("common"),
259+
eq("sample_dataset"),
260+
eq(new HashMap<>()));
265261

266262
f.download("common", "sample_dataset", "20230308", "csv");
267263
}
@@ -650,46 +646,38 @@ public void testDownloadMultipleFiles() throws Exception {
650646
doNothing()
651647
.when(apiManager)
652648
.callAPIFileDownload(
653-
String.format(
654-
"%scatalogs/%s/datasets/%s/datasetseries/%s/distributions/%s?file=%s",
655-
config.getRootURL(), "common", "sample_dataset", "20230308", "csv", "file1"),
656-
String.format("%s/%s", TMP_PATH, "file1.csv"),
657-
"common",
658-
"sample_dataset",
659-
new HashMap<>());
649+
anyString(),
650+
eq(String.format("%s/%s", TMP_PATH, "file1.csv")),
651+
eq("common"),
652+
eq("sample_dataset"),
653+
eq(new HashMap<>()));
660654

661655
doNothing()
662656
.when(apiManager)
663657
.callAPIFileDownload(
664-
String.format(
665-
"%scatalogs/%s/datasets/%s/datasetseries/%s/distributions/%s?file=%s",
666-
config.getRootURL(), "common", "sample_dataset", "20230308", "csv", "file2"),
667-
String.format("%s/%s", TMP_PATH, "file2.csv"),
668-
"common",
669-
"sample_dataset",
670-
new HashMap<>());
658+
anyString(),
659+
eq(String.format("%s/%s", TMP_PATH, "file2.csv")),
660+
eq("common"),
661+
eq("sample_dataset"),
662+
eq(new HashMap<>()));
671663

672664
f.download("common", "sample_dataset", "20230308", "csv", TMP_PATH);
673665

674666
verify(apiManager, times(1))
675667
.callAPIFileDownload(
676-
String.format(
677-
"%scatalogs/%s/datasets/%s/datasetseries/%s/distributions/%s?file=%s",
678-
config.getRootURL(), "common", "sample_dataset", "20230308", "csv", "file1"),
679-
String.format("%s/%s", TMP_PATH, "file1.csv"),
680-
"common",
681-
"sample_dataset",
682-
new HashMap<>());
668+
anyString(),
669+
eq(String.format("%s/%s", TMP_PATH, "file1.csv")),
670+
eq("common"),
671+
eq("sample_dataset"),
672+
eq(new HashMap<>()));
683673

684674
verify(apiManager, times(1))
685675
.callAPIFileDownload(
686-
String.format(
687-
"%scatalogs/%s/datasets/%s/datasetseries/%s/distributions/%s?file=%s",
688-
config.getRootURL(), "common", "sample_dataset", "20230308", "csv", "file2"),
689-
String.format("%s/%s", TMP_PATH, "file2.csv"),
690-
"common",
691-
"sample_dataset",
692-
new HashMap<>());
676+
anyString(),
677+
eq(String.format("%s/%s", TMP_PATH, "file2.csv")),
678+
eq("common"),
679+
eq("sample_dataset"),
680+
eq(new HashMap<>()));
693681
}
694682

695683
@Test
@@ -778,25 +766,21 @@ public void testDownloadWithProvidedFileList() throws Exception {
778766
doNothing()
779767
.when(apiManager)
780768
.callAPIFileDownload(
781-
String.format(
782-
"%scatalogs/%s/datasets/%s/datasetseries/%s/distributions/%s?file=%s",
783-
config.getRootURL(), "common", "sample_dataset", "20230308", "csv", "custom_file"),
784-
String.format("%s/%s", TMP_PATH, "custom_file.csv"),
785-
"common",
786-
"sample_dataset",
787-
new HashMap<>());
769+
anyString(),
770+
eq(String.format("%s/%s", TMP_PATH, "custom_file.csv")),
771+
eq("common"),
772+
eq("sample_dataset"),
773+
eq(new HashMap<>()));
788774

789775
f.download("common", "sample_dataset", "20230308", "csv", TMP_PATH, fileNames);
790776

791777
verify(apiManager, times(1))
792778
.callAPIFileDownload(
793-
String.format(
794-
"%scatalogs/%s/datasets/%s/datasetseries/%s/distributions/%s?file=%s",
795-
config.getRootURL(), "common", "sample_dataset", "20230308", "csv", "custom_file"),
796-
String.format("%s/%s", TMP_PATH, "custom_file.csv"),
797-
"common",
798-
"sample_dataset",
799-
new HashMap<>());
779+
anyString(),
780+
eq(String.format("%s/%s", TMP_PATH, "custom_file.csv")),
781+
eq("common"),
782+
eq("sample_dataset"),
783+
eq(new HashMap<>()));
800784

801785
// Verify that listDistributionFiles is NOT called when file list is provided
802786
verify(apiManager, times(0))

0 commit comments

Comments
 (0)