use of com.google.gerrit.extensions.api.changes.AddReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersIT method addReviewer.
private AddReviewerResult addReviewer(String changeId, String reviewer, int expectedStatus) throws Exception {
AddReviewerInput in = new AddReviewerInput();
in.reviewer = reviewer;
return addReviewer(changeId, in, expectedStatus);
}
use of com.google.gerrit.extensions.api.changes.AddReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersIT method transitionCcToReviewer.
@Test
public void transitionCcToReviewer() throws Exception {
PushOneCommit.Result r = createChange();
String changeId = r.getChangeId();
AddReviewerInput in = new AddReviewerInput();
in.reviewer = user.email;
in.state = CC;
addReviewer(changeId, in);
ChangeInfo c = gApi.changes().id(r.getChangeId()).get();
if (notesMigration.readChanges()) {
assertReviewers(c, REVIEWER);
assertReviewers(c, CC, user);
} else {
assertReviewers(c, REVIEWER, user);
assertReviewers(c, CC);
}
in.state = REVIEWER;
addReviewer(changeId, in);
c = gApi.changes().id(r.getChangeId()).get();
assertReviewers(c, REVIEWER, user);
assertReviewers(c, CC);
}
use of com.google.gerrit.extensions.api.changes.AddReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersIT method notifyDetailsWorkOnPostReviewers.
@Test
public void notifyDetailsWorkOnPostReviewers() throws Exception {
PushOneCommit.Result r = createChange();
TestAccount userToNotify = createAccounts(1, "notify-details-post-reviewers").get(0);
AddReviewerInput addReviewer = new AddReviewerInput();
addReviewer.reviewer = user.email;
addReviewer.notify = NotifyHandling.NONE;
addReviewer.notifyDetails = ImmutableMap.of(RecipientType.TO, new NotifyInfo(ImmutableList.of(userToNotify.email)));
sender.clear();
gApi.changes().id(r.getChangeId()).addReviewer(addReviewer);
assertThat(sender.getMessages()).hasSize(1);
assertThat(sender.getMessages().get(0).rcpt()).containsExactly(userToNotify.emailAddress);
}
use of com.google.gerrit.extensions.api.changes.AddReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersByEmailIT method convertFromCCToReviewer.
@Test
public void convertFromCCToReviewer() throws Exception {
assume().that(notesMigration.readChanges()).isTrue();
AccountInfo acc = new AccountInfo("Foo Bar", "foo.bar@gerritcodereview.com");
PushOneCommit.Result r = createChange();
AddReviewerInput addInput = new AddReviewerInput();
addInput.reviewer = toRfcAddressString(acc);
addInput.state = ReviewerState.CC;
gApi.changes().id(r.getChangeId()).addReviewer(addInput);
AddReviewerInput modifyInput = new AddReviewerInput();
modifyInput.reviewer = addInput.reviewer;
modifyInput.state = ReviewerState.REVIEWER;
gApi.changes().id(r.getChangeId()).addReviewer(modifyInput);
ChangeInfo info = gApi.changes().id(r.getChangeId()).get(EnumSet.of(ListChangesOption.DETAILED_LABELS));
assertThat(info.reviewers).isEqualTo(ImmutableMap.of(ReviewerState.REVIEWER, ImmutableList.of(acc)));
}
use of com.google.gerrit.extensions.api.changes.AddReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersByEmailIT method addByEmail.
@Test
public void addByEmail() throws Exception {
assume().that(notesMigration.readChanges()).isTrue();
AccountInfo acc = new AccountInfo("Foo Bar", "foo.bar@gerritcodereview.com");
for (ReviewerState state : ImmutableList.of(ReviewerState.CC, ReviewerState.REVIEWER)) {
PushOneCommit.Result r = createChange();
AddReviewerInput input = new AddReviewerInput();
input.reviewer = toRfcAddressString(acc);
input.state = state;
gApi.changes().id(r.getChangeId()).addReviewer(input);
ChangeInfo info = gApi.changes().id(r.getChangeId()).get(EnumSet.of(ListChangesOption.DETAILED_LABELS));
assertThat(info.reviewers).isEqualTo(ImmutableMap.of(state, ImmutableList.of(acc)));
// All reviewers added by email should be removable
assertThat(info.removableReviewers).isEqualTo(ImmutableList.of(acc));
}
}
Aggregations