Package com.atlassian.jira.rest.client.domain

Examples of com.atlassian.jira.rest.client.domain.Comment


    }

    public Comment addCommentToIssue(BasicIssue issue, String commentText) {
        // URI self, String body, @Nullable BasicUser author, @Nullable BasicUser updateAuthor, DateTime creationDate, DateTime updateDate, Visibility visibility, @Nullable Long id
        DateTime now = new DateTime();
        Comment comment = new Comment(null, commentText, null, null, now, null, null, issue.getId());
        List<Comment> commentsForIssue = comments.get(issue.getId());
        if (commentsForIssue == null) {
            commentsForIssue = new ArrayList<Comment>();
        }
        commentsForIssue.add(comment);
View Full Code Here


        MockJiraRestClient jiraRestClient = (MockJiraRestClient) factory.getClient();
        MockSearchRestClient searchRestClient = (MockSearchRestClient) jiraRestClient.getSearchClient();
        BasicIssue issue1 = searchRestClient.addIssue();
        String commentText = "Comment added at " + new Date();
        Comment comment1 = searchRestClient.addCommentToIssue(issue1, commentText);

        mockResultEndpoint.expectedBodiesReceived(comment1);
       

        mockResultEndpoint.assertIsSatisfied();
View Full Code Here

        MockEndpoint mockResultEndpoint = getMockEndpoint("mock:result");

        MockJiraRestClient jiraRestClient = (MockJiraRestClient) factory.getClient();
        MockSearchRestClient searchRestClient = (MockSearchRestClient) jiraRestClient.getSearchClient();
        BasicIssue issue1 = searchRestClient.addIssue();
        Comment comment1 = searchRestClient.addCommentToIssue(issue1, "Comment added at " + new Date());
        BasicIssue issue2 = searchRestClient.addIssue();
        Comment comment2 = searchRestClient.addCommentToIssue(issue2, "Comment added at " + new Date());

        mockResultEndpoint.expectedBodiesReceivedInAnyOrder(comment1, comment2);

        mockResultEndpoint.assertIsSatisfied();
    }
View Full Code Here

     */
    public class NewCommentProcessor implements Processor {
        @Override
        public void process(Exchange exchange) throws Exception {
            Message in = exchange.getIn();
            Comment comment = (Comment) in.getBody();
            LOG.debug("Got comment with id " + comment.getId() + " Body " + comment.getBody());
        }
View Full Code Here

    @Override
    protected int poll() throws Exception {
        Stack<Comment> newComments = getComments();
        while (!newComments.empty()) {
            Comment newComment = newComments.pop();
            Exchange e = getEndpoint().createExchange();
            e.getIn().setBody(newComment);
            getProcessor().process(e);
        }
        return newComments.size();
View Full Code Here

    final String body = json.getString("body");
    final BasicUser author = JsonParseUtil.parseBasicUser(json.optJSONObject("author"));
    final BasicUser updateAuthor = JsonParseUtil.parseBasicUser(json.optJSONObject("updateAuthor"));

    final Visibility visibility = visibilityJsonParser.parseVisibility(json);
    return new Comment(selfUri, body, author, updateAuthor, JsonParseUtil.parseDateTime(json.getString("created")),
        JsonParseUtil.parseDateTime(json.getString("updated")), visibility, id);
  }
View Full Code Here

    // comments
    final Iterable<Comment> comments = issue.getComments();
    assertNotNull(comments);
    assertEquals(1, Iterables.size(comments));
    final Comment comment = comments.iterator().next();
    assertEquals("My comment", comment.getBody());
    assertEquals("Administrator", comment.getAuthor().getDisplayName());
  }
View Full Code Here

    final Worklog worklog3 = Iterables.get(worklogs, 3);
    assertEquals("", worklog3.getComment());

    // comments
    assertEquals(3, Iterables.size(issue.getComments()));
    final Comment comment = issue.getComments().iterator().next();
    assertEquals(Visibility.Type.ROLE, comment.getVisibility().getType());
    assertEquals(TestConstants.USER_ADMIN, comment.getAuthor());
    assertEquals(TestConstants.USER_ADMIN, comment.getUpdateAuthor());
  }
View Full Code Here

  @Test
  public void testParseIssueWithAnonymousComment() throws JSONException {
    final Issue issue = parseIssue("/json/issue/valid-anonymous-comment-jira-4.3.json");
    assertEquals(1, Iterables.size(issue.getComments()));
    final Comment comment = issue.getComments().iterator().next();
    assertEquals("A comment from anonymous user", comment.getBody());
    assertNull(comment.getAuthor());

  }
View Full Code Here

  }

  @Test
  @JiraBuildNumberDependent(BN_JIRA_5)
  public void testAddCommentToIssueWithGroupLevelVisibility() {
    final Comment comment = Comment.createWithGroupLevel("Simple test comment restricted for admins.",
        IntegrationTestUtil.GROUP_JIRA_ADMINISTRATORS);
    final String issueKey = "ANONEDIT-1";
    final Comment addedComment = testAddCommentToIssueImpl(issueKey, comment);

    // try to get as anonymous user
    setAnonymousMode();

    final IssueRestClient issueClient = client.getIssueClient();
    final Issue issue = issueClient.getIssue(issueKey, pm);

    // test if we can see added comment
    assertFalse(hasComment(issue.getComments(), addedComment.getId()));
  }
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.domain.Comment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.