use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method commitMessageIsTrimmed.
@Test
public void commitMessageIsTrimmed() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.function = LabelFunction.NO_OP.getFunctionName();
input.commitMessage = " Set NoOp function ";
gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(projectOperations.project(allProjects).getHead(RefNames.REFS_CONFIG).getShortMessage()).isEqualTo("Set NoOp function");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method unsetCanOverride.
@Test
public void unsetCanOverride() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().canOverride).isTrue();
LabelDefinitionInput input = new LabelDefinitionInput();
input.canOverride = false;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.canOverride).isNull();
assertThat(gApi.projects().name(project.get()).label("foo").get().canOverride).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method unsetCopyAnyScore.
@Test
public void unsetCopyAnyScore() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
try (ProjectConfigUpdate u = updateProject(project)) {
u.getConfig().updateLabelType("foo", lt -> lt.setCopyAnyScore(true));
u.save();
}
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAnyScore).isTrue();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyAnyScore = false;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyAnyScore).isNull();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAnyScore).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method cannotSetNameIfNameClashes.
@Test
public void cannotSetNameIfNameClashes() throws Exception {
configLabel("Foo-Review", LabelFunction.NO_OP);
configLabel("Bar-Review", LabelFunction.NO_OP);
LabelDefinitionInput input = new LabelDefinitionInput();
input.name = "Bar-Review";
ResourceConflictException thrown = assertThrows(ResourceConflictException.class, () -> gApi.projects().name(project.get()).label("Foo-Review").update(input));
assertThat(thrown).hasMessageThat().contains("name " + input.name + " already in use");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method unsetCopyAllScoresIfNoChange.
@Test
public void unsetCopyAllScoresIfNoChange() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresIfNoChange).isTrue();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyAllScoresIfNoChange = false;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyAllScoresIfNoChange).isNull();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresIfNoChange).isNull();
}
Aggregations