Remove more ReviewDb-only tests
ReviewDb is gone and these tests are no longer needed. Some tests in ChangeNotificationsIT are renamed as it's no longer needed to have "InNoteDb" as part of the test name. Change-Id: If8d7f456dfcccfe0c5bdc402371b1f2016a5d796 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -132,9 +132,7 @@ import com.google.gerrit.reviewdb.client.Account;
|
|||||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||||
import com.google.gerrit.reviewdb.client.Branch;
|
import com.google.gerrit.reviewdb.client.Branch;
|
||||||
import com.google.gerrit.reviewdb.client.Change;
|
import com.google.gerrit.reviewdb.client.Change;
|
||||||
import com.google.gerrit.reviewdb.client.LabelId;
|
|
||||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
|
||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
import com.google.gerrit.reviewdb.client.RefNames;
|
import com.google.gerrit.reviewdb.client.RefNames;
|
||||||
import com.google.gerrit.server.ChangeMessagesUtil;
|
import com.google.gerrit.server.ChangeMessagesUtil;
|
||||||
@@ -145,7 +143,6 @@ import com.google.gerrit.server.group.SystemGroupBackend;
|
|||||||
import com.google.gerrit.server.index.change.ChangeIndex;
|
import com.google.gerrit.server.index.change.ChangeIndex;
|
||||||
import com.google.gerrit.server.index.change.ChangeIndexCollection;
|
import com.google.gerrit.server.index.change.ChangeIndexCollection;
|
||||||
import com.google.gerrit.server.index.change.IndexedChangeQuery;
|
import com.google.gerrit.server.index.change.IndexedChangeQuery;
|
||||||
import com.google.gerrit.server.notedb.NoteDbChangeState.PrimaryStorage;
|
|
||||||
import com.google.gerrit.server.project.testing.Util;
|
import com.google.gerrit.server.project.testing.Util;
|
||||||
import com.google.gerrit.server.query.change.ChangeData;
|
import com.google.gerrit.server.query.change.ChangeData;
|
||||||
import com.google.gerrit.server.restapi.change.PostReview;
|
import com.google.gerrit.server.restapi.change.PostReview;
|
||||||
@@ -161,7 +158,6 @@ import java.sql.Timestamp;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1914,26 +1910,6 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
assertThat(rsrc.getChange().getLastUpdatedOn()).isNotEqualTo(oldTs);
|
assertThat(rsrc.getChange().getLastUpdatedOn()).isNotEqualTo(oldTs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addReviewerWithNoteDbWhenDummyApprovalInReviewDbExists() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
|
||||||
assume().that(notesMigration.changePrimaryStorage()).isEqualTo(PrimaryStorage.REVIEW_DB);
|
|
||||||
|
|
||||||
PushOneCommit.Result r = createChange();
|
|
||||||
|
|
||||||
// insert dummy approval in ReviewDb
|
|
||||||
PatchSetApproval psa =
|
|
||||||
new PatchSetApproval(
|
|
||||||
new PatchSetApproval.Key(r.getPatchSetId(), user.id, new LabelId("Code-Review")),
|
|
||||||
(short) 0,
|
|
||||||
TimeUtil.nowTs());
|
|
||||||
db.patchSetApprovals().insert(Collections.singleton(psa));
|
|
||||||
|
|
||||||
AddReviewerInput in = new AddReviewerInput();
|
|
||||||
in.reviewer = user.email;
|
|
||||||
gApi.changes().id(r.getChangeId()).addReviewer(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addSelfAsReviewer() throws Exception {
|
public void addSelfAsReviewer() throws Exception {
|
||||||
TestTimeUtil.resetWithClockStep(1, SECONDS);
|
TestTimeUtil.resetWithClockStep(1, SECONDS);
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import com.google.gerrit.extensions.common.FixSuggestionInfo;
|
|||||||
import com.google.gerrit.extensions.common.RobotCommentInfo;
|
import com.google.gerrit.extensions.common.RobotCommentInfo;
|
||||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||||
import com.google.gerrit.extensions.restapi.BinaryResult;
|
import com.google.gerrit.extensions.restapi.BinaryResult;
|
||||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
|
||||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||||
@@ -1007,22 +1006,6 @@ public class RobotCommentsIT extends AbstractDaemonTest {
|
|||||||
assertThat(editInfo).baseRevision().isEqualTo(currentRevision);
|
assertThat(editInfo).baseRevision().isEqualTo(currentRevision);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void robotCommentsNotSupportedWithoutNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
|
|
||||||
RobotCommentInput in = createRobotCommentInput();
|
|
||||||
ReviewInput reviewInput = new ReviewInput();
|
|
||||||
Map<String, List<RobotCommentInput>> robotComments = new HashMap<>();
|
|
||||||
robotComments.put(in.path, ImmutableList.of(in));
|
|
||||||
reviewInput.robotComments = robotComments;
|
|
||||||
reviewInput.message = "comment test";
|
|
||||||
|
|
||||||
exception.expect(MethodNotAllowedException.class);
|
|
||||||
exception.expectMessage("robot comments not supported");
|
|
||||||
gApi.changes().id(changeId).current().review(reviewInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void queryChangesWithCommentCounts() throws Exception {
|
public void queryChangesWithCommentCounts() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
|
|||||||
@@ -1362,14 +1362,6 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
assertThat(hashtags).containsExactlyElementsIn(expected);
|
assertThat(hashtags).containsExactlyElementsIn(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void pushForMasterWithHashtagsNoteDbDisabled() throws Exception {
|
|
||||||
// Push with hashtags should fail when reading from NoteDb is disabled.
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
PushOneCommit.Result r = pushTo("refs/for/master%hashtag=tag1");
|
|
||||||
r.assertErrorStatus("cannot add hashtags; noteDb is disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void pushCommitUsingSignedOffBy() throws Exception {
|
public void pushCommitUsingSignedOffBy() throws Exception {
|
||||||
PushOneCommit push =
|
PushOneCommit push =
|
||||||
|
|||||||
@@ -255,30 +255,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
* AddReviewerSender tests.
|
* AddReviewerSender tests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void addReviewerToReviewableChangeInReviewDb(Adder adder) throws Exception {
|
private void addReviewerToReviewableChange(Adder adder) throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
|
||||||
addReviewer(adder, sc.changeId, sc.owner, reviewer.email);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newchange", sc)
|
|
||||||
.to(reviewer)
|
|
||||||
.cc(sc.reviewer, sc.ccer)
|
|
||||||
.cc(sc.reviewerByEmail, sc.ccerByEmail)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addReviewerToReviewableChangeInReviewDbSingly() throws Exception {
|
|
||||||
addReviewerToReviewableChangeInReviewDb(singly());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addReviewerToReviewableChangeInReviewDbBatch() throws Exception {
|
|
||||||
addReviewerToReviewableChangeInReviewDb(batch());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addReviewerToReviewableChangeInNoteDb(Adder adder) throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
||||||
@@ -293,16 +270,16 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeInNoteDbSingly() throws Exception {
|
public void addReviewerToReviewableChangeSingly() throws Exception {
|
||||||
addReviewerToReviewableChangeInNoteDb(singly());
|
addReviewerToReviewableChange(singly());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeInNoteDbBatch() throws Exception {
|
public void addReviewerToReviewableChangeBatch() throws Exception {
|
||||||
addReviewerToReviewableChangeInNoteDb(batch());
|
addReviewerToReviewableChange(batch());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReviewerToReviewableChangeByOwnerCcingSelfInNoteDb(Adder adder) throws Exception {
|
private void addReviewerToReviewableChangeByOwnerCcingSelf(Adder adder) throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
||||||
@@ -317,16 +294,16 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeByOwnerCcingSelfInNoteDbSingly() throws Exception {
|
public void addReviewerToReviewableChangeByOwnerCcingSelfSingly() throws Exception {
|
||||||
addReviewerToReviewableChangeByOwnerCcingSelfInNoteDb(singly());
|
addReviewerToReviewableChangeByOwnerCcingSelf(singly());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeByOwnerCcingSelfInNoteDbBatch() throws Exception {
|
public void addReviewerToReviewableChangeByOwnerCcingSelfBatch() throws Exception {
|
||||||
addReviewerToReviewableChangeByOwnerCcingSelfInNoteDb(batch());
|
addReviewerToReviewableChangeByOwnerCcingSelf(batch());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReviewerToReviewableChangeByOtherInNoteDb(Adder adder) throws Exception {
|
private void addReviewerToReviewableChangeByOther(Adder adder) throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
TestAccount other = accountCreator.create("other", "other@example.com", "other");
|
TestAccount other = accountCreator.create("other", "other@example.com", "other");
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -342,16 +319,16 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeByOtherInNoteDbSingly() throws Exception {
|
public void addReviewerToReviewableChangeByOtherSingly() throws Exception {
|
||||||
addReviewerToReviewableChangeByOtherInNoteDb(singly());
|
addReviewerToReviewableChangeByOther(singly());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeByOtherInNoteDbBatch() throws Exception {
|
public void addReviewerToReviewableChangeByOtherBatch() throws Exception {
|
||||||
addReviewerToReviewableChangeByOtherInNoteDb(batch());
|
addReviewerToReviewableChangeByOther(batch());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReviewerToReviewableChangeByOtherCcingSelfInNoteDb(Adder adder) throws Exception {
|
private void addReviewerToReviewableChangeByOtherCcingSelf(Adder adder) throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
TestAccount other = accountCreator.create("other", "other@example.com", "other");
|
TestAccount other = accountCreator.create("other", "other@example.com", "other");
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -367,34 +344,16 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeByOtherCcingSelfInNoteDbSingly() throws Exception {
|
public void addReviewerToReviewableChangeByOtherCcingSelfSingly() throws Exception {
|
||||||
addReviewerToReviewableChangeByOtherCcingSelfInNoteDb(singly());
|
addReviewerToReviewableChangeByOtherCcingSelf(singly());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeByOtherCcingSelfInNoteDbBatch() throws Exception {
|
public void addReviewerToReviewableChangeByOtherCcingSelfBatch() throws Exception {
|
||||||
addReviewerToReviewableChangeByOtherCcingSelfInNoteDb(batch());
|
addReviewerToReviewableChangeByOtherCcingSelf(batch());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReviewerByEmailToReviewableChangeInReviewDb(Adder adder) throws Exception {
|
private void addReviewerByEmailToReviewableChange(Adder adder) throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
String email = "addedbyemail@example.com";
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
addReviewer(adder, sc.changeId, sc.owner, email);
|
|
||||||
assertThat(sender).notSent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addReviewerByEmailToReviewableChangeInReviewDbSingly() throws Exception {
|
|
||||||
addReviewerByEmailToReviewableChangeInReviewDb(singly());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addReviewerByEmailToReviewableChangeInReviewDbBatch() throws Exception {
|
|
||||||
addReviewerByEmailToReviewableChangeInReviewDb(batch());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addReviewerByEmailToReviewableChangeInNoteDb(Adder adder) throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
String email = "addedbyemail@example.com";
|
String email = "addedbyemail@example.com";
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -409,13 +368,13 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerByEmailToReviewableChangeInNoteDbSingly() throws Exception {
|
public void addReviewerByEmailToReviewableChangeSingly() throws Exception {
|
||||||
addReviewerByEmailToReviewableChangeInNoteDb(singly());
|
addReviewerByEmailToReviewableChange(singly());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerByEmailToReviewableChangeInNoteDbBatch() throws Exception {
|
public void addReviewerByEmailToReviewableChangeBatch() throws Exception {
|
||||||
addReviewerByEmailToReviewableChangeInNoteDb(batch());
|
addReviewerByEmailToReviewableChange(batch());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReviewerToWipChange(Adder adder) throws Exception {
|
private void addReviewerToWipChange(Adder adder) throws Exception {
|
||||||
@@ -452,7 +411,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
addReviewerToReviewableWipChange(batch());
|
addReviewerToReviewableWipChange(batch());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReviewerToWipChangeInNoteDbNotifyAll(Adder adder) throws Exception {
|
private void addReviewerToWipChangeNotifyAll(Adder adder) throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageWipChange();
|
StagedChange sc = stageWipChange();
|
||||||
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
||||||
@@ -467,40 +426,16 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToWipChangeInNoteDbNotifyAllSingly() throws Exception {
|
public void addReviewerToWipChangeNotifyAllSingly() throws Exception {
|
||||||
addReviewerToWipChangeInNoteDbNotifyAll(singly());
|
addReviewerToWipChangeNotifyAll(singly());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToWipChangeInNoteDbNotifyAllBatch() throws Exception {
|
public void addReviewerToWipChangeNotifyAllBatch() throws Exception {
|
||||||
addReviewerToWipChangeInNoteDbNotifyAll(batch());
|
addReviewerToWipChangeNotifyAll(batch());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReviewerToWipChangeInReviewDbNotifyAll(Adder adder) throws Exception {
|
private void addReviewerToReviewableChangeNotifyOwnerReviewers(Adder adder) throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageWipChange();
|
|
||||||
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
|
||||||
addReviewer(adder, sc.changeId, sc.owner, reviewer.email, NotifyHandling.ALL);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newchange", sc)
|
|
||||||
.to(reviewer)
|
|
||||||
.cc(sc.reviewer, sc.ccer)
|
|
||||||
.cc(sc.reviewerByEmail, sc.ccerByEmail)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addReviewerToWipChangeInReviewDbNotifyAllSingly() throws Exception {
|
|
||||||
addReviewerToWipChangeInReviewDbNotifyAll(singly());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addReviewerToWipChangeInReviewDbNotifyAllBatch() throws Exception {
|
|
||||||
addReviewerToWipChangeInReviewDbNotifyAll(batch());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addReviewerToReviewableChangeInNoteDbNotifyOwnerReviewers(Adder adder)
|
|
||||||
throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
TestAccount reviewer = accountCreator.create("added", "added@example.com", "added");
|
||||||
@@ -515,16 +450,16 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeInNoteDbNotifyOwnerReviewersSingly() throws Exception {
|
public void addReviewerToReviewableChangeNotifyOwnerReviewersSingly() throws Exception {
|
||||||
addReviewerToReviewableChangeInNoteDbNotifyOwnerReviewers(singly());
|
addReviewerToReviewableChangeNotifyOwnerReviewers(singly());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeInNoteDbNotifyOwnerReviewersBatch() throws Exception {
|
public void addReviewerToReviewableChangeNotifyOwnerReviewersBatch() throws Exception {
|
||||||
addReviewerToReviewableChangeInNoteDbNotifyOwnerReviewers(batch());
|
addReviewerToReviewableChangeNotifyOwnerReviewers(batch());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyOwner(Adder adder)
|
private void addReviewerToReviewableChangeByOwnerCcingSelfNotifyOwner(Adder adder)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -534,18 +469,16 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyOwnerSingly()
|
public void addReviewerToReviewableChangeByOwnerCcingSelfNotifyOwnerSingly() throws Exception {
|
||||||
throws Exception {
|
addReviewerToReviewableChangeByOwnerCcingSelfNotifyOwner(singly());
|
||||||
addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyOwner(singly());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyOwnerBatch()
|
public void addReviewerToReviewableChangeByOwnerCcingSelfNotifyOwnerBatch() throws Exception {
|
||||||
throws Exception {
|
addReviewerToReviewableChangeByOwnerCcingSelfNotifyOwner(batch());
|
||||||
addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyOwner(batch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyNone(Adder adder)
|
private void addReviewerToReviewableChangeByOwnerCcingSelfNotifyNone(Adder adder)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -555,18 +488,16 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyNoneSingly()
|
public void addReviewerToReviewableChangeByOwnerCcingSelfNotifyNoneSingly() throws Exception {
|
||||||
throws Exception {
|
addReviewerToReviewableChangeByOwnerCcingSelfNotifyNone(singly());
|
||||||
addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyNone(singly());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyNoneBatch()
|
public void addReviewerToReviewableChangeByOwnerCcingSelfNotifyNoneBatch() throws Exception {
|
||||||
throws Exception {
|
addReviewerToReviewableChangeByOwnerCcingSelfNotifyNone(batch());
|
||||||
addReviewerToReviewableChangeInNoteDbByOwnerCcingSelfNotifyNone(batch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addNonUserReviewerByEmailInNoteDb(Adder adder) throws Exception {
|
private void addNonUserReviewerByEmail(Adder adder) throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
addReviewer(adder, sc.changeId, sc.owner, "nonexistent@example.com");
|
addReviewer(adder, sc.changeId, sc.owner, "nonexistent@example.com");
|
||||||
@@ -579,16 +510,16 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addNonUserReviewerByEmailInNoteDbSingly() throws Exception {
|
public void addNonUserReviewerByEmailSingly() throws Exception {
|
||||||
addNonUserReviewerByEmailInNoteDb(singly(ReviewerState.REVIEWER));
|
addNonUserReviewerByEmail(singly(ReviewerState.REVIEWER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addNonUserReviewerByEmailInNoteDbBatch() throws Exception {
|
public void addNonUserReviewerByEmailBatch() throws Exception {
|
||||||
addNonUserReviewerByEmailInNoteDb(batch(ReviewerState.REVIEWER));
|
addNonUserReviewerByEmail(batch(ReviewerState.REVIEWER));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addNonUserCcByEmailInNoteDb(Adder adder) throws Exception {
|
private void addNonUserCcByEmail(Adder adder) throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
addReviewer(adder, sc.changeId, sc.owner, "nonexistent@example.com");
|
addReviewer(adder, sc.changeId, sc.owner, "nonexistent@example.com");
|
||||||
@@ -601,13 +532,13 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addNonUserCcByEmailInNoteDbSingly() throws Exception {
|
public void addNonUserCcByEmailSingly() throws Exception {
|
||||||
addNonUserCcByEmailInNoteDb(singly(ReviewerState.CC));
|
addNonUserCcByEmail(singly(ReviewerState.CC));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addNonUserCcByEmailInNoteDbBatch() throws Exception {
|
public void addNonUserCcByEmailBatch() throws Exception {
|
||||||
addNonUserCcByEmailInNoteDb(batch(ReviewerState.CC));
|
addNonUserCcByEmail(batch(ReviewerState.CC));
|
||||||
}
|
}
|
||||||
|
|
||||||
private interface Adder {
|
private interface Adder {
|
||||||
@@ -923,7 +854,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addReviewerOnWipChangeAndStartReviewInNoteDb() throws Exception {
|
public void addReviewerOnWipChangeAndStartReview() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageWipChange();
|
StagedChange sc = stageWipChange();
|
||||||
ReviewInput in = ReviewInput.noScore().reviewer(other.email).setWorkInProgress(false);
|
ReviewInput in = ReviewInput.noScore().reviewer(other.email).setWorkInProgress(false);
|
||||||
@@ -945,28 +876,6 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
assertThat(sender).notSent();
|
assertThat(sender).notSent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addReviewerOnWipChangeAndStartReviewInReviewDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageWipChange();
|
|
||||||
ReviewInput in = ReviewInput.noScore().reviewer(other.email).setWorkInProgress(false);
|
|
||||||
gApi.changes().id(sc.changeId).revision("current").review(in);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("comment", sc)
|
|
||||||
.cc(sc.reviewer, sc.ccer, other)
|
|
||||||
.cc(sc.reviewerByEmail, sc.ccerByEmail)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(ALL_COMMENTS)
|
|
||||||
.noOneElse();
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newchange", sc)
|
|
||||||
.to(other)
|
|
||||||
.cc(sc.reviewer, sc.ccer)
|
|
||||||
.cc(sc.reviewerByEmail, sc.ccerByEmail)
|
|
||||||
.noOneElse();
|
|
||||||
assertThat(sender).notSent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void startReviewMessageNotRepeated() throws Exception {
|
public void startReviewMessageNotRepeated() throws Exception {
|
||||||
// TODO(logan): Remove this test check once PolyGerrit workaround is rolled back.
|
// TODO(logan): Remove this test check once PolyGerrit workaround is rolled back.
|
||||||
@@ -1104,7 +1013,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createReviewableChangeWithReviewersAndCcsByEmailInNoteDb() throws Exception {
|
public void createReviewableChangeWithReviewersAndCcsByEmail() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedPreChange spc =
|
StagedPreChange spc =
|
||||||
stagePreChange(
|
stagePreChange(
|
||||||
@@ -1290,7 +1199,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void deleteReviewerByEmailFromWipChangeInNoteDb() throws Exception {
|
public void deleteReviewerByEmailFromWipChange() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageWipChangeWithExtraReviewer();
|
StagedChange sc = stageWipChangeWithExtraReviewer();
|
||||||
gApi.changes().id(sc.changeId).reviewer(sc.reviewerByEmail).remove();
|
gApi.changes().id(sc.changeId).reviewer(sc.reviewerByEmail).remove();
|
||||||
@@ -1650,7 +1559,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetByOwnerOnReviewableChangeInNoteDb() throws Exception {
|
public void newPatchSetByOwnerOnReviewableChange() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
pushTo(sc, "refs/for/master", sc.owner);
|
pushTo(sc, "refs/for/master", sc.owner);
|
||||||
@@ -1665,20 +1574,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetByOwnerOnReviewableChangeInReviewDb() throws Exception {
|
public void newPatchSetByOtherOnReviewableChange() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
pushTo(sc, "refs/for/master", sc.owner);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetByOtherOnReviewableChangeInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
pushTo(sc, "refs/for/master", other);
|
pushTo(sc, "refs/for/master", other);
|
||||||
@@ -1694,21 +1590,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetByOtherOnReviewableChangeInReviewDb() throws Exception {
|
public void newPatchSetByOtherOnReviewableChangeOwnerSelfCc() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
pushTo(sc, "refs/for/master", other);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.notTo(sc.owner) // TODO(logan): This email shouldn't come from the owner.
|
|
||||||
.to(sc.reviewer, sc.ccer, other)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetByOtherOnReviewableChangeOwnerSelfCcInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
pushTo(sc, "refs/for/master", other, EmailStrategy.CC_ON_OWN_COMMENTS);
|
pushTo(sc, "refs/for/master", other, EmailStrategy.CC_ON_OWN_COMMENTS);
|
||||||
@@ -1724,21 +1606,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetByOtherOnReviewableChangeOwnerSelfCcInReviewDb() throws Exception {
|
public void newPatchSetByOtherOnReviewableChangeNotifyOwnerReviewers() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
pushTo(sc, "refs/for/master", other, EmailStrategy.CC_ON_OWN_COMMENTS);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.notTo(sc.owner) // TODO(logan): This shouldn't be sent *from* the owner.
|
|
||||||
.to(sc.reviewer, sc.ccer, other)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetByOtherOnReviewableChangeNotifyOwnerReviewersInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
pushTo(sc, "refs/for/master%notify=OWNER_REVIEWERS", other);
|
pushTo(sc, "refs/for/master%notify=OWNER_REVIEWERS", other);
|
||||||
@@ -1753,21 +1621,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetByOtherOnReviewableChangeNotifyOwnerReviewersInReviewDb()
|
public void newPatchSetByOtherOnReviewableChangeOwnerSelfCcNotifyOwnerReviewers()
|
||||||
throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
pushTo(sc, "refs/for/master%notify=OWNER_REVIEWERS", other);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.notTo(sc.owner) // TODO(logan): This shouldn't be sent *from* the owner.
|
|
||||||
.to(sc.reviewer, sc.ccer)
|
|
||||||
.to(other)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetByOtherOnReviewableChangeOwnerSelfCcNotifyOwnerReviewersInNoteDb()
|
|
||||||
throws Exception {
|
throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -1782,20 +1636,6 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
.noOneElse();
|
.noOneElse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetByOtherOnReviewableChangeOwnerSelfCcNotifyOwnerReviewersInReviewDb()
|
|
||||||
throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
pushTo(sc, "refs/for/master%notify=OWNER_REVIEWERS", other, EmailStrategy.CC_ON_OWN_COMMENTS);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer)
|
|
||||||
.to(other)
|
|
||||||
.notTo(sc.owner) // TODO(logan): This shouldn't be sent *from* the owner.
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetByOtherOnReviewableChangeNotifyOwner() throws Exception {
|
public void newPatchSetByOtherOnReviewableChangeNotifyOwner() throws Exception {
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -1843,7 +1683,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetOnWipChangeNotifyAllInNoteDb() throws Exception {
|
public void newPatchSetOnWipChangeNotifyAll() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageWipChange();
|
StagedChange sc = stageWipChange();
|
||||||
pushTo(sc, "refs/for/master%wip,notify=ALL", sc.owner);
|
pushTo(sc, "refs/for/master%wip,notify=ALL", sc.owner);
|
||||||
@@ -1858,20 +1698,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetOnWipChangeNotifyAllInReviewDb() throws Exception {
|
public void newPatchSetOnWipChangeToReady() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageWipChange();
|
|
||||||
pushTo(sc, "refs/for/master%wip,notify=ALL", sc.owner);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetOnWipChangeToReadyInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageWipChange();
|
StagedChange sc = stageWipChange();
|
||||||
pushTo(sc, "refs/for/master%ready", sc.owner);
|
pushTo(sc, "refs/for/master%ready", sc.owner);
|
||||||
@@ -1885,19 +1712,6 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
.noOneElse();
|
.noOneElse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetOnWipChangeToReadyInReviewDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageWipChange();
|
|
||||||
pushTo(sc, "refs/for/master%ready", sc.owner);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetOnReviewableWipChange() throws Exception {
|
public void newPatchSetOnReviewableWipChange() throws Exception {
|
||||||
StagedChange sc = stageReviewableWipChange();
|
StagedChange sc = stageReviewableWipChange();
|
||||||
@@ -1906,7 +1720,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetOnReviewableChangeAddingReviewerInNoteDb() throws Exception {
|
public void newPatchSetOnReviewableChangeAddingReviewer() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
TestAccount newReviewer = sc.testAccount("newReviewer");
|
TestAccount newReviewer = sc.testAccount("newReviewer");
|
||||||
@@ -1922,22 +1736,6 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
assertThat(sender).notSent();
|
assertThat(sender).notSent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetOnReviewableChangeAddingReviewerInReviewDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
TestAccount newReviewer = sc.testAccount("newReviewer");
|
|
||||||
pushTo(sc, "refs/for/master%r=" + newReviewer.username, sc.owner);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer, newReviewer)
|
|
||||||
.cc(sc.reviewerByEmail, sc.ccerByEmail)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
assertThat(sender).notSent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetOnWipChangeAddingReviewer() throws Exception {
|
public void newPatchSetOnWipChangeAddingReviewer() throws Exception {
|
||||||
StagedChange sc = stageWipChange();
|
StagedChange sc = stageWipChange();
|
||||||
@@ -1947,7 +1745,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetOnWipChangeAddingReviewerNotifyAllInNoteDb() throws Exception {
|
public void newPatchSetOnWipChangeAddingReviewerNotifyAll() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageWipChange();
|
StagedChange sc = stageWipChange();
|
||||||
TestAccount newReviewer = sc.testAccount("newReviewer");
|
TestAccount newReviewer = sc.testAccount("newReviewer");
|
||||||
@@ -1964,23 +1762,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newPatchSetOnWipChangeAddingReviewerNotifyAllInReviewDb() throws Exception {
|
public void newPatchSetOnWipChangeSettingReady() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageWipChange();
|
|
||||||
TestAccount newReviewer = sc.testAccount("newReviewer");
|
|
||||||
pushTo(sc, "refs/for/master%notify=ALL,r=" + newReviewer.username, sc.owner);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer, newReviewer)
|
|
||||||
.cc(sc.reviewerByEmail, sc.ccerByEmail)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
assertThat(sender).notSent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetOnWipChangeSettingReadyInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageWipChange();
|
StagedChange sc = stageWipChange();
|
||||||
pushTo(sc, "refs/for/master%ready", sc.owner);
|
pushTo(sc, "refs/for/master%ready", sc.owner);
|
||||||
@@ -1995,21 +1777,6 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
assertThat(sender).notSent();
|
assertThat(sender).notSent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void newPatchSetOnWipChangeSettingReadyInReviewDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageWipChange();
|
|
||||||
pushTo(sc, "refs/for/master%ready", sc.owner);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer)
|
|
||||||
.cc(sc.reviewerByEmail, sc.ccerByEmail)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
assertThat(sender).notSent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pushTo(StagedChange sc, String ref, TestAccount by) throws Exception {
|
private void pushTo(StagedChange sc, String ref, TestAccount by) throws Exception {
|
||||||
pushTo(sc, ref, by, ENABLED);
|
pushTo(sc, ref, by, ENABLED);
|
||||||
}
|
}
|
||||||
@@ -2021,7 +1788,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void editCommitMessageEditByOwnerOnReviewableChangeInNoteDb() throws Exception {
|
public void editCommitMessageEditByOwnerOnReviewableChange() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
editCommitMessage(sc, sc.owner);
|
editCommitMessage(sc, sc.owner);
|
||||||
@@ -2036,20 +1803,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void editCommitMessageEditByOwnerOnReviewableChangeInReviewDb() throws Exception {
|
public void editCommitMessageEditByOtherOnReviewableChange() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
editCommitMessage(sc, sc.owner);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void editCommitMessageEditByOtherOnReviewableChangeInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
editCommitMessage(sc, other);
|
editCommitMessage(sc, other);
|
||||||
@@ -2064,20 +1818,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void editCommitMessageEditByOtherOnReviewableChangeInReviewDb() throws Exception {
|
public void editCommitMessageByOtherOnReviewableChangeOwnerSelfCc() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
editCommitMessage(sc, other);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.owner, sc.reviewer, sc.ccer)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void editCommitMessageByOtherOnReviewableChangeOwnerSelfCcInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
editCommitMessage(sc, other, CC_ON_OWN_COMMENTS);
|
editCommitMessage(sc, other, CC_ON_OWN_COMMENTS);
|
||||||
@@ -2092,21 +1833,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void editCommitMessageByOtherOnReviewableChangeOwnerSelfCcInReviewDb() throws Exception {
|
public void editCommitMessageByOtherOnReviewableChangeNotifyOwnerReviewers() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
editCommitMessage(sc, other, CC_ON_OWN_COMMENTS);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.owner, sc.reviewer, sc.ccer, other)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void editCommitMessageByOtherOnReviewableChangeNotifyOwnerReviewersInNoteDb()
|
|
||||||
throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
editCommitMessage(sc, other, OWNER_REVIEWERS);
|
editCommitMessage(sc, other, OWNER_REVIEWERS);
|
||||||
@@ -2119,16 +1846,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void editCommitMessageByOtherOnReviewableChangeNotifyOwnerReviewersInReviewDb()
|
public void editCommitMessageByOtherOnReviewableChangeOwnerSelfCcNotifyOwnerReviewers()
|
||||||
throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
editCommitMessage(sc, other, OWNER_REVIEWERS);
|
|
||||||
assertThat(sender).sent("newpatchset", sc).to(sc.owner, sc.reviewer, sc.ccer).noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void editCommitMessageByOtherOnReviewableChangeOwnerSelfCcNotifyOwnerReviewersInNoteDb()
|
|
||||||
throws Exception {
|
throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -2141,19 +1859,6 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
.noOneElse();
|
.noOneElse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void editCommitMessageByOtherOnReviewableChangeOwnerSelfCcNotifyOwnerReviewersInReviewDb()
|
|
||||||
throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
editCommitMessage(sc, other, OWNER_REVIEWERS, CC_ON_OWN_COMMENTS);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.owner, sc.reviewer, sc.ccer)
|
|
||||||
.cc(other)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void editCommitMessageByOtherOnReviewableChangeNotifyOwner() throws Exception {
|
public void editCommitMessageByOtherOnReviewableChangeNotifyOwner() throws Exception {
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -2204,7 +1909,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void editCommitMessageOnWipChangeNotifyAllInNoteDb() throws Exception {
|
public void editCommitMessageOnWipChangeNotifyAll() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageWipChange();
|
StagedChange sc = stageWipChange();
|
||||||
editCommitMessage(sc, sc.owner, ALL);
|
editCommitMessage(sc, sc.owner, ALL);
|
||||||
@@ -2218,19 +1923,6 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
.noOneElse();
|
.noOneElse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void editCommitMessageOnWipChangeNotifyAllInReviewDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageWipChange();
|
|
||||||
editCommitMessage(sc, sc.owner, ALL);
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newpatchset", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void editCommitMessage(StagedChange sc, TestAccount by) throws Exception {
|
private void editCommitMessage(StagedChange sc, TestAccount by) throws Exception {
|
||||||
editCommitMessage(sc, by, null, ENABLED);
|
editCommitMessage(sc, by, null, ENABLED);
|
||||||
}
|
}
|
||||||
@@ -2357,30 +2049,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void revertChangeByOwnerInReviewDb() throws Exception {
|
public void revertChangeByOwner() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageChange();
|
|
||||||
revert(sc, sc.owner);
|
|
||||||
|
|
||||||
// email for the newly created revert change
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newchange", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer, sc.watchingProjectOwner, admin)
|
|
||||||
.bcc(NEW_CHANGES, NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
|
|
||||||
// email for the change that is reverted
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("revert", sc)
|
|
||||||
.cc(sc.reviewer, sc.ccer, admin)
|
|
||||||
.cc(sc.reviewerByEmail)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(ALL_COMMENTS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void revertChangeByOwnerInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageChange();
|
StagedChange sc = stageChange();
|
||||||
revert(sc, sc.owner);
|
revert(sc, sc.owner);
|
||||||
@@ -2404,32 +2073,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void revertChangeByOwnerCcingSelfInReviewDb() throws Exception {
|
public void revertChangeByOwnerCcingSelf() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageChange();
|
|
||||||
revert(sc, sc.owner, CC_ON_OWN_COMMENTS);
|
|
||||||
|
|
||||||
// email for the newly created revert change
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newchange", sc)
|
|
||||||
.to(sc.reviewer, sc.ccer, sc.watchingProjectOwner, admin)
|
|
||||||
.cc(sc.owner)
|
|
||||||
.bcc(NEW_CHANGES, NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
|
|
||||||
// email for the change that is reverted
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("revert", sc)
|
|
||||||
.to(sc.owner)
|
|
||||||
.cc(sc.reviewer, sc.ccer, admin)
|
|
||||||
.cc(sc.reviewerByEmail)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(ALL_COMMENTS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void revertChangeByOwnerCcingSelfInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageChange();
|
StagedChange sc = stageChange();
|
||||||
revert(sc, sc.owner, CC_ON_OWN_COMMENTS);
|
revert(sc, sc.owner, CC_ON_OWN_COMMENTS);
|
||||||
@@ -2454,31 +2098,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void revertChangeByOtherInReviewDb() throws Exception {
|
public void revertChangeByOther() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageChange();
|
|
||||||
revert(sc, other);
|
|
||||||
|
|
||||||
// email for the newly created revert change
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newchange", sc)
|
|
||||||
.to(sc.owner, sc.reviewer, sc.ccer, sc.watchingProjectOwner, admin)
|
|
||||||
.bcc(NEW_CHANGES, NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
|
|
||||||
// email for the change that is reverted
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("revert", sc)
|
|
||||||
.to(sc.owner)
|
|
||||||
.cc(sc.reviewer, sc.ccer, admin)
|
|
||||||
.cc(sc.reviewerByEmail)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(ALL_COMMENTS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void revertChangeByOtherInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageChange();
|
StagedChange sc = stageChange();
|
||||||
revert(sc, other);
|
revert(sc, other);
|
||||||
@@ -2503,32 +2123,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void revertChangeByOtherCcingSelfInReviewDb() throws Exception {
|
public void revertChangeByOtherCcingSelf() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageChange();
|
|
||||||
revert(sc, other, CC_ON_OWN_COMMENTS);
|
|
||||||
|
|
||||||
// email for the newly created revert change
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("newchange", sc)
|
|
||||||
.to(sc.owner, sc.reviewer, sc.ccer, sc.watchingProjectOwner, admin)
|
|
||||||
.cc(other)
|
|
||||||
.bcc(NEW_CHANGES, NEW_PATCHSETS)
|
|
||||||
.noOneElse();
|
|
||||||
|
|
||||||
// email for the change that is reverted
|
|
||||||
assertThat(sender)
|
|
||||||
.sent("revert", sc)
|
|
||||||
.to(sc.owner)
|
|
||||||
.cc(other, sc.reviewer, sc.ccer, admin)
|
|
||||||
.cc(sc.reviewerByEmail)
|
|
||||||
.bcc(sc.starrer)
|
|
||||||
.bcc(ALL_COMMENTS)
|
|
||||||
.noOneElse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void revertChangeByOtherCcingSelfInNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageChange();
|
StagedChange sc = stageChange();
|
||||||
revert(sc, other, CC_ON_OWN_COMMENTS);
|
revert(sc, other, CC_ON_OWN_COMMENTS);
|
||||||
@@ -2623,7 +2218,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setAssigneeToSelfOnReviewableChangeInNoteDb() throws Exception {
|
public void setAssigneeToSelfOnReviewableChange() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
assign(sc, sc.owner, sc.owner);
|
assign(sc, sc.owner, sc.owner);
|
||||||
@@ -2633,14 +2228,6 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
.noOneElse();
|
.noOneElse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void setAssigneeToSelfOnReviewableChangeInReviewDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
assign(sc, sc.owner, sc.owner);
|
|
||||||
assertThat(sender).notSent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void changeAssigneeOnReviewableChange() throws Exception {
|
public void changeAssigneeOnReviewableChange() throws Exception {
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
@@ -2656,7 +2243,7 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void changeAssigneeToSelfOnReviewableChangeInNoteDb() throws Exception {
|
public void changeAssigneeToSelfOnReviewableChange() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
StagedChange sc = stageReviewableChange();
|
StagedChange sc = stageReviewableChange();
|
||||||
assign(sc, sc.owner, sc.assignee);
|
assign(sc, sc.owner, sc.assignee);
|
||||||
@@ -2668,16 +2255,6 @@ public class ChangeNotificationsIT extends AbstractNotificationTest {
|
|||||||
.noOneElse();
|
.noOneElse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void changeAssigneeToSelfOnReviewableChangeInReviewDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
StagedChange sc = stageReviewableChange();
|
|
||||||
assign(sc, sc.owner, sc.assignee);
|
|
||||||
sender.clear();
|
|
||||||
assign(sc, sc.owner, sc.owner);
|
|
||||||
assertThat(sender).notSent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setAssigneeOnReviewableWipChange() throws Exception {
|
public void setAssigneeOnReviewableWipChange() throws Exception {
|
||||||
StagedChange sc = stageReviewableWipChange();
|
StagedChange sc = stageReviewableWipChange();
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ import com.google.gerrit.extensions.api.changes.HashtagsInput;
|
|||||||
import com.google.gerrit.extensions.api.changes.NotifyHandling;
|
import com.google.gerrit.extensions.api.changes.NotifyHandling;
|
||||||
import com.google.gerrit.extensions.api.changes.ReviewInput;
|
import com.google.gerrit.extensions.api.changes.ReviewInput;
|
||||||
import com.google.gerrit.extensions.api.changes.ReviewInput.DraftHandling;
|
import com.google.gerrit.extensions.api.changes.ReviewInput.DraftHandling;
|
||||||
import com.google.gerrit.extensions.api.changes.ReviewInput.RobotCommentInput;
|
|
||||||
import com.google.gerrit.extensions.api.changes.StarsInput;
|
import com.google.gerrit.extensions.api.changes.StarsInput;
|
||||||
import com.google.gerrit.extensions.api.groups.GroupInput;
|
import com.google.gerrit.extensions.api.groups.GroupInput;
|
||||||
import com.google.gerrit.extensions.api.projects.ConfigInput;
|
import com.google.gerrit.extensions.api.projects.ConfigInput;
|
||||||
@@ -69,7 +68,6 @@ import com.google.gerrit.extensions.restapi.BadRequestException;
|
|||||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||||
import com.google.gerrit.index.FieldDef;
|
import com.google.gerrit.index.FieldDef;
|
||||||
import com.google.gerrit.index.IndexConfig;
|
import com.google.gerrit.index.IndexConfig;
|
||||||
import com.google.gerrit.index.QueryOptions;
|
|
||||||
import com.google.gerrit.index.Schema;
|
import com.google.gerrit.index.Schema;
|
||||||
import com.google.gerrit.lifecycle.LifecycleManager;
|
import com.google.gerrit.lifecycle.LifecycleManager;
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
@@ -81,7 +79,6 @@ import com.google.gerrit.reviewdb.client.PatchSet;
|
|||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
import com.google.gerrit.reviewdb.client.RefNames;
|
import com.google.gerrit.reviewdb.client.RefNames;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDbUtil;
|
|
||||||
import com.google.gerrit.server.CurrentUser;
|
import com.google.gerrit.server.CurrentUser;
|
||||||
import com.google.gerrit.server.IdentifiedUser;
|
import com.google.gerrit.server.IdentifiedUser;
|
||||||
import com.google.gerrit.server.PatchSetUtil;
|
import com.google.gerrit.server.PatchSetUtil;
|
||||||
@@ -102,11 +99,7 @@ import com.google.gerrit.server.git.meta.MetaDataUpdate;
|
|||||||
import com.google.gerrit.server.index.change.ChangeField;
|
import com.google.gerrit.server.index.change.ChangeField;
|
||||||
import com.google.gerrit.server.index.change.ChangeIndexCollection;
|
import com.google.gerrit.server.index.change.ChangeIndexCollection;
|
||||||
import com.google.gerrit.server.index.change.ChangeIndexer;
|
import com.google.gerrit.server.index.change.ChangeIndexer;
|
||||||
import com.google.gerrit.server.index.change.IndexedChangeQuery;
|
|
||||||
import com.google.gerrit.server.index.change.StalenessChecker;
|
|
||||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
import com.google.gerrit.server.notedb.ChangeNotes;
|
||||||
import com.google.gerrit.server.notedb.NoteDbChangeState;
|
|
||||||
import com.google.gerrit.server.notedb.NoteDbChangeState.PrimaryStorage;
|
|
||||||
import com.google.gerrit.server.project.ProjectCache;
|
import com.google.gerrit.server.project.ProjectCache;
|
||||||
import com.google.gerrit.server.project.ProjectConfig;
|
import com.google.gerrit.server.project.ProjectConfig;
|
||||||
import com.google.gerrit.server.schema.SchemaCreator;
|
import com.google.gerrit.server.schema.SchemaCreator;
|
||||||
@@ -116,7 +109,6 @@ import com.google.gerrit.server.util.OneOffRequestContext;
|
|||||||
import com.google.gerrit.server.util.RequestContext;
|
import com.google.gerrit.server.util.RequestContext;
|
||||||
import com.google.gerrit.server.util.ThreadLocalRequestContext;
|
import com.google.gerrit.server.util.ThreadLocalRequestContext;
|
||||||
import com.google.gerrit.server.util.time.TimeUtil;
|
import com.google.gerrit.server.util.time.TimeUtil;
|
||||||
import com.google.gerrit.testing.DisabledReviewDb;
|
|
||||||
import com.google.gerrit.testing.GerritServerTests;
|
import com.google.gerrit.testing.GerritServerTests;
|
||||||
import com.google.gerrit.testing.InMemoryDatabase;
|
import com.google.gerrit.testing.InMemoryDatabase;
|
||||||
import com.google.gerrit.testing.InMemoryRepositoryManager;
|
import com.google.gerrit.testing.InMemoryRepositoryManager;
|
||||||
@@ -131,7 +123,6 @@ import java.sql.Timestamp;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@@ -1599,7 +1590,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void byHashtagWithNoteDb() throws Exception {
|
public void byHashtag() throws Exception {
|
||||||
assume().that(notesMigration.readChanges()).isTrue();
|
assume().that(notesMigration.readChanges()).isTrue();
|
||||||
List<Change> changes = setUpHashtagChanges();
|
List<Change> changes = setUpHashtagChanges();
|
||||||
assertQuery("hashtag:foo", changes.get(1), changes.get(0));
|
assertQuery("hashtag:foo", changes.get(1), changes.get(0));
|
||||||
@@ -1611,35 +1602,6 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
|||||||
assertQuery("hashtag:\"# #a tag\"", changes.get(1));
|
assertQuery("hashtag:\"# #a tag\"", changes.get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void byHashtagWithoutNoteDb() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
|
|
||||||
notesMigration.setWriteChanges(true);
|
|
||||||
notesMigration.setReadChanges(true);
|
|
||||||
db.close();
|
|
||||||
db = schemaFactory.open();
|
|
||||||
List<Change> changes;
|
|
||||||
try {
|
|
||||||
changes = setUpHashtagChanges();
|
|
||||||
notesMigration.setWriteChanges(false);
|
|
||||||
notesMigration.setReadChanges(false);
|
|
||||||
} finally {
|
|
||||||
db.close();
|
|
||||||
}
|
|
||||||
db = schemaFactory.open();
|
|
||||||
for (Change c : changes) {
|
|
||||||
indexer.index(db, c); // Reindex without hashtag field.
|
|
||||||
}
|
|
||||||
assertQuery("hashtag:foo");
|
|
||||||
assertQuery("hashtag:bar");
|
|
||||||
assertQuery("hashtag:\" bar \"");
|
|
||||||
assertQuery("hashtag:\"a tag\"");
|
|
||||||
assertQuery("hashtag:\" a tag \"");
|
|
||||||
assertQuery("hashtag:#foo");
|
|
||||||
assertQuery("hashtag:\"# #foo\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void byDefault() throws Exception {
|
public void byDefault() throws Exception {
|
||||||
TestRepository<Repo> repo = createProject("repo");
|
TestRepository<Repo> repo = createProject("repo");
|
||||||
@@ -2340,71 +2302,6 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void prepopulatedFields() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
TestRepository<Repo> repo = createProject("repo");
|
|
||||||
Change change = insert(repo, newChange(repo));
|
|
||||||
|
|
||||||
db = new DisabledReviewDb();
|
|
||||||
requestContext.setContext(newRequestContext(userId));
|
|
||||||
// Use QueryProcessor directly instead of API so we get ChangeDatas back.
|
|
||||||
List<ChangeData> cds =
|
|
||||||
queryProcessorProvider
|
|
||||||
.get()
|
|
||||||
.query(queryBuilder.parse(change.getId().toString()))
|
|
||||||
.entities();
|
|
||||||
assertThat(cds).hasSize(1);
|
|
||||||
|
|
||||||
ChangeData cd = cds.get(0);
|
|
||||||
cd.change();
|
|
||||||
cd.patchSets();
|
|
||||||
cd.currentApprovals();
|
|
||||||
cd.changedLines();
|
|
||||||
cd.reviewedBy();
|
|
||||||
cd.reviewers();
|
|
||||||
cd.unresolvedCommentCount();
|
|
||||||
|
|
||||||
if (getSchemaVersion() < 51) {
|
|
||||||
assertMissingField(ChangeField.TOTAL_COMMENT_COUNT);
|
|
||||||
} else {
|
|
||||||
cd.totalCommentCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(dborowitz): Swap out GitRepositoryManager somehow? Will probably be
|
|
||||||
// necessary for NoteDb anyway.
|
|
||||||
cd.isMergeable();
|
|
||||||
|
|
||||||
exception.expect(DisabledReviewDb.Disabled.class);
|
|
||||||
cd.messages();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void prepopulateOnlyRequestedFields() throws Exception {
|
|
||||||
assume().that(notesMigration.readChanges()).isFalse();
|
|
||||||
TestRepository<Repo> repo = createProject("repo");
|
|
||||||
Change change = insert(repo, newChange(repo));
|
|
||||||
|
|
||||||
db = new DisabledReviewDb();
|
|
||||||
requestContext.setContext(newRequestContext(userId));
|
|
||||||
// Use QueryProcessor directly instead of API so we get ChangeDatas back.
|
|
||||||
List<ChangeData> cds =
|
|
||||||
queryProcessorProvider
|
|
||||||
.get()
|
|
||||||
.setRequestedFields(
|
|
||||||
ImmutableSet.of(ChangeField.PATCH_SET.getName(), ChangeField.CHANGE.getName()))
|
|
||||||
.query(queryBuilder.parse(change.getId().toString()))
|
|
||||||
.entities();
|
|
||||||
assertThat(cds).hasSize(1);
|
|
||||||
|
|
||||||
ChangeData cd = cds.get(0);
|
|
||||||
cd.change();
|
|
||||||
cd.patchSets();
|
|
||||||
|
|
||||||
exception.expect(DisabledReviewDb.Disabled.class);
|
|
||||||
cd.currentApprovals();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void reindexIfStale() throws Exception {
|
public void reindexIfStale() throws Exception {
|
||||||
Account.Id user = createAccount("user");
|
Account.Id user = createAccount("user");
|
||||||
@@ -2432,93 +2329,6 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
|||||||
assertQuery("has:edit");
|
assertQuery("has:edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void refStateFields() throws Exception {
|
|
||||||
// This test method manages primary storage manually.
|
|
||||||
assume().that(notesMigration.changePrimaryStorage()).isEqualTo(PrimaryStorage.REVIEW_DB);
|
|
||||||
Account.Id user = createAccount("user");
|
|
||||||
Project.NameKey project = new Project.NameKey("repo");
|
|
||||||
TestRepository<Repo> repo = createProject(project.get());
|
|
||||||
String path = "file";
|
|
||||||
RevCommit commit = repo.parseBody(repo.commit().message("one").add(path, "contents").create());
|
|
||||||
Change change = insert(repo, newChangeForCommit(repo, commit));
|
|
||||||
Change.Id id = change.getId();
|
|
||||||
int c = id.get();
|
|
||||||
String changeId = change.getKey().get();
|
|
||||||
requestContext.setContext(newRequestContext(user));
|
|
||||||
|
|
||||||
// Ensure one of each type of supported ref is present for the change. If
|
|
||||||
// any more refs are added, update this test to reflect them.
|
|
||||||
|
|
||||||
// Edit
|
|
||||||
gApi.changes().id(changeId).edit().create();
|
|
||||||
|
|
||||||
// Star
|
|
||||||
gApi.accounts().self().starChange(change.getId().toString());
|
|
||||||
|
|
||||||
if (notesMigration.readChanges()) {
|
|
||||||
// Robot comment.
|
|
||||||
ReviewInput rin = new ReviewInput();
|
|
||||||
RobotCommentInput rcin = new RobotCommentInput();
|
|
||||||
rcin.robotId = "happyRobot";
|
|
||||||
rcin.robotRunId = "1";
|
|
||||||
rcin.line = 1;
|
|
||||||
rcin.message = "nit: trailing whitespace";
|
|
||||||
rcin.path = path;
|
|
||||||
rin.robotComments = ImmutableMap.of(path, ImmutableList.of(rcin));
|
|
||||||
gApi.changes().id(c).current().review(rin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draft.
|
|
||||||
DraftInput din = new DraftInput();
|
|
||||||
din.path = path;
|
|
||||||
din.line = 1;
|
|
||||||
din.message = "draft";
|
|
||||||
gApi.changes().id(c).current().createDraft(din);
|
|
||||||
|
|
||||||
if (notesMigration.readChanges()) {
|
|
||||||
// Force NoteDb primary.
|
|
||||||
change = ReviewDbUtil.unwrapDb(db).changes().get(id);
|
|
||||||
change.setNoteDbState(NoteDbChangeState.NOTE_DB_PRIMARY_STATE);
|
|
||||||
ReviewDbUtil.unwrapDb(db).changes().update(Collections.singleton(change));
|
|
||||||
indexer.index(db, change);
|
|
||||||
}
|
|
||||||
|
|
||||||
QueryOptions opts =
|
|
||||||
IndexedChangeQuery.createOptions(indexConfig, 0, 1, StalenessChecker.FIELDS);
|
|
||||||
ChangeData cd = indexes.getSearchIndex().get(id, opts).get();
|
|
||||||
|
|
||||||
String cs = RefNames.shard(c);
|
|
||||||
int u = user.get();
|
|
||||||
String us = RefNames.shard(u);
|
|
||||||
|
|
||||||
List<String> expectedStates =
|
|
||||||
Lists.newArrayList(
|
|
||||||
"repo:refs/users/" + us + "/edit-" + c + "/1",
|
|
||||||
"All-Users:refs/starred-changes/" + cs + "/" + u);
|
|
||||||
if (notesMigration.readChanges()) {
|
|
||||||
expectedStates.add("repo:refs/changes/" + cs + "/meta");
|
|
||||||
expectedStates.add("repo:refs/changes/" + cs + "/robot-comments");
|
|
||||||
expectedStates.add("All-Users:refs/draft-comments/" + cs + "/" + u);
|
|
||||||
}
|
|
||||||
assertThat(
|
|
||||||
cd.getRefStates()
|
|
||||||
.stream()
|
|
||||||
.map(String::new)
|
|
||||||
// Omit SHA-1, we're just concerned with the project/ref names.
|
|
||||||
.map(s -> s.substring(0, s.lastIndexOf(':')))
|
|
||||||
.collect(toList()))
|
|
||||||
.containsExactlyElementsIn(expectedStates);
|
|
||||||
|
|
||||||
List<String> expectedPatterns = Lists.newArrayList("repo:refs/users/*/edit-" + c + "/*");
|
|
||||||
expectedPatterns.add("All-Users:refs/starred-changes/" + cs + "/*");
|
|
||||||
if (notesMigration.readChanges()) {
|
|
||||||
expectedPatterns.add("All-Users:refs/draft-comments/" + cs + "/*");
|
|
||||||
}
|
|
||||||
assertThat(cd.getRefStatePatterns().stream().map(String::new).collect(toList()))
|
|
||||||
.containsExactlyElementsIn(expectedPatterns);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void watched() throws Exception {
|
public void watched() throws Exception {
|
||||||
TestRepository<Repo> repo = createProject("repo");
|
TestRepository<Repo> repo = createProject("repo");
|
||||||
|
|||||||
Reference in New Issue
Block a user