{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/92583209","pull_request_review_id":13100711,"id":92583209,"diff_hunk":"@@ -113,6 +115,156 @@ public void testFailureEqualsAndHashcode() {\n         checkEqualsAndHashCode(randomFailure(), copy, mutate);\n     }\n \n+    public void testShardInfoToXContent() throws IOException {\n+        ReplicationResponse.ShardInfo shardInfo = new ReplicationResponse.ShardInfo(10, 10);\n+\n+        try (XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent())) {\n+            shardInfo.toXContent(builder, ToXContent.EMPTY_PARAMS);\n+            assertEquals(\"{\\\"total\\\":10,\\\"successful\\\":10,\\\"failed\\\":0}\", builder.string());\n+        }\n+    }\n+\n+    public void testShardInfoWithFailureToXContent() throws IOException {\n+        ReplicationResponse.ShardInfo shardInfo = new ReplicationResponse.ShardInfo(2, 1,\n+                new ReplicationResponse.ShardInfo.Failure(new ShardId(\"_index\", \"_uuid\", 1), \"_node_id\",\n+                        new IllegalStateException(\"failure cause\"), RestStatus.LOCKED, true));\n+\n+        try (XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent())) {\n+            shardInfo.toXContent(builder, ToXContent.EMPTY_PARAMS);\n+            assertEquals(\"{\"\n+                + \"\\\"total\\\":2,\"\n+                + \"\\\"successful\\\":1,\"\n+                + \"\\\"failed\\\":1,\"\n+                + \"\\\"failures\\\":[\"\n+                    + \"{\"\n+                    + \"\\\"_index\\\":\\\"_index\\\",\"\n+                    + \"\\\"_shard\\\":1,\"\n+                    + \"\\\"_node\\\":\\\"_node_id\\\",\"\n+                    + \"\\\"reason\\\":{\\\"type\\\":\\\"illegal_state_exception\\\",\\\"reason\\\":\\\"failure cause\\\"},\"\n+                    + \"\\\"status\\\":\\\"LOCKED\\\",\"\n+                    + \"\\\"primary\\\":true\"\n+                    + \"}\"\n+                + \"]\"\n+            + \"}\", builder.string());\n+        }\n+    }\n+\n+    public void testRandomShardInfoToXContent() throws IOException {\n+        final ReplicationResponse.ShardInfo shardInfo = randomShardInfo();\n+\n+        // Build the expected JSON from the random ShardInfo\n+        StringBuilder expectedJson = new StringBuilder();\n+        expectedJson.append(\"{\");","path":"core/src/test/java/org/elasticsearch/action/support/replication/ReplicationResponseTests.java","position":80,"original_position":80,"commit_id":"08c98fddbc8c2dff79bd09c7efe8a9a366838d82","original_commit_id":"08c98fddbc8c2dff79bd09c7efe8a9a366838d82","user":{"login":"tlrx","id":642733,"avatar_url":"https://avatars.githubusercontent.com/u/642733?v=3","gravatar_id":"","url":"https://api.github.com/users/tlrx","html_url":"https://github.com/tlrx","followers_url":"https://api.github.com/users/tlrx/followers","following_url":"https://api.github.com/users/tlrx/following{/other_user}","gists_url":"https://api.github.com/users/tlrx/gists{/gist_id}","starred_url":"https://api.github.com/users/tlrx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlrx/subscriptions","organizations_url":"https://api.github.com/users/tlrx/orgs","repos_url":"https://api.github.com/users/tlrx/repos","events_url":"https://api.github.com/users/tlrx/events{/privacy}","received_events_url":"https://api.github.com/users/tlrx/received_events","type":"User","site_admin":false},"body":"I find it easier to read... would you prefer using a jsonBuilder()?","created_at":"2016-12-15T10:36:00Z","updated_at":"2016-12-15T10:36:00Z","html_url":"https://github.com/elastic/elasticsearch/pull/22188#discussion_r92583209","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/22188","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/92583209"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/22188#discussion_r92583209"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/22188"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/22188","id":98123017,"html_url":"https://github.com/elastic/elasticsearch/pull/22188","diff_url":"https://github.com/elastic/elasticsearch/pull/22188.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/22188.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/22188","number":22188,"state":"open","locked":false,"title":"Add unit tests for toXContent methods in ReplicationResponse","user":{"login":"tlrx","id":642733,"avatar_url":"https://avatars.githubusercontent.com/u/642733?v=3","gravatar_id":"","url":"https://api.github.com/users/tlrx","html_url":"https://github.com/tlrx","followers_url":"https://api.github.com/users/tlrx/followers","following_url":"https://api.github.com/users/tlrx/following{/other_user}","gists_url":"https://api.github.com/users/tlrx/gists{/gist_id}","starred_url":"https://api.github.com/users/tlrx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlrx/subscriptions","organizations_url":"https://api.github.com/users/tlrx/orgs","repos_url":"https://api.github.com/users/tlrx/repos","events_url":"https://api.github.com/users/tlrx/events{/privacy}","received_events_url":"https://api.github.com/users/tlrx/received_events","type":"User","site_admin":false},"body":"This commit adds unit tests for the `toXContent()` methods of the inner classes  `ReplicationResponse.ShardInfo` and `ReplicationResponse.ShardInfo.Failure`.","created_at":"2016-12-15T10:26:34Z","updated_at":"2016-12-15T10:36:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9f8741420d93c1d629ab51c0da2b77be7e8c183","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/22188/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/22188/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/22188/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/08c98fddbc8c2dff79bd09c7efe8a9a366838d82","head":{"label":"tlrx:add-toxcontent-tests-for-ReplicationResponse","ref":"add-toxcontent-tests-for-ReplicationResponse","sha":"08c98fddbc8c2dff79bd09c7efe8a9a366838d82","user":{"login":"tlrx","id":642733,"avatar_url":"https://avatars.githubusercontent.com/u/642733?v=3","gravatar_id":"","url":"https://api.github.com/users/tlrx","html_url":"https://github.com/tlrx","followers_url":"https://api.github.com/users/tlrx/followers","following_url":"https://api.github.com/users/tlrx/following{/other_user}","gists_url":"https://api.github.com/users/tlrx/gists{/gist_id}","starred_url":"https://api.github.com/users/tlrx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlrx/subscriptions","organizations_url":"https://api.github.com/users/tlrx/orgs","repos_url":"https://api.github.com/users/tlrx/repos","events_url":"https://api.github.com/users/tlrx/events{/privacy}","received_events_url":"https://api.github.com/users/tlrx/received_events","type":"User","site_admin":false},"repo":{"id":24718639,"name":"elasticsearch","full_name":"tlrx/elasticsearch","owner":{"login":"tlrx","id":642733,"avatar_url":"https://avatars.githubusercontent.com/u/642733?v=3","gravatar_id":"","url":"https://api.github.com/users/tlrx","html_url":"https://github.com/tlrx","followers_url":"https://api.github.com/users/tlrx/followers","following_url":"https://api.github.com/users/tlrx/following{/other_user}","gists_url":"https://api.github.com/users/tlrx/gists{/gist_id}","starred_url":"https://api.github.com/users/tlrx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlrx/subscriptions","organizations_url":"https://api.github.com/users/tlrx/orgs","repos_url":"https://api.github.com/users/tlrx/repos","events_url":"https://api.github.com/users/tlrx/events{/privacy}","received_events_url":"https://api.github.com/users/tlrx/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tlrx/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/tlrx/elasticsearch","forks_url":"https://api.github.com/repos/tlrx/elasticsearch/forks","keys_url":"https://api.github.com/repos/tlrx/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tlrx/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tlrx/elasticsearch/teams","hooks_url":"https://api.github.com/repos/tlrx/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/tlrx/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/tlrx/elasticsearch/events","assignees_url":"https://api.github.com/repos/tlrx/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/tlrx/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/tlrx/elasticsearch/tags","blobs_url":"https://api.github.com/repos/tlrx/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tlrx/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tlrx/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/tlrx/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tlrx/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/tlrx/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/tlrx/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/tlrx/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/tlrx/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/tlrx/elasticsearch/subscription","commits_url":"https://api.github.com/repos/tlrx/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/tlrx/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/tlrx/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/tlrx/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/tlrx/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/tlrx/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tlrx/elasticsearch/merges","archive_url":"https://api.github.com/repos/tlrx/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tlrx/elasticsearch/downloads","issues_url":"https://api.github.com/repos/tlrx/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/tlrx/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/tlrx/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/tlrx/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tlrx/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/tlrx/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/tlrx/elasticsearch/deployments","created_at":"2014-10-02T12:51:44Z","updated_at":"2014-10-02T08:42:36Z","pushed_at":"2016-12-15T10:24:40Z","git_url":"git://github.com/tlrx/elasticsearch.git","ssh_url":"git@github.com:tlrx/elasticsearch.git","clone_url":"https://github.com/tlrx/elasticsearch.git","svn_url":"https://github.com/tlrx/elasticsearch","homepage":"http://elasticsearch.org","size":229831,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"3005366b1322a251a49eadd8d4dad2cb9644ee4f","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch","forks_url":"https://api.github.com/repos/elastic/elasticsearch/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/elasticsearch/deployments","created_at":"2010-02-08T13:20:56Z","updated_at":"2016-12-15T10:12:43Z","pushed_at":"2016-12-15T10:26:34Z","git_url":"git://github.com/elastic/elasticsearch.git","ssh_url":"git@github.com:elastic/elasticsearch.git","clone_url":"https://github.com/elastic/elasticsearch.git","svn_url":"https://github.com/elastic/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":297530,"stargazers_count":19795,"watchers_count":19795,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6799,"mirror_url":null,"open_issues_count":1190,"forks":6799,"open_issues":1190,"watchers":19795,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/22188"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/22188"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/22188"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/22188/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/22188/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/22188/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/08c98fddbc8c2dff79bd09c7efe8a9a366838d82"}}}}
{"actor":{"display_login":"tlrx"}}