commit 1dcb891435ce26e987588b364f80d665c36aff5f Author: Sven Selberg Date: Thu Oct 1 07:51:27 2020 +0200 TestProjectCreation: Add permissionsOnly setting Change-Id: I6ec62b75c6c4e2ae8166bd58dc74486aaed306cb diff --git a/java/com/google/gerrit/acceptance/testsuite/project/ProjectOperationsImpl.java b/java/com/google/gerrit/acceptance/testsuite/project/ProjectOperationsImpl.java index 21bfcd1..80d8c09 100644 --- a/java/com/google/gerrit/acceptance/testsuite/project/ProjectOperationsImpl.java +++ b/java/com/google/gerrit/acceptance/testsuite/project/ProjectOperationsImpl.java @@ -91,6 +91,7 @@ public class ProjectOperationsImpl implements ProjectOperations { CreateProjectArgs args = new CreateProjectArgs(); args.setProjectName(name); + args.permissionsOnly = projectCreation.permissionOnly().orElse(false); args.branch = Collections.singletonList(Constants.R_HEADS + Constants.MASTER); args.createEmptyCommit = projectCreation.createEmptyCommit().orElse(true); projectCreation.parent().ifPresent(p -> args.newParent = p); diff --git a/java/com/google/gerrit/acceptance/testsuite/project/TestProjectCreation.java b/java/com/google/gerrit/acceptance/testsuite/project/TestProjectCreation.java index 99e045c..cb68d7a 100644 --- a/java/com/google/gerrit/acceptance/testsuite/project/TestProjectCreation.java +++ b/java/com/google/gerrit/acceptance/testsuite/project/TestProjectCreation.java @@ -29,6 +29,8 @@ public abstract class TestProjectCreation { public abstract Optional createEmptyCommit(); + public abstract Optional permissionOnly(); + public abstract Optional submitType(); abstract ThrowingFunction projectCreator(); @@ -48,6 +50,8 @@ public abstract class TestProjectCreation { public abstract TestProjectCreation.Builder createEmptyCommit(boolean value); + public abstract TestProjectCreation.Builder permissionOnly(boolean value); + /** Skips the empty commit on creation. This means that project's branches will not exist. */ public TestProjectCreation.Builder noEmptyCommit() { return createEmptyCommit(false); diff --git a/javatests/com/google/gerrit/acceptance/testsuite/project/ProjectOperationsImplTest.java b/javatests/com/google/gerrit/acceptance/testsuite/project/ProjectOperationsImplTest.java index 65c7b5c..246d764 100644 --- a/javatests/com/google/gerrit/acceptance/testsuite/project/ProjectOperationsImplTest.java +++ b/javatests/com/google/gerrit/acceptance/testsuite/project/ProjectOperationsImplTest.java @@ -41,6 +41,7 @@ import com.google.gerrit.acceptance.AbstractDaemonTest; import com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.TestPermission; import com.google.gerrit.common.data.Permission; import com.google.gerrit.entities.Project; +import com.google.gerrit.entities.RefNames; import com.google.gerrit.extensions.api.projects.BranchInfo; import com.google.gerrit.extensions.api.projects.ConfigInput; import com.google.gerrit.server.project.ProjectConfig; @@ -84,6 +85,13 @@ public class ProjectOperationsImplTest extends AbstractDaemonTest { } @Test + public void permissionOnly() throws Exception { + Project.NameKey key = projectOperations.newProject().permissionOnly(true).create(); + String head = gApi.projects().name(key.get()).head(); + assertThat(head).isEqualTo(RefNames.REFS_CONFIG); + } + + @Test public void getProjectConfig() throws Exception { Project.NameKey key = projectOperations.newProject().create(); assertThat(projectOperations.project(key).getProjectConfig().getProject().getDescription())