Search in sources :

Example 1 with VulnerabilitySourceQualifiedId

use of com.blackducksoftware.integration.hub.api.response.VulnerabilitySourceQualifiedId in project hub-alert by blackducksoftware.

the class VulnerabilityProcessorTest method testProcess.

@Test
public void testProcess() throws URISyntaxException, HubIntegrationException {
    final MapProcessorCache cache = new MapProcessorCache();
    final VulnerabilityProcessor vulnProcessor = new VulnerabilityProcessor(cache, new TestLogger());
    final Date createdAt = new Date();
    final ProjectVersionModel projectVersionModel = new ProjectVersionModel();
    projectVersionModel.setProjectLink("New project link");
    final String componentName = "notification test";
    final ComponentVersionView componentVersionView = new ComponentVersionView();
    final String componentVersionUrl = "sss";
    final String componentIssueUrl = "ddd";
    final List<VulnerabilitySourceQualifiedId> addedVulns = Lists.newArrayList();
    final List<VulnerabilitySourceQualifiedId> updatedVulns = Lists.newArrayList();
    final List<VulnerabilitySourceQualifiedId> deletedVulns = Lists.newArrayList();
    final VulnerabilityContentItem emptyVulnerabilityContentItem = new VulnerabilityContentItem(createdAt, projectVersionModel, componentName, componentVersionView, componentVersionUrl, addedVulns, updatedVulns, deletedVulns, componentIssueUrl);
    vulnProcessor.process(emptyVulnerabilityContentItem);
    assertTrue(cache.getEvents().size() == 0);
    final VulnerabilitySourceQualifiedId addedQualifiedId = new VulnerabilitySourceQualifiedId();
    final VulnerabilitySourceQualifiedId removedQualifiedId = new VulnerabilitySourceQualifiedId();
    addedVulns.add(addedQualifiedId);
    updatedVulns.add(addedQualifiedId);
    deletedVulns.add(removedQualifiedId);
    final VulnerabilityContentItem filledAndEmptiedVulnerabilityContentItem = new VulnerabilityContentItem(createdAt, projectVersionModel, componentName, componentVersionView, componentVersionUrl, addedVulns, updatedVulns, deletedVulns, componentIssueUrl);
    vulnProcessor.process(filledAndEmptiedVulnerabilityContentItem);
    assertTrue(cache.getEvents().size() == 0);
}
Also used : VulnerabilityContentItem(com.blackducksoftware.integration.hub.notification.VulnerabilityContentItem) VulnerabilitySourceQualifiedId(com.blackducksoftware.integration.hub.api.response.VulnerabilitySourceQualifiedId) ComponentVersionView(com.blackducksoftware.integration.hub.api.generated.view.ComponentVersionView) ProjectVersionModel(com.blackducksoftware.integration.hub.notification.ProjectVersionModel) TestLogger(com.blackducksoftware.integration.test.TestLogger) Date(java.util.Date) MapProcessorCache(com.blackducksoftware.integration.hub.notification.MapProcessorCache) Test(org.junit.Test)

Aggregations

ComponentVersionView (com.blackducksoftware.integration.hub.api.generated.view.ComponentVersionView)1 VulnerabilitySourceQualifiedId (com.blackducksoftware.integration.hub.api.response.VulnerabilitySourceQualifiedId)1 MapProcessorCache (com.blackducksoftware.integration.hub.notification.MapProcessorCache)1 ProjectVersionModel (com.blackducksoftware.integration.hub.notification.ProjectVersionModel)1 VulnerabilityContentItem (com.blackducksoftware.integration.hub.notification.VulnerabilityContentItem)1 TestLogger (com.blackducksoftware.integration.test.TestLogger)1 Date (java.util.Date)1 Test (org.junit.Test)1