Search in sources :

Example 1 with NotificationRecipient

use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.

the class NotificationSendingServiceTest method saveNotificationWithoutEmailPropagation.

@Test
public void saveNotificationWithoutEmailPropagation() {
    Notification notification = getNotification();
    notification.setStopEmailPropagation(true);
    setBehaviour();
    notificationSendingService.sendNotification(notification);
    List<NotificationRecipient> recipients = getRecipients();
    verify(emailSendingService, never()).sendEmailForNotification(notification, userList);
    recipients.forEach(notificationRecipient -> {
        verify(emailSendingService, never()).sendEmailForNotification(notificationRecipient);
    });
}
Also used : NotificationRecipient(amu.zhcet.notification.recipient.NotificationRecipient) Notification(amu.zhcet.notification.Notification) Test(org.junit.Test)

Example 2 with NotificationRecipient

use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.

the class NotificationSendingServiceTest method saveNotificationWithoutFirebasePropagation.

@Test
public void saveNotificationWithoutFirebasePropagation() {
    Notification notification = getNotification();
    notification.setStopFirebasePropagation(true);
    setBehaviour();
    notificationSendingService.sendNotification(notification);
    List<NotificationRecipient> recipients = getRecipients();
    recipients.forEach(notificationRecipient -> {
        verify(firebaseNotificationSender, never()).sendFirebaseNotification(notificationRecipient);
    });
}
Also used : NotificationRecipient(amu.zhcet.notification.recipient.NotificationRecipient) Notification(amu.zhcet.notification.Notification) Test(org.junit.Test)

Example 3 with NotificationRecipient

use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.

the class NotificationSendingService method fromNotification.

private NotificationRecipient fromNotification(Notification notification, User user) {
    NotificationRecipient notificationRecipient = new NotificationRecipient();
    notificationRecipient.setNotification(notification);
    notificationRecipient.setRecipient(user);
    return notificationRecipient;
}
Also used : NotificationRecipient(amu.zhcet.notification.recipient.NotificationRecipient)

Example 4 with NotificationRecipient

use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.

the class NotificationSendingService method sendUserNotification.

private void sendUserNotification(Notification notification, User user) {
    NotificationRecipient notificationRecipient = fromNotification(notification, user);
    cachedNotificationService.save(notificationRecipient);
    completeNotificationDistribution(notificationRecipient);
}
Also used : NotificationRecipient(amu.zhcet.notification.recipient.NotificationRecipient)

Example 5 with NotificationRecipient

use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.

the class NotificationSendingServiceTest method saveNotificationRecipient.

@Test
public void saveNotificationRecipient() {
    Notification notification = getNotification();
    setBehaviour();
    notificationSendingService.sendNotification(notification);
    Stream.of(userIds).forEach(id -> verify(cachedNotificationService).resetUnreadCount(id));
    List<NotificationRecipient> recipients = getRecipients();
    verify(emailSendingService).sendEmailForNotification(notification, userList);
    recipients.forEach(notificationRecipient -> {
        assertTrue(Arrays.asList(userIds).contains(notificationRecipient.getRecipient().getUserId()));
        assertEquals(notification, notificationRecipient.getNotification());
        verify(cachedNotificationService).resetUnreadCount(notificationRecipient.getRecipient().getUserId());
        verify(firebaseNotificationSender).sendFirebaseNotification(notificationRecipient);
    });
}
Also used : NotificationRecipient(amu.zhcet.notification.recipient.NotificationRecipient) Notification(amu.zhcet.notification.Notification) Test(org.junit.Test)

Aggregations

NotificationRecipient (amu.zhcet.notification.recipient.NotificationRecipient)5 Notification (amu.zhcet.notification.Notification)3 Test (org.junit.Test)3