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