@Test public void testGetEmptyNotificationsWhenHmsReturnsANullResponse() throws Exception { SentryStore store = Mockito.mock(SentryStore.class); HiveConnectionFactory hmsConnection = Mockito.mock(HiveConnectionFactory.class); HiveMetaStoreClient hmsClient = Mockito.mock(HiveMetaStoreClient.class); Mockito.when(hmsConnection.connect()).thenReturn(new HMSClient(hmsClient)); try (HiveNotificationFetcher fetcher = new HiveNotificationFetcher(store, hmsConnection)) { List<NotificationEvent> events; Mockito.when(hmsClient.getNextNotification(0, Integer.MAX_VALUE, null)) .thenReturn(null); events = fetcher.fetchNotifications(0); assertTrue(events.isEmpty()); } }
public List<NotificationEvent> fetchNotifications(long lastEventId) throws Exception { return fetchNotifications(lastEventId, Integer.MAX_VALUE); }
HiveNotificationFetcher implements AutoCloseable { public List<NotificationEvent> fetchNotifications(long lastEventId) throws Exception { return fetchNotifications(lastEventId, Integer.MAX_VALUE); } }
HiveNotificationFetcher implements AutoCloseable { public List<NotificationEvent> fetchNotifications(long lastEventId) throws Exception { return fetchNotifications(lastEventId, Integer.MAX_VALUE); } HiveNotificationFetcher(SentryStoreInterface sentryStore, HiveConnectionFactory hmsConnectionFactory); }
HiveNotificationFetcher implements AutoCloseable { public List<NotificationEvent> fetchNotifications(long lastEventId) throws Exception { return fetchNotifications(lastEventId, Integer.MAX_VALUE); } HiveNotificationFetcher(SentryStoreInterface sentryStore, HiveConnectionFactory hmsConnectionFactory); List<NotificationEvent> fetchNotifications(long lastEventId); List<NotificationEvent> fetchNotifications(long lastEventId, int maxEvents); long getCurrentNotificationId(); @Override void close(); }
HiveNotificationFetcher implements AutoCloseable { public List<NotificationEvent> fetchNotifications(long lastEventId) throws Exception { return fetchNotifications(lastEventId, Integer.MAX_VALUE); } HiveNotificationFetcher(SentryStoreInterface sentryStore, HiveConnectionFactory hmsConnectionFactory); List<NotificationEvent> fetchNotifications(long lastEventId); List<NotificationEvent> fetchNotifications(long lastEventId, int maxEvents); long getCurrentNotificationId(); @Override void close();  }