{"action":"created","comment":{"url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/comments/64696898","id":64696898,"diff_hunk":"@@ -0,0 +1,68 @@\n+import io.commercetools.sunrise.cms.CmsIdentifier;\n+import io.commercetools.sunrise.cms.contentful.ContentfulCmsService;\n+import org.junit.Before;\n+import org.junit.Test;\n+\n+import java.util.List;\n+import java.util.Locale;\n+import java.util.Optional;\n+import java.util.concurrent.CompletionStage;\n+import java.util.concurrent.TimeUnit;\n+\n+import static java.util.Arrays.asList;\n+import static org.assertj.core.api.Assertions.assertThat;\n+\n+public class ContentfulCmsServiceIT {\n+    private static final Locale DE = Locale.forLanguageTag(\"de\");\n+    private static final Locale EN_US = Locale.forLanguageTag(\"en-US\");\n+    private static final List<Locale> SUPPORTED_LOCALES = asList(DE, EN_US);\n+\n+    // credentials for contentful demo account\n+    private static final String SPACE_ID = \"cfexampleapi\";\n+    private static final String TOKEN = \"b4c0n73n7fu1\";\n+    private ContentfulCmsService contentfulCmsService;\n+\n+    @Before\n+    public void setUp() throws Exception {\n+        contentfulCmsService = ContentfulCmsService.of(SPACE_ID, TOKEN);\n+    }\n+\n+    @Test\n+    public void whenAskForExistingStringContentThenGet() throws Exception {\n+        CmsIdentifier identifier = CmsIdentifier.ofEntryTypeAndKeyAndField(\"human\", \"Finn\", \"description\");\n+        CompletionStage<Optional<String>> optionalCompletionStage = contentfulCmsService.get(SUPPORTED_LOCALES, identifier);\n+        Optional<String> content = optionalCompletionStage.toCompletableFuture().get(5, TimeUnit.SECONDS);\n+\n+        assertThat(content.isPresent()).isTrue();\n+        assertThat(content.get()).isEqualTo(\"Fearless adventurer! Defender of pancakes.\");\n+    }\n+\n+    @Test\n+    public void whenAskForNotExistingStringContentThenNotPresent() throws Exception {\n+        CmsIdentifier identifier = CmsIdentifier.ofEntryTypeAndKeyAndField(\"human\", \"Jake\", \"likes\");\n+        CompletionStage<Optional<String>> optionalCompletionStage = contentfulCmsService.get(SUPPORTED_LOCALES, identifier);\n+        Optional<String> content = optionalCompletionStage.toCompletableFuture().get(5, TimeUnit.SECONDS);\n+\n+        assertThat(content.isPresent()).isFalse();","path":"cms-contentful/it/ContentfulCmsServiceIT.java","position":46,"original_position":46,"commit_id":"dbf8adebc7e5d766db10b71be6487344b13ad18d","original_commit_id":"dbf8adebc7e5d766db10b71be6487344b13ad18d","user":{"login":"schleichardt","id":1320833,"avatar_url":"https://avatars.githubusercontent.com/u/1320833?v=3","gravatar_id":"","url":"https://api.github.com/users/schleichardt","html_url":"https://github.com/schleichardt","followers_url":"https://api.github.com/users/schleichardt/followers","following_url":"https://api.github.com/users/schleichardt/following{/other_user}","gists_url":"https://api.github.com/users/schleichardt/gists{/gist_id}","starred_url":"https://api.github.com/users/schleichardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schleichardt/subscriptions","organizations_url":"https://api.github.com/users/schleichardt/orgs","repos_url":"https://api.github.com/users/schleichardt/repos","events_url":"https://api.github.com/users/schleichardt/events{/privacy}","received_events_url":"https://api.github.com/users/schleichardt/received_events","type":"User","site_admin":false},"body":"as in https://github.com/commercetools/commercetools-sunrise-java-cms/pull/2/files#r64696705 it could be improved by\r\n\r\n`assertThat(content).isEmpty();`\r\n\r\nhttp://joel-costigliola.github.io/assertj/core-8/api/org/assertj/core/api/AbstractOptionalAssert.html","created_at":"2016-05-26T06:29:27Z","updated_at":"2016-05-26T06:29:27Z","html_url":"https://github.com/commercetools/commercetools-sunrise-java-cms/pull/2#discussion_r64696898","pull_request_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/comments/64696898"},"html":{"href":"https://github.com/commercetools/commercetools-sunrise-java-cms/pull/2#discussion_r64696898"},"pull_request":{"href":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/2","id":71196450,"html_url":"https://github.com/commercetools/commercetools-sunrise-java-cms/pull/2","diff_url":"https://github.com/commercetools/commercetools-sunrise-java-cms/pull/2.diff","patch_url":"https://github.com/commercetools/commercetools-sunrise-java-cms/pull/2.patch","issue_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues/2","number":2,"state":"open","locked":false,"title":"Fetch entry from space","user":{"login":"dariuszor","id":12546307,"avatar_url":"https://avatars.githubusercontent.com/u/12546307?v=3","gravatar_id":"","url":"https://api.github.com/users/dariuszor","html_url":"https://github.com/dariuszor","followers_url":"https://api.github.com/users/dariuszor/followers","following_url":"https://api.github.com/users/dariuszor/following{/other_user}","gists_url":"https://api.github.com/users/dariuszor/gists{/gist_id}","starred_url":"https://api.github.com/users/dariuszor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dariuszor/subscriptions","organizations_url":"https://api.github.com/users/dariuszor/orgs","repos_url":"https://api.github.com/users/dariuszor/repos","events_url":"https://api.github.com/users/dariuszor/events{/privacy}","received_events_url":"https://api.github.com/users/dariuszor/received_events","type":"User","site_admin":false},"body":"@lauraluiz  could you have a look here?\r\n\r\nCurrently I am using space call for fetching some data.\r\nI am using it this way having in mind that we want to cache data.\r\n\r\nSingle sync call contains some amount of entries and url for fetching next portion of data.\r\nI am planning to focus on collecting all data in some next PR.\r\nFirstly I will create data models, which will contains only this fields, which are important for us.\r\n\r\nI am also planning to create ContentfulCmsConfig file.\r\n\r\nAbout assets, in my opininon, the way it is now handled (indistinctly assets - only url needed - and texts) is fine. I think there is lack of support for some string lists. Eg, for footer links, which could be added to contentful, and their number could have change.","created_at":"2016-05-24T10:36:03Z","updated_at":"2016-05-26T06:29:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc26fb406ca9ef76ad903d9f2ae39fa18b8e81e3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/2/commits","review_comments_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/2/comments","review_comment_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues/2/comments","statuses_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/statuses/dbf8adebc7e5d766db10b71be6487344b13ad18d","head":{"label":"commercetools:fetch_entry_from_space","ref":"fetch_entry_from_space","sha":"dbf8adebc7e5d766db10b71be6487344b13ad18d","user":{"login":"commercetools","id":1084585,"avatar_url":"https://avatars.githubusercontent.com/u/1084585?v=3","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"repo":{"id":59130746,"name":"commercetools-sunrise-java-cms","full_name":"commercetools/commercetools-sunrise-java-cms","owner":{"login":"commercetools","id":1084585,"avatar_url":"https://avatars.githubusercontent.com/u/1084585?v=3","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/commercetools/commercetools-sunrise-java-cms","description":"Module for Sunrise Java to use CMS","fork":false,"url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms","forks_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/forks","keys_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/teams","hooks_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/hooks","issue_events_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues/events{/number}","events_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/events","assignees_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/assignees{/user}","branches_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/branches{/branch}","tags_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/tags","blobs_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/languages","stargazers_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/stargazers","contributors_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/contributors","subscribers_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/subscribers","subscription_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/subscription","commits_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/contents/{+path}","compare_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/merges","archive_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/downloads","issues_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues{/number}","pulls_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/labels{/name}","releases_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/releases{/id}","deployments_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/deployments","created_at":"2016-05-18T15:58:30Z","updated_at":"2016-05-18T17:40:45Z","pushed_at":"2016-05-24T13:49:09Z","git_url":"git://github.com/commercetools/commercetools-sunrise-java-cms.git","ssh_url":"git@github.com:commercetools/commercetools-sunrise-java-cms.git","clone_url":"https://github.com/commercetools/commercetools-sunrise-java-cms.git","svn_url":"https://github.com/commercetools/commercetools-sunrise-java-cms","homepage":"","size":57,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"commercetools:master","ref":"master","sha":"4eef73de4750a89134cefe931e579c384a531f8b","user":{"login":"commercetools","id":1084585,"avatar_url":"https://avatars.githubusercontent.com/u/1084585?v=3","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"repo":{"id":59130746,"name":"commercetools-sunrise-java-cms","full_name":"commercetools/commercetools-sunrise-java-cms","owner":{"login":"commercetools","id":1084585,"avatar_url":"https://avatars.githubusercontent.com/u/1084585?v=3","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/commercetools/commercetools-sunrise-java-cms","description":"Module for Sunrise Java to use CMS","fork":false,"url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms","forks_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/forks","keys_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/teams","hooks_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/hooks","issue_events_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues/events{/number}","events_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/events","assignees_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/assignees{/user}","branches_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/branches{/branch}","tags_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/tags","blobs_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/languages","stargazers_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/stargazers","contributors_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/contributors","subscribers_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/subscribers","subscription_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/subscription","commits_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/contents/{+path}","compare_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/merges","archive_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/downloads","issues_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues{/number}","pulls_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/labels{/name}","releases_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/releases{/id}","deployments_url":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/deployments","created_at":"2016-05-18T15:58:30Z","updated_at":"2016-05-18T17:40:45Z","pushed_at":"2016-05-24T13:49:09Z","git_url":"git://github.com/commercetools/commercetools-sunrise-java-cms.git","ssh_url":"git@github.com:commercetools/commercetools-sunrise-java-cms.git","clone_url":"https://github.com/commercetools/commercetools-sunrise-java-cms.git","svn_url":"https://github.com/commercetools/commercetools-sunrise-java-cms","homepage":"","size":57,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/2"},"html":{"href":"https://github.com/commercetools/commercetools-sunrise-java-cms/pull/2"},"issue":{"href":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues/2"},"comments":{"href":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/commercetools/commercetools-sunrise-java-cms/statuses/dbf8adebc7e5d766db10b71be6487344b13ad18d"}}}}
{"actor":{"display_login":"schleichardt"}}