Esempio n. 1
0
 public JiraTickets tickets() throws ExecutionException, InterruptedException {
   List<JiraTicket> jiraTickets = new ArrayList<JiraTicket>();
   for (BasicIssue issuesKey : issuesKeys) {
     Promise<Issue> issuePromise = issueRestClient.getIssue(issuesKey.getKey());
     Issue i = issuePromise.get();
     JiraTicket ticket =
         new JiraTicket(
             i.getKey(),
             field(i, HOTFIX_TO),
             field(i, FIX_DETAILS),
             field(i, HOTFIX_FILES),
             field(i, HOTFIX_INSTRUCTIONS),
             field(i, HOTFIX_APPROVED_BY),
             field(i, VERIFICATION_DETAILS));
     jiraTickets.add(ticket);
   }
   return new JiraTickets(jiraTickets);
 }
Esempio n. 2
0
 private String field(Issue issue, TicketFields filed) {
   Field field = issue.getFieldByName(filed.getName());
   if (field != null) {
     Object fieldValue = field.getValue();
     if (fieldValue != null) {
       return fieldValue.toString();
     }
   }
   return "";
 }
Esempio n. 3
0
  public void uploadAttachments(JiraTickets tickets)
      throws ExecutionException, InterruptedException, IOException {
    for (JiraTicket t : tickets) {
      Promise<Issue> issuePromise = issueRestClient.getIssue(t.getId());
      Issue i = issuePromise.get();
      File rollback = t.getRollback();
      File hotfix = t.getHotfix();

      if (rollback != null && rollback.canRead()) {
        issueRestClient.addAttachment(
            i.getAttachmentsUri(), FileUtils.openInputStream(rollback), rollback.getName());
      }

      if (hotfix != null && hotfix.canRead()) {
        issueRestClient.addAttachment(
            i.getAttachmentsUri(), FileUtils.openInputStream(hotfix), hotfix.getName());
      }
    }
  }
Esempio n. 4
0
 public void updateTickets(JiraTickets tickets) throws ExecutionException, InterruptedException {
   for (JiraTicket t : tickets) {
     Promise<Issue> issuePromise = issueRestClient.getIssue(t.getId());
     Issue i = issuePromise.get();
     // find transition (we need ID)
     Iterable<Transition> transitions =
         issueRestClient.getTransitions(i.getTransitionsUri()).get();
     String tName = "Hotfix Failed";
     if (t.isValid()) {
       tName = "Out On Dev";
     }
     Transition transition = find(transitions, tName);
     if (transition == null) {
       continue;
     }
     // prepare fields
     // List<FieldInput> fields = Arrays.asList(   new FieldInput("resolution",
     // ComplexIssueInputFieldValue.with("name", "RerunPass")));
     Comment comment = Comment.valueOf(StringUtils.join(t.getValidationMessages(), "\n"));
     issueRestClient.transition(i, new TransitionInput(transition.getId(), comment));
   }
 }