use of com.google.gerrit.server.project.ProjectState 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.server.project.ProjectState in project gerrit by GerritCodeReview.
the class CreateProjectIT method createProjectThatEndsWithSlash.
@Test
public void createProjectThatEndsWithSlash() throws Exception {
String newProjectName = name("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.server.project.ProjectState in project gerrit by GerritCodeReview.
the class CreateProjectIT method createProjectHttp.
@Test
public void createProjectHttp() throws Exception {
String newProjectName = name("newProject");
RestResponse r = adminRestSession.put("/projects/" + newProjectName);
r.assertCreated();
ProjectInfo p = newGson().fromJson(r.getReader(), ProjectInfo.class);
assertThat(p.name).isEqualTo(newProjectName);
// Check that we populate the label data in the HTTP path. See GetProjectIT#getProject
// for more extensive coverage of the LabelTypeInfo.
assertThat(p.labels).hasSize(1);
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.server.project.ProjectState in project gerrit by GerritCodeReview.
the class ProjectLevelConfigIT method nonExistingConfig.
@Test
public void nonExistingConfig() {
ProjectState state = projectCache.get(project).get();
assertThat(state.getConfig("test.config").get().toText()).isEqualTo("");
}
use of com.google.gerrit.server.project.ProjectState in project gerrit by GerritCodeReview.
the class ProjectLevelConfigIT method brokenConfigDoesNotBlockPush.
@Test
public void brokenConfigDoesNotBlockPush() throws Exception {
String configName = "test.config";
PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo, "Create Project Level Config", configName, "\\\\///");
push.to(RefNames.REFS_CONFIG).assertOkStatus();
ProjectState state = projectCache.get(project).get();
assertThat(state.getConfig(configName).get().toText()).isEmpty();
}
Aggregations