Merge branch 'stable-3.0' * stable-3.0: Fix the testAllNumericUserGroup all-numeric username Test all-numeric username Change-Id: Ia85c38a18e7ad26802873b2cbb2ce9db8f0f4bea
diff --git a/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java b/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java index 5b2bed9..9159bb0 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java +++ b/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java
@@ -105,7 +105,7 @@ String ident = username(uuid); Optional<AccountState> state = Optional.empty(); if (ident.matches(ACCOUNT_ID_PATTERN)) { - state = accountCache.get(new Account.Id(Integer.parseInt(ident))); + state = accountCache.get(Account.id(Integer.parseInt(ident))); } if (!state.isPresent() && ExternalId.isValidUsername(ident)) { state = accountCache.getByUsername(ident); @@ -114,7 +114,7 @@ } if (state.isPresent()) { String name = nameOf(uuid, state.get()); - String email = Strings.emptyToNull(state.get().getAccount().getPreferredEmail()); + String email = Strings.emptyToNull(state.get().getAccount().preferredEmail()); return new GroupDescription.Basic() { @Override public AccountGroup.UUID getGroupUUID() { @@ -157,7 +157,7 @@ private static GroupReference accountToGroup(AccountState s) { AccountGroup.UUID uuid = - s.getUserName().isPresent() ? uuid(s.getUserName().get()) : uuid(s.getAccount().getId()); + s.getUserName().isPresent() ? uuid(s.getUserName().get()) : uuid(s.getAccount().id()); return new GroupReference(uuid, nameOf(uuid, s)); } @@ -171,7 +171,7 @@ } private static AccountGroup.UUID uuid(String username) { - return new AccountGroup.UUID(UUID_PREFIX + username); + return AccountGroup.uuid(UUID_PREFIX + username); } private static void checkUUID(AccountGroup.UUID uuid) { @@ -181,8 +181,8 @@ private static String nameOf(AccountGroup.UUID uuid, AccountState accountState) { StringBuilder buf = new StringBuilder(); - if (accountState.getAccount().getFullName() != null) { - buf.append(accountState.getAccount().getFullName()); + if (accountState.getAccount().fullName() != null) { + buf.append(accountState.getAccount().fullName()); } if (accountState.getUserName().isPresent()) { if (buf.length() > 0) { @@ -191,9 +191,9 @@ buf.append(accountState.getUserName().get()); } } else if (buf.length() > 0) { - buf.append(" (").append(accountState.getAccount().getId().get()).append(")"); + buf.append(" (").append(accountState.getAccount().id().get()).append(")"); } else { - buf.append(accountState.getAccount().getId().get()); + buf.append(accountState.getAccount().id().get()); } String ident = username(uuid);