{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/nakadi/pulls/comments/82575260","pull_request_review_id":3472733,"id":82575260,"diff_hunk":"@@ -0,0 +1,114 @@\n+package org.zalando.nakadi.webservice;\n+\n+import com.fasterxml.jackson.core.JsonProcessingException;\n+import com.fasterxml.jackson.databind.ObjectMapper;\n+import com.jayway.restassured.http.ContentType;\n+import org.apache.commons.collections.map.HashedMap;\n+import org.apache.curator.framework.CuratorFramework;\n+import org.apache.http.HttpStatus;\n+import org.junit.After;\n+import org.junit.Assert;\n+import org.junit.Test;\n+import org.zalando.nakadi.config.JsonConfig;\n+import org.zalando.nakadi.domain.EventType;\n+import org.zalando.nakadi.service.FloodService;\n+import org.zalando.nakadi.utils.JsonTestHelper;\n+import org.zalando.nakadi.webservice.utils.NakadiTestUtils;\n+import org.zalando.nakadi.webservice.utils.ZookeeperTestUtils;\n+\n+import java.io.IOException;\n+import java.util.Collections;\n+import java.util.HashMap;\n+import java.util.Set;\n+\n+import static com.jayway.restassured.RestAssured.given;\n+\n+public class NakadiControllerAT extends BaseAT {\n+\n+    private static final String FLOODERS_URL = \"/nakadi/flooders\";\n+    private static final ObjectMapper MAPPER = (new JsonConfig()).jacksonObjectMapper();\n+    private static final JsonTestHelper JSON_HELPER = new JsonTestHelper(MAPPER);\n+    private static final CuratorFramework CURATOR = ZookeeperTestUtils.createCurator(ZOOKEEPER_URL);\n+\n+    @After\n+    public void setUp() {\n+        clearFloodersData();\n+    }\n+\n+    @Test\n+    public void testBlockFlooder() throws Exception {\n+        final EventType eventType = NakadiTestUtils.createEventType();\n+        blockFlooder(new FloodService.Flooder(eventType.getName(), FloodService.Type.CONSUMER_ET));\n+\n+        Assert.assertNotNull(CURATOR.checkExists()\n+                .forPath(\"/nakadi/flooders/consumers/event_types/\" + eventType.getName()));\n+    }\n+\n+    @Test\n+    public void testUnblockFlooder() throws Exception {\n+        final EventType eventType = NakadiTestUtils.createEventType();\n+        final FloodService.Flooder flooder =\n+                new FloodService.Flooder(eventType.getName(), FloodService.Type.CONSUMER_ET);\n+        blockFlooder(flooder);\n+\n+        unblockFlooder(flooder);\n+\n+        Assert.assertNull(CURATOR.checkExists()\n+                .forPath(\"/nakadi/flooders/consumers/event_types/\" + eventType.getName()));\n+    }\n+\n+    @Test\n+    public void testGetFlooders() throws Exception {\n+        final EventType eventType = NakadiTestUtils.createEventType();\n+\n+        final FloodService.Flooder flooder =\n+                new FloodService.Flooder(eventType.getName(), FloodService.Type.CONSUMER_ET);\n+        blockFlooder(flooder);\n+\n+        given()\n+                .contentType(ContentType.JSON)\n+                .get(FLOODERS_URL)\n+                .then()\n+                .statusCode(HttpStatus.SC_OK)\n+                .content(JSON_HELPER.matchesObject(new HashedMap() {\n+                    {","path":"src/acceptance-test/java/org/zalando/nakadi/webservice/NakadiControllerAT.java","position":74,"original_position":74,"commit_id":"9edfe704728bfc8e056ca8591c34d8a81e3dde81","original_commit_id":"9edfe704728bfc8e056ca8591c34d8a81e3dde81","user":{"login":"v-stepanov","id":13309177,"avatar_url":"https://avatars.githubusercontent.com/u/13309177?v=3","gravatar_id":"","url":"https://api.github.com/users/v-stepanov","html_url":"https://github.com/v-stepanov","followers_url":"https://api.github.com/users/v-stepanov/followers","following_url":"https://api.github.com/users/v-stepanov/following{/other_user}","gists_url":"https://api.github.com/users/v-stepanov/gists{/gist_id}","starred_url":"https://api.github.com/users/v-stepanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/v-stepanov/subscriptions","organizations_url":"https://api.github.com/users/v-stepanov/orgs","repos_url":"https://api.github.com/users/v-stepanov/repos","events_url":"https://api.github.com/users/v-stepanov/events{/privacy}","received_events_url":"https://api.github.com/users/v-stepanov/received_events","type":"User","site_admin":false},"body":"`{{`","created_at":"2016-10-10T10:06:05Z","updated_at":"2016-10-10T10:06:05Z","html_url":"https://github.com/zalando/nakadi/pull/447#discussion_r82575260","pull_request_url":"https://api.github.com/repos/zalando/nakadi/pulls/447","_links":{"self":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/comments/82575260"},"html":{"href":"https://github.com/zalando/nakadi/pull/447#discussion_r82575260"},"pull_request":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/447"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/nakadi/pulls/447","id":87080655,"html_url":"https://github.com/zalando/nakadi/pull/447","diff_url":"https://github.com/zalando/nakadi/pull/447.diff","patch_url":"https://github.com/zalando/nakadi/pull/447.patch","issue_url":"https://api.github.com/repos/zalando/nakadi/issues/447","number":447,"state":"open","locked":false,"title":"ARUHA-355: Block abusive producers/consumers","user":{"login":"adyach","id":4863810,"avatar_url":"https://avatars.githubusercontent.com/u/4863810?v=3","gravatar_id":"","url":"https://api.github.com/users/adyach","html_url":"https://github.com/adyach","followers_url":"https://api.github.com/users/adyach/followers","following_url":"https://api.github.com/users/adyach/following{/other_user}","gists_url":"https://api.github.com/users/adyach/gists{/gist_id}","starred_url":"https://api.github.com/users/adyach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adyach/subscriptions","organizations_url":"https://api.github.com/users/adyach/orgs","repos_url":"https://api.github.com/users/adyach/repos","events_url":"https://api.github.com/users/adyach/events{/privacy}","received_events_url":"https://api.github.com/users/adyach/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-28T09:07:03Z","updated_at":"2016-10-10T10:06:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c53c177e922ef03f6de237bd3e2d48930b537a5c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zalando/nakadi/pulls/447/commits","review_comments_url":"https://api.github.com/repos/zalando/nakadi/pulls/447/comments","review_comment_url":"https://api.github.com/repos/zalando/nakadi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/nakadi/issues/447/comments","statuses_url":"https://api.github.com/repos/zalando/nakadi/statuses/9edfe704728bfc8e056ca8591c34d8a81e3dde81","head":{"label":"zalando:feature/aruha-355","ref":"feature/aruha-355","sha":"9edfe704728bfc8e056ca8591c34d8a81e3dde81","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":44234368,"name":"nakadi","full_name":"zalando/nakadi","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/nakadi","description":"A distributed event bus that implements a RESTful API abstraction instead of Kafka-like queues","fork":false,"url":"https://api.github.com/repos/zalando/nakadi","forks_url":"https://api.github.com/repos/zalando/nakadi/forks","keys_url":"https://api.github.com/repos/zalando/nakadi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/nakadi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/nakadi/teams","hooks_url":"https://api.github.com/repos/zalando/nakadi/hooks","issue_events_url":"https://api.github.com/repos/zalando/nakadi/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/nakadi/events","assignees_url":"https://api.github.com/repos/zalando/nakadi/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/nakadi/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/nakadi/tags","blobs_url":"https://api.github.com/repos/zalando/nakadi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/nakadi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/nakadi/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/nakadi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/nakadi/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/nakadi/languages","stargazers_url":"https://api.github.com/repos/zalando/nakadi/stargazers","contributors_url":"https://api.github.com/repos/zalando/nakadi/contributors","subscribers_url":"https://api.github.com/repos/zalando/nakadi/subscribers","subscription_url":"https://api.github.com/repos/zalando/nakadi/subscription","commits_url":"https://api.github.com/repos/zalando/nakadi/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/nakadi/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/nakadi/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/nakadi/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/nakadi/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/nakadi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/nakadi/merges","archive_url":"https://api.github.com/repos/zalando/nakadi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/nakadi/downloads","issues_url":"https://api.github.com/repos/zalando/nakadi/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/nakadi/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/nakadi/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/nakadi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/nakadi/labels{/name}","releases_url":"https://api.github.com/repos/zalando/nakadi/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/nakadi/deployments","created_at":"2015-10-14T08:30:17Z","updated_at":"2016-10-09T05:26:04Z","pushed_at":"2016-10-10T09:41:23Z","git_url":"git://github.com/zalando/nakadi.git","ssh_url":"git@github.com:zalando/nakadi.git","clone_url":"https://github.com/zalando/nakadi.git","svn_url":"https://github.com/zalando/nakadi","homepage":"","size":4055,"stargazers_count":50,"watchers_count":50,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":26,"forks":27,"open_issues":26,"watchers":50,"default_branch":"master"}},"base":{"label":"zalando:master","ref":"master","sha":"da7ecdbe04f3a78dab73f1bb498a0b36e4fcd2af","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":44234368,"name":"nakadi","full_name":"zalando/nakadi","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/nakadi","description":"A distributed event bus that implements a RESTful API abstraction instead of Kafka-like queues","fork":false,"url":"https://api.github.com/repos/zalando/nakadi","forks_url":"https://api.github.com/repos/zalando/nakadi/forks","keys_url":"https://api.github.com/repos/zalando/nakadi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/nakadi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/nakadi/teams","hooks_url":"https://api.github.com/repos/zalando/nakadi/hooks","issue_events_url":"https://api.github.com/repos/zalando/nakadi/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/nakadi/events","assignees_url":"https://api.github.com/repos/zalando/nakadi/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/nakadi/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/nakadi/tags","blobs_url":"https://api.github.com/repos/zalando/nakadi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/nakadi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/nakadi/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/nakadi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/nakadi/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/nakadi/languages","stargazers_url":"https://api.github.com/repos/zalando/nakadi/stargazers","contributors_url":"https://api.github.com/repos/zalando/nakadi/contributors","subscribers_url":"https://api.github.com/repos/zalando/nakadi/subscribers","subscription_url":"https://api.github.com/repos/zalando/nakadi/subscription","commits_url":"https://api.github.com/repos/zalando/nakadi/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/nakadi/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/nakadi/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/nakadi/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/nakadi/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/nakadi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/nakadi/merges","archive_url":"https://api.github.com/repos/zalando/nakadi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/nakadi/downloads","issues_url":"https://api.github.com/repos/zalando/nakadi/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/nakadi/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/nakadi/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/nakadi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/nakadi/labels{/name}","releases_url":"https://api.github.com/repos/zalando/nakadi/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/nakadi/deployments","created_at":"2015-10-14T08:30:17Z","updated_at":"2016-10-09T05:26:04Z","pushed_at":"2016-10-10T09:41:23Z","git_url":"git://github.com/zalando/nakadi.git","ssh_url":"git@github.com:zalando/nakadi.git","clone_url":"https://github.com/zalando/nakadi.git","svn_url":"https://github.com/zalando/nakadi","homepage":"","size":4055,"stargazers_count":50,"watchers_count":50,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":26,"forks":27,"open_issues":26,"watchers":50,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/447"},"html":{"href":"https://github.com/zalando/nakadi/pull/447"},"issue":{"href":"https://api.github.com/repos/zalando/nakadi/issues/447"},"comments":{"href":"https://api.github.com/repos/zalando/nakadi/issues/447/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/447/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/447/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/nakadi/statuses/9edfe704728bfc8e056ca8591c34d8a81e3dde81"}}}}
{"actor":{"display_login":"v-stepanov"}}