TestProjectCreation: add owners setting
Change-Id: I3364c044338663326ab11b1f748495d50bbd9d43
This commit is contained in:
@@ -96,7 +96,7 @@ public class ProjectOperationsImpl implements ProjectOperations {
|
||||
args.createEmptyCommit = projectCreation.createEmptyCommit().orElse(true);
|
||||
projectCreation.parent().ifPresent(p -> args.newParent = p);
|
||||
// ProjectCreator wants non-null owner IDs.
|
||||
args.ownerIds = new ArrayList<>();
|
||||
args.ownerIds = new ArrayList<>(projectCreation.owners());
|
||||
projectCreation.submitType().ifPresent(st -> args.submitType = st);
|
||||
projectCreator.createProject(args);
|
||||
return Project.nameKey(name);
|
||||
|
||||
@@ -14,8 +14,12 @@
|
||||
|
||||
package com.google.gerrit.acceptance.testsuite.project;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gerrit.acceptance.testsuite.ThrowingFunction;
|
||||
import com.google.gerrit.entities.AccountGroup;
|
||||
import com.google.gerrit.entities.Project;
|
||||
import com.google.gerrit.extensions.client.SubmitType;
|
||||
import java.util.Optional;
|
||||
@@ -33,6 +37,8 @@ public abstract class TestProjectCreation {
|
||||
|
||||
public abstract Optional<SubmitType> submitType();
|
||||
|
||||
public abstract ImmutableSet<AccountGroup.UUID> owners();
|
||||
|
||||
abstract ThrowingFunction<TestProjectCreation, Project.NameKey> projectCreator();
|
||||
|
||||
public static Builder builder(
|
||||
@@ -57,6 +63,13 @@ public abstract class TestProjectCreation {
|
||||
return createEmptyCommit(false);
|
||||
}
|
||||
|
||||
public TestProjectCreation.Builder addOwner(AccountGroup.UUID owner) {
|
||||
ownersBuilder().add(requireNonNull(owner, "owner"));
|
||||
return this;
|
||||
}
|
||||
|
||||
abstract ImmutableSet.Builder<AccountGroup.UUID> ownersBuilder();
|
||||
|
||||
abstract TestProjectCreation.Builder projectCreator(
|
||||
ThrowingFunction<TestProjectCreation, Project.NameKey> projectCreator);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user