use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class OpenRepoTest method addToAttentionSet.
private void addToAttentionSet(ChangeUpdate update) {
AttentionSetUpdate attentionSetUpdate = AttentionSetUpdate.createForWrite(otherUser.getAccountId(), AttentionSetUpdate.Operation.ADD, "test");
update.addToPlannedAttentionSetUpdates(ImmutableSet.of(attentionSetUpdate));
}
use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class AttentionSetIT method addUsersAsReviewerAndAttentionSetInPrivateChanges.
@Test
public void addUsersAsReviewerAndAttentionSetInPrivateChanges() throws Exception {
PushOneCommit.Result r = createChange();
change(r).setPrivate(true);
change(r).current().review(new ReviewInput().reviewer(user.email()));
AttentionSetUpdate attentionSet = Iterables.getOnlyElement(getAttentionSetUpdatesForUser(r, user));
assertThat(attentionSet).hasAccountIdThat().isEqualTo(user.id());
assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.ADD);
assertThat(attentionSet).hasReasonThat().isEqualTo("Reviewer was added");
}
use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class ChangeNotesTest method DoesNotFilterLatestAttentionSetUpdates.
@Test
public void DoesNotFilterLatestAttentionSetUpdates() throws Exception {
Change c = newChange();
ChangeUpdate update = newUpdate(c, changeOwner);
AttentionSetUpdate firstAttentionSetUpdate = AttentionSetUpdate.createForWrite(changeOwner.getAccountId(), Operation.ADD, "test");
update.addToPlannedAttentionSetUpdates(ImmutableSet.of(firstAttentionSetUpdate));
update.commit();
update = newUpdate(c, changeOwner);
firstAttentionSetUpdate = addTimestamp(firstAttentionSetUpdate, c);
AttentionSetUpdate secondAttentionSetUpdate = AttentionSetUpdate.createForWrite(changeOwner.getAccountId(), Operation.REMOVE, "test");
update.addToPlannedAttentionSetUpdates(ImmutableSet.of(secondAttentionSetUpdate));
update.commit();
secondAttentionSetUpdate = addTimestamp(secondAttentionSetUpdate, c);
ChangeNotes notes = newNotes(c);
assertThat(notes.getAttentionSetUpdates()).containsExactly(secondAttentionSetUpdate, firstAttentionSetUpdate);
}
use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class ChangeNotesTest method addAttentionStatusForMultipleUsers.
@Test
public void addAttentionStatusForMultipleUsers() throws Exception {
Change c = newChange();
ChangeUpdate update = newUpdate(c, changeOwner);
// put the user as cc to ensure that the user took part in this change.
update.putReviewer(otherUser.getAccount().id(), CC);
AttentionSetUpdate attentionSetUpdate0 = AttentionSetUpdate.createForWrite(changeOwner.getAccountId(), Operation.ADD, "test");
AttentionSetUpdate attentionSetUpdate1 = AttentionSetUpdate.createForWrite(otherUser.getAccountId(), Operation.ADD, "test");
update.addToPlannedAttentionSetUpdates(ImmutableSet.of(attentionSetUpdate0, attentionSetUpdate1));
update.commit();
ChangeNotes notes = newNotes(c);
assertThat(notes.getAttentionSet()).containsExactly(addTimestamp(attentionSetUpdate0, c), addTimestamp(attentionSetUpdate1, c));
}
use of com.google.gerrit.entities.AttentionSetUpdate in project gerrit by GerritCodeReview.
the class ChangeNotesTest method addAttentionStatus_rejectIfSameUserTwice.
@Test
public void addAttentionStatus_rejectIfSameUserTwice() throws Exception {
Change c = newChange();
ChangeUpdate update = newUpdate(c, changeOwner);
AttentionSetUpdate attentionSetUpdate0 = AttentionSetUpdate.createForWrite(changeOwner.getAccountId(), Operation.ADD, "test 0");
AttentionSetUpdate attentionSetUpdate1 = AttentionSetUpdate.createForWrite(changeOwner.getAccountId(), Operation.ADD, "test 1");
IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> update.addToPlannedAttentionSetUpdates(ImmutableSet.of(attentionSetUpdate0, attentionSetUpdate1)));
assertThat(thrown).hasMessageThat().contains("must not specify multiple updates for single user");
}
Aggregations