use of com.synopsys.integration.alert.common.rest.model.AlertNotificationModel in project hub-alert by blackducksoftware.
the class NotificationReceivedEventHandlerTestIT method cleanUpDB.
@AfterEach
public void cleanUpDB() {
PageRequest pageRequest = defaultNotificationAccessor.getPageRequestForNotifications(0, pageSize, null, null);
Page<AlertNotificationModel> notifications = defaultNotificationAccessor.findAll(pageRequest, false);
notifications.get().forEach(defaultNotificationAccessor::deleteNotification);
defaultNotificationAccessor.findByCreatedAtBefore(OffsetDateTime.now().minusMinutes(2));
defaultConfigurationAccessor.deleteConfiguration(blackDuckGlobalConfigId);
}
use of com.synopsys.integration.alert.common.rest.model.AlertNotificationModel in project hub-alert by blackducksoftware.
the class NotificationReceivedEventHandlerTestIT method testHandleEventProcessedNotifications.
@Test
void testHandleEventProcessedNotifications() {
List<AlertNotificationModel> notificationContent = new ArrayList<>();
notificationContent.add(createAlertNotificationModel(true));
notificationContent.add(createAlertNotificationModel(true));
List<AlertNotificationModel> savedModels = defaultNotificationAccessor.saveAllNotifications(notificationContent);
assertNotNull(savedModels);
assertEquals(0, defaultNotificationAccessor.getFirstPageOfNotificationsNotProcessed(pageSize).getModels().size());
NotificationProcessor notificationProcessor = createNotificationProcessor();
NotificationReceivedEventHandler notificationReceivedEventHandler = new NotificationReceivedEventHandler(defaultNotificationAccessor, notificationProcessor, eventManager);
notificationReceivedEventHandler.handle(new NotificationReceivedEvent());
testAlertNotificationModels(savedModels);
}
use of com.synopsys.integration.alert.common.rest.model.AlertNotificationModel in project hub-alert by blackducksoftware.
the class NotificationReceivedEventHandlerTestIT method testHandleEventMixedProcessedNotifications.
@Test
void testHandleEventMixedProcessedNotifications() {
List<AlertNotificationModel> notificationContent = new ArrayList<>();
notificationContent.add(createAlertNotificationModel(true));
notificationContent.add(createAlertNotificationModel(false));
List<AlertNotificationModel> savedModels = defaultNotificationAccessor.saveAllNotifications(notificationContent);
assertNotNull(savedModels);
NotificationProcessor notificationProcessor = createNotificationProcessor();
NotificationReceivedEventHandler notificationReceivedEventHandler = new NotificationReceivedEventHandler(defaultNotificationAccessor, notificationProcessor, eventManager);
notificationReceivedEventHandler.handle(new NotificationReceivedEvent());
testAlertNotificationModels(savedModels);
}
use of com.synopsys.integration.alert.common.rest.model.AlertNotificationModel in project hub-alert by blackducksoftware.
the class MockNotificationAccessor method setNotificationsProcessed.
@Override
public void setNotificationsProcessed(List<AlertNotificationModel> notifications) {
for (AlertNotificationModel notification : notifications) {
AlertNotificationModel updatedNotification = createProcessedAlertNotificationModel(notification);
int index = alertNotificationModels.indexOf(notification);
alertNotificationModels.set(index, updatedNotification);
}
}
Aggregations