{"action":"created","comment":{"url":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/comments/65328868","id":65328868,"diff_hunk":"@@ -0,0 +1,139 @@\n+package com.sensorberg.sdk.internal.http;\n+\n+import com.google.gson.Gson;\n+\n+import com.sensorberg.sdk.SensorbergTestApplication;\n+import com.sensorberg.sdk.di.TestComponent;\n+import com.sensorberg.sdk.internal.interfaces.PlatformIdentifier;\n+import com.sensorberg.sdk.internal.transport.RetrofitApiServiceImpl;\n+import com.sensorberg.sdk.internal.transport.interfaces.Transport;\n+import com.sensorberg.sdk.model.server.BaseResolveResponse;\n+import com.sensorberg.sdk.test.RepeatFlaky;\n+import com.sensorberg.sdk.test.RepeatFlakyRule;\n+import com.sensorberg.sdk.testUtils.SuccessfulRetrofitApiService;\n+\n+import org.fest.assertions.api.Assertions;\n+import org.junit.Before;\n+import org.junit.Rule;\n+import org.junit.Test;\n+import org.junit.rules.ExpectedException;\n+import org.junit.runner.RunWith;\n+\n+import android.content.Context;\n+import android.support.test.runner.AndroidJUnit4;\n+\n+import java.net.UnknownHostException;\n+\n+import javax.inject.Inject;\n+import javax.inject.Named;\n+\n+import okhttp3.OkHttpClient;\n+import okhttp3.Request;\n+import retrofit2.Call;\n+import retrofit2.Response;\n+\n+@RunWith(AndroidJUnit4.class)\n+public class ApiServiceShould {\n+\n+    @Rule\n+    public RepeatFlakyRule mRepeatFlakyRule = new RepeatFlakyRule();\n+\n+    private static final String TEST_API_KEY = \"0000000000000000000000000000000000000000000000000000000000000000\";\n+\n+    @Inject\n+    Gson gson;\n+\n+    @Inject\n+    Context mContext;\n+\n+    @Inject\n+    @Named(\"androidPlatformIdentifier\")\n+    PlatformIdentifier realPlatformIdentifier;\n+\n+    @Inject\n+    @Named(\"realRetrofitApiService\")\n+    RetrofitApiServiceImpl realRetrofitApiService;\n+\n+    @Rule\n+    public ExpectedException exception = ExpectedException.none();\n+\n+    @Before\n+    public void setUp() throws Exception {\n+        ((TestComponent) SensorbergTestApplication.getComponent()).inject(this);\n+        realRetrofitApiService.setApiToken(TEST_API_KEY);\n+    }\n+\n+    @Test\n+    public void apiservice_should_have_valid_useragent_in_header() throws Exception {\n+        Call<BaseResolveResponse> call = realRetrofitApiService.updateBeaconLayout(\"\");\n+        Response<BaseResolveResponse> response = call.execute();\n+\n+        Assertions.assertThat(response.raw().request().headers()).isNotNull();\n+        Assertions.assertThat(response.raw().request().headers().get(Transport.HEADER_USER_AGENT))\n+                .isEqualTo(realPlatformIdentifier.getUserAgentString());\n+    }\n+\n+    @Test\n+    public void apiservice_should_have_advertiserid_in_header() throws Exception {\n+        Call<BaseResolveResponse> call = realRetrofitApiService.updateBeaconLayout(\"\");\n+        Response<BaseResolveResponse> response = call.execute();\n+\n+        Assertions.assertThat(realPlatformIdentifier.getAdvertiserIdentifier()).isNotNull();\n+        Response<BaseResolveResponse> responseWithAdvertiserId = call.clone().execute();\n+\n+        Assertions.assertThat(responseWithAdvertiserId.raw().request().headers().get(Transport.HEADER_ADVERTISER_IDENTIFIER))\n+                .isEqualTo(realPlatformIdentifier.getAdvertiserIdentifier());\n+    }\n+\n+    @Test\n+    public void apiservice_should_have_valid_installationid_in_header() throws Exception {\n+        Call<BaseResolveResponse> call = realRetrofitApiService.updateBeaconLayout(\"\");\n+        Response<BaseResolveResponse> response = call.execute();\n+\n+        Assertions.assertThat(response.raw().request().headers()).isNotNull();\n+        Assertions.assertThat(response.raw().request().headers().get(Transport.HEADER_INSTALLATION_IDENTIFIER))\n+                .isEqualTo(realPlatformIdentifier.getDeviceInstallationIdentifier());\n+","path":"android-sdk/src/androidTest/java/com/sensorberg/sdk/internal/http/ApiServiceShould.java","position":96,"original_position":96,"commit_id":"1c43607e9ae586d6522d601f7fa37b615f8e1a72","original_commit_id":"1c43607e9ae586d6522d601f7fa37b615f8e1a72","user":{"login":"skraynick","id":3478646,"avatar_url":"https://avatars.githubusercontent.com/u/3478646?v=3","gravatar_id":"","url":"https://api.github.com/users/skraynick","html_url":"https://github.com/skraynick","followers_url":"https://api.github.com/users/skraynick/followers","following_url":"https://api.github.com/users/skraynick/following{/other_user}","gists_url":"https://api.github.com/users/skraynick/gists{/gist_id}","starred_url":"https://api.github.com/users/skraynick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skraynick/subscriptions","organizations_url":"https://api.github.com/users/skraynick/orgs","repos_url":"https://api.github.com/users/skraynick/repos","events_url":"https://api.github.com/users/skraynick/events{/privacy}","received_events_url":"https://api.github.com/users/skraynick/received_events","type":"User","site_admin":false},"body":"no space","created_at":"2016-06-01T09:26:49Z","updated_at":"2016-06-01T09:26:49Z","html_url":"https://github.com/sensorberg-dev/android-sdk/pull/27#discussion_r65328868","pull_request_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/comments/65328868"},"html":{"href":"https://github.com/sensorberg-dev/android-sdk/pull/27#discussion_r65328868"},"pull_request":{"href":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/27","id":71976553,"html_url":"https://github.com/sensorberg-dev/android-sdk/pull/27","diff_url":"https://github.com/sensorberg-dev/android-sdk/pull/27.diff","patch_url":"https://github.com/sensorberg-dev/android-sdk/pull/27.patch","issue_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues/27","number":27,"state":"open","locked":false,"title":"Refactor/volley out retrofit in","user":{"login":"mrsasha","id":1850452,"avatar_url":"https://avatars.githubusercontent.com/u/1850452?v=3","gravatar_id":"","url":"https://api.github.com/users/mrsasha","html_url":"https://github.com/mrsasha","followers_url":"https://api.github.com/users/mrsasha/followers","following_url":"https://api.github.com/users/mrsasha/following{/other_user}","gists_url":"https://api.github.com/users/mrsasha/gists{/gist_id}","starred_url":"https://api.github.com/users/mrsasha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrsasha/subscriptions","organizations_url":"https://api.github.com/users/mrsasha/orgs","repos_url":"https://api.github.com/users/mrsasha/repos","events_url":"https://api.github.com/users/mrsasha/events{/privacy}","received_events_url":"https://api.github.com/users/mrsasha/received_events","type":"User","site_admin":false},"body":"@skraynick chk pls.","created_at":"2016-05-31T08:31:02Z","updated_at":"2016-06-01T09:26:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"skraynick","id":3478646,"avatar_url":"https://avatars.githubusercontent.com/u/3478646?v=3","gravatar_id":"","url":"https://api.github.com/users/skraynick","html_url":"https://github.com/skraynick","followers_url":"https://api.github.com/users/skraynick/followers","following_url":"https://api.github.com/users/skraynick/following{/other_user}","gists_url":"https://api.github.com/users/skraynick/gists{/gist_id}","starred_url":"https://api.github.com/users/skraynick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skraynick/subscriptions","organizations_url":"https://api.github.com/users/skraynick/orgs","repos_url":"https://api.github.com/users/skraynick/repos","events_url":"https://api.github.com/users/skraynick/events{/privacy}","received_events_url":"https://api.github.com/users/skraynick/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/27/commits","review_comments_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/27/comments","review_comment_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues/27/comments","statuses_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/statuses/1c43607e9ae586d6522d601f7fa37b615f8e1a72","head":{"label":"sensorberg-dev:refactor/volley_out_retrofit_in","ref":"refactor/volley_out_retrofit_in","sha":"1c43607e9ae586d6522d601f7fa37b615f8e1a72","user":{"login":"sensorberg-dev","id":7324933,"avatar_url":"https://avatars.githubusercontent.com/u/7324933?v=3","gravatar_id":"","url":"https://api.github.com/users/sensorberg-dev","html_url":"https://github.com/sensorberg-dev","followers_url":"https://api.github.com/users/sensorberg-dev/followers","following_url":"https://api.github.com/users/sensorberg-dev/following{/other_user}","gists_url":"https://api.github.com/users/sensorberg-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/sensorberg-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sensorberg-dev/subscriptions","organizations_url":"https://api.github.com/users/sensorberg-dev/orgs","repos_url":"https://api.github.com/users/sensorberg-dev/repos","events_url":"https://api.github.com/users/sensorberg-dev/events{/privacy}","received_events_url":"https://api.github.com/users/sensorberg-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":22636262,"name":"android-sdk","full_name":"sensorberg-dev/android-sdk","owner":{"login":"sensorberg-dev","id":7324933,"avatar_url":"https://avatars.githubusercontent.com/u/7324933?v=3","gravatar_id":"","url":"https://api.github.com/users/sensorberg-dev","html_url":"https://github.com/sensorberg-dev","followers_url":"https://api.github.com/users/sensorberg-dev/followers","following_url":"https://api.github.com/users/sensorberg-dev/following{/other_user}","gists_url":"https://api.github.com/users/sensorberg-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/sensorberg-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sensorberg-dev/subscriptions","organizations_url":"https://api.github.com/users/sensorberg-dev/orgs","repos_url":"https://api.github.com/users/sensorberg-dev/repos","events_url":"https://api.github.com/users/sensorberg-dev/events{/privacy}","received_events_url":"https://api.github.com/users/sensorberg-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sensorberg-dev/android-sdk","description":"Android SDK for handling beacon technology via the Sensorberg Beacon Management Platform.","fork":false,"url":"https://api.github.com/repos/sensorberg-dev/android-sdk","forks_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/forks","keys_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/teams","hooks_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/hooks","issue_events_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/events","assignees_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/tags","blobs_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/languages","stargazers_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/stargazers","contributors_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/contributors","subscribers_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/subscribers","subscription_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/subscription","commits_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/merges","archive_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/downloads","issues_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/labels{/name}","releases_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/deployments","created_at":"2014-08-05T08:28:12Z","updated_at":"2016-03-30T07:21:59Z","pushed_at":"2016-05-31T16:44:34Z","git_url":"git://github.com/sensorberg-dev/android-sdk.git","ssh_url":"git@github.com:sensorberg-dev/android-sdk.git","clone_url":"https://github.com/sensorberg-dev/android-sdk.git","svn_url":"https://github.com/sensorberg-dev/android-sdk","homepage":"http://www.sensorberg.com","size":10866,"stargazers_count":12,"watchers_count":12,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":4,"forks":9,"open_issues":4,"watchers":12,"default_branch":"develop"}},"base":{"label":"sensorberg-dev:develop","ref":"develop","sha":"24a814860688630ff0da2ba6ee01dc593e5dbf5a","user":{"login":"sensorberg-dev","id":7324933,"avatar_url":"https://avatars.githubusercontent.com/u/7324933?v=3","gravatar_id":"","url":"https://api.github.com/users/sensorberg-dev","html_url":"https://github.com/sensorberg-dev","followers_url":"https://api.github.com/users/sensorberg-dev/followers","following_url":"https://api.github.com/users/sensorberg-dev/following{/other_user}","gists_url":"https://api.github.com/users/sensorberg-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/sensorberg-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sensorberg-dev/subscriptions","organizations_url":"https://api.github.com/users/sensorberg-dev/orgs","repos_url":"https://api.github.com/users/sensorberg-dev/repos","events_url":"https://api.github.com/users/sensorberg-dev/events{/privacy}","received_events_url":"https://api.github.com/users/sensorberg-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":22636262,"name":"android-sdk","full_name":"sensorberg-dev/android-sdk","owner":{"login":"sensorberg-dev","id":7324933,"avatar_url":"https://avatars.githubusercontent.com/u/7324933?v=3","gravatar_id":"","url":"https://api.github.com/users/sensorberg-dev","html_url":"https://github.com/sensorberg-dev","followers_url":"https://api.github.com/users/sensorberg-dev/followers","following_url":"https://api.github.com/users/sensorberg-dev/following{/other_user}","gists_url":"https://api.github.com/users/sensorberg-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/sensorberg-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sensorberg-dev/subscriptions","organizations_url":"https://api.github.com/users/sensorberg-dev/orgs","repos_url":"https://api.github.com/users/sensorberg-dev/repos","events_url":"https://api.github.com/users/sensorberg-dev/events{/privacy}","received_events_url":"https://api.github.com/users/sensorberg-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sensorberg-dev/android-sdk","description":"Android SDK for handling beacon technology via the Sensorberg Beacon Management Platform.","fork":false,"url":"https://api.github.com/repos/sensorberg-dev/android-sdk","forks_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/forks","keys_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/teams","hooks_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/hooks","issue_events_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/events","assignees_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/tags","blobs_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/languages","stargazers_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/stargazers","contributors_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/contributors","subscribers_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/subscribers","subscription_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/subscription","commits_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/merges","archive_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/downloads","issues_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/labels{/name}","releases_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/sensorberg-dev/android-sdk/deployments","created_at":"2014-08-05T08:28:12Z","updated_at":"2016-03-30T07:21:59Z","pushed_at":"2016-05-31T16:44:34Z","git_url":"git://github.com/sensorberg-dev/android-sdk.git","ssh_url":"git@github.com:sensorberg-dev/android-sdk.git","clone_url":"https://github.com/sensorberg-dev/android-sdk.git","svn_url":"https://github.com/sensorberg-dev/android-sdk","homepage":"http://www.sensorberg.com","size":10866,"stargazers_count":12,"watchers_count":12,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":4,"forks":9,"open_issues":4,"watchers":12,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/27"},"html":{"href":"https://github.com/sensorberg-dev/android-sdk/pull/27"},"issue":{"href":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues/27"},"comments":{"href":"https://api.github.com/repos/sensorberg-dev/android-sdk/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sensorberg-dev/android-sdk/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/sensorberg-dev/android-sdk/statuses/1c43607e9ae586d6522d601f7fa37b615f8e1a72"}}}}
{"actor":{"display_login":"skraynick"}}