@Test
    public void testGetTableMeta() throws Exception {
        String dbName1 = "database1";
        String tblName1 = "table1";

        String userName = ugi.getUserName();
        allowCreateDatabase(userName);
        allowSelect(userName);
        driver.run("create database " + dbName1);
        allowCreateInDb(dbName1, userName);
        driver.run("use " + dbName1);
        driver.run(String.format("create table %s (a string) partitioned by (b string)", tblName1));
        allowSelectInDb(dbName1, userName);

        String dbName2 = "database2";
        String tblName2 = "table2";
        driver.run("create database " + dbName2);
        allowSelectInDb(dbName2, userName);
        driver.run("use " + dbName2);
        driver.run(String.format("create table %s (a string) partitioned by (b string)", tblName2));

        List<TableMeta> tableMetas = msc.getTableMeta("*", "*", Lists.newArrayList());
        assertEquals(2, tableMetas.size());

        revokeSelect(userName);
        disallowSelectDatabase(dbName1, userName);
        tableMetas = msc.getTableMeta("*", "*", Lists.newArrayList());
        assertEquals(1, tableMetas.size());
        assertEquals(dbName2, tableMetas.get(0).getDbName());
        assertEquals(tblName2, tableMetas.get(0).getTableName());

        disallowSelectDatabase(dbName2, userName);
        tableMetas = msc.getTableMeta("*", "*", Lists.newArrayList());
        assertEquals(0, tableMetas.size());
    }
TestMetastoreClientSideAuthorizationProvider : Simple base test for Metastore client side
Authorization Providers. By default, tests DefaultHiveAuthorizationProvider
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestMetastoreClientSideAuthorizationProvider.java