{"action":"created","comment":{"url":"https://api.github.com/repos/opendatakit/collect/pulls/comments/207700028","pull_request_review_id":143373367,"id":207700028,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzcwMDAyOA==","diff_hunk":"@@ -0,0 +1,68 @@\n+package org.odk.collect.android.http.mock;\n+\n+import android.support.annotation.NonNull;\n+import android.support.annotation.Nullable;\n+\n+import org.odk.collect.android.http.HttpCredentialsInterface;\n+import org.odk.collect.android.http.HttpGetResult;\n+import org.odk.collect.android.http.HttpHeadResult;\n+import org.odk.collect.android.http.OpenRosaHttpInterface;\n+import org.odk.collect.android.utilities.ResponseMessageParser;\n+\n+import java.io.ByteArrayInputStream;\n+import java.io.File;\n+import java.io.IOException;\n+import java.io.InputStream;\n+import java.net.HttpURLConnection;\n+import java.net.URI;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+\n+public class MockHttpClientConnection implements OpenRosaHttpInterface {\n+\n+    private boolean getHttpShouldReturnNull;\n+\n+    @NonNull\n+    @Override\n+    public HttpGetResult get(@NonNull URI uri, @Nullable String contentType, @Nullable HttpCredentialsInterface credentials) throws Exception {\n+        if (getHttpShouldReturnNull) {\n+            return null;\n+        }\n+\n+        String xml =\n+        \"<forms>\" +\n+        \"<form url=\\\"https://opendatakit.appspot.com/formXml?formId=CascadingSelect\\\">Cascading Select Form</form>\" +\n+        \"<form url=\\\"https://opendatakit.appspot.com/formXml?formId=widgets\\\">Widgets</form>\" +\n+        \"<form url=\\\"https://opendatakit.appspot.com/formXml?formId=NewWidgets\\\">New Widgets</form>\" +\n+        \"<form url=\\\"https://opendatakit.appspot.com/formXml?formId=sample\\\">sample</form>\" +\n+        \"</forms>\";\n+\n+        InputStream is = new ByteArrayInputStream(xml.getBytes());\n+\n+        Map<String, String> headers = new HashMap<>();\n+        headers.put(\"X-OpenRosa-Version\", \"1.0\");\n+        headers.put(\"Content-Type\", \"text/xml;charset=utf-8\");\n+\n+        return new HttpGetResult(is, headers, \"test-hash\", HttpURLConnection.HTTP_OK);\n+    }\n+\n+    @NonNull\n+    @Override\n+    public HttpHeadResult head(@NonNull URI uri, @Nullable HttpCredentialsInterface credentials) throws Exception {\n+        return new HttpHeadResult(0, new HashMap<String, String>());\n+    }\n+\n+    @NonNull\n+    @Override\n+    public ResponseMessageParser uploadSubmissionFile(@NonNull List<File> fileList, @NonNull File submissionFile, @NonNull URI uri, @Nullable HttpCredentialsInterface credentials) throws IOException {\n+        return null;","path":"collect_app/src/test/java/org/odk/collect/android/http/mock/MockHttpClientConnection.java","position":59,"original_position":59,"commit_id":"6f35d92d8a74189dc3d2d9053e9d228d30e1f671","original_commit_id":"6f35d92d8a74189dc3d2d9053e9d228d30e1f671","user":{"login":"jd-alexander","id":1509205,"node_id":"MDQ6VXNlcjE1MDkyMDU=","avatar_url":"https://avatars1.githubusercontent.com/u/1509205?v=4","gravatar_id":"","url":"https://api.github.com/users/jd-alexander","html_url":"https://github.com/jd-alexander","followers_url":"https://api.github.com/users/jd-alexander/followers","following_url":"https://api.github.com/users/jd-alexander/following{/other_user}","gists_url":"https://api.github.com/users/jd-alexander/gists{/gist_id}","starred_url":"https://api.github.com/users/jd-alexander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jd-alexander/subscriptions","organizations_url":"https://api.github.com/users/jd-alexander/orgs","repos_url":"https://api.github.com/users/jd-alexander/repos","events_url":"https://api.github.com/users/jd-alexander/events{/privacy}","received_events_url":"https://api.github.com/users/jd-alexander/received_events","type":"User","site_admin":false},"body":"How difficult is it for us to mock this behaviour and test it? When we do the switch to `okHttp` are there tests related to upload functionality that verify it's behaviour?","created_at":"2018-08-04T05:01:23Z","updated_at":"2018-08-04T05:01:23Z","html_url":"https://github.com/opendatakit/collect/pull/2257#discussion_r207700028","pull_request_url":"https://api.github.com/repos/opendatakit/collect/pulls/2257","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/comments/207700028"},"html":{"href":"https://github.com/opendatakit/collect/pull/2257#discussion_r207700028"},"pull_request":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/2257"}}},"pull_request":{"url":"https://api.github.com/repos/opendatakit/collect/pulls/2257","id":191110324,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxMTEwMzI0","html_url":"https://github.com/opendatakit/collect/pull/2257","diff_url":"https://github.com/opendatakit/collect/pull/2257.diff","patch_url":"https://github.com/opendatakit/collect/pull/2257.patch","issue_url":"https://api.github.com/repos/opendatakit/collect/issues/2257","number":2257,"state":"open","locked":false,"title":"Issue #620 break dependency on httpclient","user":{"login":"xsteelej","id":34111631,"node_id":"MDQ6VXNlcjM0MTExNjMx","avatar_url":"https://avatars1.githubusercontent.com/u/34111631?v=4","gravatar_id":"","url":"https://api.github.com/users/xsteelej","html_url":"https://github.com/xsteelej","followers_url":"https://api.github.com/users/xsteelej/followers","following_url":"https://api.github.com/users/xsteelej/following{/other_user}","gists_url":"https://api.github.com/users/xsteelej/gists{/gist_id}","starred_url":"https://api.github.com/users/xsteelej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xsteelej/subscriptions","organizations_url":"https://api.github.com/users/xsteelej/orgs","repos_url":"https://api.github.com/users/xsteelej/repos","events_url":"https://api.github.com/users/xsteelej/events{/privacy}","received_events_url":"https://api.github.com/users/xsteelej/received_events","type":"User","site_admin":false},"body":"Closes #620 \r\n\r\nThis is the first of two pull requests planned for this issue. In this initial pull request the code has been refactored so that httpclient is only used in one place. Once this approach has been reviewed, tested and merged, then a second pull request will be raised that swaps out httpclient with another http client (which is yet to be decided).\r\n\r\n<!-- \r\nThank you for contributing to ODK Collect!\r\n\r\nBefore sending this PR, please read\r\nhttps://github.com/opendatakit/collect/blob/master/CONTRIBUTING.md\r\n-->\r\n\r\n#### What has been done to verify that this works as intended?\r\n\r\nVerified that the app downloads blank forms and that forms are correct uploaded to https://opendatakit.appspot.com\r\n\r\n#### Why is this the best possible solution? Were any other approaches considered?\r\n\r\nTo fix this in two stages (PRs) means that the refactoring can be reviewed and verified first and then the second pull request the review would just concentrate on the new http library.\r\n\r\n#### Are there any risks to merging this code? If so, what are they?\r\n\r\nThe refactoring is quite risky, a bug could be introduced into the download or upload functionality.\r\n\r\n#### Do we need any specific form for testing your changes? If so, please attach one.\r\n\r\nWe need to check \r\n\r\n#### Does this change require updates to documentation? If so, please file an issue [here]( https://github.com/opendatakit/docs/issues/new) and include the link below.\r\n\r\n#### Before submitting this PR, please make sure you have:\r\n- [x] run `./gradlew pmd checkstyle lint findbugs` and confirmed all checks still pass.\r\n- [] verified that any new UI elements use theme colors. [UI Components Style guidelines](https://github.com/opendatakit/collect/blob/master/CONTRIBUTING.md#ui-components-style-guidelines)","created_at":"2018-05-29T11:11:13Z","updated_at":"2018-08-04T05:01:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba6631034902d299cd30da52c6e976a1d0f0d4e0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/opendatakit/collect/pulls/2257/commits","review_comments_url":"https://api.github.com/repos/opendatakit/collect/pulls/2257/comments","review_comment_url":"https://api.github.com/repos/opendatakit/collect/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opendatakit/collect/issues/2257/comments","statuses_url":"https://api.github.com/repos/opendatakit/collect/statuses/6f35d92d8a74189dc3d2d9053e9d228d30e1f671","head":{"label":"xsteelej:issue_#620_break_dependancy_on_httpclient","ref":"issue_#620_break_dependancy_on_httpclient","sha":"6f35d92d8a74189dc3d2d9053e9d228d30e1f671","user":{"login":"xsteelej","id":34111631,"node_id":"MDQ6VXNlcjM0MTExNjMx","avatar_url":"https://avatars1.githubusercontent.com/u/34111631?v=4","gravatar_id":"","url":"https://api.github.com/users/xsteelej","html_url":"https://github.com/xsteelej","followers_url":"https://api.github.com/users/xsteelej/followers","following_url":"https://api.github.com/users/xsteelej/following{/other_user}","gists_url":"https://api.github.com/users/xsteelej/gists{/gist_id}","starred_url":"https://api.github.com/users/xsteelej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xsteelej/subscriptions","organizations_url":"https://api.github.com/users/xsteelej/orgs","repos_url":"https://api.github.com/users/xsteelej/repos","events_url":"https://api.github.com/users/xsteelej/events{/privacy}","received_events_url":"https://api.github.com/users/xsteelej/received_events","type":"User","site_admin":false},"repo":{"id":128728266,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg3MjgyNjY=","name":"collect","full_name":"xsteelej/collect","owner":{"login":"xsteelej","id":34111631,"node_id":"MDQ6VXNlcjM0MTExNjMx","avatar_url":"https://avatars1.githubusercontent.com/u/34111631?v=4","gravatar_id":"","url":"https://api.github.com/users/xsteelej","html_url":"https://github.com/xsteelej","followers_url":"https://api.github.com/users/xsteelej/followers","following_url":"https://api.github.com/users/xsteelej/following{/other_user}","gists_url":"https://api.github.com/users/xsteelej/gists{/gist_id}","starred_url":"https://api.github.com/users/xsteelej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xsteelej/subscriptions","organizations_url":"https://api.github.com/users/xsteelej/orgs","repos_url":"https://api.github.com/users/xsteelej/repos","events_url":"https://api.github.com/users/xsteelej/events{/privacy}","received_events_url":"https://api.github.com/users/xsteelej/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xsteelej/collect","description":"ODK Collect is an Android app for filling out forms. It's been used to collect billions of data points in challenging environments around the world. Contribute and make the world a better place! ✨📋✨","fork":true,"url":"https://api.github.com/repos/xsteelej/collect","forks_url":"https://api.github.com/repos/xsteelej/collect/forks","keys_url":"https://api.github.com/repos/xsteelej/collect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xsteelej/collect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xsteelej/collect/teams","hooks_url":"https://api.github.com/repos/xsteelej/collect/hooks","issue_events_url":"https://api.github.com/repos/xsteelej/collect/issues/events{/number}","events_url":"https://api.github.com/repos/xsteelej/collect/events","assignees_url":"https://api.github.com/repos/xsteelej/collect/assignees{/user}","branches_url":"https://api.github.com/repos/xsteelej/collect/branches{/branch}","tags_url":"https://api.github.com/repos/xsteelej/collect/tags","blobs_url":"https://api.github.com/repos/xsteelej/collect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xsteelej/collect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xsteelej/collect/git/refs{/sha}","trees_url":"https://api.github.com/repos/xsteelej/collect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xsteelej/collect/statuses/{sha}","languages_url":"https://api.github.com/repos/xsteelej/collect/languages","stargazers_url":"https://api.github.com/repos/xsteelej/collect/stargazers","contributors_url":"https://api.github.com/repos/xsteelej/collect/contributors","subscribers_url":"https://api.github.com/repos/xsteelej/collect/subscribers","subscription_url":"https://api.github.com/repos/xsteelej/collect/subscription","commits_url":"https://api.github.com/repos/xsteelej/collect/commits{/sha}","git_commits_url":"https://api.github.com/repos/xsteelej/collect/git/commits{/sha}","comments_url":"https://api.github.com/repos/xsteelej/collect/comments{/number}","issue_comment_url":"https://api.github.com/repos/xsteelej/collect/issues/comments{/number}","contents_url":"https://api.github.com/repos/xsteelej/collect/contents/{+path}","compare_url":"https://api.github.com/repos/xsteelej/collect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xsteelej/collect/merges","archive_url":"https://api.github.com/repos/xsteelej/collect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xsteelej/collect/downloads","issues_url":"https://api.github.com/repos/xsteelej/collect/issues{/number}","pulls_url":"https://api.github.com/repos/xsteelej/collect/pulls{/number}","milestones_url":"https://api.github.com/repos/xsteelej/collect/milestones{/number}","notifications_url":"https://api.github.com/repos/xsteelej/collect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xsteelej/collect/labels{/name}","releases_url":"https://api.github.com/repos/xsteelej/collect/releases{/id}","deployments_url":"https://api.github.com/repos/xsteelej/collect/deployments","created_at":"2018-04-09T06:57:31Z","updated_at":"2018-07-31T20:25:53Z","pushed_at":"2018-07-31T22:11:07Z","git_url":"git://github.com/xsteelej/collect.git","ssh_url":"git@github.com:xsteelej/collect.git","clone_url":"https://github.com/xsteelej/collect.git","svn_url":"https://github.com/xsteelej/collect","homepage":"https://docs.opendatakit.org/collect-intro","size":41375,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opendatakit:master","ref":"master","sha":"f0caae5f38c8af5837300e77e8cea96799b7b66b","user":{"login":"opendatakit","id":6222985,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyMjI5ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/6222985?v=4","gravatar_id":"","url":"https://api.github.com/users/opendatakit","html_url":"https://github.com/opendatakit","followers_url":"https://api.github.com/users/opendatakit/followers","following_url":"https://api.github.com/users/opendatakit/following{/other_user}","gists_url":"https://api.github.com/users/opendatakit/gists{/gist_id}","starred_url":"https://api.github.com/users/opendatakit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opendatakit/subscriptions","organizations_url":"https://api.github.com/users/opendatakit/orgs","repos_url":"https://api.github.com/users/opendatakit/repos","events_url":"https://api.github.com/users/opendatakit/events{/privacy}","received_events_url":"https://api.github.com/users/opendatakit/received_events","type":"Organization","site_admin":false},"repo":{"id":40213809,"node_id":"MDEwOlJlcG9zaXRvcnk0MDIxMzgwOQ==","name":"collect","full_name":"opendatakit/collect","owner":{"login":"opendatakit","id":6222985,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyMjI5ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/6222985?v=4","gravatar_id":"","url":"https://api.github.com/users/opendatakit","html_url":"https://github.com/opendatakit","followers_url":"https://api.github.com/users/opendatakit/followers","following_url":"https://api.github.com/users/opendatakit/following{/other_user}","gists_url":"https://api.github.com/users/opendatakit/gists{/gist_id}","starred_url":"https://api.github.com/users/opendatakit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opendatakit/subscriptions","organizations_url":"https://api.github.com/users/opendatakit/orgs","repos_url":"https://api.github.com/users/opendatakit/repos","events_url":"https://api.github.com/users/opendatakit/events{/privacy}","received_events_url":"https://api.github.com/users/opendatakit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opendatakit/collect","description":"ODK Collect is an Android app for filling out forms. It's been used to collect billions of data points in challenging environments around the world. Contribute and make the world a better place! ✨📋✨","fork":false,"url":"https://api.github.com/repos/opendatakit/collect","forks_url":"https://api.github.com/repos/opendatakit/collect/forks","keys_url":"https://api.github.com/repos/opendatakit/collect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opendatakit/collect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opendatakit/collect/teams","hooks_url":"https://api.github.com/repos/opendatakit/collect/hooks","issue_events_url":"https://api.github.com/repos/opendatakit/collect/issues/events{/number}","events_url":"https://api.github.com/repos/opendatakit/collect/events","assignees_url":"https://api.github.com/repos/opendatakit/collect/assignees{/user}","branches_url":"https://api.github.com/repos/opendatakit/collect/branches{/branch}","tags_url":"https://api.github.com/repos/opendatakit/collect/tags","blobs_url":"https://api.github.com/repos/opendatakit/collect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opendatakit/collect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opendatakit/collect/git/refs{/sha}","trees_url":"https://api.github.com/repos/opendatakit/collect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opendatakit/collect/statuses/{sha}","languages_url":"https://api.github.com/repos/opendatakit/collect/languages","stargazers_url":"https://api.github.com/repos/opendatakit/collect/stargazers","contributors_url":"https://api.github.com/repos/opendatakit/collect/contributors","subscribers_url":"https://api.github.com/repos/opendatakit/collect/subscribers","subscription_url":"https://api.github.com/repos/opendatakit/collect/subscription","commits_url":"https://api.github.com/repos/opendatakit/collect/commits{/sha}","git_commits_url":"https://api.github.com/repos/opendatakit/collect/git/commits{/sha}","comments_url":"https://api.github.com/repos/opendatakit/collect/comments{/number}","issue_comment_url":"https://api.github.com/repos/opendatakit/collect/issues/comments{/number}","contents_url":"https://api.github.com/repos/opendatakit/collect/contents/{+path}","compare_url":"https://api.github.com/repos/opendatakit/collect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opendatakit/collect/merges","archive_url":"https://api.github.com/repos/opendatakit/collect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opendatakit/collect/downloads","issues_url":"https://api.github.com/repos/opendatakit/collect/issues{/number}","pulls_url":"https://api.github.com/repos/opendatakit/collect/pulls{/number}","milestones_url":"https://api.github.com/repos/opendatakit/collect/milestones{/number}","notifications_url":"https://api.github.com/repos/opendatakit/collect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opendatakit/collect/labels{/name}","releases_url":"https://api.github.com/repos/opendatakit/collect/releases{/id}","deployments_url":"https://api.github.com/repos/opendatakit/collect/deployments","created_at":"2015-08-04T23:21:33Z","updated_at":"2018-08-03T12:09:38Z","pushed_at":"2018-08-03T18:48:36Z","git_url":"git://github.com/opendatakit/collect.git","ssh_url":"git@github.com:opendatakit/collect.git","clone_url":"https://github.com/opendatakit/collect.git","svn_url":"https://github.com/opendatakit/collect","homepage":"https://docs.opendatakit.org/collect-intro","size":41169,"stargazers_count":311,"watchers_count":311,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":668,"mirror_url":null,"archived":false,"open_issues_count":216,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":668,"open_issues":216,"watchers":311,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/2257"},"html":{"href":"https://github.com/opendatakit/collect/pull/2257"},"issue":{"href":"https://api.github.com/repos/opendatakit/collect/issues/2257"},"comments":{"href":"https://api.github.com/repos/opendatakit/collect/issues/2257/comments"},"review_comments":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/2257/comments"},"review_comment":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/2257/commits"},"statuses":{"href":"https://api.github.com/repos/opendatakit/collect/statuses/6f35d92d8a74189dc3d2d9053e9d228d30e1f671"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jd-alexander"}}