{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/nakadi/pulls/comments/73114759","id":73114759,"diff_hunk":"@@ -0,0 +1,119 @@\n+package org.zalando.nakadi.controller;\n+\n+import com.codahale.metrics.MetricRegistry;\n+import com.fasterxml.jackson.databind.ObjectMapper;\n+import org.junit.Assert;\n+import org.junit.Test;\n+import org.mockito.Matchers;\n+import org.mockito.Mockito;\n+import org.springframework.core.MethodParameter;\n+import org.springframework.http.converter.StringHttpMessageConverter;\n+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;\n+import org.springframework.test.web.servlet.ResultActions;\n+import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;\n+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;\n+import org.springframework.test.web.servlet.result.MockMvcResultMatchers;\n+import org.springframework.test.web.servlet.setup.MockMvcBuilders;\n+import org.springframework.test.web.servlet.setup.StandaloneMockMvcBuilder;\n+import org.springframework.web.bind.support.WebDataBinderFactory;\n+import org.springframework.web.context.request.NativeWebRequest;\n+import org.springframework.web.method.support.HandlerMethodArgumentResolver;\n+import org.springframework.web.method.support.ModelAndViewContainer;\n+import org.zalando.nakadi.config.JsonConfig;\n+import org.zalando.nakadi.domain.EventType;\n+import org.zalando.nakadi.enrichment.Enrichment;\n+import org.zalando.nakadi.exceptions.IllegalScopeException;\n+import org.zalando.nakadi.metrics.EventTypeMetricRegistry;\n+import org.zalando.nakadi.metrics.EventTypeMetrics;\n+import org.zalando.nakadi.partitioning.PartitionResolver;\n+import org.zalando.nakadi.repository.TopicRepository;\n+import org.zalando.nakadi.repository.db.EventTypeCache;\n+import org.zalando.nakadi.security.AuthorizedClient;\n+import org.zalando.nakadi.security.Client;\n+import org.zalando.nakadi.service.EventPublisher;\n+import org.zalando.nakadi.utils.EventTypeTestBuilder;\n+import org.zalando.nakadi.validation.EventTypeValidator;\n+\n+import java.util.Collections;\n+import java.util.Set;\n+\n+import static org.springframework.http.MediaType.APPLICATION_JSON;\n+\n+public final class EventScopeTest {\n+\n+    private static final String EVENT_NAME = \"my-event\";\n+    private static final String EVENT_BATCH = \"[{\\\"payload\\\": \\\"My Event Payload\\\"}]\";\n+    private static final Set<String> SCOPE_WRITE = Collections.singleton(\"oauth2.scope.write\");\n+    private static final String URL = \"/event-types/\" + EVENT_NAME + \"/events\";\n+\n+    private final ObjectMapper objectMapper = new JsonConfig().jacksonObjectMapper();\n+    private final EventTypeCache eventTypeCache;\n+    private final StandaloneMockMvcBuilder mvcBuilder;\n+\n+    public EventScopeTest() throws Exception {","path":"src/test/java/org/zalando/nakadi/controller/EventScopeTest.java","position":53,"original_position":53,"commit_id":"c1e91c19bfb78cd04f0bf9055f1f4363e54a3c8d","original_commit_id":"33864ef84f91ced41ed2ab46d9fe90ed7b231ce9","user":{"login":"rcillo","id":344648,"avatar_url":"https://avatars.githubusercontent.com/u/344648?v=3","gravatar_id":"","url":"https://api.github.com/users/rcillo","html_url":"https://github.com/rcillo","followers_url":"https://api.github.com/users/rcillo/followers","following_url":"https://api.github.com/users/rcillo/following{/other_user}","gists_url":"https://api.github.com/users/rcillo/gists{/gist_id}","starred_url":"https://api.github.com/users/rcillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcillo/subscriptions","organizations_url":"https://api.github.com/users/rcillo/orgs","repos_url":"https://api.github.com/users/rcillo/repos","events_url":"https://api.github.com/users/rcillo/events{/privacy}","received_events_url":"https://api.github.com/users/rcillo/received_events","type":"User","site_admin":false},"body":"I mean, the new code was added the publisher class. Maybe we should just add 1 mock test there to make sure the helper is invoked and another one in the controller to simulate a throwing condition.","created_at":"2016-08-02T08:32:42Z","updated_at":"2016-08-02T08:32:42Z","html_url":"https://github.com/zalando/nakadi/pull/362#discussion_r73114759","pull_request_url":"https://api.github.com/repos/zalando/nakadi/pulls/362","_links":{"self":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/comments/73114759"},"html":{"href":"https://github.com/zalando/nakadi/pull/362#discussion_r73114759"},"pull_request":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/362"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/nakadi/pulls/362","id":79364770,"html_url":"https://github.com/zalando/nakadi/pull/362","diff_url":"https://github.com/zalando/nakadi/pull/362.diff","patch_url":"https://github.com/zalando/nakadi/pull/362.patch","issue_url":"https://api.github.com/repos/zalando/nakadi/issues/362","number":362,"state":"open","locked":false,"title":"ARUHA-224 Support per event type definition of scopes for reading and writing","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-07-29T14:06:03Z","updated_at":"2016-08-02T08:32:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6e89c49bd6eef83aa2c8a02ff888dc75053578d0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zalando/nakadi/pulls/362/commits","review_comments_url":"https://api.github.com/repos/zalando/nakadi/pulls/362/comments","review_comment_url":"https://api.github.com/repos/zalando/nakadi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/nakadi/issues/362/comments","statuses_url":"https://api.github.com/repos/zalando/nakadi/statuses/c1e91c19bfb78cd04f0bf9055f1f4363e54a3c8d","head":{"label":"zalando:feature/ARUHA-224","ref":"feature/ARUHA-224","sha":"c1e91c19bfb78cd04f0bf9055f1f4363e54a3c8d","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-08-01T13:36:05Z","pushed_at":"2016-08-02T08:11:08Z","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":3368,"stargazers_count":30,"watchers_count":30,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":9,"forks":20,"open_issues":9,"watchers":30,"default_branch":"master"}},"base":{"label":"zalando:master","ref":"master","sha":"3ae041639f17c93897dd392177839e5bd34ea0a4","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-08-01T13:36:05Z","pushed_at":"2016-08-02T08:11:08Z","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":3368,"stargazers_count":30,"watchers_count":30,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":9,"forks":20,"open_issues":9,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/362"},"html":{"href":"https://github.com/zalando/nakadi/pull/362"},"issue":{"href":"https://api.github.com/repos/zalando/nakadi/issues/362"},"comments":{"href":"https://api.github.com/repos/zalando/nakadi/issues/362/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/362/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/362/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/nakadi/statuses/c1e91c19bfb78cd04f0bf9055f1f4363e54a3c8d"}}}}
{"actor":{"display_login":"rcillo"}}