use of com.google.gerrit.extensions.api.projects.ProjectInput in project gerrit by GerritCodeReview.
the class ProjectIT method createProjectNoNameInInput.
@Test
public void createProjectNoNameInInput() throws Exception {
ProjectInput in = new ProjectInput();
exception.expect(BadRequestException.class);
exception.expectMessage("input.name is required");
gApi.projects().create(in);
}
use of com.google.gerrit.extensions.api.projects.ProjectInput in project gerrit by GerritCodeReview.
the class ProjectIT method createProjectWithMismatchedInput.
@Test
public void createProjectWithMismatchedInput() throws Exception {
ProjectInput in = new ProjectInput();
in.name = name("foo");
exception.expect(BadRequestException.class);
exception.expectMessage("name must match input.name");
gApi.projects().name("bar").create(in);
}
use of com.google.gerrit.extensions.api.projects.ProjectInput in project gerrit by GerritCodeReview.
the class CreateProjectIT method createProjectWithProperties.
@Test
public void createProjectWithProperties() throws Exception {
String newProjectName = name("newProject");
ProjectInput in = new ProjectInput();
in.name = newProjectName;
in.description = "Test description";
in.submitType = SubmitType.CHERRY_PICK;
in.useContributorAgreements = InheritableBoolean.TRUE;
in.useSignedOffBy = InheritableBoolean.TRUE;
in.useContentMerge = InheritableBoolean.TRUE;
in.requireChangeId = InheritableBoolean.TRUE;
ProjectInfo p = gApi.projects().create(in).get();
assertThat(p.name).isEqualTo(newProjectName);
Project project = projectCache.get(new Project.NameKey(newProjectName)).getProject();
assertProjectInfo(project, p);
assertThat(project.getDescription()).isEqualTo(in.description);
assertThat(project.getSubmitType()).isEqualTo(in.submitType);
assertThat(project.getUseContributorAgreements()).isEqualTo(in.useContributorAgreements);
assertThat(project.getUseSignedOffBy()).isEqualTo(in.useSignedOffBy);
assertThat(project.getUseContentMerge()).isEqualTo(in.useContentMerge);
assertThat(project.getRequireChangeID()).isEqualTo(in.requireChangeId);
}
use of com.google.gerrit.extensions.api.projects.ProjectInput in project gerrit by GerritCodeReview.
the class CreateProjectIT method createProjectWithCreateProjectCapabilityAndParentNotVisible.
@Test
public void createProjectWithCreateProjectCapabilityAndParentNotVisible() throws Exception {
Project parent = projectCache.get(allProjects).getProject();
parent.setState(com.google.gerrit.extensions.client.ProjectState.HIDDEN);
allowGlobalCapabilities(SystemGroupBackend.REGISTERED_USERS, GlobalCapability.CREATE_PROJECT);
try {
setApiUser(user);
ProjectInput in = new ProjectInput();
in.name = name("newProject");
ProjectInfo p = gApi.projects().create(in).get();
assertThat(p.name).isEqualTo(in.name);
} finally {
parent.setState(com.google.gerrit.extensions.client.ProjectState.ACTIVE);
removeGlobalCapabilities(SystemGroupBackend.REGISTERED_USERS, GlobalCapability.CREATE_PROJECT);
}
}
use of com.google.gerrit.extensions.api.projects.ProjectInput in project gerrit by GerritCodeReview.
the class CreateProjectIT method createProjectWithBranches.
@Test
public void createProjectWithBranches() throws Exception {
String newProjectName = name("newProject");
ProjectInput in = new ProjectInput();
in.name = newProjectName;
in.createEmptyCommit = true;
in.branches = Lists.newArrayListWithCapacity(3);
in.branches.add("refs/heads/test");
in.branches.add("refs/heads/master");
// without 'refs/heads' prefix
in.branches.add("release");
gApi.projects().create(in);
assertHead(newProjectName, "refs/heads/test");
assertEmptyCommit(newProjectName, "refs/heads/test", "refs/heads/master", "refs/heads/release");
}
Aggregations