{"action":"created","comment":{"url":"https://api.github.com/repos/togglz/togglz/pulls/comments/94078725","pull_request_review_id":14599421,"id":94078725,"diff_hunk":"@@ -0,0 +1,306 @@\n+package org.togglz.googleclouddatastore.repository;\n+\n+import com.google.cloud.datastore.BooleanValue;\n+import com.google.cloud.datastore.Datastore;\n+import com.google.cloud.datastore.DatastoreOptions;\n+import com.google.cloud.datastore.Entity;\n+import com.google.cloud.datastore.Key;\n+import com.google.cloud.datastore.StringValue;\n+import com.google.cloud.datastore.Transaction;\n+import com.google.cloud.datastore.Value;\n+import com.google.cloud.datastore.testing.LocalDatastoreHelper;\n+import org.joda.time.Duration;\n+import org.junit.After;\n+import org.junit.AfterClass;\n+import org.junit.Before;\n+import org.junit.BeforeClass;\n+import org.junit.Test;\n+import org.togglz.core.Feature;\n+import org.togglz.core.repository.FeatureState;\n+\n+import java.io.IOException;\n+import java.util.ArrayList;\n+import java.util.Arrays;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.concurrent.TimeoutException;\n+\n+import static org.hamcrest.CoreMatchers.is;\n+import static org.junit.Assert.assertEquals;\n+import static org.junit.Assert.assertFalse;\n+import static org.junit.Assert.assertNotNull;\n+import static org.junit.Assert.assertNull;\n+import static org.junit.Assert.assertThat;\n+\n+/**\n+ * Created by fabio on 30/09/16.\n+ */\n+public class GoogleCloudDatastoreStateRepositoryTest {\n+\n+    private static final int MAX_ENTITY_GROUPS = 25;\n+    private static LocalDatastoreHelper helper = LocalDatastoreHelper.create(1.0);\n+    private static final DatastoreOptions options = helper.getOptions();\n+    private static final Datastore datastore = options.getService();\n+\n+    private GoogleCloudDatastoreStateRepository repository;\n+\n+    @BeforeClass\n+    public static void beforeClass() throws IOException, InterruptedException {\n+        helper.start();\n+    }\n+\n+    @Before\n+    public void setUp() throws Exception {\n+        repository = new GoogleCloudDatastoreStateRepository(datastore);\n+    }\n+\n+    @AfterClass\n+    public static void afterClass() throws IOException, InterruptedException, TimeoutException {\n+        helper.stop(Duration.standardMinutes(1));\n+    }\n+\n+    @After\n+    public void tearDown() throws Exception {\n+        helper.reset();\n+    }\n+\n+    @Test\n+    public void customKindName() {\n+        final String kind = \"CustomKind\";\n+        repository = new GoogleCloudDatastoreStateRepository(kind, datastore);\n+        assertEquals(kind, repository.kind());\n+    }\n+\n+    @Test\n+    public void testShouldSaveStateWithoutStrategyOrParameters() {\n+        /*\n+         * WHEN a feature without strategy is persisted\n+         */\n+        final FeatureState state = new FeatureState(TestFeature.F1).disable();\n+        repository.setFeatureState(state);\n+\n+        /*\n+         * THEN there should be a corresponding entry in the database\n+         */\n+        final Key key = datastore.newKeyFactory().setKind(repository.kind()).newKey(TestFeature.F1.name());\n+        final Entity featureEntity = datastore.get(key);\n+\n+        assertEquals(false, featureEntity.getBoolean(GoogleCloudDatastoreStateRepository.ENABLED));\n+        assertFalse(featureEntity.contains(GoogleCloudDatastoreStateRepository.STRATEGY_ID));\n+        assertFalse(featureEntity.contains(GoogleCloudDatastoreStateRepository.STRATEGY_PARAMS_NAMES));\n+        assertFalse(featureEntity.contains(GoogleCloudDatastoreStateRepository.STRATEGY_PARAMS_VALUES));\n+\n+    }\n+\n+    @SuppressWarnings(\"unchecked\")","path":"google-cloud-datastore/src/test/java/org/togglz/googleclouddatastore/repository/GoogleCloudDatastoreStateRepositoryTest.java","position":96,"original_position":96,"commit_id":"1e991255c59b133696128e77a9c2ad44598d269b","original_commit_id":"1e991255c59b133696128e77a9c2ad44598d269b","user":{"login":"hexmind","id":5780288,"avatar_url":"https://avatars.githubusercontent.com/u/5780288?v=3","gravatar_id":"","url":"https://api.github.com/users/hexmind","html_url":"https://github.com/hexmind","followers_url":"https://api.github.com/users/hexmind/followers","following_url":"https://api.github.com/users/hexmind/following{/other_user}","gists_url":"https://api.github.com/users/hexmind/gists{/gist_id}","starred_url":"https://api.github.com/users/hexmind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hexmind/subscriptions","organizations_url":"https://api.github.com/users/hexmind/orgs","repos_url":"https://api.github.com/users/hexmind/repos","events_url":"https://api.github.com/users/hexmind/events{/privacy}","received_events_url":"https://api.github.com/users/hexmind/received_events","type":"User","site_admin":false},"body":"Can you fix unchecked warning?","created_at":"2016-12-28T21:20:50Z","updated_at":"2016-12-28T21:21:26Z","html_url":"https://github.com/togglz/togglz/pull/196#discussion_r94078725","pull_request_url":"https://api.github.com/repos/togglz/togglz/pulls/196","_links":{"self":{"href":"https://api.github.com/repos/togglz/togglz/pulls/comments/94078725"},"html":{"href":"https://github.com/togglz/togglz/pull/196#discussion_r94078725"},"pull_request":{"href":"https://api.github.com/repos/togglz/togglz/pulls/196"}}},"pull_request":{"url":"https://api.github.com/repos/togglz/togglz/pulls/196","id":99539879,"html_url":"https://github.com/togglz/togglz/pull/196","diff_url":"https://github.com/togglz/togglz/pull/196.diff","patch_url":"https://github.com/togglz/togglz/pull/196.patch","issue_url":"https://api.github.com/repos/togglz/togglz/issues/196","number":196,"state":"open","locked":false,"title":"Add google cloud datastore state repository","user":{"login":"fabito","id":308613,"avatar_url":"https://avatars.githubusercontent.com/u/308613?v=3","gravatar_id":"","url":"https://api.github.com/users/fabito","html_url":"https://github.com/fabito","followers_url":"https://api.github.com/users/fabito/followers","following_url":"https://api.github.com/users/fabito/following{/other_user}","gists_url":"https://api.github.com/users/fabito/gists{/gist_id}","starred_url":"https://api.github.com/users/fabito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabito/subscriptions","organizations_url":"https://api.github.com/users/fabito/orgs","repos_url":"https://api.github.com/users/fabito/repos","events_url":"https://api.github.com/users/fabito/events{/privacy}","received_events_url":"https://api.github.com/users/fabito/received_events","type":"User","site_admin":false},"body":"This PR adds a [Google Cloud Datastore](https://cloud.google.com/datastore/) state repository implementation.\r\nThis `StateRepository`  implementation is targeted to applications that runs outside appengine but still uses Datastore for storage.","created_at":"2016-12-28T11:44:27Z","updated_at":"2016-12-28T21:21:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34ac68a880a7eb37eb416323ba4b37f7d22fdc20","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/togglz/togglz/pulls/196/commits","review_comments_url":"https://api.github.com/repos/togglz/togglz/pulls/196/comments","review_comment_url":"https://api.github.com/repos/togglz/togglz/pulls/comments{/number}","comments_url":"https://api.github.com/repos/togglz/togglz/issues/196/comments","statuses_url":"https://api.github.com/repos/togglz/togglz/statuses/1e991255c59b133696128e77a9c2ad44598d269b","head":{"label":"smartcanvas:add/google-cloud-datastore-state-repository","ref":"add/google-cloud-datastore-state-repository","sha":"1e991255c59b133696128e77a9c2ad44598d269b","user":{"login":"smartcanvas","id":13066501,"avatar_url":"https://avatars.githubusercontent.com/u/13066501?v=3","gravatar_id":"","url":"https://api.github.com/users/smartcanvas","html_url":"https://github.com/smartcanvas","followers_url":"https://api.github.com/users/smartcanvas/followers","following_url":"https://api.github.com/users/smartcanvas/following{/other_user}","gists_url":"https://api.github.com/users/smartcanvas/gists{/gist_id}","starred_url":"https://api.github.com/users/smartcanvas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartcanvas/subscriptions","organizations_url":"https://api.github.com/users/smartcanvas/orgs","repos_url":"https://api.github.com/users/smartcanvas/repos","events_url":"https://api.github.com/users/smartcanvas/events{/privacy}","received_events_url":"https://api.github.com/users/smartcanvas/received_events","type":"Organization","site_admin":false},"repo":{"id":61843792,"name":"togglz","full_name":"smartcanvas/togglz","owner":{"login":"smartcanvas","id":13066501,"avatar_url":"https://avatars.githubusercontent.com/u/13066501?v=3","gravatar_id":"","url":"https://api.github.com/users/smartcanvas","html_url":"https://github.com/smartcanvas","followers_url":"https://api.github.com/users/smartcanvas/followers","following_url":"https://api.github.com/users/smartcanvas/following{/other_user}","gists_url":"https://api.github.com/users/smartcanvas/gists{/gist_id}","starred_url":"https://api.github.com/users/smartcanvas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartcanvas/subscriptions","organizations_url":"https://api.github.com/users/smartcanvas/orgs","repos_url":"https://api.github.com/users/smartcanvas/repos","events_url":"https://api.github.com/users/smartcanvas/events{/privacy}","received_events_url":"https://api.github.com/users/smartcanvas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/smartcanvas/togglz","description":"Feature Flags for the Java platform","fork":true,"url":"https://api.github.com/repos/smartcanvas/togglz","forks_url":"https://api.github.com/repos/smartcanvas/togglz/forks","keys_url":"https://api.github.com/repos/smartcanvas/togglz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smartcanvas/togglz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smartcanvas/togglz/teams","hooks_url":"https://api.github.com/repos/smartcanvas/togglz/hooks","issue_events_url":"https://api.github.com/repos/smartcanvas/togglz/issues/events{/number}","events_url":"https://api.github.com/repos/smartcanvas/togglz/events","assignees_url":"https://api.github.com/repos/smartcanvas/togglz/assignees{/user}","branches_url":"https://api.github.com/repos/smartcanvas/togglz/branches{/branch}","tags_url":"https://api.github.com/repos/smartcanvas/togglz/tags","blobs_url":"https://api.github.com/repos/smartcanvas/togglz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smartcanvas/togglz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smartcanvas/togglz/git/refs{/sha}","trees_url":"https://api.github.com/repos/smartcanvas/togglz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smartcanvas/togglz/statuses/{sha}","languages_url":"https://api.github.com/repos/smartcanvas/togglz/languages","stargazers_url":"https://api.github.com/repos/smartcanvas/togglz/stargazers","contributors_url":"https://api.github.com/repos/smartcanvas/togglz/contributors","subscribers_url":"https://api.github.com/repos/smartcanvas/togglz/subscribers","subscription_url":"https://api.github.com/repos/smartcanvas/togglz/subscription","commits_url":"https://api.github.com/repos/smartcanvas/togglz/commits{/sha}","git_commits_url":"https://api.github.com/repos/smartcanvas/togglz/git/commits{/sha}","comments_url":"https://api.github.com/repos/smartcanvas/togglz/comments{/number}","issue_comment_url":"https://api.github.com/repos/smartcanvas/togglz/issues/comments{/number}","contents_url":"https://api.github.com/repos/smartcanvas/togglz/contents/{+path}","compare_url":"https://api.github.com/repos/smartcanvas/togglz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smartcanvas/togglz/merges","archive_url":"https://api.github.com/repos/smartcanvas/togglz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smartcanvas/togglz/downloads","issues_url":"https://api.github.com/repos/smartcanvas/togglz/issues{/number}","pulls_url":"https://api.github.com/repos/smartcanvas/togglz/pulls{/number}","milestones_url":"https://api.github.com/repos/smartcanvas/togglz/milestones{/number}","notifications_url":"https://api.github.com/repos/smartcanvas/togglz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smartcanvas/togglz/labels{/name}","releases_url":"https://api.github.com/repos/smartcanvas/togglz/releases{/id}","deployments_url":"https://api.github.com/repos/smartcanvas/togglz/deployments","created_at":"2016-06-23T23:41:49Z","updated_at":"2016-06-23T23:41:51Z","pushed_at":"2016-12-28T13:30:05Z","git_url":"git://github.com/smartcanvas/togglz.git","ssh_url":"git@github.com:smartcanvas/togglz.git","clone_url":"https://github.com/smartcanvas/togglz.git","svn_url":"https://github.com/smartcanvas/togglz","homepage":"http://www.togglz.org/","size":1442,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"togglz:master","ref":"master","sha":"85126e1a650c84eeb069f934cd451bcf70bcc763","user":{"login":"togglz","id":3795113,"avatar_url":"https://avatars.githubusercontent.com/u/3795113?v=3","gravatar_id":"","url":"https://api.github.com/users/togglz","html_url":"https://github.com/togglz","followers_url":"https://api.github.com/users/togglz/followers","following_url":"https://api.github.com/users/togglz/following{/other_user}","gists_url":"https://api.github.com/users/togglz/gists{/gist_id}","starred_url":"https://api.github.com/users/togglz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/togglz/subscriptions","organizations_url":"https://api.github.com/users/togglz/orgs","repos_url":"https://api.github.com/users/togglz/repos","events_url":"https://api.github.com/users/togglz/events{/privacy}","received_events_url":"https://api.github.com/users/togglz/received_events","type":"Organization","site_admin":false},"repo":{"id":3028163,"name":"togglz","full_name":"togglz/togglz","owner":{"login":"togglz","id":3795113,"avatar_url":"https://avatars.githubusercontent.com/u/3795113?v=3","gravatar_id":"","url":"https://api.github.com/users/togglz","html_url":"https://github.com/togglz","followers_url":"https://api.github.com/users/togglz/followers","following_url":"https://api.github.com/users/togglz/following{/other_user}","gists_url":"https://api.github.com/users/togglz/gists{/gist_id}","starred_url":"https://api.github.com/users/togglz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/togglz/subscriptions","organizations_url":"https://api.github.com/users/togglz/orgs","repos_url":"https://api.github.com/users/togglz/repos","events_url":"https://api.github.com/users/togglz/events{/privacy}","received_events_url":"https://api.github.com/users/togglz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/togglz/togglz","description":"Feature Flags for the Java platform","fork":false,"url":"https://api.github.com/repos/togglz/togglz","forks_url":"https://api.github.com/repos/togglz/togglz/forks","keys_url":"https://api.github.com/repos/togglz/togglz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/togglz/togglz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/togglz/togglz/teams","hooks_url":"https://api.github.com/repos/togglz/togglz/hooks","issue_events_url":"https://api.github.com/repos/togglz/togglz/issues/events{/number}","events_url":"https://api.github.com/repos/togglz/togglz/events","assignees_url":"https://api.github.com/repos/togglz/togglz/assignees{/user}","branches_url":"https://api.github.com/repos/togglz/togglz/branches{/branch}","tags_url":"https://api.github.com/repos/togglz/togglz/tags","blobs_url":"https://api.github.com/repos/togglz/togglz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/togglz/togglz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/togglz/togglz/git/refs{/sha}","trees_url":"https://api.github.com/repos/togglz/togglz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/togglz/togglz/statuses/{sha}","languages_url":"https://api.github.com/repos/togglz/togglz/languages","stargazers_url":"https://api.github.com/repos/togglz/togglz/stargazers","contributors_url":"https://api.github.com/repos/togglz/togglz/contributors","subscribers_url":"https://api.github.com/repos/togglz/togglz/subscribers","subscription_url":"https://api.github.com/repos/togglz/togglz/subscription","commits_url":"https://api.github.com/repos/togglz/togglz/commits{/sha}","git_commits_url":"https://api.github.com/repos/togglz/togglz/git/commits{/sha}","comments_url":"https://api.github.com/repos/togglz/togglz/comments{/number}","issue_comment_url":"https://api.github.com/repos/togglz/togglz/issues/comments{/number}","contents_url":"https://api.github.com/repos/togglz/togglz/contents/{+path}","compare_url":"https://api.github.com/repos/togglz/togglz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/togglz/togglz/merges","archive_url":"https://api.github.com/repos/togglz/togglz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/togglz/togglz/downloads","issues_url":"https://api.github.com/repos/togglz/togglz/issues{/number}","pulls_url":"https://api.github.com/repos/togglz/togglz/pulls{/number}","milestones_url":"https://api.github.com/repos/togglz/togglz/milestones{/number}","notifications_url":"https://api.github.com/repos/togglz/togglz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/togglz/togglz/labels{/name}","releases_url":"https://api.github.com/repos/togglz/togglz/releases{/id}","deployments_url":"https://api.github.com/repos/togglz/togglz/deployments","created_at":"2011-12-21T16:49:03Z","updated_at":"2016-12-27T22:16:20Z","pushed_at":"2016-12-28T20:32:38Z","git_url":"git://github.com/togglz/togglz.git","ssh_url":"git@github.com:togglz/togglz.git","clone_url":"https://github.com/togglz/togglz.git","svn_url":"https://github.com/togglz/togglz","homepage":"http://www.togglz.org/","size":1801,"stargazers_count":261,"watchers_count":261,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":99,"mirror_url":null,"open_issues_count":31,"forks":99,"open_issues":31,"watchers":261,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/togglz/togglz/pulls/196"},"html":{"href":"https://github.com/togglz/togglz/pull/196"},"issue":{"href":"https://api.github.com/repos/togglz/togglz/issues/196"},"comments":{"href":"https://api.github.com/repos/togglz/togglz/issues/196/comments"},"review_comments":{"href":"https://api.github.com/repos/togglz/togglz/pulls/196/comments"},"review_comment":{"href":"https://api.github.com/repos/togglz/togglz/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/togglz/togglz/pulls/196/commits"},"statuses":{"href":"https://api.github.com/repos/togglz/togglz/statuses/1e991255c59b133696128e77a9c2ad44598d269b"}}}}
{"actor":{"display_login":"hexmind"}}