{"action":"created","comment":{"url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/comments/93288743","pull_request_review_id":13813208,"id":93288743,"diff_hunk":"@@ -0,0 +1,101 @@\n+/*\n+ * Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package com.hazelcast.simulator.tests.quorum;\n+\n+import org.junit.Assert;\n+\n+import com.hazelcast.core.IMap;\n+import com.hazelcast.quorum.QuorumException;\n+import com.hazelcast.simulator.test.AbstractTest;\n+import com.hazelcast.simulator.test.BaseThreadState;\n+import com.hazelcast.simulator.test.annotations.Setup;\n+import com.hazelcast.simulator.test.annotations.TimeStep;\n+\n+public class QuorumMapTest extends AbstractTest {\n+\n+    // properties\n+    public int keyCount = 100;\n+    public int gracePeriodInMilliSec = 2000;\n+    private volatile long lastInconsistencyTimestamp = 0L;\n+    private IMap<Long, Long> map;\n+\n+    @Setup\n+    @SuppressWarnings(\"unchecked\")\n+    public void setup() {\n+        map = targetInstance.getMap(name);\n+    }\n+\n+    @TimeStep\n+    public void testPut(BaseThreadState state) {\n+        final int quorumCount = targetInstance.getConfig()\n+                .getQuorumConfig(\"map-quorum-ref\").getSize();\n+        boolean operationFailed = false;\n+\n+        try {\n+            map.put((long) state.randomInt(keyCount), 0L);\n+            if (targetInstance.getCluster().getMembers().size() < quorumCount) {\n+                if (!(lastInconsistencyTimestamp > 0L)) {\n+                    startGracePeriodTimer();\n+                } else {\n+                    if (isGracePeriodElapsed()) {\n+                        operationFailed = true;\n+                    }\n+                }\n+            } else {\n+                resetGracePeriodTimer();\n+            }\n+        } catch (QuorumException qe) {\n+            if (targetInstance.getCluster().getMembers().size() >= quorumCount) {\n+                if (!(lastInconsistencyTimestamp > 0L)) {\n+                    startGracePeriodTimer();\n+                } else {\n+                    if (isGracePeriodElapsed()) {\n+                        operationFailed = true;\n+                    }\n+                }\n+            } else {\n+                resetGracePeriodTimer();\n+            }\n+        }\n+\n+        if (operationFailed) {\n+            Assert.fail(String","path":"tests/tests-hz38/src/main/java/com/hazelcast/simulator/tests/quorum/QuorumMapTest.java","position":75,"original_position":75,"commit_id":"5cfbe1b3ab5971eeb40fc76777d63c752206f569","original_commit_id":"5cfbe1b3ab5971eeb40fc76777d63c752206f569","user":{"login":"pveentjer","id":105243,"avatar_url":"https://avatars.githubusercontent.com/u/105243?v=3","gravatar_id":"","url":"https://api.github.com/users/pveentjer","html_url":"https://github.com/pveentjer","followers_url":"https://api.github.com/users/pveentjer/followers","following_url":"https://api.github.com/users/pveentjer/following{/other_user}","gists_url":"https://api.github.com/users/pveentjer/gists{/gist_id}","starred_url":"https://api.github.com/users/pveentjer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pveentjer/subscriptions","organizations_url":"https://api.github.com/users/pveentjer/orgs","repos_url":"https://api.github.com/users/pveentjer/repos","events_url":"https://api.github.com/users/pveentjer/events{/privacy}","received_events_url":"https://api.github.com/users/pveentjer/received_events","type":"User","site_admin":false},"body":"You can just throw an Exception. You don't need to call Assert.fail. Any exception is fine.","created_at":"2016-12-20T17:46:18Z","updated_at":"2016-12-20T17:46:18Z","html_url":"https://github.com/hazelcast/hazelcast-simulator/pull/1267#discussion_r93288743","pull_request_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/1267","_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/comments/93288743"},"html":{"href":"https://github.com/hazelcast/hazelcast-simulator/pull/1267#discussion_r93288743"},"pull_request":{"href":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/1267"}}},"pull_request":{"url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/1267","id":97699497,"html_url":"https://github.com/hazelcast/hazelcast-simulator/pull/1267","diff_url":"https://github.com/hazelcast/hazelcast-simulator/pull/1267.diff","patch_url":"https://github.com/hazelcast/hazelcast-simulator/pull/1267.patch","issue_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/issues/1267","number":1267,"state":"open","locked":false,"title":"adding quorum tests","user":{"login":"bansalsandeep","id":22785265,"avatar_url":"https://avatars.githubusercontent.com/u/22785265?v=3","gravatar_id":"","url":"https://api.github.com/users/bansalsandeep","html_url":"https://github.com/bansalsandeep","followers_url":"https://api.github.com/users/bansalsandeep/followers","following_url":"https://api.github.com/users/bansalsandeep/following{/other_user}","gists_url":"https://api.github.com/users/bansalsandeep/gists{/gist_id}","starred_url":"https://api.github.com/users/bansalsandeep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bansalsandeep/subscriptions","organizations_url":"https://api.github.com/users/bansalsandeep/orgs","repos_url":"https://api.github.com/users/bansalsandeep/repos","events_url":"https://api.github.com/users/bansalsandeep/events{/privacy}","received_events_url":"https://api.github.com/users/bansalsandeep/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-13T07:33:47Z","updated_at":"2016-12-20T17:46:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"03b0a2db8fdb7a481ad98b9133dc1a9bd925ee80","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/1267/commits","review_comments_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/1267/comments","review_comment_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/issues/1267/comments","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/statuses/5cfbe1b3ab5971eeb40fc76777d63c752206f569","head":{"label":"bansalsandeep:quorum-tests","ref":"quorum-tests","sha":"5cfbe1b3ab5971eeb40fc76777d63c752206f569","user":{"login":"bansalsandeep","id":22785265,"avatar_url":"https://avatars.githubusercontent.com/u/22785265?v=3","gravatar_id":"","url":"https://api.github.com/users/bansalsandeep","html_url":"https://github.com/bansalsandeep","followers_url":"https://api.github.com/users/bansalsandeep/followers","following_url":"https://api.github.com/users/bansalsandeep/following{/other_user}","gists_url":"https://api.github.com/users/bansalsandeep/gists{/gist_id}","starred_url":"https://api.github.com/users/bansalsandeep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bansalsandeep/subscriptions","organizations_url":"https://api.github.com/users/bansalsandeep/orgs","repos_url":"https://api.github.com/users/bansalsandeep/repos","events_url":"https://api.github.com/users/bansalsandeep/events{/privacy}","received_events_url":"https://api.github.com/users/bansalsandeep/received_events","type":"User","site_admin":false},"repo":{"id":71064480,"name":"hazelcast-simulator","full_name":"bansalsandeep/hazelcast-simulator","owner":{"login":"bansalsandeep","id":22785265,"avatar_url":"https://avatars.githubusercontent.com/u/22785265?v=3","gravatar_id":"","url":"https://api.github.com/users/bansalsandeep","html_url":"https://github.com/bansalsandeep","followers_url":"https://api.github.com/users/bansalsandeep/followers","following_url":"https://api.github.com/users/bansalsandeep/following{/other_user}","gists_url":"https://api.github.com/users/bansalsandeep/gists{/gist_id}","starred_url":"https://api.github.com/users/bansalsandeep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bansalsandeep/subscriptions","organizations_url":"https://api.github.com/users/bansalsandeep/orgs","repos_url":"https://api.github.com/users/bansalsandeep/repos","events_url":"https://api.github.com/users/bansalsandeep/events{/privacy}","received_events_url":"https://api.github.com/users/bansalsandeep/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bansalsandeep/hazelcast-simulator","description":"A tool for stress testing Hazelcast","fork":true,"url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator","forks_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/forks","keys_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/teams","hooks_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/hooks","issue_events_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/issues/events{/number}","events_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/events","assignees_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/assignees{/user}","branches_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/branches{/branch}","tags_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/tags","blobs_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/git/refs{/sha}","trees_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/statuses/{sha}","languages_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/languages","stargazers_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/stargazers","contributors_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/contributors","subscribers_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/subscribers","subscription_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/subscription","commits_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/commits{/sha}","git_commits_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/git/commits{/sha}","comments_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/comments{/number}","issue_comment_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/issues/comments{/number}","contents_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/contents/{+path}","compare_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/merges","archive_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/downloads","issues_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/issues{/number}","pulls_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/pulls{/number}","milestones_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/milestones{/number}","notifications_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/labels{/name}","releases_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/releases{/id}","deployments_url":"https://api.github.com/repos/bansalsandeep/hazelcast-simulator/deployments","created_at":"2016-10-16T17:04:03Z","updated_at":"2016-10-16T17:04:06Z","pushed_at":"2016-12-20T17:31:57Z","git_url":"git://github.com/bansalsandeep/hazelcast-simulator.git","ssh_url":"git@github.com:bansalsandeep/hazelcast-simulator.git","clone_url":"https://github.com/bansalsandeep/hazelcast-simulator.git","svn_url":"https://github.com/bansalsandeep/hazelcast-simulator","homepage":null,"size":16049,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"hazelcast:master","ref":"master","sha":"087d79bfb514f1b88bb174f2a109a917366e57d4","user":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"repo":{"id":11445479,"name":"hazelcast-simulator","full_name":"hazelcast/hazelcast-simulator","owner":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hazelcast/hazelcast-simulator","description":"A tool for stress testing Hazelcast","fork":false,"url":"https://api.github.com/repos/hazelcast/hazelcast-simulator","forks_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/forks","keys_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/teams","hooks_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/hooks","issue_events_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/issues/events{/number}","events_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/events","assignees_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/assignees{/user}","branches_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/branches{/branch}","tags_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/tags","blobs_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/git/refs{/sha}","trees_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/statuses/{sha}","languages_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/languages","stargazers_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/stargazers","contributors_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/contributors","subscribers_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/subscribers","subscription_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/subscription","commits_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/commits{/sha}","git_commits_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/git/commits{/sha}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/comments{/number}","issue_comment_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/issues/comments{/number}","contents_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/contents/{+path}","compare_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/merges","archive_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/downloads","issues_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/issues{/number}","pulls_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls{/number}","milestones_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/milestones{/number}","notifications_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/labels{/name}","releases_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/releases{/id}","deployments_url":"https://api.github.com/repos/hazelcast/hazelcast-simulator/deployments","created_at":"2013-07-16T09:18:54Z","updated_at":"2016-12-08T11:00:03Z","pushed_at":"2016-12-20T17:31:58Z","git_url":"git://github.com/hazelcast/hazelcast-simulator.git","ssh_url":"git@github.com:hazelcast/hazelcast-simulator.git","clone_url":"https://github.com/hazelcast/hazelcast-simulator.git","svn_url":"https://github.com/hazelcast/hazelcast-simulator","homepage":null,"size":16739,"stargazers_count":29,"watchers_count":29,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":69,"forks":40,"open_issues":69,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/1267"},"html":{"href":"https://github.com/hazelcast/hazelcast-simulator/pull/1267"},"issue":{"href":"https://api.github.com/repos/hazelcast/hazelcast-simulator/issues/1267"},"comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast-simulator/issues/1267/comments"},"review_comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/1267/comments"},"review_comment":{"href":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hazelcast/hazelcast-simulator/pulls/1267/commits"},"statuses":{"href":"https://api.github.com/repos/hazelcast/hazelcast-simulator/statuses/5cfbe1b3ab5971eeb40fc76777d63c752206f569"}}}}
{"actor":{"display_login":"pveentjer"}}