@Test public void testNotifyUnknownRecipient() throws Exception { context.checking(new Expectations() { { oneOf(placeholderPersonMapper).execute(RECIPIENT1); will(returnValue(null)); } }); Collection<UserActionRequest> result = sut.notify(NotificationType.COMMENT_TO_COMMENTED_POST, Collections.singletonList(RECIPIENT1), Collections.EMPTY_MAP, recipientIndex); context.assertIsSatisfied(); assertNull(result); }
@Override public Collection<UserActionRequest> notify(final NotificationType inType, final Collection<Long> inRecipients, final Map<String, Object> inProperties, final Map<Long, PersonModelView> inRecipientIndex) throws Exception { Context velocityContext = new VelocityContext(new VelocityContext(inProperties, velocityGlobalContext)); velocityContext.put("context", velocityContext); velocityContext.put("type", inType); for (long recipientId : inRecipients) { Person recipient = placeholderPersonMapper.execute(recipientId); if (recipient == null) { continue; } if (aggregateTemplates.containsKey(inType)) { updateAggregateNotification(recipient, inType, inProperties, velocityContext); } else { createNewNotification(recipient, inType, inProperties, velocityContext); } } return null; }
InAppNotificationNotifier implements Notifier { @Override public Collection<UserActionRequest> notify(final NotificationType inType, final Collection<Long> inRecipients, final Map<String, Object> inProperties, final Map<Long, PersonModelView> inRecipientIndex) throws Exception { Context velocityContext = new VelocityContext(new VelocityContext(inProperties, velocityGlobalContext)); velocityContext.put("context", velocityContext); velocityContext.put("type", inType); for (long recipientId : inRecipients) { Person recipient = placeholderPersonMapper.execute(recipientId); if (recipient == null) { continue; } if (aggregateTemplates.containsKey(inType)) { updateAggregateNotification(recipient, inType, inProperties, velocityContext); } else { createNewNotification(recipient, inType, inProperties, velocityContext); } } return null; } }
InAppNotificationNotifier implements Notifier { @Override public Collection<UserActionRequest> notify(final NotificationType inType, final Collection<Long> inRecipients, final Map<String, Object> inProperties, final Map<Long, PersonModelView> inRecipientIndex) throws Exception { Context velocityContext = new VelocityContext(new VelocityContext(inProperties, velocityGlobalContext)); velocityContext.put("context", velocityContext); velocityContext.put("type", inType); for (long recipientId : inRecipients) { Person recipient = placeholderPersonMapper.execute(recipientId); if (recipient == null) { continue; } if (aggregateTemplates.containsKey(inType)) { updateAggregateNotification(recipient, inType, inProperties, velocityContext); } else { createNewNotification(recipient, inType, inProperties, velocityContext); } } return null; } InAppNotificationNotifier(final VelocityEngine inVelocityEngine, final Context inVelocityGlobalContext,
            final Map<NotificationType, String> inTemplates, final Map<NotificationType, String> inAggregateTemplates,
            final DomainMapper<PersistenceRequest<InAppNotificationEntity>, Boolean> inInsertMapper,
            final DomainMapper<PersistenceRequest<InAppNotificationEntity>, Boolean> inUpdateMapper,
            final DomainMapper<Long, UnreadInAppNotificationCountDTO> inSyncMapper,
            final DomainMapper<Long, Person> inPlaceholderPersonMapper,
            final DomainMapper<InAppNotificationEntity, InAppNotificationEntity> inExistingNotificationMapper); }
InAppNotificationNotifier implements Notifier { @Override public Collection<UserActionRequest> notify(final NotificationType inType, final Collection<Long> inRecipients, final Map<String, Object> inProperties, final Map<Long, PersonModelView> inRecipientIndex) throws Exception { Context velocityContext = new VelocityContext(new VelocityContext(inProperties, velocityGlobalContext)); velocityContext.put("context", velocityContext); velocityContext.put("type", inType); for (long recipientId : inRecipients) { Person recipient = placeholderPersonMapper.execute(recipientId); if (recipient == null) { continue; } if (aggregateTemplates.containsKey(inType)) { updateAggregateNotification(recipient, inType, inProperties, velocityContext); } else { createNewNotification(recipient, inType, inProperties, velocityContext); } } return null; } InAppNotificationNotifier(final VelocityEngine inVelocityEngine, final Context inVelocityGlobalContext,
            final Map<NotificationType, String> inTemplates, final Map<NotificationType, String> inAggregateTemplates,
            final DomainMapper<PersistenceRequest<InAppNotificationEntity>, Boolean> inInsertMapper,
            final DomainMapper<PersistenceRequest<InAppNotificationEntity>, Boolean> inUpdateMapper,
            final DomainMapper<Long, UnreadInAppNotificationCountDTO> inSyncMapper,
            final DomainMapper<Long, Person> inPlaceholderPersonMapper,
            final DomainMapper<InAppNotificationEntity, InAppNotificationEntity> inExistingNotificationMapper); @Override Collection<UserActionRequest> notify(final NotificationType inType, final Collection<Long> inRecipients,
            final Map<String, Object> inProperties, final Map<Long, PersonModelView> inRecipientIndex); }
InAppNotificationNotifier implements Notifier { @Override public Collection<UserActionRequest> notify(final NotificationType inType, final Collection<Long> inRecipients, final Map<String, Object> inProperties, final Map<Long, PersonModelView> inRecipientIndex) throws Exception { Context velocityContext = new VelocityContext(new VelocityContext(inProperties, velocityGlobalContext)); velocityContext.put("context", velocityContext); velocityContext.put("type", inType); for (long recipientId : inRecipients) { Person recipient = placeholderPersonMapper.execute(recipientId); if (recipient == null) { continue; } if (aggregateTemplates.containsKey(inType)) { updateAggregateNotification(recipient, inType, inProperties, velocityContext); } else { createNewNotification(recipient, inType, inProperties, velocityContext); } } return null; } InAppNotificationNotifier(final VelocityEngine inVelocityEngine, final Context inVelocityGlobalContext,
            final Map<NotificationType, String> inTemplates, final Map<NotificationType, String> inAggregateTemplates,
            final DomainMapper<PersistenceRequest<InAppNotificationEntity>, Boolean> inInsertMapper,
            final DomainMapper<PersistenceRequest<InAppNotificationEntity>, Boolean> inUpdateMapper,
            final DomainMapper<Long, UnreadInAppNotificationCountDTO> inSyncMapper,
            final DomainMapper<Long, Person> inPlaceholderPersonMapper,
            final DomainMapper<InAppNotificationEntity, InAppNotificationEntity> inExistingNotificationMapper); @Override Collection<UserActionRequest> notify(final NotificationType inType, final Collection<Long> inRecipients,
            final Map<String, Object> inProperties, final Map<Long, PersonModelView> inRecipientIndex);  }