Refactor array usage to list for RepositoryConfig and GroupSetProvider

Have getOwnerGroups return a list of strings rather than an array in
RepositoryConfig.

Replace string array usage with a list for the GroupSetProvider
constructor, to simplify the life of its caller(s) now using the
aforementioned list-returning getOwnerGroups.

Update the impacted RepositoryConfigTest tests accordingly. That
includes a minor refactoring in testAllBasePath, for consistency
purposes.

Change-Id: I540dae480a37c3bbb144fef48a95ba4ff29a019f
This commit is contained in:
Marco Miller
2016-04-06 17:42:29 -04:00
parent c2353a6a97
commit 823a4c25d4
5 changed files with 37 additions and 34 deletions

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.server.config;
import com.google.common.collect.ImmutableList;
import com.google.gerrit.extensions.client.SubmitType;
import com.google.gerrit.reviewdb.client.Project;
import com.google.inject.Inject;
@@ -46,9 +47,9 @@ public class RepositoryConfig {
DEFAULT_SUBMIT_TYPE_NAME, SubmitType.MERGE_IF_NECESSARY);
}
public String[] getOwnerGroups(Project.NameKey project) {
return cfg.getStringList(SECTION_NAME, findSubSection(project.get()),
OWNER_GROUP_NAME);
public List<String> getOwnerGroups(Project.NameKey project) {
return ImmutableList.copyOf(cfg.getStringList(SECTION_NAME,
findSubSection(project.get()), OWNER_GROUP_NAME));
}
public Path getBasePath(Project.NameKey project) {