use of com.synopsys.integration.alert.database.job.DistributionJobEntity in project hub-alert by blackducksoftware.
the class NotificationAccessorTestIT method testFindAllWithSearchByFieldValue.
@Test
public void testFindAllWithSearchByFieldValue() {
NotificationEntity notificationContent = createNotificationContent();
notificationContent = notificationContentRepository.save(notificationContent);
OffsetDateTime currentTime = DateUtils.createCurrentDateTimestamp();
DistributionJobEntity distributionJobEntity = new DistributionJobEntity(null, "job_name", true, FrequencyType.REAL_TIME.name(), ProcessingType.DEFAULT.name(), ChannelKeys.EMAIL.getUniversalKey(), UUID.randomUUID(), currentTime, null);
DistributionJobEntity savedJob = distributionJobRepository.save(distributionJobEntity);
final String auditStatus = "audit status thing";
AuditEntryEntity auditEntryEntity = new AuditEntryEntity(savedJob.getJobId(), DateUtils.createCurrentDateTimestamp(), DateUtils.createCurrentDateTimestamp(), auditStatus, "", "");
auditEntryEntity = auditEntryRepository.save(auditEntryEntity);
AuditNotificationRelation auditNotificationRelation = new AuditNotificationRelation(auditEntryEntity.getId(), notificationContent.getId());
auditNotificationRepository.save(auditNotificationRelation);
PageRequest pageRequest = PageRequest.of(0, 10);
Page<AlertNotificationModel> all = notificationManager.findAllWithSearch(ChannelKeys.EMAIL.getUniversalKey(), pageRequest, false);
// Search term should match the channel name
assertFalse(all.isEmpty());
}
Aggregations