@Test
  public void getOnlyMaxEvents() throws Exception {
    Database db = new Database("db1", "no description", testTempDir, emptyParameters);
    msClient.createDatabase(db);
    db = new Database("db2", "no description", testTempDir, emptyParameters);
    msClient.createDatabase(db);
    db = new Database("db3", "no description", testTempDir, emptyParameters);
    msClient.createDatabase(db);

    // Get notifications from metastore
    NotificationEventResponse rsp = msClient.getNextNotification(firstEventId, 2, null);
    assertEquals(2, rsp.getEventsSize());
    assertEquals(firstEventId + 1, rsp.getEvents().get(0).getEventId());
    assertEquals(firstEventId + 2, rsp.getEvents().get(1).getEventId());
  }
Tests DbNotificationListener when used as a transactional event listener
(hive.metastore.transactional.event.listeners)
itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java