use of com.google.gerrit.entities.LegacySubmitRequirement in project gerrit by GerritCodeReview.
the class ChangeJson method submitRecordToInfo.
private SubmitRecordInfo submitRecordToInfo(SubmitRecord record) {
SubmitRecordInfo info = new SubmitRecordInfo();
if (record.status != null) {
info.status = SubmitRecordInfo.Status.valueOf(record.status.name());
}
info.ruleName = record.ruleName;
info.errorMessage = record.errorMessage;
if (record.labels != null) {
info.labels = new ArrayList<>();
for (SubmitRecord.Label label : record.labels) {
SubmitRecordInfo.Label labelInfo = new SubmitRecordInfo.Label();
labelInfo.label = label.label;
if (label.status != null) {
labelInfo.status = SubmitRecordInfo.Label.Status.valueOf(label.status.name());
}
labelInfo.appliedBy = accountLoader.get(label.appliedBy);
info.labels.add(labelInfo);
}
}
if (record.requirements != null) {
info.requirements = new ArrayList<>();
for (LegacySubmitRequirement requirement : record.requirements) {
info.requirements.add(requirementToInfo(requirement, record.status));
}
}
return info;
}
use of com.google.gerrit.entities.LegacySubmitRequirement in project gerrit by GerritCodeReview.
the class EventFactory method addSubmitRecordRequirements.
private void addSubmitRecordRequirements(SubmitRecord submitRecord, SubmitRecordAttribute sa) {
if (submitRecord.requirements != null && !submitRecord.requirements.isEmpty()) {
sa.requirements = new ArrayList<>();
for (LegacySubmitRequirement req : submitRecord.requirements) {
SubmitRequirementAttribute re = new SubmitRequirementAttribute();
re.fallbackText = req.fallbackText();
re.type = req.type();
sa.requirements.add(re);
}
}
}
use of com.google.gerrit.entities.LegacySubmitRequirement in project gerrit by GerritCodeReview.
the class ChangeFieldTest method storedSubmitRequirementWithoutCustomData.
@Test
public void storedSubmitRequirementWithoutCustomData() {
SubmitRecord r = record(SubmitRecord.Status.OK, label(SubmitRecord.Label.Status.MAY, "Label-1", null), label(SubmitRecord.Label.Status.OK, "Label-2", 1));
// Doesn't have any custom data value
LegacySubmitRequirement sr = LegacySubmitRequirement.builder().setFallbackText("short_type").setType("ci_status").build();
r.requirements = Collections.singletonList(sr);
assertStoredRecordRoundTrip(r);
}
use of com.google.gerrit.entities.LegacySubmitRequirement in project gerrit by GerritCodeReview.
the class ChangeFieldTest method storedSubmitRecordsWithRequirement.
@Test
public void storedSubmitRecordsWithRequirement() {
SubmitRecord r = record(SubmitRecord.Status.OK, label(SubmitRecord.Label.Status.MAY, "Label-1", null), label(SubmitRecord.Label.Status.OK, "Label-2", 1));
LegacySubmitRequirement sr = LegacySubmitRequirement.builder().setType("short_type").setFallbackText("Fallback text may contain special symbols like < > \\ / ; :").build();
r.requirements = Collections.singletonList(sr);
assertStoredRecordRoundTrip(r);
}
Aggregations