@Override public EndpointNotificationDto getUnicastNotification(String notificationId) throws ControlServiceException { return notificationService.findUnicastNotificationById(notificationId); }
@Override public NotificationDto findUnicastNotificationById(String unicastNotificationId) { EndpointNotificationDto notification = notificationService.findUnicastNotificationById( unicastNotificationId); if (notification == null) { return null; } else { return convertUnicastNotification(notification); } } }
@Test public void testFindUnicastNotificationById() { TopicDto topicDto = generateTopicDto(null, null); EndpointProfileDto profile = generateEndpointProfileDto(topicDto.getApplicationId(), Arrays.asList(topicDto.getId())); byte[] keyHash = profile.getEndpointKeyHash(); EndpointNotificationDto notification = generateUnicastNotificationDto(null, topicDto.getId(), keyHash); Assert.assertTrue(isNotBlank(notification.getId())); EndpointNotificationDto found = notificationService.findUnicastNotificationById(notification.getId()); Assert.assertEquals(notification, found); }
@Test public void testRemoveUnicastNotificationById() { TopicDto topicDto = generateTopicDto(null, null); EndpointProfileDto profile = generateEndpointProfileDto(topicDto.getApplicationId(), Arrays.asList(topicDto.getId())); byte[] keyHash = profile.getEndpointKeyHash(); EndpointNotificationDto notification = generateUnicastNotificationDto(null, topicDto.getId(), keyHash); Assert.assertTrue(isNotBlank(notification.getId())); notificationService.removeUnicastNotificationById(notification.getId()); EndpointNotificationDto notif = notificationService.findUnicastNotificationById(notification.getId()); Assert.assertNull(notif); }