use of lombok.AccessLevel.PRIVATE in project SONG by overture-stack.
the class Benchmark method saveForStudy.
@SneakyThrows
private void saveForStudy(String studyId, Registry registry, List<UploadData> uploadDataList) {
val modList = uploadDataList.stream().filter(x -> !x.getUploadState().equals("VALIDATION_ERROR")).collect(toList());
val total = modList.size();
val errored = uploadDataList.size() - total;
log.warn("Num Errored Files: {}", errored);
int count = 0;
val saveMonitor = monitor.getStudyMonitor(studyId).getSaveMonitor();
for (val uploadData : modList) {
val submittedAnalysisId = uploadData.getAnalysisId();
val idExists = doesIdExist(uploadData.getStudyId(), registry, submittedAnalysisId);
log.info("ANALYSIS_ID {} existence: {}", submittedAnalysisId, idExists);
val rawResponse = saveMonitor.callIncr(() -> registry.save(uploadData.getStudyId(), uploadData.getUploadId(), benchmarkConfig.isIgnoreIdCollisions()));
val response = readTree(rawResponse.getOutputs());
val status = response.path("status").textValue();
val analysisId = response.path("analysisId").textValue();
uploadData.setAnalysisId(analysisId);
log.info("Saving {} file {} /{} : {}", uploadData.getStudyId(), ++count, total, uploadData.getFile().getFileName().toString());
}
}
use of lombok.AccessLevel.PRIVATE in project component-runtime by Talend.
the class Generator method generatedJira.
private static void generatedJira(final File generatedDir, final String username, final String password, final String version) {
if (username == null || username.trim().isEmpty() || "skip".equals(username)) {
log.error("No JIRA credentials, will skip changelog generation");
return;
}
final String project = "TCOMP";
final String jiraBase = "https://jira.talendforge.org";
final File file = new File(generatedDir, "generated_changelog.adoc");
final Client client = ClientBuilder.newClient().register(new JsonbJaxrsProvider<>());
final String auth = "Basic " + Base64.getEncoder().encodeToString((username + ':' + password).getBytes(StandardCharsets.UTF_8));
try {
final WebTarget restApi = client.target(jiraBase + "/rest/api/2").property("http.connection.timeout", 60000L);
final List<JiraVersion> versions = restApi.path("project/{project}/versions").resolveTemplate("project", project).request(APPLICATION_JSON_TYPE).header("Authorization", auth).get(new GenericType<List<JiraVersion>>() {
});
final String currentVersion = version.replace("-SNAPSHOT", "");
final List<JiraVersion> loggedVersions = versions.stream().filter(v -> (v.isReleased() || jiraVersionMatches(currentVersion, v.getName()))).collect(toList());
if (loggedVersions.isEmpty()) {
try (final PrintStream stream = new PrintStream(new WriteIfDifferentStream(file))) {
stream.println("No version found.");
}
return;
}
final String jql = "project=" + project + " AND labels=\"changelog\"" + loggedVersions.stream().map(v -> "fixVersion=" + v.getName()).collect(joining(" OR ", " AND (", ")"));
final Function<Long, JiraIssues> searchFrom = startAt -> restApi.path("search").queryParam("jql", jql).queryParam("startAt", startAt).request(APPLICATION_JSON_TYPE).header("Authorization", auth).get(JiraIssues.class);
final Function<JiraIssues, Stream<JiraIssues>> paginate = new Function<JiraIssues, Stream<JiraIssues>>() {
@Override
public Stream<JiraIssues> apply(final JiraIssues issues) {
final long nextStartAt = issues.getStartAt() + issues.getMaxResults();
final Stream<JiraIssues> fetched = Stream.of(issues);
return issues.getTotal() > nextStartAt ? Stream.concat(fetched, apply(searchFrom.apply(nextStartAt))) : fetched;
}
};
final Set<String> includeStatus = Stream.of("closed", "resolved", "development done", "qa done", "done").collect(toSet());
final Map<String, TreeMap<String, List<JiraIssue>>> issues = Stream.of(searchFrom.apply(0L)).flatMap(paginate).flatMap(i -> ofNullable(i.getIssues()).map(Collection::stream).orElseGet(Stream::empty)).filter(issue -> includeStatus.contains(issue.getFields().getStatus().getName().toLowerCase(ENGLISH))).flatMap(i -> i.getFields().getFixVersions().stream().map(v -> Pair.of(v, i))).collect(groupingBy(pair -> pair.getKey().getName(), () -> new TreeMap<>(versionComparator()), groupingBy(pair -> pair.getValue().getFields().getIssuetype().getName(), TreeMap::new, collectingAndThen(mapping(Pair::getValue, toList()), l -> {
l.sort(comparing(JiraIssue::getKey));
return l;
}))));
final String changelog = issues.entrySet().stream().map(versionnedIssues -> new StringBuilder("\n\n== Version ").append(versionnedIssues.getKey()).append(versionnedIssues.getValue().entrySet().stream().collect((Supplier<StringBuilder>) StringBuilder::new, (builder, issuesByType) -> builder.append("\n\n=== ").append(issuesByType.getKey()).append("\n\n").append(issuesByType.getValue().stream().collect((Supplier<StringBuilder>) StringBuilder::new, // useful
(a, i) -> a.append("- link:").append(jiraBase).append("/browse/").append(i.getKey()).append("[").append(i.getKey()).append("^]").append(": ").append(i.getFields().getSummary()).append("\n"), StringBuilder::append)), StringBuilder::append))).collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString();
try (final PrintStream stream = new PrintStream(new WriteIfDifferentStream(file))) {
stream.println(changelog);
}
} finally {
client.close();
}
}
Aggregations