use of com.synopsys.integration.blackduck.api.manual.component.LicenseLimitNotificationContent in project hub-alert by blackducksoftware.
the class LicenseLimitNotificationDetailExtractorTest method extractDetailedContentTest.
@Test
public void extractDetailedContentTest() {
LicenseLimitNotificationDetailExtractor extractor = new LicenseLimitNotificationDetailExtractor();
LicenseLimitNotificationView notificationView = new LicenseLimitNotificationView();
LicenseLimitNotificationContent notificationContent = new LicenseLimitNotificationContent();
notificationView.setContent(notificationContent);
AlertNotificationModel notification = new AlertNotificationModel(0L, 0L, "BlackDuck", "Config 1", null, null, null, null, false);
List<DetailedNotificationContent> detailedNotificationContents = extractor.extractDetailedContent(notification, notificationView);
assertEquals(1, detailedNotificationContents.size());
DetailedNotificationContent detailedNotificationContent = detailedNotificationContents.get(0);
assertTrue(detailedNotificationContent.getProjectName().isEmpty(), "Expected no project name to be present");
assertTrue(detailedNotificationContent.getPolicyName().isEmpty(), "Expected no policy name to be present");
assertEquals(0, detailedNotificationContent.getVulnerabilitySeverities().size());
}
use of com.synopsys.integration.blackduck.api.manual.component.LicenseLimitNotificationContent in project hub-alert by blackducksoftware.
the class LicenseLimitNotificationMessageExtractorTest method extractTest.
@Test
public void extractTest() {
LicenseLimitNotificationContent notificationContentComponent = createLicenseLimitNotificationContent();
NotificationContentWrapper notificationContentWrapper = createNotificationContentWrapper(notificationContentComponent);
LicenseLimitNotificationMessageExtractor licenseLimitNotificationMessageExtractor = new LicenseLimitNotificationMessageExtractor(blackDuckProviderKey);
ProviderMessageHolder providerMessageHolder = licenseLimitNotificationMessageExtractor.extract(notificationContentWrapper, notificationContentComponent);
assertEquals(0, providerMessageHolder.getProjectMessages().size());
assertEquals(1, providerMessageHolder.getSimpleMessages().size());
SimpleMessage simpleMessage = providerMessageHolder.getSimpleMessages().get(0);
assertEquals(summary, simpleMessage.getSummary());
assertEquals(description, simpleMessage.getDescription());
assertEquals(4, simpleMessage.getDetails().size());
}
use of com.synopsys.integration.blackduck.api.manual.component.LicenseLimitNotificationContent in project hub-alert by blackducksoftware.
the class LicenseLimitNotificationMessageExtractorTest method createLicenseLimitNotificationContent.
private LicenseLimitNotificationContent createLicenseLimitNotificationContent() {
LicenseLimitNotificationContent licenseLimitNotificationContent = new LicenseLimitNotificationContent();
licenseLimitNotificationContent.setLicenseViolationType(LicenseLimitType.MANAGED_CODEBASE_BYTES_NEW);
licenseLimitNotificationContent.setMessage(description);
licenseLimitNotificationContent.setMarketingPageUrl("http://someUrl");
licenseLimitNotificationContent.setUsedCodeSize(100L);
licenseLimitNotificationContent.setHardLimit(200L);
licenseLimitNotificationContent.setSoftLimit(150L);
return licenseLimitNotificationContent;
}
use of com.synopsys.integration.blackduck.api.manual.component.LicenseLimitNotificationContent in project hub-alert by blackducksoftware.
the class DetailedNotificationContentTest method projectlessTest.
@Test
public void projectlessTest() {
LicenseLimitNotificationContent licenseLimitNotificationContent = new LicenseLimitNotificationContent();
DetailedNotificationContent detailedContent = DetailedNotificationContent.projectless(ALERT_NOTIFICATION_MODEL, licenseLimitNotificationContent);
assertContent(detailedContent, ALERT_NOTIFICATION_MODEL.getProviderConfigId(), licenseLimitNotificationContent.getClass(), List.of());
assertTrue(detailedContent.getProjectName().isEmpty(), "Expected no project name");
assertTrue(detailedContent.getPolicyName().isEmpty(), EXPECTED_NO_POLICY);
}
Aggregations