use of com.synopsys.integration.blackduck.api.manual.view.ProjectNotificationView in project hub-alert by blackducksoftware.
the class ProjectNotificationDetailExtractorTest method extractDetailedContentTest.
@Test
public void extractDetailedContentTest() throws IOException {
String jsonContent = TestResourceUtils.readFileToString(NOTIFICATION_JSON_PATH);
ProjectNotificationView projectNotificationView = gson.fromJson(jsonContent, ProjectNotificationView.class);
ProjectNotificationContent projectNotificationContent = projectNotificationView.getContent();
AlertNotificationModel notification = new AlertNotificationModel(0L, 0L, "BlackDuck", "Config 1", null, null, null, null, false);
ProjectNotificationDetailExtractor extractor = new ProjectNotificationDetailExtractor();
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(projectNotificationContent.getProjectName(), optionalProjectName.get());
assertTrue(detailedNotificationContent.getPolicyName().isEmpty(), "Expected no policy name to be present");
assertEquals(0, detailedNotificationContent.getVulnerabilitySeverities().size());
}
use of com.synopsys.integration.blackduck.api.manual.view.ProjectNotificationView in project hub-alert by blackducksoftware.
the class JmsNotificationReceiverTestIT method createAlertNotificationModel.
private AlertNotificationModel createAlertNotificationModel(Long id, boolean processed) {
ProjectNotificationContent projectNotificationContent = new ProjectNotificationContent();
projectNotificationContent.setProject("project");
projectNotificationContent.setProjectName(String.format("projectName-%s", id));
projectNotificationContent.setOperationType(OperationType.CREATE);
ProjectNotificationView projectNotificationView = new ProjectNotificationView();
projectNotificationView.setContent(projectNotificationContent);
projectNotificationView.setType(NotificationType.PROJECT);
String content = gson.toJson(projectNotificationView);
return new AlertNotificationModel(id, blackDuckGlobalConfigId, "provider_blackduck", "DELETED CONFIGURATION", NotificationType.PROJECT.name(), content, DateUtils.createCurrentDateTimestamp(), DateUtils.createCurrentDateTimestamp(), processed);
}
Aggregations