@Test public void testGetNotification() throws Exception { final Map<byte[], byte[]> tsMap = new TreeMap<>(new Bytes.ByteArrayComparator()); tsMap.put("1444042473518".getBytes(), "1".getBytes()); new Expectations() { { mockResult.getRow(); times = 1; result = "rowid".getBytes(CHARSET); mockResult.getValue("s".getBytes(), "qs".getBytes()); times = 1; result = "DELIVERED".getBytes(); mockResult.getFamilyMap("ts".getBytes()); times = 1; result = tsMap; } }; Notification notification = notificationStore.getNotification("n123"); assertEquals("rowid", notification.getId()); assertEquals(Notification.Status.DELIVERED, notification.getStatus()); assertEquals(1444042473518L, notification.getTs()); new Verifications() { { Get get; mockHTable.get(get = withCapture()); times = 1; } }; }
@Override public Notification getNotification(String notificationId) { try { String tableName = notificationMapper.getTableName(); LOG.debug("getting notification with notificationId {} from table {}", notificationId, tableName); Get get = new Get(notificationId.getBytes(StandardCharsets.UTF_8)); Result result = tables.get(tableName).get().get(get); return result.isEmpty() ? null : notificationMapper.entity(result); } catch (IOException ex) { throw new NotificationStoreException("Error getting notification id: " + notificationId, ex); } }
HBaseNotificationStore implements NotificationStore { @Override public Notification getNotification(String notificationId) { try { String tableName = notificationMapper.getTableName(); LOG.debug("getting notification with notificationId {} from table {}", notificationId, tableName); Get get = new Get(notificationId.getBytes(StandardCharsets.UTF_8)); Result result = tables.get(tableName).get().get(get); return result.isEmpty() ? null : notificationMapper.entity(result); } catch (IOException ex) { throw new NotificationStoreException("Error getting notification id: " + notificationId, ex); } } }
HBaseNotificationStore implements NotificationStore { @Override public Notification getNotification(String notificationId) { try { String tableName = notificationMapper.getTableName(); LOG.debug("getting notification with notificationId {} from table {}", notificationId, tableName); Get get = new Get(notificationId.getBytes(StandardCharsets.UTF_8)); Result result = tables.get(tableName).get().get(get); return result.isEmpty() ? null : notificationMapper.entity(result); } catch (IOException ex) { throw new NotificationStoreException("Error getting notification id: " + notificationId, ex); } }  }
HBaseNotificationStore implements NotificationStore { @Override public Notification getNotification(String notificationId) { try { String tableName = notificationMapper.getTableName(); LOG.debug("getting notification with notificationId {} from table {}", notificationId, tableName); Get get = new Get(notificationId.getBytes(StandardCharsets.UTF_8)); Result result = tables.get(tableName).get().get(get); return result.isEmpty() ? null : notificationMapper.entity(result); } catch (IOException ex) { throw new NotificationStoreException("Error getting notification id: " + notificationId, ex); } }  @Override void init(Map<String, Object> config); @Override void store(Notification notification); @Override Notification getNotification(String notificationId); @Override List<Notification> getNotifications(List<String> notificationIds); @Override StreamlineEvent getEvent(String eventId); @Override List<StreamlineEvent> getEvents(List<String> eventIds); @Override List<T> findEntities(Criteria<T> criteria); @Override void close(); @Override Notification updateNotificationStatus(String notificationId, Notification.Status status); }
HBaseNotificationStore implements NotificationStore { @Override public Notification getNotification(String notificationId) { try { String tableName = notificationMapper.getTableName(); LOG.debug("getting notification with notificationId {} from table {}", notificationId, tableName); Get get = new Get(notificationId.getBytes(StandardCharsets.UTF_8)); Result result = tables.get(tableName).get().get(get); return result.isEmpty() ? null : notificationMapper.entity(result); } catch (IOException ex) { throw new NotificationStoreException("Error getting notification id: " + notificationId, ex); } }  @Override void init(Map<String, Object> config); @Override void store(Notification notification); @Override Notification getNotification(String notificationId); @Override List<Notification> getNotifications(List<String> notificationIds); @Override StreamlineEvent getEvent(String eventId); @Override List<StreamlineEvent> getEvents(List<String> eventIds); @Override List<T> findEntities(Criteria<T> criteria); @Override void close(); @Override Notification updateNotificationStatus(String notificationId, Notification.Status status);  }