{"action":"created","comment":{"url":"https://api.github.com/repos/cloudant/sync-android/pulls/comments/72630357","id":72630357,"diff_hunk":"@@ -563,36 +633,42 @@ public void indexSingleArrayFieldWhenIndexingArraysInSubDoc() throws Exception {\n         pets.put(\"species\", species);\n         bodyMap.put(\"pet\", pets);\n         rev.setBody(DocumentBodyFactory.create(bodyMap));\n-        DocumentRevision saved;\n+        final DocumentRevision saved;\n         saved = ds.createDocumentFromRevision(rev);\n \n-        assertThat(IndexUpdater.updateIndex(\"basic\", fields, db, ds, im.getQueue()), is(true));\n+        assertThat(IndexUpdater.updateIndex(\"basic\", fields, ds, im.getDatabaseQueue()), is(true));\n         assertThat(getIndexSequenceNumber(\"basic\"), is(1l));\n \n-        cursor = null;\n-        try {\n-            SQLDatabase db = TestUtils.getDatabaseConnectionToExistingDb(this.db);\n-            cursor = db.rawQuery(sql, new String[]{});\n-            assertThat(cursor.getCount(), is(2));\n-            assertThat(cursor.getColumnCount(), is(4));\n-            List<String> petList = new ArrayList<String>();\n-            while (cursor.moveToNext()) {\n-                assertThat(cursor.columnName(0), is(\"_id\"));\n-                assertThat(cursor.getString(0), is(\"id123\"));\n-                assertThat(cursor.columnName(1), is(\"_rev\"));\n-                assertThat(cursor.getString(1), is(saved.getRevision()));\n-                assertThat(cursor.columnName(2), is(\"name\"));\n-                assertThat(cursor.getString(2), is(\"mike\"));\n-                assertThat(cursor.columnName(3), is(\"pet.species\"));\n-                assertThat(cursor.getString(3), is(notNullValue()));\n-                petList.add(cursor.getString(3));\n+        im.getDatabaseQueue().submit(new SQLQueueCallable<Void>() {\n+            @Override\n+            public Void call(SQLDatabase db) throws Exception {\n+                Cursor cursor = null;\n+                try {\n+                    cursor = db.rawQuery(sql, new String[]{});\n+                    assertThat(cursor.getCount(), is(2));\n+                    assertThat(cursor.getColumnCount(), is(4));\n+                    List<String> petList = new ArrayList<String>();\n+                    while (cursor.moveToNext()) {\n+                        assertThat(cursor.columnName(0), is(\"_id\"));\n+                        assertThat(cursor.getString(0), is(\"id123\"));\n+                        assertThat(cursor.columnName(1), is(\"_rev\"));\n+                        assertThat(cursor.getString(1), is(saved.getRevision()));\n+                        assertThat(cursor.columnName(2), is(\"name\"));\n+                        assertThat(cursor.getString(2), is(\"mike\"));\n+                        assertThat(cursor.columnName(3), is(\"pet.species\"));\n+                        assertThat(cursor.getString(3), is(notNullValue()));\n+                        petList.add(cursor.getString(3));\n+                    }\n+                    assertThat(petList, containsInAnyOrder(\"cat\", \"dog\"));\n+                }catch (SQLException e) {\n+                    Assert.fail(String.format(\"SQLException occurred executing %s: %s\", sql, e));","path":"cloudant-sync-datastore-core/src/test/java/com/cloudant/sync/query/IndexUpdaterTest.java","position":814,"original_position":814,"commit_id":"b72880178b9cc12bcc10b2aa156b1d2fc84aeea4","original_commit_id":"b72880178b9cc12bcc10b2aa156b1d2fc84aeea4","user":{"login":"rhyshort","id":1616727,"avatar_url":"https://avatars.githubusercontent.com/u/1616727?v=3","gravatar_id":"","url":"https://api.github.com/users/rhyshort","html_url":"https://github.com/rhyshort","followers_url":"https://api.github.com/users/rhyshort/followers","following_url":"https://api.github.com/users/rhyshort/following{/other_user}","gists_url":"https://api.github.com/users/rhyshort/gists{/gist_id}","starred_url":"https://api.github.com/users/rhyshort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhyshort/subscriptions","organizations_url":"https://api.github.com/users/rhyshort/orgs","repos_url":"https://api.github.com/users/rhyshort/repos","events_url":"https://api.github.com/users/rhyshort/events{/privacy}","received_events_url":"https://api.github.com/users/rhyshort/received_events","type":"User","site_admin":false},"body":"Ah no, it should have been removed, blinded by  the amount of code i needed to change\r\n","created_at":"2016-07-28T14:18:04Z","updated_at":"2016-07-28T14:18:04Z","html_url":"https://github.com/cloudant/sync-android/pull/322#discussion_r72630357","pull_request_url":"https://api.github.com/repos/cloudant/sync-android/pulls/322","_links":{"self":{"href":"https://api.github.com/repos/cloudant/sync-android/pulls/comments/72630357"},"html":{"href":"https://github.com/cloudant/sync-android/pull/322#discussion_r72630357"},"pull_request":{"href":"https://api.github.com/repos/cloudant/sync-android/pulls/322"}}},"pull_request":{"url":"https://api.github.com/repos/cloudant/sync-android/pulls/322","id":79025225,"html_url":"https://github.com/cloudant/sync-android/pull/322","diff_url":"https://github.com/cloudant/sync-android/pull/322.diff","patch_url":"https://github.com/cloudant/sync-android/pull/322.patch","issue_url":"https://api.github.com/repos/cloudant/sync-android/issues/322","number":322,"state":"open","locked":false,"title":"Use SQLDatabaseQueue instead of an executor service directly","user":{"login":"rhyshort","id":1616727,"avatar_url":"https://avatars.githubusercontent.com/u/1616727?v=3","gravatar_id":"","url":"https://api.github.com/users/rhyshort","html_url":"https://github.com/rhyshort","followers_url":"https://api.github.com/users/rhyshort/followers","following_url":"https://api.github.com/users/rhyshort/following{/other_user}","gists_url":"https://api.github.com/users/rhyshort/gists{/gist_id}","starred_url":"https://api.github.com/users/rhyshort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhyshort/subscriptions","organizations_url":"https://api.github.com/users/rhyshort/orgs","repos_url":"https://api.github.com/users/rhyshort/repos","events_url":"https://api.github.com/users/rhyshort/events{/privacy}","received_events_url":"https://api.github.com/users/rhyshort/received_events","type":"User","site_admin":false},"body":"## What\r\n\r\nUse `SQLDatabaseQueue` instead of an `ExecutorService` and `SQLDatabse` directly.\r\n\r\n## How\r\n\r\nSwap out the `SQLDatabase` and `ExecutorService` with `SQLDatabaseQueue`\r\n\r\n## Testing\r\n\r\nAll tests pass, however some have been reworked slightly so they run on the queue rather than on the main test thread.\r\n\r\n## Issues\r\n\r\nResolves #286","created_at":"2016-07-27T13:37:37Z","updated_at":"2016-07-28T14:18:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"50f41032bbd167668355b318f139f4fb39d1c094","assignee":{"login":"emlaver","id":10552966,"avatar_url":"https://avatars.githubusercontent.com/u/10552966?v=3","gravatar_id":"","url":"https://api.github.com/users/emlaver","html_url":"https://github.com/emlaver","followers_url":"https://api.github.com/users/emlaver/followers","following_url":"https://api.github.com/users/emlaver/following{/other_user}","gists_url":"https://api.github.com/users/emlaver/gists{/gist_id}","starred_url":"https://api.github.com/users/emlaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emlaver/subscriptions","organizations_url":"https://api.github.com/users/emlaver/orgs","repos_url":"https://api.github.com/users/emlaver/repos","events_url":"https://api.github.com/users/emlaver/events{/privacy}","received_events_url":"https://api.github.com/users/emlaver/received_events","type":"User","site_admin":false},"assignees":[{"login":"emlaver","id":10552966,"avatar_url":"https://avatars.githubusercontent.com/u/10552966?v=3","gravatar_id":"","url":"https://api.github.com/users/emlaver","html_url":"https://github.com/emlaver","followers_url":"https://api.github.com/users/emlaver/followers","following_url":"https://api.github.com/users/emlaver/following{/other_user}","gists_url":"https://api.github.com/users/emlaver/gists{/gist_id}","starred_url":"https://api.github.com/users/emlaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emlaver/subscriptions","organizations_url":"https://api.github.com/users/emlaver/orgs","repos_url":"https://api.github.com/users/emlaver/repos","events_url":"https://api.github.com/users/emlaver/events{/privacy}","received_events_url":"https://api.github.com/users/emlaver/received_events","type":"User","site_admin":false},{"login":"ricellis","id":10698320,"avatar_url":"https://avatars.githubusercontent.com/u/10698320?v=3","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/cloudant/sync-android/pulls/322/commits","review_comments_url":"https://api.github.com/repos/cloudant/sync-android/pulls/322/comments","review_comment_url":"https://api.github.com/repos/cloudant/sync-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudant/sync-android/issues/322/comments","statuses_url":"https://api.github.com/repos/cloudant/sync-android/statuses/b72880178b9cc12bcc10b2aa156b1d2fc84aeea4","head":{"label":"cloudant:286-indexmanager-sqldb-queue","ref":"286-indexmanager-sqldb-queue","sha":"b72880178b9cc12bcc10b2aa156b1d2fc84aeea4","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":16811502,"name":"sync-android","full_name":"cloudant/sync-android","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/sync-android","description":"A JSON-based document datastore for Android applications","fork":false,"url":"https://api.github.com/repos/cloudant/sync-android","forks_url":"https://api.github.com/repos/cloudant/sync-android/forks","keys_url":"https://api.github.com/repos/cloudant/sync-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/sync-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/sync-android/teams","hooks_url":"https://api.github.com/repos/cloudant/sync-android/hooks","issue_events_url":"https://api.github.com/repos/cloudant/sync-android/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/sync-android/events","assignees_url":"https://api.github.com/repos/cloudant/sync-android/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/sync-android/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/sync-android/tags","blobs_url":"https://api.github.com/repos/cloudant/sync-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/sync-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/sync-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/sync-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/sync-android/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/sync-android/languages","stargazers_url":"https://api.github.com/repos/cloudant/sync-android/stargazers","contributors_url":"https://api.github.com/repos/cloudant/sync-android/contributors","subscribers_url":"https://api.github.com/repos/cloudant/sync-android/subscribers","subscription_url":"https://api.github.com/repos/cloudant/sync-android/subscription","commits_url":"https://api.github.com/repos/cloudant/sync-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/sync-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/sync-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/sync-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/sync-android/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/sync-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/sync-android/merges","archive_url":"https://api.github.com/repos/cloudant/sync-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/sync-android/downloads","issues_url":"https://api.github.com/repos/cloudant/sync-android/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/sync-android/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/sync-android/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/sync-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/sync-android/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/sync-android/releases{/id}","deployments_url":"https://api.github.com/repos/cloudant/sync-android/deployments","created_at":"2014-02-13T17:52:09Z","updated_at":"2016-07-24T18:37:35Z","pushed_at":"2016-07-27T13:37:37Z","git_url":"git://github.com/cloudant/sync-android.git","ssh_url":"git@github.com:cloudant/sync-android.git","clone_url":"https://github.com/cloudant/sync-android.git","svn_url":"https://github.com/cloudant/sync-android","homepage":"","size":22458,"stargazers_count":166,"watchers_count":166,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":50,"mirror_url":null,"open_issues_count":35,"forks":50,"open_issues":35,"watchers":166,"default_branch":"master"}},"base":{"label":"cloudant:master","ref":"master","sha":"17b98fccb7e6f2ceb186f414e8981b9f43ca0d7b","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":16811502,"name":"sync-android","full_name":"cloudant/sync-android","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/sync-android","description":"A JSON-based document datastore for Android applications","fork":false,"url":"https://api.github.com/repos/cloudant/sync-android","forks_url":"https://api.github.com/repos/cloudant/sync-android/forks","keys_url":"https://api.github.com/repos/cloudant/sync-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/sync-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/sync-android/teams","hooks_url":"https://api.github.com/repos/cloudant/sync-android/hooks","issue_events_url":"https://api.github.com/repos/cloudant/sync-android/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/sync-android/events","assignees_url":"https://api.github.com/repos/cloudant/sync-android/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/sync-android/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/sync-android/tags","blobs_url":"https://api.github.com/repos/cloudant/sync-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/sync-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/sync-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/sync-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/sync-android/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/sync-android/languages","stargazers_url":"https://api.github.com/repos/cloudant/sync-android/stargazers","contributors_url":"https://api.github.com/repos/cloudant/sync-android/contributors","subscribers_url":"https://api.github.com/repos/cloudant/sync-android/subscribers","subscription_url":"https://api.github.com/repos/cloudant/sync-android/subscription","commits_url":"https://api.github.com/repos/cloudant/sync-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/sync-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/sync-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/sync-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/sync-android/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/sync-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/sync-android/merges","archive_url":"https://api.github.com/repos/cloudant/sync-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/sync-android/downloads","issues_url":"https://api.github.com/repos/cloudant/sync-android/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/sync-android/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/sync-android/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/sync-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/sync-android/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/sync-android/releases{/id}","deployments_url":"https://api.github.com/repos/cloudant/sync-android/deployments","created_at":"2014-02-13T17:52:09Z","updated_at":"2016-07-24T18:37:35Z","pushed_at":"2016-07-27T13:37:37Z","git_url":"git://github.com/cloudant/sync-android.git","ssh_url":"git@github.com:cloudant/sync-android.git","clone_url":"https://github.com/cloudant/sync-android.git","svn_url":"https://github.com/cloudant/sync-android","homepage":"","size":22458,"stargazers_count":166,"watchers_count":166,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":50,"mirror_url":null,"open_issues_count":35,"forks":50,"open_issues":35,"watchers":166,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudant/sync-android/pulls/322"},"html":{"href":"https://github.com/cloudant/sync-android/pull/322"},"issue":{"href":"https://api.github.com/repos/cloudant/sync-android/issues/322"},"comments":{"href":"https://api.github.com/repos/cloudant/sync-android/issues/322/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudant/sync-android/pulls/322/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudant/sync-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudant/sync-android/pulls/322/commits"},"statuses":{"href":"https://api.github.com/repos/cloudant/sync-android/statuses/b72880178b9cc12bcc10b2aa156b1d2fc84aeea4"}}}}
{"actor":{"display_login":"rhyshort"}}