Merge changes Ie4b6673e,I1fc5eec9,I2ad7ab44
* changes: Use 'example.com' domain for emails in tests Access the static method ReviewInput.recommend() in a static way PostReviewAttentionSet: Fix warnings about type safety issues
This commit is contained in:
@@ -158,7 +158,7 @@ public class PostReviewAttentionSet {
|
||||
private void processManualUpdates(BatchUpdate bu, RevisionResource revision, ReviewInput input)
|
||||
throws BadRequestException, IOException, PermissionBackendException,
|
||||
UnprocessableEntityException, ConfigInvalidException {
|
||||
Set<Account.Id> accountsChangedInCommit = new HashSet();
|
||||
Set<Account.Id> accountsChangedInCommit = new HashSet<>();
|
||||
// If we specify a user to remove, and the user is in the attention set, we remove it.
|
||||
if (input.removeFromAttentionSet != null) {
|
||||
for (AttentionSetInput remove : input.removeFromAttentionSet) {
|
||||
|
||||
@@ -1221,7 +1221,7 @@ public class AccountIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void cannotAddNonConfirmedEmailWithoutModifyAccountPermission() throws Exception {
|
||||
TestAccount account = accountCreator.create(name("user"));
|
||||
EmailInput input = newEmailInput("test@test.com");
|
||||
EmailInput input = newEmailInput("test@example.com");
|
||||
requestScopeOperations.setApiUser(user.id());
|
||||
assertThrows(AuthException.class, () -> gApi.accounts().id(account.username()).addEmail(input));
|
||||
}
|
||||
|
||||
@@ -1878,7 +1878,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
Timestamp oldTs = rsrc.getChange().getLastUpdatedOn();
|
||||
|
||||
// create a group named "ab" with one user: testUser
|
||||
String email = "abcd@test.com";
|
||||
String email = "abcd@example.com";
|
||||
String fullname = "abcd";
|
||||
Account.Id accountIdOfTestUser =
|
||||
accountOperations
|
||||
@@ -1931,11 +1931,11 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
accountOperations
|
||||
.newAccount()
|
||||
.username("kobebryant")
|
||||
.preferredEmail("kobebryant@test.com")
|
||||
.preferredEmail("kobebryant@example.com")
|
||||
.fullname(testUserFullname)
|
||||
.create();
|
||||
|
||||
String myGroupUserEmail = "lee@test.com";
|
||||
String myGroupUserEmail = "lee@example.com";
|
||||
String myGroupUserFullname = "lee";
|
||||
Account.Id accountIdOfGroupUser =
|
||||
accountOperations
|
||||
@@ -3747,7 +3747,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
"Configure Notifications",
|
||||
"project.config",
|
||||
"[notify \"my=notify-config\"]\n"
|
||||
+ " email = foo@test.com\n"
|
||||
+ " email = foo@example.com\n"
|
||||
+ " filter = dir:\\\"foo/bar/baz\\\"");
|
||||
push.to(RefNames.REFS_CONFIG);
|
||||
testRepo.reset(oldHead);
|
||||
@@ -3759,7 +3759,8 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
admin.newIdent(), testRepo, "Test change", "foo/bar/baz/test.txt", "some content");
|
||||
PushOneCommit.Result r = push.to("refs/for/master");
|
||||
assertThat(sender.getMessages()).hasSize(1);
|
||||
assertThat(sender.getMessages().get(0).rcpt()).containsExactly(Address.parse("foo@test.com"));
|
||||
assertThat(sender.getMessages().get(0).rcpt())
|
||||
.containsExactly(Address.parse("foo@example.com"));
|
||||
|
||||
// Comment on the change.
|
||||
sender.clear();
|
||||
@@ -3767,7 +3768,8 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
reviewInput.message = "some message";
|
||||
gApi.changes().id(r.getChangeId()).current().review(reviewInput);
|
||||
assertThat(sender.getMessages()).hasSize(1);
|
||||
assertThat(sender.getMessages().get(0).rcpt()).containsExactly(Address.parse("foo@test.com"));
|
||||
assertThat(sender.getMessages().get(0).rcpt())
|
||||
.containsExactly(Address.parse("foo@example.com"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -828,7 +828,7 @@ public class AttentionSetIT extends AbstractDaemonTest {
|
||||
change(r).addToAttentionSet(new AttentionSetInput(user.email(), "remove"));
|
||||
|
||||
requestScopeOperations.setApiUser(user.id());
|
||||
ReviewInput reviewInput = ReviewInput.create().recommend();
|
||||
ReviewInput reviewInput = ReviewInput.recommend();
|
||||
change(r).current().review(reviewInput);
|
||||
|
||||
// reviewer removed
|
||||
|
||||
@@ -279,7 +279,7 @@ public class ProjectWatchIT extends AbstractDaemonTest {
|
||||
sender.clear();
|
||||
|
||||
// watch project as user2
|
||||
TestAccount user2 = accountCreator.create("user2", "user2@test.com", "User2", null);
|
||||
TestAccount user2 = accountCreator.create("user2", "user2@example.com", "User2", null);
|
||||
requestScopeOperations.setApiUser(user2.id());
|
||||
watch(watchedProject);
|
||||
|
||||
@@ -391,7 +391,7 @@ public class ProjectWatchIT extends AbstractDaemonTest {
|
||||
sender.clear();
|
||||
|
||||
// watch project as user2
|
||||
TestAccount user2 = accountCreator.create("user2", "user2@test.com", "User2", null);
|
||||
TestAccount user2 = accountCreator.create("user2", "user2@example.com", "User2", null);
|
||||
requestScopeOperations.setApiUser(user2.id());
|
||||
watch(anyProject);
|
||||
|
||||
@@ -528,7 +528,7 @@ public class ProjectWatchIT extends AbstractDaemonTest {
|
||||
// watch project as user that can view all private change
|
||||
TestAccount userThatCanViewPrivateChanges =
|
||||
accountCreator.create(
|
||||
"user2", "user2@test.com", "User2", null, groupThatCanViewPrivateChanges.name);
|
||||
"user2", "user2@example.com", "User2", null, groupThatCanViewPrivateChanges.name);
|
||||
requestScopeOperations.setApiUser(userThatCanViewPrivateChanges.id());
|
||||
watch(watchedProject);
|
||||
|
||||
|
||||
@@ -146,9 +146,9 @@ public class FromAddressGeneratorProviderTest {
|
||||
@Test
|
||||
public void USERNoAllowDomain() {
|
||||
setFrom("USER");
|
||||
setDomains(Arrays.asList("example.com"));
|
||||
setDomains(Arrays.asList("example.net"));
|
||||
final String name = "A U. Thor";
|
||||
final String email = "a.u.thor@test.com";
|
||||
final String email = "a.u.thor@example.com";
|
||||
final Account.Id user = user(name, email);
|
||||
|
||||
final Address r = create().from(user);
|
||||
@@ -161,10 +161,10 @@ public class FromAddressGeneratorProviderTest {
|
||||
@Test
|
||||
public void USERAllowDomainTwice() {
|
||||
setFrom("USER");
|
||||
setDomains(Arrays.asList("example.net"));
|
||||
setDomains(Arrays.asList("example.com"));
|
||||
setDomains(Arrays.asList("test.com"));
|
||||
final String name = "A U. Thor";
|
||||
final String email = "a.u.thor@test.com";
|
||||
final String email = "a.u.thor@example.com";
|
||||
final Account.Id user = user(name, email);
|
||||
|
||||
final Address r = create().from(user);
|
||||
@@ -177,10 +177,10 @@ public class FromAddressGeneratorProviderTest {
|
||||
@Test
|
||||
public void USERAllowDomainTwiceReverse() {
|
||||
setFrom("USER");
|
||||
setDomains(Arrays.asList("test.com"));
|
||||
setDomains(Arrays.asList("example.com"));
|
||||
setDomains(Arrays.asList("example.net"));
|
||||
final String name = "A U. Thor";
|
||||
final String email = "a.u.thor@test.com";
|
||||
final String email = "a.u.thor@example.com";
|
||||
final Account.Id user = user(name, email);
|
||||
|
||||
final Address r = create().from(user);
|
||||
@@ -193,9 +193,9 @@ public class FromAddressGeneratorProviderTest {
|
||||
@Test
|
||||
public void USERAllowTwoDomains() {
|
||||
setFrom("USER");
|
||||
setDomains(Arrays.asList("example.com", "test.com"));
|
||||
setDomains(Arrays.asList("example.com", "example.net"));
|
||||
final String name = "A U. Thor";
|
||||
final String email = "a.u.thor@test.com";
|
||||
final String email = "a.u.thor@example.com";
|
||||
final Account.Id user = user(name, email);
|
||||
|
||||
final Address r = create().from(user);
|
||||
|
||||
@@ -217,7 +217,7 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests {
|
||||
|
||||
AccountInfo user5 = newAccountWithEmail("user5", name("user5MixedCase@example.com"));
|
||||
|
||||
assertQuery("notexisting@test.com");
|
||||
assertQuery("notexisting@example.com");
|
||||
|
||||
assertQuery(currentUserInfo.email, currentUserInfo);
|
||||
assertQuery("email:" + currentUserInfo.email, currentUserInfo);
|
||||
@@ -253,8 +253,8 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests {
|
||||
|
||||
@Test
|
||||
public void byEmailWithoutModifyAccountCapability() throws Exception {
|
||||
String preferredEmail = name("primary@test.com");
|
||||
String secondaryEmail = name("secondary@test.com");
|
||||
String preferredEmail = name("primary@example.com");
|
||||
String secondaryEmail = name("secondary@example.com");
|
||||
AccountInfo user1 = newAccountWithEmail("user1", preferredEmail);
|
||||
addEmails(user1, secondaryEmail);
|
||||
|
||||
@@ -485,11 +485,11 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests {
|
||||
// sorting by account ID. Use the same fullname for all accounts so that sorting must be done by
|
||||
// preferred email.
|
||||
AccountInfo userFoo3 =
|
||||
newAccount("user3", "foo-" + appendix, "foo3-" + appendix + "@test.com", true);
|
||||
newAccount("user3", "foo-" + appendix, "foo3-" + appendix + "@example.com", true);
|
||||
AccountInfo userFoo1 =
|
||||
newAccount("user1", "foo-" + appendix, "foo1-" + appendix + "@test.com", true);
|
||||
newAccount("user1", "foo-" + appendix, "foo1-" + appendix + "@example.com", true);
|
||||
AccountInfo userFoo2 =
|
||||
newAccount("user2", "foo-" + appendix, "foo2-" + appendix + "@test.com", true);
|
||||
newAccount("user2", "foo-" + appendix, "foo2-" + appendix + "@example.com", true);
|
||||
assertThat(userFoo3._accountId).isLessThan(userFoo1._accountId);
|
||||
assertThat(userFoo1._accountId).isLessThan(userFoo2._accountId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user