@Test
  public void testMetaApiDisAllowed() throws Exception {
    TestAuthValidator.allowActions = false;

    Connection hs2Conn = getConnection("user1");
    DatabaseMetaData dbmetadata = hs2Conn.getMetaData();

    try {
      dbmetadata.getCatalogs();
      fail("HiveAccessControlException expected");
    } catch (SQLException e) {
      assertErrorContains(e, TestAuthValidator.DENIED_ERR);
    } catch (Exception e) {
      fail("HiveAccessControlException expected");
    }

    try {
      dbmetadata.getSchemas();
      fail("HiveAccessControlException expected");
    } catch (SQLException e) {
      assertErrorContains(e, TestAuthValidator.DENIED_ERR);
    } catch (Exception e) {
      fail("HiveAccessControlException expected");
    }

    try {
      dbmetadata.getTypeInfo();
      fail("HiveAccessControlException expected");
    } catch (SQLException e) {
      assertErrorContains(e, TestAuthValidator.DENIED_ERR);
    } catch (Exception e) {
      fail("HiveAccessControlException expected");
    }

    try {
      dbmetadata.getTables(null, "default", "t%", null);
      fail("HiveAccessControlException expected");
    } catch (SQLException e) {
      assertErrorContains(e, TestAuthValidator.DENIED_ERR);
    } catch (Exception e) {
      fail("HiveAccessControlException expected");
    }

    try {
      dbmetadata.getTableTypes();
      fail("HiveAccessControlException expected");
    } catch (SQLException e) {
      assertErrorContains(e, TestAuthValidator.DENIED_ERR);
    } catch (Exception e) {
      fail("HiveAccessControlException expected");
    }

    try {
      dbmetadata.getColumns(null, "default", "nosuchtable", null);
      fail("HiveAccessControlException expected");
    } catch (SQLException e) {
      assertErrorContains(e, TestAuthValidator.DENIED_ERR);
    } catch (Exception e) {
      fail("HiveAccessControlException expected");
    }

    try {
      dbmetadata.getFunctions(null, null, "trim");
      fail("HiveAccessControlException expected");
    } catch (SQLException e) {
      assertErrorContains(e, TestAuthValidator.DENIED_ERR);
    } catch (Exception e) {
      fail("HiveAccessControlException expected");
    }

  }
Call the HS2 metadata api's with authorizer disallowing those calls
@throws Exception
itests/hive-unit/src/test/java/org/apache/hive/jdbc/authorization/TestJdbcMetadataApiAuth.java