{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/151170243","pull_request_review_id":76834806,"id":151170243,"diff_hunk":"@@ -45,28 +104,167 @@ class AttributesSpec extends StreamSpec {\n \n   \"attributes\" must {\n \n+    val attributes = Attributes.name(\"a\") and Attributes.name(\"b\") and Attributes.inputBuffer(1, 2)\n+\n+    \"give access to first attribute\" in {\n+      attributes.getFirst[Name] should ===(Some(Attributes.Name(\"a\")))\n+    }\n+\n+    \"give access to attribute byt type\" in {\n+      attributes.get[Name] should ===(Some(Attributes.Name(\"b\")))\n+    }\n+\n+  }\n+\n+  \"attributes on a stage\" must {\n+\n     \"be overridable on a module basis\" in {\n-      val runnable = Source.empty.toMat(AttributesSink().withAttributes(Attributes.name(\"new-name\")))(Keep.right)\n-      whenReady(runnable.run()) { attributes ⇒\n-        attributes.get[Name] should contain(Name(\"new-name\"))\n-      }\n+      val attributes =\n+        Source.fromGraph(new AttributesSource().withAttributes(Attributes.name(\"new-name\")))\n+          .runWith(Sink.head)\n+          .futureValue\n+      attributes.get[Name] should contain(Name(\"new-name\"))\n     }\n \n     \"keep the outermost attribute as the least specific\" in {\n-      val runnable = Source.empty.toMat(AttributesSink())(Keep.right).withAttributes(Attributes.name(\"new-name\"))\n-      whenReady(runnable.run()) { attributes ⇒\n-        attributes.get[Name] should contain(Name(\"attributesSink\"))\n-      }\n+      val attributes = Source.fromGraph(new AttributesSource(Attributes.name(\"original-name\")))\n+        .map(identity)\n+        .addAttributes(Attributes.name(\"whole-graph\"))\n+        .runWith(Sink.head)\n+        .futureValue\n+\n+      // most specific\n+      attributes.get[Name] should contain(Name(\"original-name\"))\n+\n+      // least specific\n+      attributes.getFirst[Name] should contain(Name(\"whole-graph\"))\n     }\n \n-    val attributes = Attributes.name(\"a\") and Attributes.name(\"b\") and Attributes.inputBuffer(1, 2)\n+    \"replace the attributes directly on a graph stage\" in {\n+      val attributes =\n+        Source.fromGraph(\n+          new AttributesSource(Attributes.name(\"original-name\")).withAttributes(Attributes.name(\"new-name\"))\n+        )\n+          .runWith(Sink.head)\n+          .futureValue\n \n-    \"give access to first attribute\" in {\n-      attributes.getFirst[Name] should ===(Some(Attributes.Name(\"a\")))\n+      // most specific\n+      attributes.get[Name] should contain(Name(\"new-name\"))\n+\n+      // least specific\n+      attributes.getFirst[Name] should contain(Name(\"new-name\"))\n     }\n \n-    \"give access to attribute byt type\" in {\n-      attributes.get[Name] should ===(Some(Attributes.Name(\"b\")))\n+    \"make the attributes on Source.fromGraph source behave the same as the stage itself\" in {\n+      val attributes =\n+        Source.fromGraph(new AttributesSource(Attributes.name(\"original-name\")))\n+          .withAttributes(Attributes.name(\"replaced\")) // this actually replaces now\n+          .toMat(Sink.head)(Keep.right).withAttributes(Attributes.name(\"whole-graph\"))\n+          .run()\n+          .futureValue\n+\n+      // most specific\n+      attributes.get[Name] should contain(Name(\"replaced\"))\n+\n+      // least specific\n+      attributes.getFirst[Name] should contain(Name(\"whole-graph\"))\n+    }\n+\n+    \"make the attributes on Flow.fromGraph source behave the same as the stage itself\" in {\n+      val attributes =\n+        Source.maybe\n+          .viaMat(\n+            Flow.fromGraph(new AttributesFlow(Attributes.name(\"original-name\")))\n+              .withAttributes(Attributes.name(\"replaced\")) // this actually replaces now\n+          )(Keep.right)\n+          .withAttributes(Attributes.name(\"source-flow\"))\n+          .toMat(Sink.ignore)(Keep.left)\n+          .withAttributes(Attributes.name(\"whole-graph\"))\n+          .run()\n+\n+      // most specific\n+      attributes.get[Name] should contain(Name(\"replaced\"))\n+\n+      // least specific\n+      attributes.getFirst[Name] should contain(Name(\"whole-graph\"))\n+    }\n+\n+    \"make the attributes on Sink.fromGraph source behave the same as the stage itself\" in {\n+      val attributes =\n+        Source.maybe.toMat(\n+          Sink.fromGraph(new AttributesSink(Attributes.name(\"original-name\")))\n+            .withAttributes(Attributes.name(\"replaced\")) // this actually replaces now\n+        )(Keep.right)\n+          .withAttributes(Attributes.name(\"whole-graph\"))\n+          .run()\n+\n+      // most specific\n+      attributes.get[Name] should contain(Name(\"replaced\"))\n+\n+      // least specific\n+      attributes.getFirst[Name] should contain(Name(\"whole-graph\"))\n+    }\n+\n+    \"use the initial attributes for dispatcher\" in {\n+      val dispatcher =\n+        Source.fromGraph(new ThreadNameSnitchingStage(\"my-dispatcher\"))\n+          .runWith(Sink.head)\n+          .futureValue\n+\n+      dispatcher should startWith(\"AttributesSpec-my-dispatcher\")\n+    }\n+\n+    \"use the most specific dispatcher when specified directly around the graph stage\" in {\n+      val dispatcher =\n+        Source.fromGraph(\n+          // directly on stage\n+          new ThreadNameSnitchingStage(\"akka.stream.default-blocking-io-dispatcher\")\n+            .addAttributes(ActorAttributes.dispatcher(\"my-dispatcher\")))\n+          .runWith(Sink.head)\n+          .futureValue\n+\n+      dispatcher should startWith(\"AttributesSpec-my-dispatcher\")\n+    }\n+\n+    \"use the most specific dispatcher when defined on a surrounding composed graph\" in {\n+      val dispatcher =\n+        Source.fromGraph(\n+          // on the composed graph\n+          new ThreadNameSnitchingStage(\"akka.stream.default-blocking-io-dispatcher\"))\n+          .map(identity)\n+          // this is now for source -> flow\n+          .addAttributes(ActorAttributes.dispatcher(\"my-dispatcher\"))","path":"akka-stream-tests/src/test/scala/akka/stream/scaladsl/AttributesSpec.scala","position":265,"original_position":265,"commit_id":"634e02d690e1a658615e6792f4740c47a0f6c52f","original_commit_id":"634e02d690e1a658615e6792f4740c47a0f6c52f","user":{"login":"patriknw","id":336161,"avatar_url":"https://avatars3.githubusercontent.com/u/336161?v=4","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"body":"does this add another async boundary, so that there is one actor for the ThreadNameSnitchingStage and another actor for map(identity) and a third for Sink.head ?\r\n\r\n","created_at":"2017-11-15T16:02:38Z","updated_at":"2017-11-15T16:04:13Z","html_url":"https://github.com/akka/akka/pull/24000#discussion_r151170243","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/24000","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/151170243"},"html":{"href":"https://github.com/akka/akka/pull/24000#discussion_r151170243"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/24000"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/24000","id":152776351,"html_url":"https://github.com/akka/akka/pull/24000","diff_url":"https://github.com/akka/akka/pull/24000.diff","patch_url":"https://github.com/akka/akka/pull/24000.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/24000","number":24000,"state":"open","locked":false,"title":"[WIP] Johan prototyping attributes that works as expected","user":{"login":"johanandren","id":666915,"avatar_url":"https://avatars3.githubusercontent.com/u/666915?v=4","gravatar_id":"","url":"https://api.github.com/users/johanandren","html_url":"https://github.com/johanandren","followers_url":"https://api.github.com/users/johanandren/followers","following_url":"https://api.github.com/users/johanandren/following{/other_user}","gists_url":"https://api.github.com/users/johanandren/gists{/gist_id}","starred_url":"https://api.github.com/users/johanandren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanandren/subscriptions","organizations_url":"https://api.github.com/users/johanandren/orgs","repos_url":"https://api.github.com/users/johanandren/repos","events_url":"https://api.github.com/users/johanandren/events{/privacy}","received_events_url":"https://api.github.com/users/johanandren/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-15T13:38:26Z","updated_at":"2017-11-15T16:04:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"da444ba6035b4399f31fde0cd6c1ea4edf1d9e85","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/24000/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/24000/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/24000/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/634e02d690e1a658615e6792f4740c47a0f6c52f","head":{"label":"johanandren:wip-prototyping-attributes-1-johanandren","ref":"wip-prototyping-attributes-1-johanandren","sha":"634e02d690e1a658615e6792f4740c47a0f6c52f","user":{"login":"johanandren","id":666915,"avatar_url":"https://avatars3.githubusercontent.com/u/666915?v=4","gravatar_id":"","url":"https://api.github.com/users/johanandren","html_url":"https://github.com/johanandren","followers_url":"https://api.github.com/users/johanandren/followers","following_url":"https://api.github.com/users/johanandren/following{/other_user}","gists_url":"https://api.github.com/users/johanandren/gists{/gist_id}","starred_url":"https://api.github.com/users/johanandren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanandren/subscriptions","organizations_url":"https://api.github.com/users/johanandren/orgs","repos_url":"https://api.github.com/users/johanandren/repos","events_url":"https://api.github.com/users/johanandren/events{/privacy}","received_events_url":"https://api.github.com/users/johanandren/received_events","type":"User","site_admin":false},"repo":{"id":41662207,"name":"akka","full_name":"johanandren/akka","owner":{"login":"johanandren","id":666915,"avatar_url":"https://avatars3.githubusercontent.com/u/666915?v=4","gravatar_id":"","url":"https://api.github.com/users/johanandren","html_url":"https://github.com/johanandren","followers_url":"https://api.github.com/users/johanandren/followers","following_url":"https://api.github.com/users/johanandren/following{/other_user}","gists_url":"https://api.github.com/users/johanandren/gists{/gist_id}","starred_url":"https://api.github.com/users/johanandren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanandren/subscriptions","organizations_url":"https://api.github.com/users/johanandren/orgs","repos_url":"https://api.github.com/users/johanandren/repos","events_url":"https://api.github.com/users/johanandren/events{/privacy}","received_events_url":"https://api.github.com/users/johanandren/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/johanandren/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/johanandren/akka","forks_url":"https://api.github.com/repos/johanandren/akka/forks","keys_url":"https://api.github.com/repos/johanandren/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/johanandren/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/johanandren/akka/teams","hooks_url":"https://api.github.com/repos/johanandren/akka/hooks","issue_events_url":"https://api.github.com/repos/johanandren/akka/issues/events{/number}","events_url":"https://api.github.com/repos/johanandren/akka/events","assignees_url":"https://api.github.com/repos/johanandren/akka/assignees{/user}","branches_url":"https://api.github.com/repos/johanandren/akka/branches{/branch}","tags_url":"https://api.github.com/repos/johanandren/akka/tags","blobs_url":"https://api.github.com/repos/johanandren/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/johanandren/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/johanandren/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/johanandren/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/johanandren/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/johanandren/akka/languages","stargazers_url":"https://api.github.com/repos/johanandren/akka/stargazers","contributors_url":"https://api.github.com/repos/johanandren/akka/contributors","subscribers_url":"https://api.github.com/repos/johanandren/akka/subscribers","subscription_url":"https://api.github.com/repos/johanandren/akka/subscription","commits_url":"https://api.github.com/repos/johanandren/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/johanandren/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/johanandren/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/johanandren/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/johanandren/akka/contents/{+path}","compare_url":"https://api.github.com/repos/johanandren/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/johanandren/akka/merges","archive_url":"https://api.github.com/repos/johanandren/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/johanandren/akka/downloads","issues_url":"https://api.github.com/repos/johanandren/akka/issues{/number}","pulls_url":"https://api.github.com/repos/johanandren/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/johanandren/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/johanandren/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/johanandren/akka/labels{/name}","releases_url":"https://api.github.com/repos/johanandren/akka/releases{/id}","deployments_url":"https://api.github.com/repos/johanandren/akka/deployments","created_at":"2015-08-31T07:37:07Z","updated_at":"2016-02-02T08:15:23Z","pushed_at":"2017-11-15T15:06:07Z","git_url":"git://github.com/johanandren/akka.git","ssh_url":"git@github.com:johanandren/akka.git","clone_url":"https://github.com/johanandren/akka.git","svn_url":"https://github.com/johanandren/akka","homepage":"http://akka.io","size":205103,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"1f8b0137a8a914d2dc075b5f1fd87a7891342503","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars2.githubusercontent.com/u/1496237?v=4","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Build highly concurrent, distributed, and resilient message-driven applications on the JVM","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2017-11-15T14:39:45Z","pushed_at":"2017-11-15T15:54:39Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":204307,"stargazers_count":7835,"watchers_count":7835,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2494,"mirror_url":null,"archived":false,"open_issues_count":609,"forks":2494,"open_issues":609,"watchers":7835,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/24000"},"html":{"href":"https://github.com/akka/akka/pull/24000"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/24000"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/24000/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/24000/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/24000/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/634e02d690e1a658615e6792f4740c47a0f6c52f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"patriknw"}}