use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class AttentionSetIT method reviewRemovesUserFromAttentionSet.
@Test
public void reviewRemovesUserFromAttentionSet() throws Exception {
PushOneCommit.Result r = createChange();
change(r).addToAttentionSet(new AttentionSetInput(admin.email(), "reason"));
ReviewInput reviewInput = new ReviewInput();
change(r).current().review(reviewInput);
AttentionSetUpdate attentionSet = Iterables.getOnlyElement(r.getChange().attentionSet());
assertThat(attentionSet).hasAccountIdThat().isEqualTo(admin.id());
assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.REMOVE);
assertThat(attentionSet).hasReasonThat().isEqualTo("removed on reply");
}
use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class AttentionSetIT method ccsConsideredSameAsRemovedForExistingReviewers.
@Test
public void ccsConsideredSameAsRemovedForExistingReviewers() throws Exception {
PushOneCommit.Result r = createChange();
change(r).addReviewer(user.email());
ReviewerInput reviewerInput = new ReviewerInput();
reviewerInput.state = ReviewerState.CC;
reviewerInput.reviewer = user.email();
change(r).addReviewer(reviewerInput);
AttentionSetUpdate attentionSet = Iterables.getOnlyElement(r.getChange().attentionSet());
assertThat(attentionSet).hasAccountIdThat().isEqualTo(user.id());
assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.REMOVE);
assertThat(attentionSet).hasReasonThat().isEqualTo("Reviewer/Cc was removed");
}
use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class AttentionSetIT method readyForReviewAddsAllReviewersToAttentionSet.
@Test
public void readyForReviewAddsAllReviewersToAttentionSet() throws Exception {
PushOneCommit.Result r = createChange();
change(r).setWorkInProgress();
change(r).addReviewer(user.email());
change(r).setReadyForReview();
AttentionSetUpdate attentionSet = Iterables.getOnlyElement(r.getChange().attentionSet());
assertThat(attentionSet).hasAccountIdThat().isEqualTo(user.id());
assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.ADD);
assertThat(attentionSet).hasReasonThat().isEqualTo("Change was marked ready for review");
}
use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class AttentionSetIT method uploaderRepliesAddsOwner.
@Test
public void uploaderRepliesAddsOwner() throws Exception {
PushOneCommit.Result r = createChange();
r = amendChangeWithUploader(r, project, user);
// Add reviewer and cc
TestAccount reviewer = accountCreator.user2();
TestAccount cc = accountCreator.admin2();
ReviewInput reviewInput = new ReviewInput().blockAutomaticAttentionSetRules();
reviewInput = reviewInput.reviewer(reviewer.email());
reviewInput.reviewer(cc.email(), ReviewerState.CC, false);
change(r).current().review(reviewInput);
requestScopeOperations.setApiUser(user.id());
change(r).current().review(new ReviewInput());
// Reviewer and CC not added since the uploader didn't reply to their comments
assertThat(getAttentionSetUpdatesForUser(r, cc)).isEmpty();
assertThat(getAttentionSetUpdatesForUser(r, reviewer)).isEmpty();
// Owner added
AttentionSetUpdate attentionSet = Iterables.getOnlyElement(getAttentionSetUpdatesForUser(r, admin));
assertThat(attentionSet).hasAccountIdThat().isEqualTo(admin.id());
assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.ADD);
assertThat(attentionSet).hasReasonThat().isEqualTo("Someone else replied on the change");
}
use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class AttentionSetIT method submitRemovesUsersForAllSubmittedChanges.
@Test
public void submitRemovesUsersForAllSubmittedChanges() throws Exception {
PushOneCommit.Result r1 = createChange("refs/heads/master", "file1", "content");
// implictly adds the user to the attention set when adding as reviewer
change(r1).current().review(ReviewInput.approve().reviewer(user.email()));
PushOneCommit.Result r2 = createChange("refs/heads/master", "file2", "content");
change(r2).current().review(ReviewInput.approve().reviewer(user.email()));
change(r2).current().submit();
// Attention set updates that relate to the admin (the person who replied) are filtered out.
AttentionSetUpdate attentionSet = Iterables.getOnlyElement(getAttentionSetUpdatesForUser(r1, user));
assertThat(attentionSet).hasAccountIdThat().isEqualTo(user.id());
assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.REMOVE);
assertThat(attentionSet).hasReasonThat().isEqualTo("Change was submitted");
// Attention set updates that relate to the admin (the person who replied) are filtered out.
attentionSet = Iterables.getOnlyElement(getAttentionSetUpdatesForUser(r2, user));
assertThat(attentionSet).hasAccountIdThat().isEqualTo(user.id());
assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.REMOVE);
assertThat(attentionSet).hasReasonThat().isEqualTo("Change was submitted");
}
Aggregations