use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class AccountIT method addReviewerToIgnoredChange.
@Test
public void addReviewerToIgnoredChange() throws Exception {
AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(accountIndexedCounter)) {
PushOneCommit.Result r = createChange();
requestScopeOperations.setApiUser(user.id());
gApi.changes().id(r.getChangeId()).ignore(true);
sender.clear();
requestScopeOperations.setApiUser(admin.id());
ReviewerInput in = new ReviewerInput();
in.reviewer = user.email();
gApi.changes().id(r.getChangeId()).addReviewer(in);
List<Message> messages = sender.getMessages();
assertThat(messages).hasSize(0);
}
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class AccountIT method ignoreChange.
@Test
public void ignoreChange() throws Exception {
AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(accountIndexedCounter)) {
TestAccount user2 = accountCreator.user2();
accountIndexedCounter.clear();
PushOneCommit.Result r = createChange();
ReviewerInput in = new ReviewerInput();
in.reviewer = user.email();
gApi.changes().id(r.getChangeId()).addReviewer(in);
in = new ReviewerInput();
in.reviewer = user2.email();
gApi.changes().id(r.getChangeId()).addReviewer(in);
requestScopeOperations.setApiUser(user.id());
gApi.changes().id(r.getChangeId()).ignore(true);
sender.clear();
requestScopeOperations.setApiUser(admin.id());
gApi.changes().id(r.getChangeId()).abandon();
List<Message> messages = sender.getMessages();
assertThat(messages).hasSize(1);
assertThat(messages.get(0).rcpt()).containsExactly(user2.getNameEmail());
accountIndexedCounter.assertNoReindex();
}
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class OutgoingEmailIT method htmlAndPlainTextSuffixAddedToMessageId.
@Test
public void htmlAndPlainTextSuffixAddedToMessageId() throws Exception {
PushOneCommit.Result result = createChange();
GeneralPreferencesInfo generalPreferencesInfo = new GeneralPreferencesInfo();
generalPreferencesInfo.emailFormat = GeneralPreferencesInfo.EmailFormat.PLAINTEXT;
gApi.accounts().id(user.id().get()).setPreferences(generalPreferencesInfo);
ReviewerInput reviewerInput = new ReviewerInput();
reviewerInput.reviewer = user.email();
gApi.changes().id(result.getChangeId()).addReviewer(reviewerInput);
sender.clear();
gApi.changes().id(result.getChangeId()).current().review(ReviewInput.approve());
assertThat(getMessageId(sender)).contains("-PLAIN");
sender.clear();
generalPreferencesInfo.emailFormat = GeneralPreferencesInfo.EmailFormat.HTML_PLAINTEXT;
gApi.accounts().id(user.id().get()).setPreferences(generalPreferencesInfo);
sender.clear();
gApi.changes().id(result.getChangeId()).current().review(ReviewInput.reject());
assertThat(getMessageId(sender)).contains("-HTML");
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersByEmailIT method addByEmail.
@Test
public void addByEmail() throws Exception {
AccountInfo acc = new AccountInfo("Foo Bar", "foo.bar@gerritcodereview.com");
for (ReviewerState state : ImmutableList.of(ReviewerState.CC, ReviewerState.REVIEWER)) {
PushOneCommit.Result r = createChange();
ReviewerInput input = new ReviewerInput();
input.reviewer = toRfcAddressString(acc);
input.state = state;
gApi.changes().id(r.getChangeId()).addReviewer(input);
ChangeInfo info = gApi.changes().id(r.getChangeId()).get(DETAILED_LABELS);
assertThat(info.reviewers).containsExactly(state, ImmutableList.of(acc));
// All reviewers added by email should be removable
assertThat(info.removableReviewers).containsExactly(acc);
}
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersByEmailIT method addExistingCcByEmailShortCircuits.
@Test
public void addExistingCcByEmailShortCircuits() throws Exception {
PushOneCommit.Result r = createChange();
ReviewerInput input = new ReviewerInput();
input.reviewer = "nonexisting@example.com";
input.state = ReviewerState.CC;
ReviewerResult result = gApi.changes().id(r.getChangeId()).addReviewer(input);
assertThat(result.ccs).hasSize(1);
AccountInfo info = result.ccs.get(0);
assertThat(info._accountId).isNull();
assertThat(info.email).isEqualTo(input.reviewer);
assertThat(gApi.changes().id(r.getChangeId()).addReviewer(input).ccs).isEmpty();
}
Aggregations