use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method setCopyMaxScore.
@Test
public void setCopyMaxScore() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyMaxScore).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyMaxScore = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyMaxScore).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyMaxScore).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method setCopyAllScoresOnTrivialRebase.
@Test
public void setCopyAllScoresOnTrivialRebase() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresOnTrivialRebase).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyAllScoresOnTrivialRebase = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyAllScoresOnTrivialRebase).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresOnTrivialRebase).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method unsetCopyValues.
@Test
public void unsetCopyValues() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
try (ProjectConfigUpdate u = updateProject(project)) {
u.getConfig().updateLabelType("foo", lt -> lt.setCopyValues(ImmutableList.of((short) -1, (short) 1)));
u.save();
}
assertThat(gApi.projects().name(project.get()).label("foo").get().copyValues).isNotEmpty();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyValues = ImmutableList.of();
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyValues).isNull();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyValues).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method updateBranches.
@Test
public void updateBranches() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
// Branches can be full ref, ref pattern or regular expression.
input.branches = ImmutableList.of("refs/heads/master", "refs/heads/foo/*", "^refs/heads/stable-.*");
LabelDefinitionInfo updatedLabel = gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(updatedLabel.branches).containsExactlyElementsIn(input.branches);
assertThat(gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).get().branches).containsExactlyElementsIn(input.branches);
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method updateFunction.
@Test
public void updateFunction() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.function = LabelFunction.NO_OP.getFunctionName();
LabelDefinitionInfo updatedLabel = gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(updatedLabel.function).isEqualTo(input.function);
assertThat(gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).get().function).isEqualTo(input.function);
}
Aggregations