@Test
  public void testSimplePrivileges() throws Exception {
    String dbName = getTestDbName();
    String tblName = getTestTableName();

    String userName = ugi.getUserName();

    allowCreateDatabase(userName);

    driver.run("create database " + dbName);
    Database db = msc.getDatabase(dbName);
    String dbLocn = db.getLocationUri();

    disallowCreateDatabase(userName);

    validateCreateDb(db,dbName);
    disallowCreateInDb(dbName, userName, dbLocn);

    driver.run("use " + dbName);
    try {
      driver.run(String.format("create table %s (a string) partitioned by (b string)", tblName));
    } catch (CommandProcessorException e) {
      // failure from not having permissions to create table
      assertNoPrivileges(e);
    }

    allowCreateInDb(dbName, userName, dbLocn);

    driver.run("use " + dbName);
    driver.run(String.format("create table %s (a string) partitioned by (b string)", tblName));

    Table tbl = msc.getTable(dbName, tblName);

    validateCreateTable(tbl,tblName, dbName);

    String fakeUser = "mal";
    List<String> fakeGroupNames = new ArrayList<String>();
    fakeGroupNames.add("groupygroup");

    InjectableDummyAuthenticator.injectUserName(fakeUser);
    InjectableDummyAuthenticator.injectGroupNames(fakeGroupNames);
    InjectableDummyAuthenticator.injectMode(true);

    allowSelectOnTable(tbl.getTableName(), fakeUser, tbl.getSd().getLocation());
    driver.run(String.format("select * from %s limit 10", tblName));

    try {
      driver.run(String.format("create table %s (a string) partitioned by (b string)", tblName+"mal"));
    } catch (CommandProcessorException e) {
      assertNoPrivileges(e);
    }

    disallowCreateInTbl(tbl.getTableName(), userName, tbl.getSd().getLocation());

    try {
      driver.run("alter table "+tblName+" add partition (b='2011')");
    } catch (CommandProcessorException e) {
      assertNoPrivileges(e);
    }

    InjectableDummyAuthenticator.injectMode(false);
    allowCreateInTbl(tbl.getTableName(), userName, tbl.getSd().getLocation());

    driver.run("alter table "+tblName+" add partition (b='2011')");

    allowDropOnTable(tblName, userName, tbl.getSd().getLocation());
    allowDropOnDb(dbName,userName,db.getLocationUri());
    driver.run("drop database if exists "+getTestDbName()+" cascade");

  }
TestClientSideAuthorizationProvider : Simple base test for client side
Authorization Providers. By default, tests DefaultHiveAuthorizationProvider
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestClientSideAuthorizationProvider.java