Search in sources :

Example 1 with BomEditNotificationContent

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

the class BomEditNotificationMessageExtractorTest method createBomEditWithProjectNameNotificationContent.

private BomEditWithProjectNameNotificationContent createBomEditWithProjectNameNotificationContent() {
    BomEditNotificationContent bomEditNotificationContent = new BomEditNotificationContent();
    bomEditNotificationContent.setProjectVersion(PROJECT_VERSION_ITEM.getValue());
    bomEditNotificationContent.setBomComponent("http://bomComponentUrl");
    bomEditNotificationContent.setComponentName(COMPONENT.getValue());
    bomEditNotificationContent.setComponentVersionName(COMPONENT_VERSION.getValue());
    return new BomEditWithProjectNameNotificationContent(bomEditNotificationContent, PROJECT_ITEM.getLabel(), PROJECT_VERSION_ITEM.getLabel());
}
Also used : BomEditNotificationContent(com.synopsys.integration.blackduck.api.manual.component.BomEditNotificationContent) BomEditWithProjectNameNotificationContent(com.synopsys.integration.alert.provider.blackduck.processor.model.BomEditWithProjectNameNotificationContent)

Example 2 with BomEditNotificationContent

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

the class BomEditNotificationDetailExtractor method extractDetailedContent.

@Override
public List<DetailedNotificationContent> extractDetailedContent(AlertNotificationModel alertNotificationModel, BomEditNotificationView notificationView) {
    BomEditNotificationContent notificationContent = notificationView.getContent();
    Optional<ProjectVersionWrapper> optionalProjectAndVersion = retrieveProjectAndVersion(alertNotificationModel.getProviderConfigId(), notificationContent.getProjectVersion());
    if (optionalProjectAndVersion.isPresent()) {
        ProjectVersionWrapper projectAndVersion = optionalProjectAndVersion.get();
        ProjectView project = projectAndVersion.getProjectView();
        ProjectVersionView projectVersion = projectAndVersion.getProjectVersionView();
        String projectName = project.getName();
        BomEditWithProjectNameNotificationContent updatedNotificationContent = new BomEditWithProjectNameNotificationContent(notificationContent, projectName, projectVersion.getVersionName());
        DetailedNotificationContent detailedContent = DetailedNotificationContent.project(alertNotificationModel, updatedNotificationContent, projectName, projectVersion.getVersionName());
        return List.of(detailedContent);
    }
    return List.of();
}
Also used : BomEditNotificationContent(com.synopsys.integration.blackduck.api.manual.component.BomEditNotificationContent) ProjectVersionView(com.synopsys.integration.blackduck.api.generated.view.ProjectVersionView) DetailedNotificationContent(com.synopsys.integration.alert.processor.api.detail.DetailedNotificationContent) ProjectView(com.synopsys.integration.blackduck.api.generated.view.ProjectView) BomEditWithProjectNameNotificationContent(com.synopsys.integration.alert.provider.blackduck.processor.model.BomEditWithProjectNameNotificationContent) ProjectVersionWrapper(com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)

Example 3 with BomEditNotificationContent

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

the class BomEditWithProjectNameNotificationContentTest method getContentTest.

@Test
public void getContentTest() {
    String bomComponent = "http://bomComponentLink";
    String componentName = "Component Name";
    String componentVersionName = "ComponentVersionName";
    BomEditNotificationContent bomEditNotificationContent = new BomEditNotificationContent();
    bomEditNotificationContent.setProjectVersion(PROJECT_VERSION_URL);
    bomEditNotificationContent.setBomComponent(bomComponent);
    bomEditNotificationContent.setComponentName(componentName);
    bomEditNotificationContent.setComponentVersionName(componentVersionName);
    BomEditWithProjectNameNotificationContent notificationContent = new BomEditWithProjectNameNotificationContent(bomEditNotificationContent, PROJECT_NAME, PROJECT_VERSION_NAME);
    assertEquals(PROJECT_NAME, notificationContent.getProjectName());
    assertEquals(PROJECT_VERSION_NAME, notificationContent.getProjectVersionName());
    assertEquals(PROJECT_VERSION_URL, notificationContent.getProjectVersionUrl());
    assertEquals(bomComponent, notificationContent.getBomComponent());
    assertEquals(componentName, notificationContent.getComponentName());
    assertEquals(componentVersionName, notificationContent.getComponentVersionName());
}
Also used : BomEditNotificationContent(com.synopsys.integration.blackduck.api.manual.component.BomEditNotificationContent) Test(org.junit.jupiter.api.Test)

Aggregations

BomEditNotificationContent (com.synopsys.integration.blackduck.api.manual.component.BomEditNotificationContent)3 BomEditWithProjectNameNotificationContent (com.synopsys.integration.alert.provider.blackduck.processor.model.BomEditWithProjectNameNotificationContent)2 DetailedNotificationContent (com.synopsys.integration.alert.processor.api.detail.DetailedNotificationContent)1 ProjectVersionView (com.synopsys.integration.blackduck.api.generated.view.ProjectVersionView)1 ProjectView (com.synopsys.integration.blackduck.api.generated.view.ProjectView)1 ProjectVersionWrapper (com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)1 Test (org.junit.jupiter.api.Test)1