use of com.google.gerrit.extensions.api.changes.ReviewInput in project gerrit by GerritCodeReview.
the class StickyApprovalsIT method vote.
private void vote(TestAccount user, String changeId, int codeReviewVote, int verifiedVote) throws Exception {
setApiUser(user);
ReviewInput in = new ReviewInput().label("Code-Review", codeReviewVote).label("Verified", verifiedVote);
gApi.changes().id(changeId).current().review(in);
}
use of com.google.gerrit.extensions.api.changes.ReviewInput in project gerrit by GerritCodeReview.
the class RevisionIT method postSubmitApprovalAfterVoteRemoved.
@Test
public void postSubmitApprovalAfterVoteRemoved() throws Exception {
PushOneCommit.Result r = createChange();
String changeId = project.get() + "~master~" + r.getChangeId();
setApiUser(admin);
revision(r).review(ReviewInput.approve());
setApiUser(user);
revision(r).review(ReviewInput.recommend());
setApiUser(admin);
gApi.changes().id(changeId).reviewer(user.username).deleteVote("Code-Review");
Optional<ApprovalInfo> crUser = get(changeId, DETAILED_LABELS).labels.get("Code-Review").all.stream().filter(a -> a._accountId == user.id.get()).findFirst();
assertThat(crUser).isPresent();
assertThat(crUser.get().value).isEqualTo(0);
revision(r).submit();
setApiUser(user);
ReviewInput in = new ReviewInput();
in.label("Code-Review", 1);
in.message = "Still LGTM";
revision(r).review(in);
ApprovalInfo cr = gApi.changes().id(changeId).get(EnumSet.of(ListChangesOption.DETAILED_LABELS)).labels.get("Code-Review").all.stream().filter(a -> a._accountId == user.getId().get()).findFirst().get();
assertThat(cr.postSubmit).isTrue();
}
use of com.google.gerrit.extensions.api.changes.ReviewInput in project gerrit by GerritCodeReview.
the class RobotCommentsIT method addRobotComment.
private void addRobotComment(String targetChangeId, RobotCommentInput robotCommentInput) throws Exception {
ReviewInput reviewInput = new ReviewInput();
reviewInput.robotComments = Collections.singletonMap(robotCommentInput.path, ImmutableList.of(robotCommentInput));
reviewInput.message = "robot comment test";
gApi.changes().id(targetChangeId).current().review(reviewInput);
}
use of com.google.gerrit.extensions.api.changes.ReviewInput in project gerrit by GerritCodeReview.
the class AbstractPushForReview method pushNewPatchsetToPatchSetLockedChange.
@Test
public void pushNewPatchsetToPatchSetLockedChange() throws Exception {
PushOneCommit.Result r = pushTo("refs/for/master");
r.assertOkStatus();
PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo, PushOneCommit.SUBJECT, "b.txt", "anotherContent", r.getChangeId());
revision(r).review(new ReviewInput().label("Patch-Set-Lock", 1));
r = push.to("refs/for/master");
r.assertErrorStatus("cannot add patch set to " + r.getChange().change().getChangeId() + ". Change is patch set locked.");
}
use of com.google.gerrit.extensions.api.changes.ReviewInput in project gerrit by GerritCodeReview.
the class ImpersonationIT method voteOnBehalfOfRequiresLabel.
@Test
public void voteOnBehalfOfRequiresLabel() throws Exception {
allowCodeReviewOnBehalfOf();
PushOneCommit.Result r = createChange();
RevisionApi revision = gApi.changes().id(r.getChangeId()).current();
ReviewInput in = new ReviewInput();
in.onBehalfOf = user.id.toString();
in.message = "Message on behalf of";
exception.expect(AuthException.class);
exception.expectMessage("label required to post review on behalf of \"" + in.onBehalfOf + '"');
revision.review(in);
}
Aggregations