use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method nameIsTrimmed.
@Test
public void nameIsTrimmed() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.name = " Foo-Review ";
LabelDefinitionInfo updatedLabel = gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(updatedLabel.name).isEqualTo("Foo-Review");
assertThat(gApi.projects().name(allProjects.get()).label("Foo-Review").get()).isNotNull();
assertThrows(ResourceNotFoundException.class, () -> gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).get());
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method setCopyAllScoresOnMergeFirstParentUpdate.
@Test
public void setCopyAllScoresOnMergeFirstParentUpdate() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresOnMergeFirstParentUpdate).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyAllScoresOnMergeFirstParentUpdate = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyAllScoresOnMergeFirstParentUpdate).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresOnMergeFirstParentUpdate).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method setCopyAnyScore.
@Test
public void setCopyAnyScore() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAnyScore).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyAnyScore = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyAnyScore).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAnyScore).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method setInvalidCopyCondition.
@Test
public void setInvalidCopyCondition() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyCondition).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyCondition = "foo:::bar";
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(project.get()).label("foo").update(input));
assertThat(thrown).hasMessageThat().contains("unable to parse copy condition");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInput in project gerrit by GerritCodeReview.
the class SetLabelIT method cannotSetValueWithEmptyDescription.
@Test
public void cannotSetValueWithEmptyDescription() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.values = ImmutableMap.of("+1", "");
BadRequestException thrown = assertThrows(BadRequestException.class, () -> gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input));
assertThat(thrown).hasMessageThat().contains("description for value '+1' cannot be empty");
}
Aggregations