Improve performance of notification sender tests
Creating all the StagedUsers accounts is expensive. This change makes it possible to reuse these test accounts across test methods within the same class, saving about 10% of test execution time. This change also saves a little time by adding reviewers to staged changes in a single batch operation, rather than one API call at a time. Other slight gains were achieved by having watchers watch All-Projects, instead of watching a new project for every test method. Change-Id: I413c8f98338be30dcf926a724333feb401c9aa52
This commit is contained in:
@@ -60,6 +60,7 @@ import com.google.gerrit.extensions.api.changes.NotifyHandling;
|
||||
import com.google.gerrit.extensions.api.changes.RecipientType;
|
||||
import com.google.gerrit.extensions.api.changes.SubmitInput;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectConfigEntryType;
|
||||
import com.google.gerrit.extensions.client.GeneralPreferencesInfo;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap.Entry;
|
||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||
@@ -1358,8 +1359,12 @@ public class ReceiveCommits {
|
||||
this.draft = cmd.getRefName().startsWith(MagicBranch.NEW_DRAFT_CHANGE);
|
||||
this.labelTypes = labelTypes;
|
||||
this.notesMigration = notesMigration;
|
||||
GeneralPreferencesInfo prefs = user.getAccount().getGeneralPreferencesInfo();
|
||||
this.defaultPublishComments =
|
||||
firstNonNull(user.getAccount().getGeneralPreferencesInfo().publishCommentsOnPush, false);
|
||||
prefs != null
|
||||
? firstNonNull(
|
||||
user.getAccount().getGeneralPreferencesInfo().publishCommentsOnPush, false)
|
||||
: false;
|
||||
}
|
||||
|
||||
MailRecipients getMailRecipients() {
|
||||
|
||||
Reference in New Issue
Block a user