@Before
    public void setUp() throws Exception {
        System.setProperty(HiveConf.ConfVars.METASTORE_PRE_EVENT_LISTENERS.varname,
                "org.apache.hadoop.hive.ql.security.authorization.AuthorizationPreEventListener");

        int port = MetaStoreTestUtils.startMetaStoreWithRetry();

        clientHiveConf = new HiveConfForTest(this.getClass());

        // Turn on client-side authorization
        clientHiveConf.setBoolVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED,true);
        clientHiveConf.set(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER.varname,
                getAuthorizationProvider());
        clientHiveConf.set(HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER.varname,
                InjectableDummyAuthenticator.class.getName());
        clientHiveConf.set(HiveConf.ConfVars.HIVE_AUTHORIZATION_TABLE_OWNER_GRANTS.varname, "");
        clientHiveConf.setVar(HiveConf.ConfVars.HIVE_MAPRED_MODE, "nonstrict");
        clientHiveConf.setVar(HiveConf.ConfVars.METASTORE_URIS, "thrift://localhost:" + port);
        clientHiveConf.setIntVar(HiveConf.ConfVars.METASTORE_THRIFT_CONNECTION_RETRIES, 3);
        clientHiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");

        clientHiveConf.set(HiveConf.ConfVars.PRE_EXEC_HOOKS.varname, "");
        clientHiveConf.set(HiveConf.ConfVars.POST_EXEC_HOOKS.varname, "");

        ugi = Utils.getUGI();

        SessionState.start(new CliSessionState(clientHiveConf));
        msc = new HiveMetaStoreClient(clientHiveConf);
        driver = DriverFactory.newDriver(clientHiveConf);
    }
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