@Test
  public void fetchNotificationEventBasedOnEventTypes() throws Exception {
    String dbName = "default";
    String table1 = "test_event_based_tbl1";
    String table2 = "test_event_based_tbl2";
    String table3 = "test_event_based_tbl3";
    // Generate some table events
    generateSometableEvents(dbName, table1);
    generateSometableEvents(dbName, table2);
    generateSometableEvents(dbName, table3);

    // Verify events by table names
    NotificationEventRequest request = new NotificationEventRequest();
    request.setLastEvent(firstEventId);
    request.setMaxEvents(-1);
    request.setDbName(dbName);
    request.setTableNames(Arrays.asList(table1, table2));
    request.setEventTypeList(Arrays.asList("CREATE_TABLE"));
    NotificationEventResponse rsp1 = msClient.getNextNotification(request, true, null);
    assertEquals(2, rsp1.getEventsSize());
    request.setTableNames(Arrays.asList(table1, table2, table3));
    request.setEventTypeList(Arrays.asList("CREATE_TABLE", "ADD_PARTITION"));
    NotificationEventResponse rsp2 = msClient.getNextNotification(request, true, null);
    assertEquals(9, rsp2.getEventsSize());
  }
The method creates some events in notification log and fetches the events
based on the fields set on the NotificationEventRequest object. It includes
setting database name, table name(s), event skip list (i.e., filter out events
that are not required). These fields are optional.
@throws Exception
itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationListener.java