{"action":"created","comment":{"url":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/comments/88412296","pull_request_review_id":8984915,"id":88412296,"diff_hunk":"@@ -0,0 +1,151 @@\n+package pl.allegro.tech.embeddedelasticsearch\n+\n+import org.elasticsearch.action.get.GetResponse\n+import org.elasticsearch.client.Client\n+import org.elasticsearch.client.transport.TransportClient\n+import org.elasticsearch.common.settings.ImmutableSettings\n+import org.elasticsearch.common.settings.Settings\n+import org.elasticsearch.common.transport.InetSocketTransportAddress\n+import org.elasticsearch.index.query.QueryBuilders\n+import org.skyscreamer.jsonassert.JSONAssert\n+import spock.lang.Specification\n+\n+import static SampleIndices.AudioBook\n+import static SampleIndices.Car\n+import static SampleIndices.PaperBook\n+import static java.util.concurrent.TimeUnit.MINUTES\n+\n+class EmbeddedElasticSpec extends Specification {\n+\n+    static final ELASTIC_VERSION = \"1.7.5\"\n+    static final TRANSPORT_TCP_PORT_VALUE = 9930\n+    static final CLUSTER_NAME_VALUE = \"myTestCluster\"\n+\n+    static EmbeddedElastic embeddedElastic = EmbeddedElastic.builder()\n+            .withElasticVersion(ELASTIC_VERSION)\n+            .withEsJavaOpts(\"-Xms128m -Xmx512m\")\n+            .withSetting(PopularProperties.TRANSPORT_TCP_PORT, TRANSPORT_TCP_PORT_VALUE)\n+            .withSetting(PopularProperties.CLUSTER_NAME, CLUSTER_NAME_VALUE)\n+            .withIndex(SampleIndices.CARS_INDEX_NAME, SampleIndices.CARS_INDEX)\n+            .withIndex(SampleIndices.BOOKS_INDEX_NAME, SampleIndices.BOOKS_INDEX)\n+            .withStartTimeout(1, MINUTES)\n+            .build()\n+            .start()\n+\n+    static Client client = createClient()\n+\n+    def setup() {\n+        embeddedElastic.recreateIndices()\n+    }\n+\n+    def cleanupSpec() {\n+        client.close()\n+        embeddedElastic.stop()\n+    }\n+\n+    def \"should index document\"() {\n+        when:\n+        index(SampleIndices.FIAT_126p)\n+\n+        then:\n+        final result = client\n+                .prepareSearch(SampleIndices.CARS_INDEX_NAME)\n+                .setTypes(SampleIndices.CAR_INDEX_TYPE)\n+                .setQuery(QueryBuilders.termQuery(\"model\", SampleIndices.FIAT_126p.model))\n+                .execute().actionGet()\n+        result.hits.totalHits() == 1\n+        assertJsonsEquals(SampleIndices.toJson(SampleIndices.FIAT_126p), result.hits.hits[0].sourceAsString)\n+    }\n+\n+    def \"should index document with id\"() {\n+        given:\n+        final id = \"some-id\"\n+        final document = SampleIndices.toJson(SampleIndices.FIAT_126p)\n+\n+        when:\n+        embeddedElastic.index(SampleIndices.CARS_INDEX_NAME, SampleIndices.CAR_INDEX_TYPE, [\"$id\": document])","path":"es1x-test/src/test/groovy/pl/allegro/tech/embeddedelasticsearch/EmbeddedElasticSpec.groovy","position":66,"original_position":66,"commit_id":"1d9305b781e368c591109126b52865f1814713b4","original_commit_id":"1d9305b781e368c591109126b52865f1814713b4","user":{"login":"gaczm","id":9557351,"avatar_url":"https://avatars.githubusercontent.com/u/9557351?v=3","gravatar_id":"","url":"https://api.github.com/users/gaczm","html_url":"https://github.com/gaczm","followers_url":"https://api.github.com/users/gaczm/followers","following_url":"https://api.github.com/users/gaczm/following{/other_user}","gists_url":"https://api.github.com/users/gaczm/gists{/gist_id}","starred_url":"https://api.github.com/users/gaczm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaczm/subscriptions","organizations_url":"https://api.github.com/users/gaczm/orgs","repos_url":"https://api.github.com/users/gaczm/repos","events_url":"https://api.github.com/users/gaczm/events{/privacy}","received_events_url":"https://api.github.com/users/gaczm/received_events","type":"User","site_admin":false},"body":"static import on whole SampleIndicies","created_at":"2016-11-17T09:16:47Z","updated_at":"2016-11-17T09:16:47Z","html_url":"https://github.com/allegro/embedded-elasticsearch/pull/12#discussion_r88412296","pull_request_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/comments/88412296"},"html":{"href":"https://github.com/allegro/embedded-elasticsearch/pull/12#discussion_r88412296"},"pull_request":{"href":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/12","id":94053726,"html_url":"https://github.com/allegro/embedded-elasticsearch/pull/12","diff_url":"https://github.com/allegro/embedded-elasticsearch/pull/12.diff","patch_url":"https://github.com/allegro/embedded-elasticsearch/pull/12.patch","issue_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues/12","number":12,"state":"open","locked":false,"title":"Add support for old elasticsearch version 1.x","user":{"login":"pbobruk","id":5273082,"avatar_url":"https://avatars.githubusercontent.com/u/5273082?v=3","gravatar_id":"","url":"https://api.github.com/users/pbobruk","html_url":"https://github.com/pbobruk","followers_url":"https://api.github.com/users/pbobruk/followers","following_url":"https://api.github.com/users/pbobruk/following{/other_user}","gists_url":"https://api.github.com/users/pbobruk/gists{/gist_id}","starred_url":"https://api.github.com/users/pbobruk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pbobruk/subscriptions","organizations_url":"https://api.github.com/users/pbobruk/orgs","repos_url":"https://api.github.com/users/pbobruk/repos","events_url":"https://api.github.com/users/pbobruk/events{/privacy}","received_events_url":"https://api.github.com/users/pbobruk/received_events","type":"User","site_admin":false},"body":"- support for elasticsearch 1.x (tests for 1.7.5)\r\n- upgrade gradle to version 3.2\r\n- fix: close connection before elasticsearch stop in tests","created_at":"2016-11-16T21:28:31Z","updated_at":"2016-11-17T09:21:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ea169ab11730bb569b399b27d503c545ef3bf14","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/12/commits","review_comments_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/12/comments","review_comment_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues/12/comments","statuses_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/statuses/1d9305b781e368c591109126b52865f1814713b4","head":{"label":"allegro:1.x","ref":"1.x","sha":"1d9305b781e368c591109126b52865f1814713b4","user":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"repo":{"id":66922401,"name":"embedded-elasticsearch","full_name":"allegro/embedded-elasticsearch","owner":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allegro/embedded-elasticsearch","description":"Tool that ease up creation of integration tests with Elasticsearch","fork":false,"url":"https://api.github.com/repos/allegro/embedded-elasticsearch","forks_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/forks","keys_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/teams","hooks_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/events","assignees_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/tags","blobs_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/languages","stargazers_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/subscription","commits_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/merges","archive_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/downloads","issues_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/deployments","created_at":"2016-08-30T08:37:10Z","updated_at":"2016-11-15T19:51:26Z","pushed_at":"2016-11-17T08:16:23Z","git_url":"git://github.com/allegro/embedded-elasticsearch.git","ssh_url":"git@github.com:allegro/embedded-elasticsearch.git","clone_url":"https://github.com/allegro/embedded-elasticsearch.git","svn_url":"https://github.com/allegro/embedded-elasticsearch","homepage":"","size":157,"stargazers_count":13,"watchers_count":13,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":13,"default_branch":"master"}},"base":{"label":"allegro:master","ref":"master","sha":"8e80c3f804bafde5bb6ce6b80be357b9a84337fa","user":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"repo":{"id":66922401,"name":"embedded-elasticsearch","full_name":"allegro/embedded-elasticsearch","owner":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allegro/embedded-elasticsearch","description":"Tool that ease up creation of integration tests with Elasticsearch","fork":false,"url":"https://api.github.com/repos/allegro/embedded-elasticsearch","forks_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/forks","keys_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/teams","hooks_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/events","assignees_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/tags","blobs_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/languages","stargazers_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/subscription","commits_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/merges","archive_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/downloads","issues_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/allegro/embedded-elasticsearch/deployments","created_at":"2016-08-30T08:37:10Z","updated_at":"2016-11-15T19:51:26Z","pushed_at":"2016-11-17T08:16:23Z","git_url":"git://github.com/allegro/embedded-elasticsearch.git","ssh_url":"git@github.com:allegro/embedded-elasticsearch.git","clone_url":"https://github.com/allegro/embedded-elasticsearch.git","svn_url":"https://github.com/allegro/embedded-elasticsearch","homepage":"","size":157,"stargazers_count":13,"watchers_count":13,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/12"},"html":{"href":"https://github.com/allegro/embedded-elasticsearch/pull/12"},"issue":{"href":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues/12"},"comments":{"href":"https://api.github.com/repos/allegro/embedded-elasticsearch/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/allegro/embedded-elasticsearch/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/allegro/embedded-elasticsearch/statuses/1d9305b781e368c591109126b52865f1814713b4"}}}}
{"actor":{"display_login":"gaczm"}}