@Test public void testSave() throws Exception { CassandraEndpointNotification notification = generateEndpointNotification(null, 1).get(0); List<CassandraEndpointNotification> found = unicastNotificationDao.findNotificationsByKeyHash( notification.getEndpointKeyHash().array()); Assert.assertEquals(1, found.size()); }
@Test public void testFindById() { CassandraEndpointNotification notification = generateEndpointNotification(null, 1).get(0); CassandraEndpointNotification saved = unicastNotificationDao.save(notification.toDto()); Assert.assertNotNull(saved.getId()); CassandraEndpointNotification found = unicastNotificationDao.findById(saved.getId()); Assert.assertEquals(saved, found); }
@Test public void testDtoConversation() throws Exception { CassandraEndpointNotification notification = generateEndpointNotification(null, 1).get(0); Assert.assertNull(notification.getId()); EndpointNotificationDto notificationDto = notification.toDto(); CassandraEndpointNotification cassandraEndpointNotification = new CassandraEndpointNotification(notificationDto); Assert.assertEquals(notificationDto, cassandraEndpointNotification.toDto()); }
@Test public void testRemoveNotificationsByAppId() throws Exception { CassandraEndpointNotification notification = generateEndpointNotification(null, 3).get(0); String appId = notification.getApplicationId(); unicastNotificationDao.removeNotificationsByAppId(appId); List<CassandraEndpointNotification> found = unicastNotificationDao.findNotificationsByKeyHash( notification.getEndpointKeyHash().array()); Assert.assertTrue(found.isEmpty()); }