use of com.google.gerrit.extensions.common.ProjectInfo in project gerrit by GerritCodeReview.
the class GetProjectIT method getProject.
@Test
public void getProject() throws Exception {
String name = project.get();
ProjectInfo p = gApi.projects().name(name).get();
assertThat(p.name).isEqualTo(name);
assertThat(p.labels).hasSize(1);
LabelTypeInfo l = p.labels.get("Code-Review");
ImmutableMap<String, String> want = ImmutableMap.of(" 0", "No score", "-1", "I would prefer this is not merged as is", "-2", "This shall not be merged", "+1", "Looks good to me, but someone else must approve", "+2", "Looks good to me, approved");
assertThat(l.values).isEqualTo(want);
assertThat(l.defaultValue).isEqualTo(0);
}
use of com.google.gerrit.extensions.common.ProjectInfo in project gerrit by GerritCodeReview.
the class GetProjectIT method getProjectWithGitSuffix.
@Test
public void getProjectWithGitSuffix() throws Exception {
String name = project.get();
ProjectInfo p = gApi.projects().name(name).get();
assertThat(p.name).isEqualTo(name);
}
use of com.google.gerrit.extensions.common.ProjectInfo in project gerrit by GerritCodeReview.
the class CreateProjectIT method createProjectThatContainsSlash.
@Test
public void createProjectThatContainsSlash() throws Exception {
String newProjectName = name("newProject/newProject");
ProjectInfo p = gApi.projects().create(newProjectName).get();
assertThat(p.name).isEqualTo(newProjectName);
Optional<ProjectState> projectState = projectCache.get(Project.nameKey(newProjectName));
assertThat(projectState).isPresent();
assertProjectInfo(projectState.get().getProject(), p);
assertHead(newProjectName, "refs/heads/master");
}
use of com.google.gerrit.extensions.common.ProjectInfo 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(Project.nameKey(newProjectName)).get().getProject();
assertProjectInfo(project, p);
assertThat(project.getDescription()).isEqualTo(in.description);
assertThat(project.getSubmitType()).isEqualTo(in.submitType);
assertThat(project.getBooleanConfig(BooleanProjectConfig.USE_CONTRIBUTOR_AGREEMENTS)).isEqualTo(in.useContributorAgreements);
assertThat(project.getBooleanConfig(BooleanProjectConfig.USE_SIGNED_OFF_BY)).isEqualTo(in.useSignedOffBy);
assertThat(project.getBooleanConfig(BooleanProjectConfig.USE_CONTENT_MERGE)).isEqualTo(in.useContentMerge);
assertThat(project.getBooleanConfig(BooleanProjectConfig.REQUIRE_CHANGE_ID)).isEqualTo(in.requireChangeId);
}
use of com.google.gerrit.extensions.common.ProjectInfo in project gerrit by GerritCodeReview.
the class CreateProjectIT method createProjectWithCapability.
@Test
public void createProjectWithCapability() throws Exception {
projectOperations.allProjectsForUpdate().add(allowCapability(GlobalCapability.CREATE_PROJECT).group(SystemGroupBackend.REGISTERED_USERS)).update();
try {
requestScopeOperations.setApiUser(user.id());
ProjectInput in = new ProjectInput();
in.name = name("newProject");
ProjectInfo p = gApi.projects().create(in).get();
assertThat(p.name).isEqualTo(in.name);
} finally {
projectOperations.allProjectsForUpdate().remove(capabilityKey(GlobalCapability.CREATE_PROJECT).group(SystemGroupBackend.REGISTERED_USERS)).update();
}
}
Aggregations