use of io.syndesis.qe.issue.SimpleIssue in project syndesis-qe by syndesisio.
the class IssueHooksUtils method analyzeGithubIssues.
public static List<SimpleIssue> analyzeGithubIssues(List<String> githubIssues, Scenario scenario) {
GitHubClient gitHubClient = getGitHubClient(scenario);
List<SimpleIssue> issues = new ArrayList<>();
if (gitHubClient == null) {
return Collections.emptyList();
}
RepositoryService repositoryService = new RepositoryService(gitHubClient);
IssueService issueService = new IssueService(gitHubClient);
try {
Repository repository = repositoryService.getRepository("syndesisio", "syndesis");
for (String tag : githubIssues) {
String issueNumber = tag.replaceFirst("^@gh-", "");
Issue issue = issueService.getIssue(repository, issueNumber);
issues.add(transformGithubIssue(issue, scenario));
}
} catch (IOException e) {
log.error("Error while processing GitHub issues", e);
scenario.attach("Error while processing GitHub issues".getBytes(), "text/plain", "ErrorMessage");
e.printStackTrace();
}
return issues;
}
use of io.syndesis.qe.issue.SimpleIssue in project syndesis-qe by syndesisio.
the class IssueHooksUtils method analyzeJiraIssues.
public static List<SimpleIssue> analyzeJiraIssues(List<String> jiraIssues, Scenario scenario) {
List<SimpleIssue> issues = new ArrayList<>();
JiraRestClient jiraClient = getJiraClient(scenario);
if (jiraClient == null) {
return Collections.emptyList();
}
IssueRestClient issueClient = jiraClient.getIssueClient();
for (String tag : jiraIssues) {
String issueName = tag.replaceFirst("^@", "");
try {
com.atlassian.jira.rest.client.api.domain.Issue issue = issueClient.getIssue(issueName).claim();
issues.add(transformJiraIssue(issue));
} catch (RestClientException e) {
log.error("Couldn't obtain the Jira issue : {}", tag);
scenario.attach("Error while processing Jira issues".getBytes(), "text/plain", "ErrorMessage");
e.printStackTrace();
}
}
return issues;
}
use of io.syndesis.qe.issue.SimpleIssue in project syndesis-qe by syndesisio.
the class IssueHooks method embedIssues.
private void embedIssues(Scenario scenario, List<SimpleIssue> issues) throws IOException {
ObjectMapper mapper = new ObjectMapper();
ArrayNode array = mapper.createArrayNode();
for (SimpleIssue issue : issues) {
array.addPOJO(issue);
}
StringWriter sw = new StringWriter();
mapper.writeValue(sw, array);
scenario.attach(sw.toString().getBytes(), "application/x.issues+json", "Issues");
}
use of io.syndesis.qe.issue.SimpleIssue in project syndesis-qe by syndesisio.
the class IssueHooksUtils method transformGithubIssue.
private static SimpleIssue transformGithubIssue(Issue githubIssue, Scenario scenario) {
SimpleIssue issue = new SimpleIssue();
issue.setIssue(Integer.toString(githubIssue.getNumber()));
issue.setUrl(githubIssue.getHtmlUrl());
issue.setIssueSummary(githubIssue.getTitle());
issue.setState(getGHIssueState(scenario, githubIssue));
return issue;
}
use of io.syndesis.qe.issue.SimpleIssue in project syndesis-qe by syndesisio.
the class IssueHooksUtils method transformJiraIssue.
private static SimpleIssue transformJiraIssue(com.atlassian.jira.rest.client.api.domain.Issue jiraIssue) {
SimpleIssue issue = new SimpleIssue();
issue.setIssue(jiraIssue.getKey());
issue.setUrl(getJiraIssueUrl(jiraIssue));
issue.setIssueSummary(jiraIssue.getSummary());
issue.setState(getJiraIssueState(jiraIssue));
return issue;
}
Aggregations