Update accounts through AccountsUpdate class

The AccountsUpdate class should become the single class that updates
accounts. At the moment it always updates the accounts in ReviewDb, but
in future it will update accounts in NoteDb.

Atomic account updates are not yet moved to AccountsUpdate. This will be
done in a follow-up change.

Change-Id: I2d1b2e054cb47269942b094363824485c4760af2
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-04-13 15:48:54 +02:00
parent 2a3b883511
commit 2803609f8e
7 changed files with 30 additions and 13 deletions

View File

@@ -39,6 +39,7 @@ import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.AccountManager;
import com.google.gerrit.server.account.Accounts;
import com.google.gerrit.server.account.AccountsUpdate;
import com.google.gerrit.server.account.AuthRequest;
import com.google.gerrit.server.account.externalids.ExternalId;
import com.google.gerrit.server.account.externalids.ExternalIdsUpdate;
@@ -74,6 +75,8 @@ import org.junit.Test;
public class GerritPublicKeyCheckerTest {
@Inject private Accounts accounts;
@Inject private AccountsUpdate.Server accountsUpdate;
@Inject private AccountCache accountCache;
@Inject private AccountManager accountManager;
@@ -121,7 +124,7 @@ public class GerritPublicKeyCheckerTest {
Account userAccount = accounts.get(db, userId);
// Note: does not match any key in TestKeys.
userAccount.setPreferredEmail("user@example.com");
db.accounts().update(ImmutableList.of(userAccount));
accountsUpdate.create().update(db, userAccount);
user = reloadUser();
requestContext.setContext(