@Test public void findByIdsTest() throws Exception { NotificationEntity notificationEntity = new NotificationEntity(id, DateUtils.createCurrentDateTimestamp(), provider, providerConfigId, DateUtils.createCurrentDateTimestamp(), notificationType, content); ConfigurationModel configurationModel = createConfigurationModel(); NotificationContentRepository notificationContentRepository = Mockito.mock(NotificationContentRepository.class); ConfigurationAccessor configurationAccessor = Mockito.mock(ConfigurationAccessor.class); Mockito.when(notificationContentRepository.findAllById(Mockito.any())).thenReturn(List.of(notificationEntity)); Mockito.when(configurationAccessor.getConfigurationById(Mockito.any())).thenReturn(Optional.of(configurationModel)); DefaultNotificationAccessor notificationManager = new DefaultNotificationAccessor(notificationContentRepository, null, null, configurationAccessor, null); List<AlertNotificationModel> alertNotificationModelList = notificationManager.findByIds(List.of(1L)); assertEquals(1, alertNotificationModelList.size()); AlertNotificationModel alertNotificationModel = alertNotificationModelList.get(0); testExpectedAlertNotificationModel(expectedAlertNotificationModel, alertNotificationModel); }
@Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) public List<AlertNotificationModel> findByIds(List<Long> notificationIds) { return toModels(notificationContentRepository.findAllById(notificationIds)); }
DefaultNotificationAccessor implements NotificationAccessor { @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) public List<AlertNotificationModel> findByIds(List<Long> notificationIds) { return toModels(notificationContentRepository.findAllById(notificationIds)); } }
DefaultNotificationAccessor implements NotificationAccessor { @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) public List<AlertNotificationModel> findByIds(List<Long> notificationIds) { return toModels(notificationContentRepository.findAllById(notificationIds)); } @Autowired  DefaultNotificationAccessor(NotificationContentRepository notificationContentRepository, AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository,
        ConfigurationAccessor configurationAccessor, EventManager eventManager); }
DefaultNotificationAccessor implements NotificationAccessor { @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) public List<AlertNotificationModel> findByIds(List<Long> notificationIds) { return toModels(notificationContentRepository.findAllById(notificationIds)); } @Autowired  DefaultNotificationAccessor(NotificationContentRepository notificationContentRepository, AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository,
        ConfigurationAccessor configurationAccessor, EventManager eventManager); @Override List<AlertNotificationModel> saveAllNotifications(Collection<AlertNotificationModel> notifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAll(PageRequest pageRequest, boolean onlyShowSentNotifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAllWithSearch(String searchTerm, PageRequest pageRequest, boolean onlyShowSentNotifications); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByIds(List<Long> notificationIds); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Optional<AlertNotificationModel> findById(Long notificationId); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBetween(OffsetDateTime startDate, OffsetDateTime endDate); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBefore(OffsetDateTime date); @Override List<AlertNotificationModel> findByCreatedAtBeforeDayOffset(int dayOffset); @Override void deleteNotificationList(List<AlertNotificationModel> notifications); @Override void deleteNotification(AlertNotificationModel notification); PageRequest getPageRequestForNotifications(Integer pageNumber, Integer pageSize, String sortField, String sortOrder); }
DefaultNotificationAccessor implements NotificationAccessor { @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) public List<AlertNotificationModel> findByIds(List<Long> notificationIds) { return toModels(notificationContentRepository.findAllById(notificationIds)); } @Autowired  DefaultNotificationAccessor(NotificationContentRepository notificationContentRepository, AuditEntryRepository auditEntryRepository, AuditNotificationRepository auditNotificationRepository,
        ConfigurationAccessor configurationAccessor, EventManager eventManager); @Override List<AlertNotificationModel> saveAllNotifications(Collection<AlertNotificationModel> notifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAll(PageRequest pageRequest, boolean onlyShowSentNotifications); @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Page<AlertNotificationModel> findAllWithSearch(String searchTerm, PageRequest pageRequest, boolean onlyShowSentNotifications); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByIds(List<Long> notificationIds); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) Optional<AlertNotificationModel> findById(Long notificationId); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBetween(OffsetDateTime startDate, OffsetDateTime endDate); @Override @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) List<AlertNotificationModel> findByCreatedAtBefore(OffsetDateTime date); @Override List<AlertNotificationModel> findByCreatedAtBeforeDayOffset(int dayOffset); @Override void deleteNotificationList(List<AlertNotificationModel> notifications); @Override void deleteNotification(AlertNotificationModel notification); PageRequest getPageRequestForNotifications(Integer pageNumber, Integer pageSize, String sortField, String sortOrder);  }