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

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


    testTransitionImpl(comment);
  }

  @Test
  public void testTransitionWithGroupLevel() {
    Comment comment = Comment.createWithGroupLevel("My text which I am just adding " + new DateTime(), "jira-users");
    testTransitionImpl(comment);
  }
View Full Code Here


    testTransitionImpl(comment);
  }

  @Test
  public void testTransitionWithInvalidRole() {
    final Comment comment = Comment.createWithRoleLevel("My text which I am just adding " + new DateTime(), "some-fake-role");
    if (IntegrationTestUtil.TESTING_JIRA_5_OR_NEWER) {
      assertInvalidCommentInput(comment, "Invalid role level specified.");
    } else {
      assertInvalidCommentInput(comment, "Invalid role [some-fake-role]");
    }
View Full Code Here

    }
  }

  @Test
  public void testTransitionWithInvalidGroup() {
    final Comment comment = Comment.createWithGroupLevel("My text which I am just adding " + new DateTime(), "some-fake-group");
    assertInvalidCommentInput(comment, "Group: some-fake-group does not exist.");
  }
View Full Code Here

    Transition transitionFound = TestUtil.getTransitionByName(transitions, "Estimate");
    DateTime now = new DateTime();
    client.getIssueClient().transition(issue, new TransitionInput(transitionFound.getId(), comment), pm);

    final Issue changedIssue = client.getIssueClient().getIssue("TST-1", pm);
    final Comment lastComment = Iterables.getLast(changedIssue.getComments());
    assertEquals(comment.getBody(), lastComment.getBody());
    assertEquals(USER_ADMIN, lastComment.getAuthor());
    assertEquals(USER_ADMIN, lastComment.getUpdateAuthor());
    assertEquals(lastComment.getCreationDate(), lastComment.getUpdateDate());
    assertTrue(lastComment.getCreationDate().isAfter(now) || lastComment.getCreationDate().isEqual(now));
    assertEquals(comment.getVisibility(), lastComment.getVisibility());
  }
View Full Code Here

    assertEquals(IssueLinkType.Direction.OUTBOUND, addedLink.getIssueLinkType().getDirection());

    final int expectedNumComments = commentInput != null ? origNumComments + 1 : origNumComments;
    assertEquals(expectedNumComments, Iterables.size(linkedIssue.getComments()));
    if (commentInput != null) {
      final Comment comment = linkedIssue.getComments().iterator().next();
      assertEquals(commentInput.getBody(), comment.getBody());
      assertEquals(USER_ADMIN, comment.getAuthor());
      assertEquals(commentInput.getVisibility(), comment.getVisibility());
    } else {
      assertFalse(linkedIssue.getComments().iterator().hasNext());
    }

View Full Code Here

    assertEquals(USER_ADMIN, client.getIssueClient().getIssue("TST-5", pm).getAssignee());
    navigation.logout();
    navigation.issue().addComment("ANNON-1", "my nice comment");
    final Issue issue = client.getIssueClient().getIssue("ANNON-1", pm);
    assertEquals(1, Iterables.size(issue.getComments()));
    final Comment comment = issue.getComments().iterator().next();
    assertEquals("my nice comment", comment.getBody());
    if (isJira5xOrNewer()) {
      assertNotNull(comment.getId());
    }
    else {
      assertNull(comment.getId());
    }
    assertNull(comment.getAuthor());
    assertNull(comment.getUpdateAuthor());

  }
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

  }

  @Test
  @JiraBuildNumberDependent(BN_JIRA_5)
  public void testAddCommentToIssueWithGroupLevelVisibility() {
    Comment comment = Comment.createWithGroupLevel("Simple test comment restricted for admins.",
        IntegrationTestUtil.GROUP_JIRA_ADMINISTRATORS);
    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

  }

  @Test
  @JiraBuildNumberDependent(BN_JIRA_5)
  public void testAddCommentToIssueWithRoleLevelVisibility() {
    Comment comment = Comment.createWithRoleLevel("Simple test comment restricted for role Administrators.",
        IntegrationTestUtil.ROLE_ADMINISTRATORS);
    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

    final Issue issueWithComments = issueClient.getIssue(issueKey, pm);
    final List<Comment> newComments = Lists.newArrayList(issueWithComments.getComments());
    newComments.removeAll(initialComments);
    assertEquals(1, Iterables.size(newComments));
    Comment addedComment = newComments.get(0);
    assertEquals(comment.getBody(), addedComment.getBody());
    assertEquals(comment.getVisibility(), addedComment.getVisibility());
    return addedComment;
  }
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.