use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class CommentsUtil method newCommentOnParent.
static CommentInput newCommentOnParent(String path, int parent, int line, String message) {
CommentInput c = new CommentInput();
c.unresolved = false;
return populate(c, path, Side.PARENT, parent, line, message);
}
use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class AbstractMailIT method newComment.
protected static CommentInput newComment(String path, Side side, int line, String message) {
CommentInput c = new CommentInput();
c.path = path;
c.side = side;
c.line = line != 0 ? line : null;
c.message = message;
if (line != 0) {
Comment.Range range = new Comment.Range();
range.startLine = line;
range.startCharacter = 1;
range.endLine = line;
range.endCharacter = 5;
c.range = range;
}
return c;
}
use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class DeleteDraftPatchSetIT method deleteDraftPS1.
@Test
public void deleteDraftPS1() throws Exception {
String changeId = createDraftChangeWith2PS();
ReviewInput rin = new ReviewInput();
rin.message = "Change message";
CommentInput cin = new CommentInput();
cin.line = 1;
cin.patchSet = 1;
cin.path = PushOneCommit.FILE_NAME;
cin.side = Side.REVISION;
cin.message = "Inline comment";
rin.comments = new HashMap<>();
rin.comments.put(cin.path, ImmutableList.of(cin));
gApi.changes().id(changeId).revision(1).review(rin);
ChangeData cd = getChange(changeId);
PatchSet.Id delPsId = new PatchSet.Id(cd.getId(), 1);
PatchSet ps = cd.patchSet(delPsId);
deletePatchSet(changeId, ps);
cd = getChange(changeId);
assertThat(cd.patchSets()).hasSize(1);
assertThat(Iterables.getOnlyElement(cd.patchSets()).getId().get()).isEqualTo(2);
// Other entities based on deleted patch sets are also deleted.
for (ChangeMessage m : cd.messages()) {
assertThat(m.getPatchSetId()).named(m.toString()).isNotEqualTo(delPsId);
}
for (Comment c : cd.publishedComments()) {
assertThat(c.key.patchSetId).named(c.toString()).isNotEqualTo(delPsId.get());
}
}
use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class DeleteDraftPatchSetIT method deleteDraftPS2.
@Test
public void deleteDraftPS2() throws Exception {
String changeId = createDraftChangeWith2PS();
ReviewInput rin = new ReviewInput();
rin.message = "Change message";
CommentInput cin = new CommentInput();
cin.line = 1;
cin.patchSet = 1;
cin.path = PushOneCommit.FILE_NAME;
cin.side = Side.REVISION;
cin.message = "Inline comment";
rin.comments = new HashMap<>();
rin.comments.put(cin.path, ImmutableList.of(cin));
gApi.changes().id(changeId).revision(1).review(rin);
ChangeData cd = getChange(changeId);
PatchSet.Id delPsId = new PatchSet.Id(cd.getId(), 2);
PatchSet ps = cd.patchSet(delPsId);
deletePatchSet(changeId, ps);
cd = getChange(changeId);
assertThat(cd.patchSets()).hasSize(1);
assertThat(Iterables.getOnlyElement(cd.patchSets()).getId().get()).isEqualTo(1);
// Other entities based on deleted patch sets are also deleted.
for (ChangeMessage m : cd.messages()) {
assertThat(m.getPatchSetId()).named(m.toString()).isNotEqualTo(delPsId);
}
for (Comment c : cd.publishedComments()) {
assertThat(c.key.patchSetId).named(c.toString()).isNotEqualTo(delPsId.get());
}
}
use of com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput in project gerrit by GerritCodeReview.
the class CommentsIT method addComment.
private CommentInput addComment(String changeId, String message) throws Exception {
ReviewInput input = new ReviewInput();
CommentInput comment = newComment(FILE_NAME, Side.REVISION, 0, message, false);
input.comments = ImmutableMap.of(comment.path, Lists.newArrayList(comment));
gApi.changes().id(changeId).current().review(input);
return comment;
}
Aggregations