use of com.synopsys.integration.alert.database.job.blackduck.BlackDuckJobDetailsEntity in project hub-alert by blackducksoftware.
the class StaticJobAccessorTest method getPageOfJobsBlankSearchTest.
@Test
void getPageOfJobsBlankSearchTest() {
ProviderKey providerKey = new BlackDuckProviderKey();
UUID jobId = UUID.randomUUID();
DistributionJobEntity distributionJobEntity = createSlackDistributionJobEntity(jobId);
distributionJobEntity.setBlackDuckJobDetails(new BlackDuckJobDetailsEntity(jobId, 3L, true, "*", "*"));
Page<DistributionJobEntity> page = new PageImpl<>(List.of(distributionJobEntity));
Mockito.when(distributionJobRepository.findByChannelDescriptorNameIn(Mockito.any(), Mockito.any())).thenReturn(page);
AlertPagedModel<DistributionJobModel> pageOfJobs = jobAccessor.getPageOfJobs(0, 10, " ", List.of(providerKey.getUniversalKey()));
assertEquals(1, pageOfJobs.getTotalPages());
List<DistributionJobModel> models = pageOfJobs.getModels();
assertEquals(1, models.size());
DistributionJobModel distributionJobModel = models.get(0);
assertEquals(jobId, distributionJobModel.getJobId());
assertEquals(jobName, distributionJobModel.getName());
}
use of com.synopsys.integration.alert.database.job.blackduck.BlackDuckJobDetailsEntity in project hub-alert by blackducksoftware.
the class DefaultProcessingJobAccessor method convertToFilteredDistributionJobResponseModel.
private FilteredDistributionJobResponseModel convertToFilteredDistributionJobResponseModel(DistributionJobEntity jobEntity) {
UUID jobId = jobEntity.getJobId();
ProcessingType processingType = Enum.valueOf(ProcessingType.class, jobEntity.getProcessingType());
String channelName = jobEntity.getChannelDescriptorName();
String jobName = jobEntity.getName();
BlackDuckJobDetailsEntity blackDuckJobDetails = jobEntity.getBlackDuckJobDetails();
List<String> notificationTypes = blackDuckJobDetailsAccessor.retrieveNotificationTypesForJob(jobId);
List<BlackDuckProjectDetailsModel> projectDetails = blackDuckJobDetailsAccessor.retrieveProjectDetailsForJob(jobId);
List<String> policyNames = blackDuckJobDetailsAccessor.retrievePolicyNamesForJob(jobId);
List<String> vulnerabilitySeverityNames = blackDuckJobDetailsAccessor.retrieveVulnerabilitySeverityNamesForJob(jobId);
boolean filterByProject = blackDuckJobDetails.getFilterByProject();
String projectNamePattern = blackDuckJobDetails.getProjectNamePattern();
String projectVersionNamePattern = blackDuckJobDetails.getProjectVersionNamePattern();
return new FilteredDistributionJobResponseModel(jobId, processingType, channelName, jobName, notificationTypes, projectDetails, policyNames, vulnerabilitySeverityNames, filterByProject, projectNamePattern, projectVersionNamePattern);
}
Aggregations