Search in sources :

Example 6 with AffectedProjectVersion

use of com.synopsys.integration.blackduck.api.manual.component.AffectedProjectVersion in project hub-alert by blackducksoftware.

the class VulnerabilityNotificationDetailExtractorTest method ensureLibraryModelMapsToVulnerabilityUniqueProjectNotificationContent.

@Test
public void ensureLibraryModelMapsToVulnerabilityUniqueProjectNotificationContent() throws IOException {
    VulnerabilityNotificationView vulnerabilityNotificationView = getVulnerabilityNotificationView(VULNERABILITY_SIMPLE_JSON_PATH);
    VulnerabilityNotificationContent content = vulnerabilityNotificationView.getContent();
    AffectedProjectVersion affectedProjectVersion = content.getAffectedProjectVersions().get(0);
    VulnerabilityUniqueProjectNotificationContent vulnerabilityUniqueProjectNotificationContent = new VulnerabilityUniqueProjectNotificationContent(content, affectedProjectVersion);
    assertEquals("alert-test-project", vulnerabilityUniqueProjectNotificationContent.getAffectedProjectVersion().getProjectName());
    assertEquals("Custom Component", vulnerabilityUniqueProjectNotificationContent.getComponentName());
    assertEquals("1.0.0", vulnerabilityUniqueProjectNotificationContent.getVersionName());
    assertEquals("https://a-hub-server.blackduck.com/api/components/7792be90-bfd2-42d7-ae19-66e051978675/versions/5a01d0b3-a6c4-469a-b9c8-c5769cffae78", vulnerabilityUniqueProjectNotificationContent.getComponentVersion());
    VulnerabilitySourceQualifiedId newVuln = vulnerabilityUniqueProjectNotificationContent.getNewVulnerabilityIds().get(0);
    VulnerabilitySourceQualifiedId updatedVuln = vulnerabilityUniqueProjectNotificationContent.getUpdatedVulnerabilityIds().get(0);
    VulnerabilitySourceQualifiedId deletedVuln = vulnerabilityUniqueProjectNotificationContent.getDeletedVulnerabilityIds().get(0);
    assertEquals(VulnerabilitySeverityType.LOW.name(), newVuln.getSeverity());
    assertEquals("CVE-2018-0001", newVuln.getVulnerabilityId());
    assertEquals(VulnerabilitySeverityType.HIGH.name(), updatedVuln.getSeverity());
    assertEquals("CVE-2018-0002", updatedVuln.getVulnerabilityId());
    assertEquals(VulnerabilitySeverityType.MEDIUM.name(), deletedVuln.getSeverity());
    assertEquals("CVE-2018-0003", deletedVuln.getVulnerabilityId());
}
Also used : VulnerabilityNotificationView(com.synopsys.integration.blackduck.api.manual.view.VulnerabilityNotificationView) VulnerabilitySourceQualifiedId(com.synopsys.integration.blackduck.api.manual.component.VulnerabilitySourceQualifiedId) AffectedProjectVersion(com.synopsys.integration.blackduck.api.manual.component.AffectedProjectVersion) VulnerabilityNotificationContent(com.synopsys.integration.blackduck.api.manual.component.VulnerabilityNotificationContent) VulnerabilityUniqueProjectNotificationContent(com.synopsys.integration.alert.provider.blackduck.processor.model.VulnerabilityUniqueProjectNotificationContent) Test(org.junit.jupiter.api.Test)

Example 7 with AffectedProjectVersion

use of com.synopsys.integration.blackduck.api.manual.component.AffectedProjectVersion in project hub-alert by blackducksoftware.

the class NotificationGeneratorUtils method createCommonContentData.

public static void createCommonContentData(VulnerabilityNotificationContent content) {
    AffectedProjectVersion affectedProjectVersion = new AffectedProjectVersion();
    affectedProjectVersion.setProjectName("VulnerableProjectName");
    affectedProjectVersion.setProjectVersionName("1.2.3");
    affectedProjectVersion.setProjectVersion("projectURL");
    affectedProjectVersion.setComponentIssueUrl("componentIssueUrl");
    content.setComponentVersion("componentversionurl");
    content.setComponentName("VulnerableComponent");
    content.setVersionName("1.2.3");
    content.setComponentVersionOriginName("originName");
    content.setAffectedProjectVersions(Arrays.asList(affectedProjectVersion));
    content.setComponentVersionOriginId("originId");
}
Also used : AffectedProjectVersion(com.synopsys.integration.blackduck.api.manual.component.AffectedProjectVersion)

Example 8 with AffectedProjectVersion

use of com.synopsys.integration.blackduck.api.manual.component.AffectedProjectVersion in project hub-alert by blackducksoftware.

the class JobNotificationMapperTestIT method createVulnerabilityUniqueProjectNotificationContent.

private VulnerabilityUniqueProjectNotificationContent createVulnerabilityUniqueProjectNotificationContent(String projectName) {
    AffectedProjectVersion affectedProjectVersion = new AffectedProjectVersion();
    affectedProjectVersion.setProjectName(projectName);
    return new VulnerabilityUniqueProjectNotificationContent(new VulnerabilityNotificationContent(), affectedProjectVersion);
}
Also used : AffectedProjectVersion(com.synopsys.integration.blackduck.api.manual.component.AffectedProjectVersion) VulnerabilityUniqueProjectNotificationContent(com.synopsys.integration.alert.provider.blackduck.processor.model.VulnerabilityUniqueProjectNotificationContent) VulnerabilityNotificationContent(com.synopsys.integration.blackduck.api.manual.component.VulnerabilityNotificationContent)

Aggregations

AffectedProjectVersion (com.synopsys.integration.blackduck.api.manual.component.AffectedProjectVersion)8 VulnerabilityNotificationContent (com.synopsys.integration.blackduck.api.manual.component.VulnerabilityNotificationContent)6 VulnerabilityUniqueProjectNotificationContent (com.synopsys.integration.alert.provider.blackduck.processor.model.VulnerabilityUniqueProjectNotificationContent)4 Test (org.junit.jupiter.api.Test)3 VulnerabilitySourceQualifiedId (com.synopsys.integration.blackduck.api.manual.component.VulnerabilitySourceQualifiedId)2 BomComponentDetails (com.synopsys.integration.alert.processor.api.extract.model.project.BomComponentDetails)1 ComponentConcern (com.synopsys.integration.alert.processor.api.extract.model.project.ComponentConcern)1 ComponentUpgradeGuidance (com.synopsys.integration.alert.processor.api.extract.model.project.ComponentUpgradeGuidance)1 BlackDuckMessageBomComponentDetailsCreator (com.synopsys.integration.alert.provider.blackduck.processor.message.service.BlackDuckMessageBomComponentDetailsCreator)1 ProjectVersionComponentVersionView (com.synopsys.integration.blackduck.api.generated.view.ProjectVersionComponentVersionView)1 VulnerabilityNotificationView (com.synopsys.integration.blackduck.api.manual.view.VulnerabilityNotificationView)1 BlackDuckApiClient (com.synopsys.integration.blackduck.service.BlackDuckApiClient)1 HttpUrl (com.synopsys.integration.rest.HttpUrl)1 IntegrationRestException (com.synopsys.integration.rest.exception.IntegrationRestException)1