{"action":"created","comment":{"url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/comments/23370832","id":23370832,"diff_hunk":"@@ -25,33 +25,63 @@\n import java.util.ArrayList;\n import java.util.List;\n \n-@SuppressWarnings(\"rawtypes\")\n+@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n public class TestOperationExecutor implements AsyncOperationExecutor {\n \n     private final List<Object> responses;\n+    private final boolean queueExecution;\n     private final List<ReadPreference> readPreferences = new ArrayList<ReadPreference>();\n+    private final List<AsyncReadOperation> queuedReadOperations = new ArrayList<AsyncReadOperation>();\n+    private final List<AsyncWriteOperation> queuedWriteOperations = new ArrayList<AsyncWriteOperation>();\n+    private final List<SingleResultCallback> queuedReadCallbacks = new ArrayList<SingleResultCallback>();\n+    private final List<SingleResultCallback> queuedWriteCallbacks = new ArrayList<SingleResultCallback>();\n     private final List<AsyncReadOperation> readOperations = new ArrayList<AsyncReadOperation>();\n     private final List<AsyncWriteOperation> writeOperations = new ArrayList<AsyncWriteOperation>();\n \n     TestOperationExecutor(final List<Object> responses) {\n+        this(responses, false);\n+    }\n+\n+    TestOperationExecutor(final List<Object> responses, final boolean queueExecution) {\n         this.responses = responses;\n+        this.queueExecution = queueExecution;\n     }\n \n     @Override\n     public <T> void execute(final AsyncReadOperation<T> operation, final ReadPreference readPreference,\n                             final SingleResultCallback<T> callback) {\n-        readOperations.add(operation);\n         readPreferences.add(readPreference);\n-        callResult(callback);\n+        if (queueExecution) {\n+            queuedReadOperations.add(operation);\n+            queuedReadCallbacks.add(callback);\n+        } else {\n+            readOperations.add(operation);\n+            callResult(callback);\n+        }\n     }\n \n+\n     @Override\n     public <T> void execute(final AsyncWriteOperation<T> operation, final SingleResultCallback<T> callback) {\n-        writeOperations.add(operation);\n-        callResult(callback);\n+        if (queueExecution) {\n+            queuedWriteOperations.add(operation);\n+            queuedWriteCallbacks.add(callback);\n+        } else {\n+            writeOperations.add(operation);\n+            callResult(callback);\n+        }\n+    }\n+\n+    public void proceedWithRead() {","path":"driver/src/test/unit/com/mongodb/reactivestreams/client/TestOperationExecutor.java","position":63,"original_position":63,"commit_id":"6929ab1171f185a0fc16d1c60722c9191a2560e8","original_commit_id":"6929ab1171f185a0fc16d1c60722c9191a2560e8","user":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2015-01-22T12:02:01Z","updated_at":"2015-01-22T12:02:01Z","html_url":"https://github.com/rozza/mongo-java-driver-reactivestreams/pull/4#discussion_r23370832","pull_request_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/comments/23370832"},"html":{"href":"https://github.com/rozza/mongo-java-driver-reactivestreams/pull/4#discussion_r23370832"},"pull_request":{"href":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/4","id":27622447,"html_url":"https://github.com/rozza/mongo-java-driver-reactivestreams/pull/4","diff_url":"https://github.com/rozza/mongo-java-driver-reactivestreams/pull/4.diff","patch_url":"https://github.com/rozza/mongo-java-driver-reactivestreams/pull/4.patch","issue_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues/4","number":4,"state":"open","locked":false,"title":"Now relies on the mongodb-driver-async driver","user":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"body":"Stops the duplication of logic handling operations\r\nAll publishers are now \"cold\" and only will action if a result is requested","created_at":"2015-01-19T17:21:53Z","updated_at":"2015-01-22T12:02:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2f6bbdcc066c4c944e93cf75f36251e9b743cae","assignee":{"login":"jyemin","id":1111546,"avatar_url":"https://avatars.githubusercontent.com/u/1111546?v=3","gravatar_id":"","url":"https://api.github.com/users/jyemin","html_url":"https://github.com/jyemin","followers_url":"https://api.github.com/users/jyemin/followers","following_url":"https://api.github.com/users/jyemin/following{/other_user}","gists_url":"https://api.github.com/users/jyemin/gists{/gist_id}","starred_url":"https://api.github.com/users/jyemin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyemin/subscriptions","organizations_url":"https://api.github.com/users/jyemin/orgs","repos_url":"https://api.github.com/users/jyemin/repos","events_url":"https://api.github.com/users/jyemin/events{/privacy}","received_events_url":"https://api.github.com/users/jyemin/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/4/commits","review_comments_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/4/comments","review_comment_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues/4/comments","statuses_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/statuses/6929ab1171f185a0fc16d1c60722c9191a2560e8","head":{"label":"rozza:async","ref":"async","sha":"6929ab1171f185a0fc16d1c60722c9191a2560e8","user":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"repo":{"id":28095123,"name":"mongo-java-driver-reactivestreams","full_name":"rozza/mongo-java-driver-reactivestreams","owner":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rozza/mongo-java-driver-reactivestreams","description":"Reactive streams implementation of the Mongo Java Driver","fork":false,"url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams","forks_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/forks","keys_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/teams","hooks_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/hooks","issue_events_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues/events{/number}","events_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/events","assignees_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/assignees{/user}","branches_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/branches{/branch}","tags_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/tags","blobs_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/refs{/sha}","trees_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/statuses/{sha}","languages_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/languages","stargazers_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/stargazers","contributors_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/contributors","subscribers_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/subscribers","subscription_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/subscription","commits_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/commits{/sha}","git_commits_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/commits{/sha}","comments_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/comments{/number}","issue_comment_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues/comments/{number}","contents_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/contents/{+path}","compare_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/merges","archive_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/downloads","issues_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues{/number}","pulls_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls{/number}","milestones_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/milestones{/number}","notifications_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/labels{/name}","releases_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/releases{/id}","created_at":"2014-12-16T16:16:46Z","updated_at":"2015-01-15T13:50:01Z","pushed_at":"2015-01-20T10:38:13Z","git_url":"git://github.com/rozza/mongo-java-driver-reactivestreams.git","ssh_url":"git@github.com:rozza/mongo-java-driver-reactivestreams.git","clone_url":"https://github.com/rozza/mongo-java-driver-reactivestreams.git","svn_url":"https://github.com/rozza/mongo-java-driver-reactivestreams","homepage":null,"size":502,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"rozza:master","ref":"master","sha":"bfadfb6230872949dca99706c8f84d320f5f7c57","user":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"repo":{"id":28095123,"name":"mongo-java-driver-reactivestreams","full_name":"rozza/mongo-java-driver-reactivestreams","owner":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rozza/mongo-java-driver-reactivestreams","description":"Reactive streams implementation of the Mongo Java Driver","fork":false,"url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams","forks_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/forks","keys_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/teams","hooks_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/hooks","issue_events_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues/events{/number}","events_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/events","assignees_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/assignees{/user}","branches_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/branches{/branch}","tags_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/tags","blobs_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/refs{/sha}","trees_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/statuses/{sha}","languages_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/languages","stargazers_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/stargazers","contributors_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/contributors","subscribers_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/subscribers","subscription_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/subscription","commits_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/commits{/sha}","git_commits_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/git/commits{/sha}","comments_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/comments{/number}","issue_comment_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues/comments/{number}","contents_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/contents/{+path}","compare_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/merges","archive_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/downloads","issues_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues{/number}","pulls_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls{/number}","milestones_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/milestones{/number}","notifications_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/labels{/name}","releases_url":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/releases{/id}","created_at":"2014-12-16T16:16:46Z","updated_at":"2015-01-15T13:50:01Z","pushed_at":"2015-01-20T10:38:13Z","git_url":"git://github.com/rozza/mongo-java-driver-reactivestreams.git","ssh_url":"git@github.com:rozza/mongo-java-driver-reactivestreams.git","clone_url":"https://github.com/rozza/mongo-java-driver-reactivestreams.git","svn_url":"https://github.com/rozza/mongo-java-driver-reactivestreams","homepage":null,"size":502,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/4"},"html":{"href":"https://github.com/rozza/mongo-java-driver-reactivestreams/pull/4"},"issue":{"href":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues/4"},"comments":{"href":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/rozza/mongo-java-driver-reactivestreams/statuses/6929ab1171f185a0fc16d1c60722c9191a2560e8"}}}}