use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel in project hub-alert by blackducksoftware.
the class JobConfigActions method createDistributionJobRequestModel.
private DistributionJobRequestModel createDistributionJobRequestModel(Collection<ConfigurationFieldModel> configFieldModels, List<JobProviderProjectFieldModel> jobProjects, OffsetDateTime createdAt, @Nullable OffsetDateTime lastUpdated) throws AlertException {
List<BlackDuckProjectDetailsModel> projectFilterDetails = jobProjects.stream().map(jobProject -> new BlackDuckProjectDetailsModel(jobProject.getName(), jobProject.getHref())).collect(Collectors.toList());
Map<String, ConfigurationFieldModel> configuredFieldsMap = DataStructureUtils.mapToValues(configFieldModels, ConfigurationFieldModel::getFieldKey);
DistributionJobModel fromResource = distributionJobModelExtractor.convertToJobModel(null, configuredFieldsMap, createdAt, lastUpdated, projectFilterDetails);
return new DistributionJobRequestModel(fromResource.isEnabled(), fromResource.getName(), fromResource.getDistributionFrequency(), fromResource.getProcessingType(), fromResource.getChannelDescriptorName(), fromResource.getChannelGlobalConfigId(), fromResource.getBlackDuckGlobalConfigId(), fromResource.isFilterByProject(), fromResource.getProjectNamePattern().orElse(null), fromResource.getProjectVersionNamePattern().orElse(null), fromResource.getNotificationTypes(), projectFilterDetails, fromResource.getPolicyFilterPolicyNames(), fromResource.getVulnerabilityFilterSeverityNames(), fromResource.getDistributionJobDetails());
}
use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel in project hub-alert by blackducksoftware.
the class JobNotificationMapperTestIT method extractSingleJobWithMatchingFilter.
@Test
public void extractSingleJobWithMatchingFilter() {
DistributionJobRequestModel jobRequestModel = createJobRequestModel(FrequencyType.REAL_TIME, ProcessingType.DIGEST, List.of(), List.of(NotificationType.VULNERABILITY.name(), NotificationType.POLICY_OVERRIDE.name()), List.of(), List.of(POLICY_FILTER_NAME));
testSingleJob(jobRequestModel, 4);
}
use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel in project hub-alert by blackducksoftware.
the class JobNotificationMapperTestIT method extractSingleJobWithoutMatchingFilter.
@Test
public void extractSingleJobWithoutMatchingFilter() {
DistributionJobRequestModel jobRequestModel = createJobRequestModel(FrequencyType.REAL_TIME, ProcessingType.DIGEST, List.of(), List.of(NotificationType.VULNERABILITY.name(), NotificationType.POLICY_OVERRIDE.name()), List.of(VulnerabilitySeverityType.HIGH.name()), List.of("RANDOM"));
testSingleJob(jobRequestModel, 2);
}
use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel in project hub-alert by blackducksoftware.
the class JobNotificationMapperTestIT method createDistributionJobModels.
private List<DistributionJobRequestModel> createDistributionJobModels() {
DistributionJobRequestModel distributionJobRequestModel1 = createJobRequestModel(FrequencyType.REAL_TIME, ProcessingType.DIGEST, List.of(), List.of(NotificationType.VULNERABILITY.name()), List.of(VulnerabilitySeverityType.LOW.name()), List.of());
DistributionJobRequestModel distributionJobRequestModel2 = createJobRequestModel(FrequencyType.REAL_TIME, ProcessingType.DIGEST, List.of(), List.of(NotificationType.VULNERABILITY.name()), List.of(VulnerabilitySeverityType.HIGH.name(), VulnerabilitySeverityType.LOW.name()), List.of());
DistributionJobRequestModel distributionJobRequestModel3 = createJobRequestModel(FrequencyType.REAL_TIME, ProcessingType.DIGEST, List.of(), List.of(NotificationType.VULNERABILITY.name()), List.of(), List.of());
DistributionJobRequestModel distributionJobRequestModel4 = createJobRequestModel(FrequencyType.REAL_TIME, ProcessingType.DIGEST, List.of(), List.of(NotificationType.VULNERABILITY.name()), List.of(VulnerabilitySeverityType.MEDIUM.name()), List.of());
return List.of(distributionJobRequestModel1, distributionJobRequestModel2, distributionJobRequestModel3, distributionJobRequestModel4);
}
Aggregations