Search in sources :

Example 21 with FilteredDistributionJobResponseModel

use of com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel in project hub-alert by blackducksoftware.

the class JobNotificationFilterUtilsTest method doesNotificationApplyToJobDefaultTest.

@Test
public void doesNotificationApplyToJobDefaultTest() {
    NotificationContentComponent notificationContent = Mockito.mock(NotificationContentComponent.class);
    AlertNotificationModel notificationModel = createAlertNotificationModel(NotificationType.LICENSE_LIMIT);
    DetailedNotificationContent detailedNotificationContent = DetailedNotificationContent.projectless(notificationModel, notificationContent);
    FilteredDistributionJobResponseModel jobResponseModel = createFilteredDistributionJobResponseModel(List.of(NotificationType.LICENSE_LIMIT.name()), List.of(), List.of(), List.of(), false, "", "");
    assertTrue(JobNotificationFilterUtils.doesNotificationApplyToJob(jobResponseModel, detailedNotificationContent));
}
Also used : AlertNotificationModel(com.synopsys.integration.alert.common.rest.model.AlertNotificationModel) FilteredDistributionJobResponseModel(com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel) NotificationContentComponent(com.synopsys.integration.blackduck.api.manual.component.NotificationContentComponent) DetailedNotificationContent(com.synopsys.integration.alert.processor.api.detail.DetailedNotificationContent) Test(org.junit.jupiter.api.Test)

Example 22 with FilteredDistributionJobResponseModel

use of com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel in project hub-alert by blackducksoftware.

the class JobNotificationFilterUtilsTest method doesProjectVersionNameMatchWithProjectTest.

@Test
public void doesProjectVersionNameMatchWithProjectTest() {
    String validProject = "projectName";
    List<String> projects = List.of("fake project", "project 2", "flippant", validProject);
    FilteredDistributionJobResponseModel jobResponseModel = createFilteredDistributionJobResponseModel(List.of(), projects, List.of(), List.of(), true, "", "1.0.*");
    boolean doesProjectApplyToJob = JobNotificationFilterUtils.doesProjectApplyToJob(jobResponseModel, "projectName", "1.0.0");
    assertTrue(doesProjectApplyToJob);
}
Also used : FilteredDistributionJobResponseModel(com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel) Test(org.junit.jupiter.api.Test)

Example 23 with FilteredDistributionJobResponseModel

use of com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel in project hub-alert by blackducksoftware.

the class JobNotificationFilterUtilsTest method doesProjectVersionNameMatchWithInvalidProjectPatternMatchTest.

@Test
public void doesProjectVersionNameMatchWithInvalidProjectPatternMatchTest() {
    List<String> projects = List.of("fake project", "project 2", "flippant");
    FilteredDistributionJobResponseModel jobResponseModel = createFilteredDistributionJobResponseModel(List.of(), projects, List.of(), List.of(), true, "projectN.*", "1.0.*");
    boolean doesProjectApplyToJob = JobNotificationFilterUtils.doesProjectApplyToJob(jobResponseModel, "wrong", "1.0.0");
    assertFalse(doesProjectApplyToJob);
}
Also used : FilteredDistributionJobResponseModel(com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel) Test(org.junit.jupiter.api.Test)

Example 24 with FilteredDistributionJobResponseModel

use of com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel in project hub-alert by blackducksoftware.

the class JobNotificationFilterUtilsTest method doesProjectVersionNameMatchWithProjectPatternMatchTest.

@Test
public void doesProjectVersionNameMatchWithProjectPatternMatchTest() {
    List<String> projects = List.of("fake project", "project 2", "flippant");
    FilteredDistributionJobResponseModel jobResponseModel = createFilteredDistributionJobResponseModel(List.of(), projects, List.of(), List.of(), true, "projectN.*", "1.0.*");
    boolean doesProjectApplyToJob = JobNotificationFilterUtils.doesProjectApplyToJob(jobResponseModel, "projectName", "1.0.0");
    assertTrue(doesProjectApplyToJob);
}
Also used : FilteredDistributionJobResponseModel(com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel) Test(org.junit.jupiter.api.Test)

Aggregations

FilteredDistributionJobResponseModel (com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobResponseModel)24 Test (org.junit.jupiter.api.Test)19 DetailedNotificationContent (com.synopsys.integration.alert.processor.api.detail.DetailedNotificationContent)8 AlertNotificationModel (com.synopsys.integration.alert.common.rest.model.AlertNotificationModel)7 NotificationContentComponent (com.synopsys.integration.blackduck.api.manual.component.NotificationContentComponent)6 FilteredDistributionJobRequestModel (com.synopsys.integration.alert.common.persistence.model.job.FilteredDistributionJobRequestModel)2 ArrayList (java.util.ArrayList)2 UUID (java.util.UUID)2 ProcessingType (com.synopsys.integration.alert.common.enumeration.ProcessingType)1 ProcessingJobAccessor (com.synopsys.integration.alert.common.persistence.accessor.ProcessingJobAccessor)1 BlackDuckProjectDetailsModel (com.synopsys.integration.alert.common.persistence.model.job.BlackDuckProjectDetailsModel)1 AlertPagedDetails (com.synopsys.integration.alert.common.rest.model.AlertPagedDetails)1 AlertPagedModel (com.synopsys.integration.alert.common.rest.model.AlertPagedModel)1 DistributionJobEntity (com.synopsys.integration.alert.database.job.DistributionJobEntity)1 BlackDuckJobDetailsEntity (com.synopsys.integration.alert.database.job.blackduck.BlackDuckJobDetailsEntity)1 NotificationDetailExtractionDelegator (com.synopsys.integration.alert.processor.api.detail.NotificationDetailExtractionDelegator)1 ProviderMessageDistributor (com.synopsys.integration.alert.processor.api.distribute.ProviderMessageDistributor)1 AlertIntegrationTest (com.synopsys.integration.alert.util.AlertIntegrationTest)1 RuleViolationNotificationView (com.synopsys.integration.blackduck.api.manual.view.RuleViolationNotificationView)1 HashMap (java.util.HashMap)1