{"action":"created","comment":{"url":"https://api.github.com/repos/xetorthio/jedis/pulls/comments/60416811","id":60416811,"diff_hunk":"@@ -0,0 +1,92 @@\n+package redis.clients.jedis.tests;\n+\n+import org.apache.commons.lang3.ClassUtils;\n+import org.apache.commons.pool2.impl.GenericObjectPoolConfig;\n+import org.junit.Test;\n+import redis.clients.jedis.Client;\n+import redis.clients.jedis.HostAndPort;\n+import redis.clients.jedis.Jedis;\n+import redis.clients.jedis.JedisCluster;\n+import redis.clients.jedis.JedisClusterConnectionHandler;\n+import redis.clients.jedis.Pipeline;\n+import uk.co.jemos.podam.api.PodamFactory;\n+import uk.co.jemos.podam.api.PodamFactoryImpl;\n+\n+import java.lang.reflect.InvocationTargetException;\n+import java.lang.reflect.Method;\n+import java.util.ArrayList;\n+import java.util.Arrays;\n+import java.util.List;\n+import java.util.Set;\n+\n+import static org.mockito.Matchers.any;\n+import static org.mockito.Matchers.anyInt;\n+import static org.mockito.Mockito.mock;\n+import static org.mockito.Mockito.reset;\n+import static org.mockito.Mockito.verify;\n+import static org.mockito.Mockito.when;\n+\n+public class DelegationVerifyTest {\n+\n+  private PodamFactory factory = new PodamFactoryImpl();\n+\n+  @Test\n+  public void testSanityOnPipeline() throws InvocationTargetException, IllegalAccessException, InstantiationException {\n+    Client mockClient = mock(Client.class);\n+    Pipeline pipeline = new Pipeline();\n+    pipeline.setClient(mockClient);\n+\n+    List<Class<?>> allInterfacesForPipeline = ClassUtils.getAllInterfaces(Pipeline.class);\n+    for (Class<?> inter : allInterfacesForPipeline) {\n+      if (!inter.getCanonicalName().startsWith(\"redis.clients.jedis.commands\")) {\n+        continue;\n+      }\n+\n+      for (Method method : inter.getMethods()) {\n+        if (needToSkipMethod(method)) {\n+          System.err.println(\"Skipping method due to some issues : \" + method);\n+          continue;\n+        }\n+\n+        Class<?>[] parameterTypes = method.getParameterTypes();\n+        Object[] parameters = new Object[parameterTypes.length];\n+\n+        int idx = 0;\n+        for (Class<?> parameterType : parameterTypes) {\n+          // FIXME: should instantiate byte[], String[], byte[][], [I(??), Map (possible?)\n+          parameters[idx++] = factory.manufacturePojo(parameterType);\n+        }\n+\n+        method.invoke(pipeline, parameters);\n+\n+        Method matchingMethod = findMatchingMethod(mockClient.getClass(), method);\n+        matchingMethod.invoke(verify(mockClient), parameters);\n+        reset(mockClient);\n+      }\n+    }\n+  }\n+\n+  private boolean needToSkipMethod(Method method) {\n+    // FIXME: we should replace vararg to List or Collection or Iterator or sth. to get rid of ambiguity. It's already reported from Scala users.","path":"src/test/java/redis/clients/jedis/tests/DelegationVerifyTest.java","position":70,"original_position":70,"commit_id":"498544a7341e72fcd099b04ed988e8b99ad500e6","original_commit_id":"498544a7341e72fcd099b04ed988e8b99ad500e6","user":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"body":"File an issue to #1263.","created_at":"2016-04-20T14:26:47Z","updated_at":"2016-04-20T14:26:47Z","html_url":"https://github.com/xetorthio/jedis/pull/1261#discussion_r60416811","pull_request_url":"https://api.github.com/repos/xetorthio/jedis/pulls/1261","_links":{"self":{"href":"https://api.github.com/repos/xetorthio/jedis/pulls/comments/60416811"},"html":{"href":"https://github.com/xetorthio/jedis/pull/1261#discussion_r60416811"},"pull_request":{"href":"https://api.github.com/repos/xetorthio/jedis/pulls/1261"}}},"pull_request":{"url":"https://api.github.com/repos/xetorthio/jedis/pulls/1261","id":67046739,"html_url":"https://github.com/xetorthio/jedis/pull/1261","diff_url":"https://github.com/xetorthio/jedis/pull/1261.diff","patch_url":"https://github.com/xetorthio/jedis/pull/1261.patch","issue_url":"https://api.github.com/repos/xetorthio/jedis/issues/1261","number":1261,"state":"open","locked":false,"title":"Introduce new test: verify delegation via reflection & mock","user":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"body":"This pull request is WIP to address #829.\r\n\r\n* DelegationVerifyTest checks that method delegates the request to delegator's method with same signature\r\n  * currently it only supports Pipeline\r\n* Whole bunch of parameter handlings are moved to Client class\r\n  * in order to check conveniently, and avoid any possible duplicated works\r\n  * will address this to BinaryJedis, Jedis, JedisCluster, ShardedJedis, etc.\r\n* fix some missed spots while testing DelegationVerifyTest\r\n\r\nI'll going to apply test to JedisCluster, and ShardedJedis too, but before that I should find a way to instantiate byte[], String[], byte[][], Map (?) and so on.\r\nPipeline test passed without addressing those things.\r\n\r\nWhen we can apply this test to JedisCluster and ShardedJedis, I guess we can resolve #829.","created_at":"2016-04-19T16:12:02Z","updated_at":"2016-04-20T14:26:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71d6da3e0a114858f19b7caf3dfab4026533d12d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/xetorthio/jedis/pulls/1261/commits","review_comments_url":"https://api.github.com/repos/xetorthio/jedis/pulls/1261/comments","review_comment_url":"https://api.github.com/repos/xetorthio/jedis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xetorthio/jedis/issues/1261/comments","statuses_url":"https://api.github.com/repos/xetorthio/jedis/statuses/498544a7341e72fcd099b04ed988e8b99ad500e6","head":{"label":"HeartSaVioR:make-delegation-verify-test","ref":"make-delegation-verify-test","sha":"498544a7341e72fcd099b04ed988e8b99ad500e6","user":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"repo":{"id":13059469,"name":"jedis","full_name":"HeartSaVioR/jedis","owner":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HeartSaVioR/jedis","description":"This repo is for PR to xetorthio/jedis","fork":true,"url":"https://api.github.com/repos/HeartSaVioR/jedis","forks_url":"https://api.github.com/repos/HeartSaVioR/jedis/forks","keys_url":"https://api.github.com/repos/HeartSaVioR/jedis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HeartSaVioR/jedis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HeartSaVioR/jedis/teams","hooks_url":"https://api.github.com/repos/HeartSaVioR/jedis/hooks","issue_events_url":"https://api.github.com/repos/HeartSaVioR/jedis/issues/events{/number}","events_url":"https://api.github.com/repos/HeartSaVioR/jedis/events","assignees_url":"https://api.github.com/repos/HeartSaVioR/jedis/assignees{/user}","branches_url":"https://api.github.com/repos/HeartSaVioR/jedis/branches{/branch}","tags_url":"https://api.github.com/repos/HeartSaVioR/jedis/tags","blobs_url":"https://api.github.com/repos/HeartSaVioR/jedis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HeartSaVioR/jedis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HeartSaVioR/jedis/git/refs{/sha}","trees_url":"https://api.github.com/repos/HeartSaVioR/jedis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HeartSaVioR/jedis/statuses/{sha}","languages_url":"https://api.github.com/repos/HeartSaVioR/jedis/languages","stargazers_url":"https://api.github.com/repos/HeartSaVioR/jedis/stargazers","contributors_url":"https://api.github.com/repos/HeartSaVioR/jedis/contributors","subscribers_url":"https://api.github.com/repos/HeartSaVioR/jedis/subscribers","subscription_url":"https://api.github.com/repos/HeartSaVioR/jedis/subscription","commits_url":"https://api.github.com/repos/HeartSaVioR/jedis/commits{/sha}","git_commits_url":"https://api.github.com/repos/HeartSaVioR/jedis/git/commits{/sha}","comments_url":"https://api.github.com/repos/HeartSaVioR/jedis/comments{/number}","issue_comment_url":"https://api.github.com/repos/HeartSaVioR/jedis/issues/comments{/number}","contents_url":"https://api.github.com/repos/HeartSaVioR/jedis/contents/{+path}","compare_url":"https://api.github.com/repos/HeartSaVioR/jedis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HeartSaVioR/jedis/merges","archive_url":"https://api.github.com/repos/HeartSaVioR/jedis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HeartSaVioR/jedis/downloads","issues_url":"https://api.github.com/repos/HeartSaVioR/jedis/issues{/number}","pulls_url":"https://api.github.com/repos/HeartSaVioR/jedis/pulls{/number}","milestones_url":"https://api.github.com/repos/HeartSaVioR/jedis/milestones{/number}","notifications_url":"https://api.github.com/repos/HeartSaVioR/jedis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HeartSaVioR/jedis/labels{/name}","releases_url":"https://api.github.com/repos/HeartSaVioR/jedis/releases{/id}","deployments_url":"https://api.github.com/repos/HeartSaVioR/jedis/deployments","created_at":"2013-09-24T09:00:45Z","updated_at":"2015-02-01T00:02:24Z","pushed_at":"2016-04-19T16:00:23Z","git_url":"git://github.com/HeartSaVioR/jedis.git","ssh_url":"git@github.com:HeartSaVioR/jedis.git","clone_url":"https://github.com/HeartSaVioR/jedis.git","svn_url":"https://github.com/HeartSaVioR/jedis","homepage":"","size":6095,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"xetorthio:master","ref":"master","sha":"8969566d0926bdd2ef438e8c9ba6e8e196f7ba7d","user":{"login":"xetorthio","id":139687,"avatar_url":"https://avatars.githubusercontent.com/u/139687?v=3","gravatar_id":"","url":"https://api.github.com/users/xetorthio","html_url":"https://github.com/xetorthio","followers_url":"https://api.github.com/users/xetorthio/followers","following_url":"https://api.github.com/users/xetorthio/following{/other_user}","gists_url":"https://api.github.com/users/xetorthio/gists{/gist_id}","starred_url":"https://api.github.com/users/xetorthio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xetorthio/subscriptions","organizations_url":"https://api.github.com/users/xetorthio/orgs","repos_url":"https://api.github.com/users/xetorthio/repos","events_url":"https://api.github.com/users/xetorthio/events{/privacy}","received_events_url":"https://api.github.com/users/xetorthio/received_events","type":"User","site_admin":false},"repo":{"id":715605,"name":"jedis","full_name":"xetorthio/jedis","owner":{"login":"xetorthio","id":139687,"avatar_url":"https://avatars.githubusercontent.com/u/139687?v=3","gravatar_id":"","url":"https://api.github.com/users/xetorthio","html_url":"https://github.com/xetorthio","followers_url":"https://api.github.com/users/xetorthio/followers","following_url":"https://api.github.com/users/xetorthio/following{/other_user}","gists_url":"https://api.github.com/users/xetorthio/gists{/gist_id}","starred_url":"https://api.github.com/users/xetorthio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xetorthio/subscriptions","organizations_url":"https://api.github.com/users/xetorthio/orgs","repos_url":"https://api.github.com/users/xetorthio/repos","events_url":"https://api.github.com/users/xetorthio/events{/privacy}","received_events_url":"https://api.github.com/users/xetorthio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xetorthio/jedis","description":"A blazingly small and sane redis java client","fork":false,"url":"https://api.github.com/repos/xetorthio/jedis","forks_url":"https://api.github.com/repos/xetorthio/jedis/forks","keys_url":"https://api.github.com/repos/xetorthio/jedis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xetorthio/jedis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xetorthio/jedis/teams","hooks_url":"https://api.github.com/repos/xetorthio/jedis/hooks","issue_events_url":"https://api.github.com/repos/xetorthio/jedis/issues/events{/number}","events_url":"https://api.github.com/repos/xetorthio/jedis/events","assignees_url":"https://api.github.com/repos/xetorthio/jedis/assignees{/user}","branches_url":"https://api.github.com/repos/xetorthio/jedis/branches{/branch}","tags_url":"https://api.github.com/repos/xetorthio/jedis/tags","blobs_url":"https://api.github.com/repos/xetorthio/jedis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xetorthio/jedis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xetorthio/jedis/git/refs{/sha}","trees_url":"https://api.github.com/repos/xetorthio/jedis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xetorthio/jedis/statuses/{sha}","languages_url":"https://api.github.com/repos/xetorthio/jedis/languages","stargazers_url":"https://api.github.com/repos/xetorthio/jedis/stargazers","contributors_url":"https://api.github.com/repos/xetorthio/jedis/contributors","subscribers_url":"https://api.github.com/repos/xetorthio/jedis/subscribers","subscription_url":"https://api.github.com/repos/xetorthio/jedis/subscription","commits_url":"https://api.github.com/repos/xetorthio/jedis/commits{/sha}","git_commits_url":"https://api.github.com/repos/xetorthio/jedis/git/commits{/sha}","comments_url":"https://api.github.com/repos/xetorthio/jedis/comments{/number}","issue_comment_url":"https://api.github.com/repos/xetorthio/jedis/issues/comments{/number}","contents_url":"https://api.github.com/repos/xetorthio/jedis/contents/{+path}","compare_url":"https://api.github.com/repos/xetorthio/jedis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xetorthio/jedis/merges","archive_url":"https://api.github.com/repos/xetorthio/jedis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xetorthio/jedis/downloads","issues_url":"https://api.github.com/repos/xetorthio/jedis/issues{/number}","pulls_url":"https://api.github.com/repos/xetorthio/jedis/pulls{/number}","milestones_url":"https://api.github.com/repos/xetorthio/jedis/milestones{/number}","notifications_url":"https://api.github.com/repos/xetorthio/jedis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xetorthio/jedis/labels{/name}","releases_url":"https://api.github.com/repos/xetorthio/jedis/releases{/id}","deployments_url":"https://api.github.com/repos/xetorthio/jedis/deployments","created_at":"2010-06-11T13:04:43Z","updated_at":"2016-04-20T10:35:54Z","pushed_at":"2016-04-19T16:12:02Z","git_url":"git://github.com/xetorthio/jedis.git","ssh_url":"git@github.com:xetorthio/jedis.git","clone_url":"https://github.com/xetorthio/jedis.git","svn_url":"https://github.com/xetorthio/jedis","homepage":"","size":91704,"stargazers_count":3513,"watchers_count":3513,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1650,"mirror_url":null,"open_issues_count":111,"forks":1650,"open_issues":111,"watchers":3513,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xetorthio/jedis/pulls/1261"},"html":{"href":"https://github.com/xetorthio/jedis/pull/1261"},"issue":{"href":"https://api.github.com/repos/xetorthio/jedis/issues/1261"},"comments":{"href":"https://api.github.com/repos/xetorthio/jedis/issues/1261/comments"},"review_comments":{"href":"https://api.github.com/repos/xetorthio/jedis/pulls/1261/comments"},"review_comment":{"href":"https://api.github.com/repos/xetorthio/jedis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xetorthio/jedis/pulls/1261/commits"},"statuses":{"href":"https://api.github.com/repos/xetorthio/jedis/statuses/498544a7341e72fcd099b04ed988e8b99ad500e6"}}}}