use of com.google.gerrit.extensions.common.LabelTypeInfo in project gerrit by GerritCodeReview.
the class ProjectJson method format.
public ProjectInfo format(ProjectState projectState) {
ProjectInfo info = format(projectState.getProject());
info.labels = new HashMap<>();
for (LabelType t : projectState.getLabelTypes().getLabelTypes()) {
LabelTypeInfo labelInfo = new LabelTypeInfo();
labelInfo.values = t.getValues().stream().collect(toMap(LabelValue::formatValue, LabelValue::getText, (v1, v2) -> {
logger.atSevere().log("Duplicate values for project: %s, label: %s found: '%s':'%s'", projectState.getName(), t.getName(), v1, v2);
return v1;
}));
labelInfo.defaultValue = t.getDefaultValue();
info.labels.put(t.getName(), labelInfo);
}
return info;
}
use of com.google.gerrit.extensions.common.LabelTypeInfo in project gerrit by GerritCodeReview.
the class GetProjectIT method getProject.
@Test
public void getProject() throws Exception {
String name = project.get();
ProjectInfo p = gApi.projects().name(name).get();
assertThat(p.name).isEqualTo(name);
assertThat(p.labels).hasSize(1);
LabelTypeInfo l = p.labels.get("Code-Review");
ImmutableMap<String, String> want = ImmutableMap.of(" 0", "No score", "-1", "I would prefer this is not merged as is", "-2", "This shall not be merged", "+1", "Looks good to me, but someone else must approve", "+2", "Looks good to me, approved");
assertThat(l.values).isEqualTo(want);
assertThat(l.defaultValue).isEqualTo(0);
}
Aggregations