{"action":"created","comment":{"url":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/comments/225874824","pull_request_review_id":165567014,"id":225874824,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTg3NDgyNA==","diff_hunk":"@@ -0,0 +1,43 @@\n+package uk.gov.hmcts.reform.bulkscanprocessor.helpers;\n+\n+import com.google.common.io.Files;\n+\n+import java.io.ByteArrayOutputStream;\n+import java.io.File;\n+import java.io.IOException;\n+import java.util.List;\n+import java.util.stream.Stream;\n+import java.util.zip.ZipEntry;\n+import java.util.zip.ZipOutputStream;\n+\n+import static com.google.common.io.Resources.getResource;\n+import static java.util.stream.Collectors.toList;\n+\n+public class DirZipper {\n+\n+    /**\n+     * Zips files from given directory. Files in resulting archive are NOT wrapped in a directory.\n+     */\n+    public static byte[] zipDir(String dirName) throws IOException {\n+\n+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n+        try (ZipOutputStream zos = new ZipOutputStream(outputStream)) {\n+\n+            // .listFiles() does not guarantee any order.\n+            // Files need to be sorted as currently mocks rely on files order.\n+            // TODO: improve mocks in tests so that order does not matter\n+            List<File> filesToZip =\n+                Stream.of(new File(getResource(dirName).getPath()).listFiles())\n+                    .sorted()\n+                    .collect(toList());","path":"src/integrationTest/java/uk/gov/hmcts/reform/bulkscanprocessor/helpers/DirZipper.java","position":32,"original_position":32,"commit_id":"4e7aee32fa3a0adb16fbd44088ab392956d80a26","original_commit_id":"4e7aee32fa3a0adb16fbd44088ab392956d80a26","user":{"login":"timja","id":21194782,"node_id":"MDQ6VXNlcjIxMTk0Nzgy","avatar_url":"https://avatars3.githubusercontent.com/u/21194782?v=4","gravatar_id":"","url":"https://api.github.com/users/timja","html_url":"https://github.com/timja","followers_url":"https://api.github.com/users/timja/followers","following_url":"https://api.github.com/users/timja/following{/other_user}","gists_url":"https://api.github.com/users/timja/gists{/gist_id}","starred_url":"https://api.github.com/users/timja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timja/subscriptions","organizations_url":"https://api.github.com/users/timja/orgs","repos_url":"https://api.github.com/users/timja/repos","events_url":"https://api.github.com/users/timja/events{/privacy}","received_events_url":"https://api.github.com/users/timja/received_events","type":"User","site_admin":false},"body":"try catch / wrapper function?","created_at":"2018-10-17T10:52:31Z","updated_at":"2018-10-17T10:52:31Z","html_url":"https://github.com/hmcts/bulk-scan-processor/pull/218#discussion_r225874824","pull_request_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/218","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/comments/225874824"},"html":{"href":"https://github.com/hmcts/bulk-scan-processor/pull/218#discussion_r225874824"},"pull_request":{"href":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/218"}},"in_reply_to_id":225872916},"pull_request":{"url":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/218","id":223553406,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzNTUzNDA2","html_url":"https://github.com/hmcts/bulk-scan-processor/pull/218","diff_url":"https://github.com/hmcts/bulk-scan-processor/pull/218.diff","patch_url":"https://github.com/hmcts/bulk-scan-processor/pull/218.patch","issue_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues/218","number":218,"state":"open","locked":false,"title":"Remove zip files from tests: part 1","user":{"login":"rkondratowicz","id":2472141,"node_id":"MDQ6VXNlcjI0NzIxNDE=","avatar_url":"https://avatars2.githubusercontent.com/u/2472141?v=4","gravatar_id":"","url":"https://api.github.com/users/rkondratowicz","html_url":"https://github.com/rkondratowicz","followers_url":"https://api.github.com/users/rkondratowicz/followers","following_url":"https://api.github.com/users/rkondratowicz/following{/other_user}","gists_url":"https://api.github.com/users/rkondratowicz/gists{/gist_id}","starred_url":"https://api.github.com/users/rkondratowicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkondratowicz/subscriptions","organizations_url":"https://api.github.com/users/rkondratowicz/orgs","repos_url":"https://api.github.com/users/rkondratowicz/repos","events_url":"https://api.github.com/users/rkondratowicz/events{/privacy}","received_events_url":"https://api.github.com/users/rkondratowicz/received_events","type":"User","site_admin":false},"body":"Background:\r\n\r\nInstead of storing **zip files** in test resources (which can't be easily inspected or, perhaps more importantly, updated), store the contents of the zip files in **folders** with descriptive name.\r\n\r\nThis PR only adds a helper class to zip folder contents in memory and updates single test.\r\n\r\nTo do in next PR(s):\r\n- update all tests to use directories instead of zip files.\r\n- once it's clear what zip file contents are used in tests, check if we really need 12 different archives/directories in tests\r\n\r\n","created_at":"2018-10-17T10:42:47Z","updated_at":"2018-10-17T10:52:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c4275022dbb84edaa6957609bd28ec49cf5d3168","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/218/commits","review_comments_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/218/comments","review_comment_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues/218/comments","statuses_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/statuses/4e7aee32fa3a0adb16fbd44088ab392956d80a26","head":{"label":"hmcts:refactor/remove-binary-files-from-tests-1","ref":"refactor/remove-binary-files-from-tests-1","sha":"4e7aee32fa3a0adb16fbd44088ab392956d80a26","user":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"repo":{"id":133028120,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMwMjgxMjA=","name":"bulk-scan-processor","full_name":"hmcts/bulk-scan-processor","private":false,"owner":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hmcts/bulk-scan-processor","description":null,"fork":false,"url":"https://api.github.com/repos/hmcts/bulk-scan-processor","forks_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/forks","keys_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/teams","hooks_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/hooks","issue_events_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues/events{/number}","events_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/events","assignees_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/assignees{/user}","branches_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/branches{/branch}","tags_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/tags","blobs_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/statuses/{sha}","languages_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/languages","stargazers_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/stargazers","contributors_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/contributors","subscribers_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/subscribers","subscription_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/subscription","commits_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/contents/{+path}","compare_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/merges","archive_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/downloads","issues_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues{/number}","pulls_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls{/number}","milestones_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/milestones{/number}","notifications_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/labels{/name}","releases_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/releases{/id}","deployments_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/deployments","created_at":"2018-05-11T10:51:58Z","updated_at":"2018-10-17T09:49:09Z","pushed_at":"2018-10-17T10:42:48Z","git_url":"git://github.com/hmcts/bulk-scan-processor.git","ssh_url":"git@github.com:hmcts/bulk-scan-processor.git","clone_url":"https://github.com/hmcts/bulk-scan-processor.git","svn_url":"https://github.com/hmcts/bulk-scan-processor","homepage":null,"size":1700,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"hmcts:master","ref":"master","sha":"17145c19665bec8b5b7388cba0be5ec12bbb471a","user":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"repo":{"id":133028120,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMwMjgxMjA=","name":"bulk-scan-processor","full_name":"hmcts/bulk-scan-processor","private":false,"owner":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hmcts/bulk-scan-processor","description":null,"fork":false,"url":"https://api.github.com/repos/hmcts/bulk-scan-processor","forks_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/forks","keys_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/teams","hooks_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/hooks","issue_events_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues/events{/number}","events_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/events","assignees_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/assignees{/user}","branches_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/branches{/branch}","tags_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/tags","blobs_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/statuses/{sha}","languages_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/languages","stargazers_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/stargazers","contributors_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/contributors","subscribers_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/subscribers","subscription_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/subscription","commits_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/contents/{+path}","compare_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/merges","archive_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/downloads","issues_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues{/number}","pulls_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls{/number}","milestones_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/milestones{/number}","notifications_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/labels{/name}","releases_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/releases{/id}","deployments_url":"https://api.github.com/repos/hmcts/bulk-scan-processor/deployments","created_at":"2018-05-11T10:51:58Z","updated_at":"2018-10-17T09:49:09Z","pushed_at":"2018-10-17T10:42:48Z","git_url":"git://github.com/hmcts/bulk-scan-processor.git","ssh_url":"git@github.com:hmcts/bulk-scan-processor.git","clone_url":"https://github.com/hmcts/bulk-scan-processor.git","svn_url":"https://github.com/hmcts/bulk-scan-processor","homepage":null,"size":1700,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/218"},"html":{"href":"https://github.com/hmcts/bulk-scan-processor/pull/218"},"issue":{"href":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues/218"},"comments":{"href":"https://api.github.com/repos/hmcts/bulk-scan-processor/issues/218/comments"},"review_comments":{"href":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/218/comments"},"review_comment":{"href":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmcts/bulk-scan-processor/pulls/218/commits"},"statuses":{"href":"https://api.github.com/repos/hmcts/bulk-scan-processor/statuses/4e7aee32fa3a0adb16fbd44088ab392956d80a26"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"timja"}}