SentryMetaStoreFilterHook implements MetaStoreFilterHook { @Override public Table filterTable(Table table) throws NoSuchObjectException { String dbName = table.getDbName(); String tableName = table.getTableName(); if (filterTab(dbName, Collections.singletonList(tableName)).isEmpty()) { throw new NoSuchObjectException(String.format("Table %s.%s does not exist", dbName, tableName)); } return table; } SentryMetaStoreFilterHook(HiveConf hiveConf);  SentryMetaStoreFilterHook(HiveConf hiveConf, HiveAuthzConf authzConf, HiveAuthzBindingFactory authzBindingFactory); @Override List<String> filterDatabases(List<String> dbList); @Override Database filterDatabase(Database dataBase); @Override List<String> filterTableNames(String dbName, List<String> tableList); @Override Table filterTable(Table table); @Override List<Table> filterTables(List<Table> tableList); @Override List<Partition> filterPartitions(List<Partition> partitionList); @Override List<PartitionSpec> filterPartitionSpecs(
      List<PartitionSpec> partitionSpecList); @Override Partition filterPartition(Partition partition); @Override List<String> filterPartitionNames(String dbName, String tblName,
      List<String> partitionNames); @Override Index filterIndex(Index index); @Override List<String> filterIndexNames(String dbName, String tblName,
      List<String> indexList); @Override List<Index> filterIndexes(List<Index> indexeList);  }
@Test public void testFilterSingleTable() throws NoSuchObjectException { final String USER1 = "user1"; final String DB1 = "db1"; SentryMetaStoreFilterHook filterHook = new SentryMetaStoreFilterHook(null, authzConf, getMockBinding(USER1)); restrictTablesNamesOnBinding(USER1, DB1, Arrays.asList("t1", "t3")); assertThatExceptionOfType(NoSuchObjectException.class) .isThrownBy(() -> filterHook.filterTable(newHmsTable(DB1, "t1"))); assertThatExceptionOfType(NoSuchObjectException.class) .isThrownBy(() -> filterHook.filterTable(newHmsTable(DB1, "t3"))); assertThat(filterHook.filterTable(newHmsTable(DB1, "t2"))) .isEqualTo(newHmsTable(DB1, "t2")); }