Skip to content

Commit

Permalink
Merge pull request #294 from DependencyTrack/fix-grammatical-number
Browse files Browse the repository at this point in the history
Fix grammatical number of `vulnerabilities` in `ProjectVulnAnalysisCompleteSubject`
  • Loading branch information
nscuro authored Sep 4, 2023
2 parents 757e553 + f0f5a14 commit 8bb2861
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ private static ComponentVulnAnalysisCompleteSubject convert(ComponentVulnAnalysi
ComponentVulnAnalysisCompleteSubject.Builder builder = ComponentVulnAnalysisCompleteSubject.newBuilder();
builder.setComponent(component);
List<Vulnerability> vulnerabilities = componentVulnAnalysisComplete.getVulnerabilityList().stream().map(NotificationModelConverter::convert).toList();
builder.addAllVulnerability(vulnerabilities);
builder.addAllVulnerabilities(vulnerabilities);
return builder.build();
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/proto/org/hyades/notification/v1/notification.proto
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,13 @@ message Vulnerability {
string name = 2;
}
}
message ComponentVulnAnalysisCompleteSubject{

message ComponentVulnAnalysisCompleteSubject {
Component component = 1;
repeated Vulnerability vulnerability = 2;
repeated Vulnerability vulnerabilities = 2;
}

message ProjectVulnAnalysisCompleteSubject{
message ProjectVulnAnalysisCompleteSubject {
Project project = 1;
repeated ComponentVulnAnalysisCompleteSubject findings = 2;
ProjectVulnAnalysisStatus status = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ public void vulnScanResultProcessingTest() throws Exception {
assertThat(subject.getFindingsList()).satisfiesExactlyInAnyOrder(
finding -> {
assertThat(finding.getComponent().getUuid()).isEqualTo(componentA.getUuid().toString());
assertThat(finding.getVulnerabilityCount()).isEqualTo(1);
assertThat(finding.getVulnerability(0).getVulnId()).isEqualTo("SNYK-001");
assertThat(finding.getVulnerability(0).getSource()).isEqualTo("SNYK");
assertThat(finding.getVulnerabilitiesCount()).isEqualTo(1);
assertThat(finding.getVulnerabilities(0).getVulnId()).isEqualTo("SNYK-001");
assertThat(finding.getVulnerabilities(0).getSource()).isEqualTo("SNYK");
},
finding -> {
assertThat(finding.getComponent().getUuid()).isEqualTo(componentB.getUuid().toString());
assertThat(finding.getVulnerabilityCount()).isEqualTo(1);
assertThat(finding.getVulnerability(0).getVulnId()).isEqualTo("SONATYPE-001");
assertThat(finding.getVulnerability(0).getSource()).isEqualTo("OSSINDEX");
assertThat(finding.getVulnerabilitiesCount()).isEqualTo(1);
assertThat(finding.getVulnerabilities(0).getVulnId()).isEqualTo("SONATYPE-001");
assertThat(finding.getVulnerabilities(0).getSource()).isEqualTo("OSSINDEX");
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ public void testConvertComponentVulnAnalysisCompleteSubject() throws Exception {
final var subject = notification.getSubject().unpack(ProjectVulnAnalysisCompleteSubject.class);
assertProject(subject.getProject());
assertComponent(subject.getFindingsList().get(0).getComponent());
assertVulnerability(subject.getFindingsList().get(0).getVulnerability(0));
assertVulnerability(subject.getFindingsList().get(0).getVulnerabilities(0));
assertThat(subject.getStatus()).isEqualTo(ProjectVulnAnalysisStatus.PROJECT_VULN_ANALYSIS_STATUS_COMPLETED);
}
}

0 comments on commit 8bb2861

Please sign in to comment.