use of com.google.common.base.Throwables in project sonarqube by SonarSource.
the class WebhookDeliveryStorage method toDto.
private WebhookDeliveryDto toDto(WebhookDelivery delivery) {
WebhookDeliveryDto dto = new WebhookDeliveryDto();
dto.setUuid(uuidFactory.create());
dto.setComponentUuid(delivery.getWebhook().getComponentUuid());
dto.setCeTaskUuid(delivery.getWebhook().getCeTaskUuid());
dto.setName(delivery.getWebhook().getName());
dto.setUrl(delivery.getWebhook().getUrl());
dto.setSuccess(delivery.isSuccess());
dto.setHttpStatus(delivery.getHttpStatus().orElse(null));
dto.setDurationMs(delivery.getDurationInMs().orElse(null));
dto.setErrorStacktrace(delivery.getError().map(Throwables::getStackTraceAsString).orElse(null));
dto.setPayload(delivery.getPayload().getJson());
dto.setCreatedAt(delivery.getAt());
return dto;
}
use of com.google.common.base.Throwables in project sonar-java by SonarSource.
the class JavaRulingTest method prepareDumpOldFolder.
private static void prepareDumpOldFolder() {
Path allRulesFolder = Paths.get("src/test/resources");
if (SUBSET_OF_ENABLED_RULES.isEmpty()) {
effectiveDumpOldFolder = allRulesFolder.toAbsolutePath();
} else {
effectiveDumpOldFolder = TMP_DUMP_OLD_FOLDER.getRoot().toPath().toAbsolutePath();
Try.of(() -> Files.list(allRulesFolder)).orElseThrow(Throwables::propagate).filter(p -> p.toFile().isDirectory()).forEach(srcProjectDir -> copyDumpSubset(srcProjectDir, effectiveDumpOldFolder.resolve(srcProjectDir.getFileName())));
}
}
use of com.google.common.base.Throwables in project sonarqube by SonarSource.
the class WebhookDeliveryStorage method toDto.
private WebhookDeliveryDto toDto(WebhookDelivery delivery) {
WebhookDeliveryDto dto = new WebhookDeliveryDto();
dto.setUuid(uuidFactory.create());
dto.setWebhookUuid(delivery.getWebhook().getUuid());
dto.setComponentUuid(delivery.getWebhook().getComponentUuid());
delivery.getWebhook().getCeTaskUuid().ifPresent(dto::setCeTaskUuid);
delivery.getWebhook().getAnalysisUuid().ifPresent(dto::setAnalysisUuid);
dto.setName(delivery.getWebhook().getName());
dto.setUrl(delivery.getEffectiveUrl().orElse(delivery.getWebhook().getUrl()));
dto.setSuccess(delivery.isSuccess());
dto.setHttpStatus(delivery.getHttpStatus().orElse(null));
dto.setDurationMs(delivery.getDurationInMs().orElse(null));
dto.setErrorStacktrace(delivery.getError().map(Throwables::getStackTraceAsString).orElse(null));
dto.setPayload(delivery.getPayload().getJson());
dto.setCreatedAt(delivery.getAt());
return dto;
}
Aggregations