use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ProjectIT method maxObjectSizeOverridesParentProjectWhenLower.
@Test
public void maxObjectSizeOverridesParentProjectWhenLower() throws Exception {
Project.NameKey child = projectOperations.newProject().parent(project).create();
ConfigInfo info = setMaxObjectSize("200k");
assertThat(info.maxObjectSizeLimit.value).isEqualTo("204800");
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("200k");
assertThat(info.maxObjectSizeLimit.summary).isNull();
info = setMaxObjectSize(child, "100k");
assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
assertThat(info.maxObjectSizeLimit.summary).isNull();
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ProjectIT method maxObjectSizeIsInheritedFromParentProject.
@Test
@GerritConfig(name = "receive.inheritProjectMaxObjectSizeLimit", value = "true")
public void maxObjectSizeIsInheritedFromParentProject() throws Exception {
Project.NameKey child = projectOperations.newProject().parent(project).create();
ConfigInfo info = setMaxObjectSize("100k");
assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
assertThat(info.maxObjectSizeLimit.summary).isNull();
info = getConfig(child);
assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
assertThat(info.maxObjectSizeLimit.configuredValue).isNull();
assertThat(info.maxObjectSizeLimit.summary).isEqualTo(String.format(INHERITED_FROM_PARENT, project));
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ProjectIT method localCommentLinkOverridesParentCommentLink.
@Test
public void localCommentLinkOverridesParentCommentLink() throws Exception {
ConfigInput input = new ConfigInput();
addCommentLink(input, BUGZILLA, BUGZILLA_MATCH, BUGZILLA_LINK);
addCommentLink(input, JIRA, JIRA_MATCH, JIRA_LINK);
ConfigInfo info = setConfig(project, input);
Map<String, CommentLinkInfo> expected = new HashMap<>();
expected.put(BUGZILLA, commentLinkInfo(BUGZILLA, BUGZILLA_MATCH, BUGZILLA_LINK));
expected.put(JIRA, commentLinkInfo(JIRA, JIRA_MATCH, JIRA_LINK));
assertCommentLinks(info, expected);
Project.NameKey child = projectOperations.newProject().parent(project).create();
String otherLink = "https://other.example.com";
input = new ConfigInput();
addCommentLink(input, BUGZILLA, BUGZILLA_MATCH, otherLink);
setConfig(child, input);
expected = new HashMap<>();
expected.put(BUGZILLA, commentLinkInfo(BUGZILLA, BUGZILLA_MATCH, otherLink));
expected.put(JIRA, commentLinkInfo(JIRA, JIRA_MATCH, JIRA_LINK));
assertCommentLinks(getConfig(child), expected);
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class SetParentIT method setParentToGrandchildNotAllowed.
@Test
public void setParentToGrandchildNotAllowed() throws Exception {
Project.NameKey child = projectOperations.newProject().parent(project).create();
String grandchild = projectOperations.newProject().parent(child).create().get();
ResourceConflictException thrown = assertThrows(ResourceConflictException.class, () -> gApi.projects().name(project.get()).parent(grandchild));
assertThat(thrown).hasMessageThat().contains("cycle exists between");
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ProjectIT method maxObjectSizeOverridesParentProjectWhenNotSetOnParent.
@Test
public void maxObjectSizeOverridesParentProjectWhenNotSetOnParent() throws Exception {
Project.NameKey child = projectOperations.newProject().parent(project).create();
ConfigInfo info = setMaxObjectSize("0");
assertThat(info.maxObjectSizeLimit.value).isNull();
assertThat(info.maxObjectSizeLimit.configuredValue).isNull();
assertThat(info.maxObjectSizeLimit.summary).isNull();
info = setMaxObjectSize(child, "100k");
assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
assertThat(info.maxObjectSizeLimit.summary).isNull();
}
Aggregations