Search in sources :

Example 61 with CommentInput

use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.

the class CommentContextIT method createChangeWithContent.

private String createChangeWithContent(String fileName, String fileContent, int line) throws Exception {
    PushOneCommit.Result result = createChange(testRepo, "master", SUBJECT, fileName, fileContent, "topic");
    String changeId = result.getChangeId();
    String ps1 = result.getCommit().name();
    CommentInput comment = CommentsUtil.newComment(fileName, Side.REVISION, line, "comment", false);
    CommentsUtil.addComments(gApi, changeId, ps1, comment);
    return changeId;
}
Also used : CommentInput(com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit)

Example 62 with CommentInput

use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.

the class CommentsUtil method addComment.

static void addComment(GerritApi gApi, PushOneCommit.Result r, String message, boolean omitDuplicateComments, Boolean unresolved, String inReplyTo, Integer line, Comment.Range range) throws Exception {
    CommentInput c = new CommentInput();
    c.line = line == null ? 1 : line;
    c.message = message;
    c.path = FILE_NAME;
    c.unresolved = unresolved;
    c.inReplyTo = inReplyTo;
    c.range = range;
    ReviewInput in = CommentsUtil.newInput(c);
    in.omitDuplicateComments = omitDuplicateComments;
    gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).review(in);
}
Also used : CommentInput(com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput) ReviewInput(com.google.gerrit.extensions.api.changes.ReviewInput)

Example 63 with CommentInput

use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.

the class CommentsUtil method addComment.

static CommentInput addComment(GerritApi gApi, String changeId) throws Exception {
    ReviewInput input = new ReviewInput();
    CommentInput comment = CommentsUtil.newComment(FILE_NAME, Side.REVISION, 0, "a message", false);
    input.comments = ImmutableMap.of(comment.path, Lists.newArrayList(comment));
    gApi.changes().id(changeId).current().review(input);
    return comment;
}
Also used : CommentInput(com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput) ReviewInput(com.google.gerrit.extensions.api.changes.ReviewInput)

Aggregations

CommentInput (com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput)63 Test (org.junit.Test)48 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)46 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)40 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)32 DeleteCommentInput (com.google.gerrit.extensions.api.changes.DeleteCommentInput)27 CommentInfo (com.google.gerrit.extensions.common.CommentInfo)26 IdString (com.google.gerrit.extensions.restapi.IdString)21 ImmutableList (com.google.common.collect.ImmutableList)14 List (java.util.List)14 Collectors.toList (java.util.stream.Collectors.toList)14 ArrayList (java.util.ArrayList)12 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)11 Change (com.google.gerrit.entities.Change)9 RobotCommentInput (com.google.gerrit.extensions.api.changes.ReviewInput.RobotCommentInput)8 GerritConfig (com.google.gerrit.acceptance.config.GerritConfig)6 DraftInput (com.google.gerrit.extensions.api.changes.DraftInput)6 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)5 Message (com.google.gerrit.testing.FakeEmailSender.Message)5 Comment (com.google.gerrit.extensions.client.Comment)4