use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobModel in project hub-alert by blackducksoftware.
the class JobConfigActionsTest method validateBadRequestTest.
@Test
public void validateBadRequestTest() {
Descriptor descriptorWithValidator = createDescriptor(Optional::empty, () -> Optional.of(jobFieldModel -> Set.of()));
JobConfigActions jobConfigActionsForTest = createJobConfigActions(new DescriptorMap(List.of(descriptorKey), List.of(descriptorWithValidator)), List.of());
Mockito.when(mockedJobAccessor.getJobByName(Mockito.anyString())).thenReturn(Optional.of(distributionJobModel));
ValidationActionResponse validationActionResponse = jobConfigActionsForTest.validate(jobFieldModel);
assertTrue(validationActionResponse.isSuccessful());
assertEquals(HttpStatus.OK, validationActionResponse.getHttpStatus());
assertTrue(validationActionResponse.hasContent());
ValidationResponseModel validationResponseModel = validationActionResponse.getContent().get();
assertTrue(validationResponseModel.hasErrors(), "Expected validation response to have errors");
}
use of com.synopsys.integration.alert.common.persistence.model.job.DistributionJobModel in project hub-alert by blackducksoftware.
the class ProcessedNotificationDetailsTest method fromDistributionJobTest.
@Test
public void fromDistributionJobTest() {
DistributionJobModel distributionJobModel = new DistributionJobModelBuilder().jobId(uuid).channelDescriptorName(CHANNEL_NAME).name(JOB_NAME).distributionFrequency(FrequencyType.REAL_TIME).processingType(ProcessingType.DEFAULT).createdAt(OffsetDateTime.now().minusMinutes(1L)).lastUpdated(OffsetDateTime.now()).blackDuckGlobalConfigId(10L).notificationTypes(List.of("notificationTypes")).build();
ProcessedNotificationDetails processedNotificationDetails = ProcessedNotificationDetails.fromDistributionJob(distributionJobModel);
assertEquals(uuid, processedNotificationDetails.getJobId());
assertEquals(CHANNEL_NAME, processedNotificationDetails.getChannelName());
assertEquals(JOB_NAME, processedNotificationDetails.getJobName());
}
Aggregations