@Test(expected = HiveClientException.class) public void testAddingPrivilegesFailure() { privilegesGrantor.grantSelectPrivileges(DB_NAME, null); }
public void grantSelectPrivileges(String dbName, String tableName) { log.info("Granting Public Select Privileges to the table: " + tableName); try { if (isSelectPrivilegeGranted(dbName, tableName)) { log.info("Skipping Granting Public privileges, the privilege is already granted on the table: " + tableName); } else { PrivilegeBag privilegeBag = new PrivilegeBag(); privilegeBag.addToPrivileges(getPublicSelectPrivilege(dbName, tableName)); client.grant_privileges(privilegeBag); log.info("Successfully granted Public Select Privileges to the table: " + tableName); } } catch (TException e) { throw new HiveClientException(("Error Granting Public Select Privileges to the table: " + tableName), e); } }
PrivilegesGrantor { public void grantSelectPrivileges(String dbName, String tableName) { log.info("Granting Public Select Privileges to the table: " + tableName); try { if (isSelectPrivilegeGranted(dbName, tableName)) { log.info("Skipping Granting Public privileges, the privilege is already granted on the table: " + tableName); } else { PrivilegeBag privilegeBag = new PrivilegeBag(); privilegeBag.addToPrivileges(getPublicSelectPrivilege(dbName, tableName)); client.grant_privileges(privilegeBag); log.info("Successfully granted Public Select Privileges to the table: " + tableName); } } catch (TException e) { throw new HiveClientException(("Error Granting Public Select Privileges to the table: " + tableName), e); } } }
PrivilegesGrantor { public void grantSelectPrivileges(String dbName, String tableName) { log.info("Granting Public Select Privileges to the table: " + tableName); try { if (isSelectPrivilegeGranted(dbName, tableName)) { log.info("Skipping Granting Public privileges, the privilege is already granted on the table: " + tableName); } else { PrivilegeBag privilegeBag = new PrivilegeBag(); privilegeBag.addToPrivileges(getPublicSelectPrivilege(dbName, tableName)); client.grant_privileges(privilegeBag); log.info("Successfully granted Public Select Privileges to the table: " + tableName); } } catch (TException e) { throw new HiveClientException(("Error Granting Public Select Privileges to the table: " + tableName), e); } } PrivilegesGrantor(IMetaStoreClient client); }
PrivilegesGrantor { public void grantSelectPrivileges(String dbName, String tableName) { log.info("Granting Public Select Privileges to the table: " + tableName); try { if (isSelectPrivilegeGranted(dbName, tableName)) { log.info("Skipping Granting Public privileges, the privilege is already granted on the table: " + tableName); } else { PrivilegeBag privilegeBag = new PrivilegeBag(); privilegeBag.addToPrivileges(getPublicSelectPrivilege(dbName, tableName)); client.grant_privileges(privilegeBag); log.info("Successfully granted Public Select Privileges to the table: " + tableName); } } catch (TException e) { throw new HiveClientException(("Error Granting Public Select Privileges to the table: " + tableName), e); } } PrivilegesGrantor(IMetaStoreClient client); void grantSelectPrivileges(String dbName, String tableName); boolean isSelectPrivilegeGranted(String dbName, String tableName); }
PrivilegesGrantor { public void grantSelectPrivileges(String dbName, String tableName) { log.info("Granting Public Select Privileges to the table: " + tableName); try { if (isSelectPrivilegeGranted(dbName, tableName)) { log.info("Skipping Granting Public privileges, the privilege is already granted on the table: " + tableName); } else { PrivilegeBag privilegeBag = new PrivilegeBag(); privilegeBag.addToPrivileges(getPublicSelectPrivilege(dbName, tableName)); client.grant_privileges(privilegeBag); log.info("Successfully granted Public Select Privileges to the table: " + tableName); } } catch (TException e) { throw new HiveClientException(("Error Granting Public Select Privileges to the table: " + tableName), e); } } PrivilegesGrantor(IMetaStoreClient client); void grantSelectPrivileges(String dbName, String tableName); boolean isSelectPrivilegeGranted(String dbName, String tableName);  }