DanielZhu58 commented on code in PR #5343: URL: https://github.com/apache/hive/pull/5343#discussion_r1767576929
########## ql/src/test/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/TestHiveMetaStoreAuthorizer.java: ########## @@ -439,4 +469,58 @@ public void testUnAuthorizedCause() { .anyMatch(stack -> stack.contains(DummyHiveAuthorizer.class.getName()))); } } + + /** + * @return pair with left value as inputs and right value as outputs, + * passed in current call to authorizer.checkPrivileges + * @throws HiveAuthzPluginException + * @throws HiveAccessControlException + */ + private Pair<List<HivePrivilegeObject>, List<HivePrivilegeObject>> getHivePrivilegeObjectInputs() throws HiveAuthzPluginException, + HiveAccessControlException { + // Create argument capturer + // a class variable cast to this generic of generic class + Class<List<HivePrivilegeObject>> class_listPrivObjects = (Class) List.class; + ArgumentCaptor<List<HivePrivilegeObject>> inputsCapturer = ArgumentCaptor + .forClass(class_listPrivObjects); + ArgumentCaptor<List<HivePrivilegeObject>> outputsCapturer = ArgumentCaptor + .forClass(class_listPrivObjects); + + verify(dummyHiveAuthorizer).checkPrivileges(any(HiveOperationType.class), + inputsCapturer.capture(), outputsCapturer.capture(), + any(HiveAuthzContext.class)); + + return new ImmutablePair<List<HivePrivilegeObject>, List<HivePrivilegeObject>>( + inputsCapturer.getValue(), outputsCapturer.getValue()); + } + + @Test + public void testCreateTab() { + reset(dummyHiveAuthorizer); + UserGroupInformation.setLoginUser(UserGroupInformation.createRemoteUser(authorizedUser)); + try { + Table table = new TableBuilder() + .setTableName(tblName) + .addCol("name", ColumnType.STRING_TYPE_NAME) + .setOwner(authorizedUser) + .build(conf); Review Comment: Acknowledged. I changed it to a storage handler-based table. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org