{"action":"created","comment":{"url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/comments/219072041","pull_request_review_id":157150728,"id":219072041,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTA3MjA0MQ==","diff_hunk":"@@ -0,0 +1,88 @@\n+/**\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package com.expedia.apiary.extensions.rangerauth.listener;\n+\n+import java.io.File;\n+import java.nio.file.FileSystems;\n+import java.nio.file.Files;\n+import java.util.List;\n+\n+import org.apache.ranger.admin.client.RangerAdminClient;\n+import org.apache.ranger.plugin.util.GrantRevokeRequest;\n+import org.apache.ranger.plugin.util.ServicePolicies;\n+import org.apache.ranger.plugin.util.ServiceTags;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import com.google.gson.Gson;\n+import com.google.gson.GsonBuilder;\n+\n+/**\n+ * A test implementation of the RangerAdminClient interface that just reads policies in from a file and returns them\n+ */\n+public class RangerAdminClientImpl implements RangerAdminClient {\n+    private static final Logger LOG = LoggerFactory.getLogger(RangerAdminClientImpl.class);\n+    private final static String cacheFilename = \"hive-policies.json\";\n+    private final static String tagFilename = \"hive-policies-tag.json\";\n+    private Gson gson;\n+\n+    public void init(String serviceName, String appId, String configPropertyPrefix) {\n+        Gson gson = null;\n+        try {\n+            gson = new GsonBuilder().setDateFormat(\"yyyyMMdd-HH:mm:ss.SSS-Z\").setPrettyPrinting().create();\n+        } catch(Throwable excp) {\n+            LOG.error(\"RangerAdminClientImpl: failed to create GsonBuilder object\", excp);\n+        }\n+        this.gson = gson;\n+    }\n+\n+    public ServicePolicies getServicePoliciesIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis) throws Exception {\n+\n+        String basedir = System.getProperty(\"basedir\");\n+        if (basedir == null) {\n+            basedir = new File(\".\").getCanonicalPath();\n+        }\n+\n+        java.nio.file.Path cachePath = FileSystems.getDefault().getPath(basedir, \"/src/test/resources/\" + cacheFilename);","path":"apiary-ranger-metastore-plugin/src/test/java/com/expedia/apiary/extensions/rangerauth/listener/RangerAdminClientImpl.java","position":57,"original_position":57,"commit_id":"4fcc09ed1d647d7953e357392d7295dda91e1ea5","original_commit_id":"4fcc09ed1d647d7953e357392d7295dda91e1ea5","user":{"login":"massdosage","id":29457,"node_id":"MDQ6VXNlcjI5NDU3","avatar_url":"https://avatars3.githubusercontent.com/u/29457?v=4","gravatar_id":"","url":"https://api.github.com/users/massdosage","html_url":"https://github.com/massdosage","followers_url":"https://api.github.com/users/massdosage/followers","following_url":"https://api.github.com/users/massdosage/following{/other_user}","gists_url":"https://api.github.com/users/massdosage/gists{/gist_id}","starred_url":"https://api.github.com/users/massdosage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/massdosage/subscriptions","organizations_url":"https://api.github.com/users/massdosage/orgs","repos_url":"https://api.github.com/users/massdosage/repos","events_url":"https://api.github.com/users/massdosage/events{/privacy}","received_events_url":"https://api.github.com/users/massdosage/received_events","type":"User","site_admin":false},"body":"You can import `java.nio.file.Path` and then just refer to `Path` here.","created_at":"2018-09-20T08:15:22Z","updated_at":"2018-09-20T08:16:25Z","html_url":"https://github.com/ExpediaInc/apiary-extensions/pull/11#discussion_r219072041","pull_request_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/11","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/comments/219072041"},"html":{"href":"https://github.com/ExpediaInc/apiary-extensions/pull/11#discussion_r219072041"},"pull_request":{"href":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/11","id":216775940,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2Nzc1OTQw","html_url":"https://github.com/ExpediaInc/apiary-extensions/pull/11","diff_url":"https://github.com/ExpediaInc/apiary-extensions/pull/11.diff","patch_url":"https://github.com/ExpediaInc/apiary-extensions/pull/11.patch","issue_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues/11","number":11,"state":"open","locked":false,"title":"fixes #10 rangerauth initial checkin","user":{"login":"rpoluri","id":38321430,"node_id":"MDQ6VXNlcjM4MzIxNDMw","avatar_url":"https://avatars3.githubusercontent.com/u/38321430?v=4","gravatar_id":"","url":"https://api.github.com/users/rpoluri","html_url":"https://github.com/rpoluri","followers_url":"https://api.github.com/users/rpoluri/followers","following_url":"https://api.github.com/users/rpoluri/following{/other_user}","gists_url":"https://api.github.com/users/rpoluri/gists{/gist_id}","starred_url":"https://api.github.com/users/rpoluri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpoluri/subscriptions","organizations_url":"https://api.github.com/users/rpoluri/orgs","repos_url":"https://api.github.com/users/rpoluri/repos","events_url":"https://api.github.com/users/rpoluri/events{/privacy}","received_events_url":"https://api.github.com/users/rpoluri/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-19T21:03:55Z","updated_at":"2018-09-20T08:16:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f05f66ae1880301be89b869b67251607f92aa0a9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/11/commits","review_comments_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/11/comments","review_comment_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues/11/comments","statuses_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/statuses/4fcc09ed1d647d7953e357392d7295dda91e1ea5","head":{"label":"ExpediaInc:feature/rangerauth_initial","ref":"feature/rangerauth_initial","sha":"4fcc09ed1d647d7953e357392d7295dda91e1ea5","user":{"login":"ExpediaInc","id":1225964,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMjU5NjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1225964?v=4","gravatar_id":"","url":"https://api.github.com/users/ExpediaInc","html_url":"https://github.com/ExpediaInc","followers_url":"https://api.github.com/users/ExpediaInc/followers","following_url":"https://api.github.com/users/ExpediaInc/following{/other_user}","gists_url":"https://api.github.com/users/ExpediaInc/gists{/gist_id}","starred_url":"https://api.github.com/users/ExpediaInc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExpediaInc/subscriptions","organizations_url":"https://api.github.com/users/ExpediaInc/orgs","repos_url":"https://api.github.com/users/ExpediaInc/repos","events_url":"https://api.github.com/users/ExpediaInc/events{/privacy}","received_events_url":"https://api.github.com/users/ExpediaInc/received_events","type":"Organization","site_admin":false},"repo":{"id":145126556,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUxMjY1NTY=","name":"apiary-extensions","full_name":"ExpediaInc/apiary-extensions","private":false,"owner":{"login":"ExpediaInc","id":1225964,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMjU5NjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1225964?v=4","gravatar_id":"","url":"https://api.github.com/users/ExpediaInc","html_url":"https://github.com/ExpediaInc","followers_url":"https://api.github.com/users/ExpediaInc/followers","following_url":"https://api.github.com/users/ExpediaInc/following{/other_user}","gists_url":"https://api.github.com/users/ExpediaInc/gists{/gist_id}","starred_url":"https://api.github.com/users/ExpediaInc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExpediaInc/subscriptions","organizations_url":"https://api.github.com/users/ExpediaInc/orgs","repos_url":"https://api.github.com/users/ExpediaInc/repos","events_url":"https://api.github.com/users/ExpediaInc/events{/privacy}","received_events_url":"https://api.github.com/users/ExpediaInc/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ExpediaInc/apiary-extensions","description":"Extensions available for use in Apiary","fork":false,"url":"https://api.github.com/repos/ExpediaInc/apiary-extensions","forks_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/forks","keys_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/teams","hooks_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/hooks","issue_events_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/events","assignees_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/tags","blobs_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/languages","stargazers_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/stargazers","contributors_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/contributors","subscribers_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/subscribers","subscription_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/subscription","commits_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/merges","archive_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/downloads","issues_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/labels{/name}","releases_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/releases{/id}","deployments_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/deployments","created_at":"2018-08-17T13:53:03Z","updated_at":"2018-09-14T00:37:58Z","pushed_at":"2018-09-20T08:03:54Z","git_url":"git://github.com/ExpediaInc/apiary-extensions.git","ssh_url":"git@github.com:ExpediaInc/apiary-extensions.git","clone_url":"https://github.com/ExpediaInc/apiary-extensions.git","svn_url":"https://github.com/ExpediaInc/apiary-extensions","homepage":null,"size":82,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"ExpediaInc:master","ref":"master","sha":"fa5cf3dee77e658bde0122b6600299b6396b671d","user":{"login":"ExpediaInc","id":1225964,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMjU5NjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1225964?v=4","gravatar_id":"","url":"https://api.github.com/users/ExpediaInc","html_url":"https://github.com/ExpediaInc","followers_url":"https://api.github.com/users/ExpediaInc/followers","following_url":"https://api.github.com/users/ExpediaInc/following{/other_user}","gists_url":"https://api.github.com/users/ExpediaInc/gists{/gist_id}","starred_url":"https://api.github.com/users/ExpediaInc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExpediaInc/subscriptions","organizations_url":"https://api.github.com/users/ExpediaInc/orgs","repos_url":"https://api.github.com/users/ExpediaInc/repos","events_url":"https://api.github.com/users/ExpediaInc/events{/privacy}","received_events_url":"https://api.github.com/users/ExpediaInc/received_events","type":"Organization","site_admin":false},"repo":{"id":145126556,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUxMjY1NTY=","name":"apiary-extensions","full_name":"ExpediaInc/apiary-extensions","private":false,"owner":{"login":"ExpediaInc","id":1225964,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyMjU5NjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1225964?v=4","gravatar_id":"","url":"https://api.github.com/users/ExpediaInc","html_url":"https://github.com/ExpediaInc","followers_url":"https://api.github.com/users/ExpediaInc/followers","following_url":"https://api.github.com/users/ExpediaInc/following{/other_user}","gists_url":"https://api.github.com/users/ExpediaInc/gists{/gist_id}","starred_url":"https://api.github.com/users/ExpediaInc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExpediaInc/subscriptions","organizations_url":"https://api.github.com/users/ExpediaInc/orgs","repos_url":"https://api.github.com/users/ExpediaInc/repos","events_url":"https://api.github.com/users/ExpediaInc/events{/privacy}","received_events_url":"https://api.github.com/users/ExpediaInc/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ExpediaInc/apiary-extensions","description":"Extensions available for use in Apiary","fork":false,"url":"https://api.github.com/repos/ExpediaInc/apiary-extensions","forks_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/forks","keys_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/teams","hooks_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/hooks","issue_events_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/events","assignees_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/tags","blobs_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/languages","stargazers_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/stargazers","contributors_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/contributors","subscribers_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/subscribers","subscription_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/subscription","commits_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/merges","archive_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/downloads","issues_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/labels{/name}","releases_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/releases{/id}","deployments_url":"https://api.github.com/repos/ExpediaInc/apiary-extensions/deployments","created_at":"2018-08-17T13:53:03Z","updated_at":"2018-09-14T00:37:58Z","pushed_at":"2018-09-20T08:03:54Z","git_url":"git://github.com/ExpediaInc/apiary-extensions.git","ssh_url":"git@github.com:ExpediaInc/apiary-extensions.git","clone_url":"https://github.com/ExpediaInc/apiary-extensions.git","svn_url":"https://github.com/ExpediaInc/apiary-extensions","homepage":null,"size":82,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/11"},"html":{"href":"https://github.com/ExpediaInc/apiary-extensions/pull/11"},"issue":{"href":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues/11"},"comments":{"href":"https://api.github.com/repos/ExpediaInc/apiary-extensions/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ExpediaInc/apiary-extensions/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/ExpediaInc/apiary-extensions/statuses/4fcc09ed1d647d7953e357392d7295dda91e1ea5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"massdosage"}}