@Test public void testExceptionsDuringAttachmentDownloadAreHandled() { Set<SW360SparseAttachment> sourceAttachments = createAttachments(1, 2); SW360SparseAttachment failedAttachment = createAttachment(1, 42); Set<SW360SparseAttachment> attachments = new HashSet<>(sourceAttachments); attachments.add(failedAttachment); SW360Release release = createReleaseWithAttachments(1, attachments); ReleaseWithSources releaseWithSources = createReleaseWithSources(release, sourceAttachments); expectDownloads(release, sourceAttachments); when(releaseAdapter.processAttachment(eq(release), eq(failedAttachment.getAttachmentId()), any())) .thenReturn(failedFuture(new IOException("Download failed"))); Collection<ReleaseWithSources> result = sourcesExporter.downloadSources(releaseAdapter, Collections.singleton(release)); assertThat(result).containsOnly(releaseWithSources); }
public Collection<ReleaseWithSources> downloadSources(SW360ReleaseClientAdapterAsync releaseAdapter, Collection<SW360Release> releases) { List<CompletableFuture<ReleaseWithSources>> downloadFutures = releases.stream() .map(release -> downloadSourcesForRelease(releaseAdapter, release)) .collect(Collectors.toList()); return FutureUtils.sequence(downloadFutures, ex -> false).join(); }
SourcesExporter { public Collection<ReleaseWithSources> downloadSources(SW360ReleaseClientAdapterAsync releaseAdapter, Collection<SW360Release> releases) { List<CompletableFuture<ReleaseWithSources>> downloadFutures = releases.stream() .map(release -> downloadSourcesForRelease(releaseAdapter, release)) .collect(Collectors.toList()); return FutureUtils.sequence(downloadFutures, ex -> false).join(); } }
SourcesExporter { public Collection<ReleaseWithSources> downloadSources(SW360ReleaseClientAdapterAsync releaseAdapter, Collection<SW360Release> releases) { List<CompletableFuture<ReleaseWithSources>> downloadFutures = releases.stream() .map(release -> downloadSourcesForRelease(releaseAdapter, release)) .collect(Collectors.toList()); return FutureUtils.sequence(downloadFutures, ex -> false).join(); } SourcesExporter(Path sourcePath); }
SourcesExporter { public Collection<ReleaseWithSources> downloadSources(SW360ReleaseClientAdapterAsync releaseAdapter, Collection<SW360Release> releases) { List<CompletableFuture<ReleaseWithSources>> downloadFutures = releases.stream() .map(release -> downloadSourcesForRelease(releaseAdapter, release)) .collect(Collectors.toList()); return FutureUtils.sequence(downloadFutures, ex -> false).join(); } SourcesExporter(Path sourcePath); Collection<ReleaseWithSources> downloadSources(SW360ReleaseClientAdapterAsync releaseAdapter,
                                                          Collection<SW360Release> releases); void removeUnreferencedFiles(Collection<ReleaseWithSources> releases); }
SourcesExporter { public Collection<ReleaseWithSources> downloadSources(SW360ReleaseClientAdapterAsync releaseAdapter, Collection<SW360Release> releases) { List<CompletableFuture<ReleaseWithSources>> downloadFutures = releases.stream() .map(release -> downloadSourcesForRelease(releaseAdapter, release)) .collect(Collectors.toList()); return FutureUtils.sequence(downloadFutures, ex -> false).join(); } SourcesExporter(Path sourcePath); Collection<ReleaseWithSources> downloadSources(SW360ReleaseClientAdapterAsync releaseAdapter,
                                                          Collection<SW360Release> releases); void removeUnreferencedFiles(Collection<ReleaseWithSources> releases);  }