GroupsIT: Move createGroup() methods to AbstractDaemonTest

So they can be reused in other tests.

Change-Id: I6735111c2c93053873e87c87f0bc43c4ea1b446d
This commit is contained in:
David Pursehouse
2016-05-10 14:28:55 +09:00
parent 268fcb9f6d
commit 75fd83803d
2 changed files with 14 additions and 13 deletions

View File

@@ -31,6 +31,7 @@ import com.google.gerrit.common.data.PermissionRule;
import com.google.gerrit.extensions.api.GerritApi; import com.google.gerrit.extensions.api.GerritApi;
import com.google.gerrit.extensions.api.changes.ReviewInput; import com.google.gerrit.extensions.api.changes.ReviewInput;
import com.google.gerrit.extensions.api.changes.RevisionApi; import com.google.gerrit.extensions.api.changes.RevisionApi;
import com.google.gerrit.extensions.api.groups.GroupInput;
import com.google.gerrit.extensions.api.projects.BranchApi; import com.google.gerrit.extensions.api.projects.BranchApi;
import com.google.gerrit.extensions.api.projects.BranchInput; import com.google.gerrit.extensions.api.projects.BranchInput;
import com.google.gerrit.extensions.api.projects.ProjectInput; import com.google.gerrit.extensions.api.projects.ProjectInput;
@@ -746,4 +747,17 @@ public abstract class AbstractDaemonTest {
assertThat(ctls).hasSize(1); assertThat(ctls).hasSize(1);
return changeResourceFactory.create(ctls.get(0)); return changeResourceFactory.create(ctls.get(0));
} }
protected String createGroup(String name) throws Exception {
return createGroup(name, "Administrators");
}
protected String createGroup(String name, String owner) throws Exception {
name = name(name);
GroupInput in = new GroupInput();
in.name = name;
in.ownerId = owner;
gApi.groups().create(in);
return name;
}
} }

View File

@@ -560,19 +560,6 @@ public class GroupsIT extends AbstractDaemonTest {
return groupCache.get(new AccountGroup.NameKey(name)); return groupCache.get(new AccountGroup.NameKey(name));
} }
private String createGroup(String name) throws Exception {
return createGroup(name, "Administrators");
}
private String createGroup(String name, String owner) throws Exception {
name = name(name);
GroupInput in = new GroupInput();
in.name = name;
in.ownerId = owner;
gApi.groups().create(in);
return name;
}
private String createAccount(String name, String group) throws Exception { private String createAccount(String name, String group) throws Exception {
name = name(name); name = name(name);
accounts.create(name, group); accounts.create(name, group);