use of com.synopsys.integration.blackduck.api.manual.view.ProjectVersionNotificationView in project hub-alert by blackducksoftware.
the class NotificationDetailExtractionDelegatorTest method createProjectVersionNotificationView.
private static ProjectVersionNotificationView createProjectVersionNotificationView() {
ProjectVersionNotificationContent projectVersionNotificationContent = new ProjectVersionNotificationContent();
projectVersionNotificationContent.setProject("https://my-project");
projectVersionNotificationContent.setProjectName("my project!");
projectVersionNotificationContent.setProjectVersion("https://project-version");
projectVersionNotificationContent.setProjectVersionName("a name for a version 02468");
projectVersionNotificationContent.setOperationType(OperationType.CREATE);
ProjectVersionNotificationView projectVersionNotificationView = new ProjectVersionNotificationView();
projectVersionNotificationView.setType(NotificationType.PROJECT_VERSION);
projectVersionNotificationView.setContent(projectVersionNotificationContent);
return projectVersionNotificationView;
}
use of com.synopsys.integration.blackduck.api.manual.view.ProjectVersionNotificationView in project hub-alert by blackducksoftware.
the class ProjectVersionNotificationDetailExtractorTest method extractDetailedContentTest.
@Test
public void extractDetailedContentTest() throws IOException {
String jsonContent = TestResourceUtils.readFileToString(NOTIFICATION_JSON_PATH);
ProjectVersionNotificationView projectNotificationView = gson.fromJson(jsonContent, ProjectVersionNotificationView.class);
ProjectVersionNotificationContent projectVersionNotificationContent = projectNotificationView.getContent();
AlertNotificationModel notification = new AlertNotificationModel(0L, 0L, "BlackDuck", "Config 1", null, null, null, null, false);
ProjectVersionNotificationDetailExtractor extractor = new ProjectVersionNotificationDetailExtractor();
List<DetailedNotificationContent> detailedNotificationContents = extractor.extractDetailedContent(notification, projectNotificationView);
assertEquals(1, detailedNotificationContents.size());
DetailedNotificationContent detailedNotificationContent = detailedNotificationContents.get(0);
Optional<String> optionalProjectName = detailedNotificationContent.getProjectName();
assertTrue(optionalProjectName.isPresent(), "Expect project name to be present");
assertEquals(projectVersionNotificationContent.getProjectName(), optionalProjectName.get());
assertTrue(detailedNotificationContent.getPolicyName().isEmpty(), "Expected no policy name to be present");
assertEquals(0, detailedNotificationContent.getVulnerabilitySeverities().size());
}
Aggregations