pull/22110/head
Madhura Bhave 4 years ago
parent 6d93d732b4
commit 9d9a90ccd4

@ -73,11 +73,11 @@ public class BintrayService {
this.restTemplate = builder.build(); this.restTemplate = builder.build();
} }
public boolean isDistributionComplete(ReleaseInfo releaseInfo, Set<String> requiredDigets, Duration timeout) { public boolean isDistributionComplete(ReleaseInfo releaseInfo, Set<String> requiredDigests, Duration timeout) {
return isDistributionComplete(releaseInfo, requiredDigets, timeout, Duration.ofSeconds(20)); return isDistributionComplete(releaseInfo, requiredDigests, timeout, Duration.ofSeconds(20));
} }
public boolean isDistributionComplete(ReleaseInfo releaseInfo, Set<String> requiredDigets, Duration timeout, public boolean isDistributionComplete(ReleaseInfo releaseInfo, Set<String> requiredDigests, Duration timeout,
Duration pollInterval) { Duration pollInterval) {
logger.debug("Checking if distribution is complete"); logger.debug("Checking if distribution is complete");
RequestEntity<Void> request = getRequest(releaseInfo, 0); RequestEntity<Void> request = getRequest(releaseInfo, 0);
@ -85,7 +85,7 @@ public class BintrayService {
waitAtMost(timeout).with().pollDelay(Duration.ZERO).pollInterval(pollInterval).until(() -> { waitAtMost(timeout).with().pollDelay(Duration.ZERO).pollInterval(pollInterval).until(() -> {
logger.debug("Checking bintray"); logger.debug("Checking bintray");
PackageFile[] published = this.restTemplate.exchange(request, PackageFile[].class).getBody(); PackageFile[] published = this.restTemplate.exchange(request, PackageFile[].class).getBody();
return hasPublishedAll(published, requiredDigets); return hasPublishedAll(published, requiredDigests);
}); });
} }
catch (ConditionTimeoutException ex) { catch (ConditionTimeoutException ex) {
@ -95,12 +95,12 @@ public class BintrayService {
return true; return true;
} }
private boolean hasPublishedAll(PackageFile[] published, Set<String> requiredDigets) { private boolean hasPublishedAll(PackageFile[] published, Set<String> requiredDigests) {
if (published == null || published.length == 0) { if (published == null || published.length == 0) {
logger.debug("Bintray returned no published files"); logger.debug("Bintray returned no published files");
return false; return false;
} }
Set<String> remaining = new HashSet<>(requiredDigets); Set<String> remaining = new HashSet<>(requiredDigests);
for (PackageFile publishedFile : published) { for (PackageFile publishedFile : published) {
logger.debug( logger.debug(
"Found published file " + publishedFile.getName() + " with digest " + publishedFile.getSha256()); "Found published file " + publishedFile.getName() + " with digest " + publishedFile.getSha256());

Loading…
Cancel
Save