Search in sources :

Example 1 with CveSearchApiImpl

use of org.eclipse.sw360.cvesearch.datasource.CveSearchApiImpl in project sw360portal by sw360.

the class CveSearchDataTranslatorTest method testWithApacheData.

@Test
public void testWithApacheData() throws IOException {
    List<CveSearchData> cveSearchDatas = new CveSearchApiImpl(host).search("apache", ".*");
    List<CveSearchDataTranslator.VulnerabilityWithRelation> vms = cveSearchDatas.stream().map(cveSearchData -> cveSearchDataTranslator.apply(cveSearchData)).collect(Collectors.toList());
    assert (vms != null);
    List<Vulnerability> vs = vms.stream().map(vm -> vm.vulnerability).collect(Collectors.toList());
    assert (vs.size() > 700);
}
Also used : java.util(java.util) CveSearchData(org.eclipse.sw360.cvesearch.datasource.CveSearchData) Test(org.junit.Test) IOException(java.io.IOException) CveSearchHandler(org.eclipse.sw360.cvesearch.service.CveSearchHandler) Collectors(java.util.stream.Collectors) CommonUtils(org.eclipse.sw360.datahandler.common.CommonUtils) CveSearchApiImpl(org.eclipse.sw360.cvesearch.datasource.CveSearchApiImpl) Assume(org.junit.Assume) CVEReference(org.eclipse.sw360.datahandler.thrift.vulnerabilities.CVEReference) Vulnerability(org.eclipse.sw360.datahandler.thrift.vulnerabilities.Vulnerability) Before(org.junit.Before) CveSearchDataTestHelper.isUrlReachable(org.eclipse.sw360.cvesearch.datasource.CveSearchDataTestHelper.isUrlReachable) Vulnerability(org.eclipse.sw360.datahandler.thrift.vulnerabilities.Vulnerability) CveSearchData(org.eclipse.sw360.cvesearch.datasource.CveSearchData) CveSearchApiImpl(org.eclipse.sw360.cvesearch.datasource.CveSearchApiImpl) Test(org.junit.Test)

Example 2 with CveSearchApiImpl

use of org.eclipse.sw360.cvesearch.datasource.CveSearchApiImpl in project sw360portal by sw360.

the class CveSearchDataTranslatorTest method testWithRealData.

@Test
public void testWithRealData() throws IOException {
    List<CveSearchData> cveSearchDatas = new CveSearchApiImpl(host).search("zyxel", "zywall");
    List<CveSearchDataTranslator.VulnerabilityWithRelation> vms = cveSearchDatas.stream().map(cveSearchData -> cveSearchDataTranslator.apply(cveSearchData)).collect(Collectors.toList());
    assert (vms != null);
}
Also used : java.util(java.util) CveSearchData(org.eclipse.sw360.cvesearch.datasource.CveSearchData) Test(org.junit.Test) IOException(java.io.IOException) CveSearchHandler(org.eclipse.sw360.cvesearch.service.CveSearchHandler) Collectors(java.util.stream.Collectors) CommonUtils(org.eclipse.sw360.datahandler.common.CommonUtils) CveSearchApiImpl(org.eclipse.sw360.cvesearch.datasource.CveSearchApiImpl) Assume(org.junit.Assume) CVEReference(org.eclipse.sw360.datahandler.thrift.vulnerabilities.CVEReference) Vulnerability(org.eclipse.sw360.datahandler.thrift.vulnerabilities.Vulnerability) Before(org.junit.Before) CveSearchDataTestHelper.isUrlReachable(org.eclipse.sw360.cvesearch.datasource.CveSearchDataTestHelper.isUrlReachable) CveSearchData(org.eclipse.sw360.cvesearch.datasource.CveSearchData) CveSearchApiImpl(org.eclipse.sw360.cvesearch.datasource.CveSearchApiImpl) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)2 java.util (java.util)2 Collectors (java.util.stream.Collectors)2 CveSearchApiImpl (org.eclipse.sw360.cvesearch.datasource.CveSearchApiImpl)2 CveSearchData (org.eclipse.sw360.cvesearch.datasource.CveSearchData)2 CveSearchDataTestHelper.isUrlReachable (org.eclipse.sw360.cvesearch.datasource.CveSearchDataTestHelper.isUrlReachable)2 CveSearchHandler (org.eclipse.sw360.cvesearch.service.CveSearchHandler)2 CommonUtils (org.eclipse.sw360.datahandler.common.CommonUtils)2 CVEReference (org.eclipse.sw360.datahandler.thrift.vulnerabilities.CVEReference)2 Vulnerability (org.eclipse.sw360.datahandler.thrift.vulnerabilities.Vulnerability)2 Assume (org.junit.Assume)2 Before (org.junit.Before)2 Test (org.junit.Test)2