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());
}
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();
}
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());
}
Aggregations