Search in sources :

Example 6 with ProjectVersionNotificationContent

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

the class DetailedNotificationContentTest method versionlessTest.

@Test
public void versionlessTest() {
    String projectName = "project with version";
    String projectVersionName = "version";
    ProjectVersionNotificationContent projectVersionNotificationContent = new ProjectVersionNotificationContent();
    DetailedNotificationContent detailedContent = DetailedNotificationContent.versionLess(ALERT_NOTIFICATION_MODEL, projectVersionNotificationContent, projectName);
    assertContent(detailedContent, ALERT_NOTIFICATION_MODEL.getProviderConfigId(), projectVersionNotificationContent.getClass(), List.of());
    assertEquals(projectName, detailedContent.getProjectName().orElse(null));
    assertTrue(detailedContent.getPolicyName().isEmpty(), EXPECTED_NO_POLICY);
    assertNull(detailedContent.getProjectVersionName().orElse(null));
}
Also used : ProjectVersionNotificationContent(com.synopsys.integration.blackduck.api.manual.component.ProjectVersionNotificationContent) Test(org.junit.jupiter.api.Test)

Example 7 with ProjectVersionNotificationContent

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

the class NotificationDetailExtractionDelegatorTest method wrapNotificationTest.

@Test
public void wrapNotificationTest() {
    ProjectVersionNotificationDetailExtractor projectVersionNDE = new ProjectVersionNotificationDetailExtractor();
    NotificationDetailExtractionDelegator delegator = new NotificationDetailExtractionDelegator(RESPONSE_RESOLVER, List.of(projectVersionNDE));
    List<DetailedNotificationContent> detailedContent = delegator.wrapNotification(ALERT_NOTIFICATION_MODEL);
    assertEquals(1, detailedContent.size());
    ProjectVersionNotificationContent content = PVN_VIEW.getContent();
    DetailedNotificationContent detailedPVN = detailedContent.get(0);
    assertEquals(content.getProjectName(), detailedPVN.getProjectName().orElse(null));
}
Also used : ProjectVersionNotificationContent(com.synopsys.integration.blackduck.api.manual.component.ProjectVersionNotificationContent) ProjectVersionNotificationDetailExtractor(com.synopsys.integration.alert.provider.blackduck.processor.detail.ProjectVersionNotificationDetailExtractor) Test(org.junit.jupiter.api.Test)

Aggregations

ProjectVersionNotificationContent (com.synopsys.integration.blackduck.api.manual.component.ProjectVersionNotificationContent)7 Test (org.junit.jupiter.api.Test)5 ProjectVersionNotificationView (com.synopsys.integration.blackduck.api.manual.view.ProjectVersionNotificationView)2 LinkableItem (com.synopsys.integration.alert.common.message.model.LinkableItem)1 AlertNotificationModel (com.synopsys.integration.alert.common.rest.model.AlertNotificationModel)1 DetailedNotificationContent (com.synopsys.integration.alert.processor.api.detail.DetailedNotificationContent)1 ProviderMessageHolder (com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder)1 ProjectMessage (com.synopsys.integration.alert.processor.api.extract.model.project.ProjectMessage)1 NotificationContentWrapper (com.synopsys.integration.alert.processor.api.filter.NotificationContentWrapper)1 NotificationExtractorBlackDuckServicesFactoryCache (com.synopsys.integration.alert.provider.blackduck.processor.NotificationExtractorBlackDuckServicesFactoryCache)1 ProjectVersionNotificationDetailExtractor (com.synopsys.integration.alert.provider.blackduck.processor.detail.ProjectVersionNotificationDetailExtractor)1 BlackDuckHttpClient (com.synopsys.integration.blackduck.http.client.BlackDuckHttpClient)1 BlackDuckServicesFactory (com.synopsys.integration.blackduck.service.BlackDuckServicesFactory)1 HttpUrl (com.synopsys.integration.rest.HttpUrl)1