protected List<CassandraEndpointNotification> generateEndpointNotification(ByteBuffer endpointKeyHash, int count) { List<CassandraEndpointNotification> savedNotifications = new ArrayList<>(); String appId = generateStringId(); if (endpointKeyHash == null) { endpointKeyHash = ByteBuffer.wrap(generateEndpointProfile(appId, null, null, null).getEndpointKeyHash()); } String schemaId = generateStringId(); for (int i = 0; i < count; i++) { CassandraEndpointNotification endpointNotification = new CassandraEndpointNotification(); endpointNotification.setEndpointKeyHash(endpointKeyHash); endpointNotification.setApplicationId(appId); endpointNotification.setSchemaId(schemaId); endpointNotification.setType(NotificationTypeDto.USER); endpointNotification.setSeqNum(100 + i); endpointNotification.setLastModifyTime(new Date(System.currentTimeMillis())); savedNotifications.add(unicastNotificationDao.save(endpointNotification)); } return savedNotifications; }
@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); } }
notificationDto.setLastTimeModify(new Date(currentTime)); EndpointNotificationDto unicast = getDto(unicastNotificationDao.save(dto)); if (unicast != null && unicast.getNotificationDto() != null) { LOG.trace("Saved unicast notifications {}", unicast);