Search in sources :

Example 1 with RefNames

use of com.google.gerrit.entities.RefNames in project gerrit by GerritCodeReview.

the class ProjectOperationsImpl method createNewProject.

private Project.NameKey createNewProject(TestProjectCreation projectCreation) throws Exception {
    String name = projectCreation.name().orElse(RandomStringUtils.randomAlphabetic(8));
    CreateProjectArgs args = new CreateProjectArgs();
    args.setProjectName(name);
    args.permissionsOnly = projectCreation.permissionOnly().orElse(false);
    args.branch = projectCreation.branches().stream().map(RefNames::fullName).collect(toImmutableList());
    args.createEmptyCommit = projectCreation.createEmptyCommit().orElse(true);
    projectCreation.parent().ifPresent(p -> args.newParent = p);
    // ProjectCreator wants non-null owner IDs.
    args.ownerIds = new ArrayList<>(projectCreation.owners());
    projectCreation.submitType().ifPresent(st -> args.submitType = st);
    projectCreator.createProject(args);
    return Project.nameKey(name);
}
Also used : RefNames(com.google.gerrit.entities.RefNames) CreateProjectArgs(com.google.gerrit.server.project.CreateProjectArgs)

Aggregations

RefNames (com.google.gerrit.entities.RefNames)1 CreateProjectArgs (com.google.gerrit.server.project.CreateProjectArgs)1