use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method setCopyAllScoresIfNoCodeChange.
@Test
public void setCopyAllScoresIfNoCodeChange() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresIfNoCodeChange).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyAllScoresIfNoCodeChange = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyAllScoresIfNoCodeChange).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresIfNoCodeChange).isTrue();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class PostLabelsIT method deleteAndRecreateLabel.
@Test
public void deleteAndRecreateLabel() throws Exception {
configLabel("Foo", LabelFunction.NO_OP);
LabelDefinitionInput fooInput = new LabelDefinitionInput();
fooInput.name = "Foo";
fooInput.function = LabelFunction.MAX_NO_BLOCK.getFunctionName();
fooInput.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
BatchLabelInput input = new BatchLabelInput();
input.delete = ImmutableList.of("Foo");
input.create = ImmutableList.of(fooInput);
gApi.projects().name(project.get()).labels(input);
LabelDefinitionInfo fooLabel = gApi.projects().name(project.get()).label("Foo").get();
assertThat(fooLabel.function).isEqualTo(fooInput.function);
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class PostLabelsIT method createAndUpdateLabel.
@Test
public void createAndUpdateLabel() throws Exception {
LabelDefinitionInput fooCreateInput = new LabelDefinitionInput();
fooCreateInput.name = "Foo";
fooCreateInput.function = LabelFunction.MAX_NO_BLOCK.getFunctionName();
fooCreateInput.values = ImmutableMap.of("+1", "Looks Good", " 0", "Don't Know", "-1", "Looks Bad");
LabelDefinitionInput fooUpdateInput = new LabelDefinitionInput();
fooUpdateInput.function = LabelFunction.ANY_WITH_BLOCK.getFunctionName();
BatchLabelInput input = new BatchLabelInput();
input.create = ImmutableList.of(fooCreateInput);
input.update = ImmutableMap.of("Foo", fooUpdateInput);
gApi.projects().name(project.get()).labels(input);
LabelDefinitionInfo fooLabel = gApi.projects().name(project.get()).label("Foo").get();
assertThat(fooLabel.function).isEqualTo(fooUpdateInput.function);
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method branchesCanBeUnset.
@Test
public void branchesCanBeUnset() throws Exception {
LabelDefinitionInput input = new LabelDefinitionInput();
input.branches = ImmutableList.of("refs/heads/master");
gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).get().branches).isNotNull();
input.branches = ImmutableList.of();
LabelDefinitionInfo updatedLabel = gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).update(input);
assertThat(updatedLabel.branches).isNull();
assertThat(gApi.projects().name(allProjects.get()).label(LabelId.CODE_REVIEW).get().branches).isNull();
}
use of com.google.gerrit.extensions.common.LabelDefinitionInfo in project gerrit by GerritCodeReview.
the class SetLabelIT method setCopyAllScoresIfListOfFilesDidNotChange.
@Test
public void setCopyAllScoresIfListOfFilesDidNotChange() throws Exception {
configLabel("foo", LabelFunction.NO_OP);
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresIfListOfFilesDidNotChange).isNull();
LabelDefinitionInput input = new LabelDefinitionInput();
input.copyAllScoresIfListOfFilesDidNotChange = true;
LabelDefinitionInfo updatedLabel = gApi.projects().name(project.get()).label("foo").update(input);
assertThat(updatedLabel.copyAllScoresIfListOfFilesDidNotChange).isTrue();
assertThat(gApi.projects().name(project.get()).label("foo").get().copyAllScoresIfListOfFilesDidNotChange).isTrue();
}
Aggregations