use of org.eclipse.sw360.datahandler.thrift.vulnerabilities.CVEReference in project sw360portal by sw360.
the class CveSearchDataToVulnerabilityTranslator method getCVEReferencesForCVE.
protected Set<CVEReference> getCVEReferencesForCVE(String cve) {
Set<CVEReference> cveReferences = new HashSet<>();
String[] cveParts = cve.split("-");
if (cveParts.length < 3) {
return null;
}
cveReferences.add(new CVEReference().setYear(cveParts[1]).setNumber(cveParts[2]));
return cveReferences;
}
use of org.eclipse.sw360.datahandler.thrift.vulnerabilities.CVEReference in project sw360portal by sw360.
the class CveSearchDataTranslatorTest method testIdTranslation.
@Test
public void testIdTranslation() {
Vulnerability v = cveSearchDataTranslator.apply(cveSearchData).vulnerability;
Set<CVEReference> cveReferences = v.getCveReferences();
assert (cveReferences.size() == 1);
CVEReference cveReference = cveReferences.stream().findAny().get();
assert (CVEYEAR.equals(cveReference.getYear()));
assert ((CVENUMBER + ID).equals(cveReference.getNumber()));
}
use of org.eclipse.sw360.datahandler.thrift.vulnerabilities.CVEReference in project sw360portal by sw360.
the class CveSearchDataTranslatorTest method getCVEReferenceForCveSearchdataTest.
@Test
public void getCVEReferenceForCveSearchdataTest() {
Set<CVEReference> cveReferences = cveSearchDataToVulnerabilityTranslator.getCVEReferencesForCVE(CVE);
assert (1 == cveReferences.size());
CVEReference cveReference = cveReferences.stream().findAny().get();
assert (CVEYEAR.equals(cveReference.getYear()));
assert (CVENUMBER.equals(cveReference.getNumber()));
}
Aggregations