use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method updateName.
@Test
public void updateName() 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(input.name);
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.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method unsetCopyMinScore.
@Test
public void unsetCopyMinScore() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
try (ProjectConfigUpdate u = updateProject(project)) {
u.getConfig().updateLabelType("foo", lt -> lt.setCopyMinScore(true));
u.save();
}
assertThat(gApi.projects().name(project.get()).label("foo").get().copyMinScore).isTrue();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyMinScore = false;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyMinScore).isNull();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyMinScore).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method unsetCopyAllScoresOnTrivialRebase.
@Test
public void unsetCopyAllScoresOnTrivialRebase() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
try (ProjectConfigUpdate u = updateProject(project)) {
u.getConfig().updateLabelType("foo", lt -> lt.setCopyAllScoresOnTrivialRebase(true));
u.save();
}
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresOnTrivialRebase).isTrue();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyAllScoresOnTrivialRebase = false;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyAllScoresOnTrivialRebase).isNull();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresOnTrivialRebase).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method branchesAreTrimmed.
@Test
public void branchesAreTrimmed() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
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).containsExactly("refs/heads/master", "refs/heads/foo/*", "^refs/heads/stable-.*");
assertThat(gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).get().branches).containsExactly("refs/heads/master", "refs/heads/foo/*", "^refs/heads/stable-.*");
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method setCanOverride.
@Test
public void setCanOverride() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
try (ProjectConfigUpdate u = updateProject(project)) {
u.getConfig().updateLabelType("foo", lt -> lt.setCanOverride(false));
u.save();
}
assertThat(gApi.projects().name(project.get()).label("foo").get().canOverride).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.canOverride = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.canOverride).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().canOverride).isTrue();
}
Aggregations