Search in sources :

Example 1 with CveSearchData

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

the class CveSearchWrapperTest method testLargeData.

@Ignore
@Test
public void testLargeData() throws IOException {
    Release release = new ReleaseBuilder().setName("server").get();
    Optional<List<CveSearchData>> resultWrapped = cveSearchWrapper.searchForRelease(release);
    assert (resultWrapped.isPresent());
    assert (resultWrapped.get() != null);
}
Also used : List(java.util.List) Release(org.eclipse.sw360.datahandler.thrift.components.Release) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with CveSearchData

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

the class CveSearchWrapperTest method compareToSearchByCPE.

@Test
public void compareToSearchByCPE() throws IOException {
    Release release = new ReleaseBuilder().setName("blindstring").setVendorFullname("blindstring").setVendorShortname("blindstring").setCpe(CPE).get();
    List<CveSearchData> resultDirect = cveSearchApi.cvefor(CPE);
    Optional<List<CveSearchData>> resultWrapped = cveSearchWrapper.searchForRelease(release);
    assert (resultWrapped.isPresent());
    assert (resultWrapped.get() != null);
    assert (isEquivalent(resultDirect, resultWrapped.get()));
}
Also used : List(java.util.List) Release(org.eclipse.sw360.datahandler.thrift.components.Release) Test(org.junit.Test)

Example 3 with CveSearchData

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

the class CveSearchWrapperTest method compareToWithoutWrapper.

@Ignore("meanwhile cveSearchWrapper implementation changed, test maybe suitable for later use")
@Test
public void compareToWithoutWrapper() throws IOException {
    Release release = new ReleaseBuilder().setName(PRODUCTNAME).setVendorFullname(VENDORNAME).get();
    List<CveSearchData> resultDirect = cveSearchApi.search(VENDORNAME, PRODUCTNAME);
    Optional<List<CveSearchData>> resultWrapped = cveSearchWrapper.searchForRelease(release);
    assert (resultWrapped.isPresent());
    assert (resultWrapped.get() != null);
    assert (resultWrapped.get().size() > 0);
    assert (isEquivalent(resultDirect, resultWrapped.get()));
}
Also used : List(java.util.List) Release(org.eclipse.sw360.datahandler.thrift.components.Release) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with CveSearchData

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

the class CveSearchDataTranslator method apply.

@Override
public VulnerabilityWithRelation apply(CveSearchData cveSearchData) {
    Vulnerability vulnerability = new CveSearchDataToVulnerabilityTranslator().apply(cveSearchData);
    ReleaseVulnerabilityRelation relation = new CveSearchDataToReleaseVulnerabilityRelationTranslator().apply(cveSearchData);
    return new VulnerabilityWithRelation(vulnerability, relation);
}
Also used : ReleaseVulnerabilityRelation(org.eclipse.sw360.datahandler.thrift.vulnerabilities.ReleaseVulnerabilityRelation) Vulnerability(org.eclipse.sw360.datahandler.thrift.vulnerabilities.Vulnerability)

Example 5 with CveSearchData

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

the class CveSearchJsonParserTest method singleEmpty.

@Test
public void singleEmpty() {
    Object resultO = cveSearchJsonParserSingle.apply(toBufferedReader(SEARCH_RESULT_EMPTY));
    CveSearchData result = (CveSearchData) resultO;
}
Also used : CveSearchData(org.eclipse.sw360.cvesearch.datasource.CveSearchData) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)12 CveSearchData (org.eclipse.sw360.cvesearch.datasource.CveSearchData)10 Vulnerability (org.eclipse.sw360.datahandler.thrift.vulnerabilities.Vulnerability)5 List (java.util.List)4 Release (org.eclipse.sw360.datahandler.thrift.components.Release)4 IOException (java.io.IOException)3 java.util (java.util)3 Collectors (java.util.stream.Collectors)3 CveSearchApiImpl (org.eclipse.sw360.cvesearch.datasource.CveSearchApiImpl)3 CommonUtils (org.eclipse.sw360.datahandler.common.CommonUtils)3 CVEReference (org.eclipse.sw360.datahandler.thrift.vulnerabilities.CVEReference)3 Before (org.junit.Before)3 CveSearchDataTestHelper.isUrlReachable (org.eclipse.sw360.cvesearch.datasource.CveSearchDataTestHelper.isUrlReachable)2 CveSearchHandler (org.eclipse.sw360.cvesearch.service.CveSearchHandler)2 Assume (org.junit.Assume)2 Ignore (org.junit.Ignore)2 Type (java.lang.reflect.Type)1 Logger (org.apache.log4j.Logger)1 TException (org.apache.thrift.TException)1 VulnerabilityConnector (org.eclipse.sw360.cvesearch.datasink.VulnerabilityConnector)1