Search in sources :

Example 6 with AccountsUpdate

use of com.google.gerrit.server.account.AccountsUpdate in project gerrit by GerritCodeReview.

the class AccountIT method checkMetaId.

@Test
public void checkMetaId() throws Exception {
    // metaId is set when account is loaded
    assertThat(accounts.get(admin.id()).get().account().metaId()).isEqualTo(getMetaId(admin.id()));
    // metaId is set when account is created
    AccountsUpdate au = accountsUpdateProvider.get();
    Account.Id accountId = Account.id(seq.nextAccountId());
    AccountState accountState = au.insert("Create Test Account", accountId, u -> {
    });
    assertThat(accountState.account().metaId()).isEqualTo(getMetaId(accountId));
    // metaId is set when account is updated
    Optional<AccountState> updatedAccountState = au.update("Set Full Name", accountId, u -> u.setFullName("foo"));
    assertThat(updatedAccountState).isPresent();
    Account updatedAccount = updatedAccountState.get().account();
    assertThat(accountState.account().metaId()).isNotEqualTo(updatedAccount.metaId());
    assertThat(updatedAccount.metaId()).isEqualTo(getMetaId(accountId));
}
Also used : TestAccount(com.google.gerrit.acceptance.TestAccount) Account(com.google.gerrit.entities.Account) AccountsUpdate(com.google.gerrit.server.account.AccountsUpdate) AccountState(com.google.gerrit.server.account.AccountState) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)6 TestAccount (com.google.gerrit.acceptance.TestAccount)6 Account (com.google.gerrit.entities.Account)6 AccountsUpdate (com.google.gerrit.server.account.AccountsUpdate)6 Test (org.junit.Test)6 StopStrategies (com.github.rholder.retry.StopStrategies)4 FluentIterable (com.google.common.collect.FluentIterable)4 ImmutableList (com.google.common.collect.ImmutableList)4 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)4 ImmutableSet (com.google.common.collect.ImmutableSet)4 ImmutableSetMultimap (com.google.common.collect.ImmutableSetMultimap)4 Iterables (com.google.common.collect.Iterables)4 BaseEncoding (com.google.common.io.BaseEncoding)4 Correspondence (com.google.common.truth.Correspondence)4 Truth.assertThat (com.google.common.truth.Truth.assertThat)4 Truth.assertWithMessage (com.google.common.truth.Truth.assertWithMessage)4 Truth8.assertThat (com.google.common.truth.Truth8.assertThat)4 AtomicLongMap (com.google.common.util.concurrent.AtomicLongMap)4 Runnables (com.google.common.util.concurrent.Runnables)4 AccountIndexedCounter (com.google.gerrit.acceptance.AccountIndexedCounter)4