public void testCreateAdminNAddUser() throws IOException, Throwable {
HiveConf conf = new HiveConf();
conf.setVar(ConfVars.USERS_IN_ADMIN_ROLE, "adminuser");
conf.setVar(ConfVars.HIVE_AUTHORIZATION_MANAGER,SQLStdHiveAuthorizerFactory.class.getName());
RawStore rawStore = new HMSHandler("testcreateroot", conf).getMS();
Role adminRole = rawStore.getRole(HiveMetaStore.ADMIN);
assertTrue(adminRole.getOwnerName().equals(HiveMetaStore.ADMIN));
assertEquals(rawStore.listPrincipalGlobalGrants(HiveMetaStore.ADMIN, PrincipalType.ROLE)
.get(0).getPrivilege(),"All");
assertEquals(rawStore.listRoles("adminuser", PrincipalType.USER).get(0).getRole().
getRoleName(),HiveMetaStore.ADMIN);
}