Polish logging in BintrayService

This commit is contained in:
Andy Wilkinson 2020-09-17 09:44:40 +01:00
parent cb4eb929f6
commit dbd27839e5

View File

@ -78,7 +78,7 @@ public class BintrayService {
logger.debug("Checking if distribution is started"); logger.debug("Checking if distribution is started");
RequestEntity<Void> request = getPackageFilesRequest(releaseInfo, 1); RequestEntity<Void> request = getPackageFilesRequest(releaseInfo, 1);
try { try {
logger.debug("Checking bintray"); logger.debug("Checking Bintray");
this.restTemplate.exchange(request, PackageFile[].class).getBody(); this.restTemplate.exchange(request, PackageFile[].class).getBody();
return true; return true;
} }
@ -100,7 +100,7 @@ public class BintrayService {
RequestEntity<Void> request = getPackageFilesRequest(releaseInfo, 0); RequestEntity<Void> request = getPackageFilesRequest(releaseInfo, 0);
try { try {
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");
try { try {
PackageFile[] published = this.restTemplate.exchange(request, PackageFile[].class).getBody(); PackageFile[] published = this.restTemplate.exchange(request, PackageFile[].class).getBody();
return hasPublishedAll(published, requiredDigests); return hasPublishedAll(published, requiredDigests);
@ -111,7 +111,7 @@ public class BintrayService {
}); });
} }
catch (ConditionTimeoutException ex) { catch (ConditionTimeoutException ex) {
logger.debug("Timeout checking bintray"); logger.debug("Timeout checking Bintray");
return false; return false;
} }
return true; return true;
@ -132,7 +132,7 @@ public class BintrayService {
logger.debug("Found all required digests"); logger.debug("Found all required digests");
return true; return true;
} }
logger.debug("Some digests have not been published:"); logger.debug(remaining.size() + " digests have not been published:");
remaining.forEach(logger::debug); remaining.forEach(logger::debug);
return false; return false;
} }
@ -148,7 +148,7 @@ public class BintrayService {
* @param releaseInfo the release information * @param releaseInfo the release information
*/ */
public void publishGradlePlugin(ReleaseInfo releaseInfo) { public void publishGradlePlugin(ReleaseInfo releaseInfo) {
logger.debug("Publishing Gradle Pluging"); logger.debug("Publishing Gradle plugin");
RequestEntity<String> requestEntity = RequestEntity RequestEntity<String> requestEntity = RequestEntity
.post(URI.create(BINTRAY_URL + "packages/" + this.bintrayProperties.getSubject() + "/" .post(URI.create(BINTRAY_URL + "packages/" + this.bintrayProperties.getSubject() + "/"
+ this.bintrayProperties.getRepo() + "/" + releaseInfo.getGroupId() + "/versions/" + this.bintrayProperties.getRepo() + "/" + releaseInfo.getGroupId() + "/versions/"
@ -156,10 +156,10 @@ public class BintrayService {
.contentType(MediaType.APPLICATION_JSON).body(GRADLE_PLUGIN_REQUEST); .contentType(MediaType.APPLICATION_JSON).body(GRADLE_PLUGIN_REQUEST);
try { try {
this.restTemplate.exchange(requestEntity, Object.class); this.restTemplate.exchange(requestEntity, Object.class);
logger.debug("Publishing Gradle Pluging complete"); logger.debug("Publishing Gradle plugin complete");
} }
catch (HttpClientErrorException ex) { catch (HttpClientErrorException ex) {
logger.info("Failed to add attribute to gradle plugin."); logger.info("Failed to add attribute to Gradle plugin");
throw ex; throw ex;
} }
} }
@ -184,7 +184,7 @@ public class BintrayService {
logger.debug("Sync complete"); logger.debug("Sync complete");
} }
catch (HttpClientErrorException ex) { catch (HttpClientErrorException ex) {
logger.info("Failed to sync."); logger.info("Failed to sync");
throw ex; throw ex;
} }
} }