{"action":"created","comment":{"url":"https://api.github.com/repos/mulesoft/mule/pulls/comments/43635700","id":43635700,"diff_hunk":"@@ -0,0 +1,603 @@\n+/*\n+ * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com\n+ * The software in this package is published under the terms of the CPAL v1.0\n+ * license, a copy of which has been included with this distribution in the\n+ * LICENSE.txt file.\n+ */\n+package org.mule.context.notification;\n+\n+import static org.hamcrest.CoreMatchers.is;\n+import static org.hamcrest.CoreMatchers.not;\n+import static org.hamcrest.CoreMatchers.nullValue;\n+import static org.hamcrest.CoreMatchers.startsWith;\n+import static org.hamcrest.collection.IsCollectionWithSize.hasSize;\n+import static org.hamcrest.core.IsCollectionContaining.hasItem;\n+import static org.junit.Assert.assertThat;\n+\n+import org.mule.DefaultMuleMessage;\n+import org.mule.api.MuleEvent;\n+import org.mule.api.MuleException;\n+import org.mule.api.client.LocalMuleClient;\n+import org.mule.api.config.MuleProperties;\n+import org.mule.api.context.notification.FlowCallStack;\n+import org.mule.api.context.notification.FlowStackElement;\n+import org.mule.api.context.notification.MessageProcessorNotificationListener;\n+import org.mule.api.processor.MessageProcessor;\n+import org.mule.tck.junit4.FunctionalTestCase;\n+import org.mule.tck.junit4.rule.SystemProperty;\n+\n+import java.util.List;\n+import java.util.concurrent.CountDownLatch;\n+import java.util.concurrent.TimeUnit;\n+\n+import org.junit.Before;\n+import org.junit.Rule;\n+import org.junit.Test;\n+\n+public class FlowStackTestCase extends FunctionalTestCase\n+{\n+\n+    public static class FlowStackAsserter implements MessageProcessor\n+    {\n+\n+        public static FlowCallStack stackToAssert;\n+        public static CountDownLatch stackLatch;\n+\n+        @Override\n+        public MuleEvent process(MuleEvent event) throws MuleException\n+        {\n+            stackToAssert = new DefaultFlowCallStack(event.getFlowCallStack());\n+            if (stackLatch != null)\n+            {\n+                stackLatch.countDown();\n+            }\n+            return event;\n+        }\n+    }\n+\n+    @Rule\n+    public SystemProperty flowStackEnabled = new SystemProperty(MuleProperties.SYSTEM_PROPERTY_PREFIX + \"flowCallStacks\", \"true\");\n+\n+    @Override\n+    protected String getConfigFile()\n+    {\n+        return \"org/mule/test/integration/notifications/flow-stack-config.xml\";\n+    }\n+\n+    @Before\n+    public void before()\n+    {\n+        muleContext.getNotificationManager().addInterfaceToType(\n+                MessageProcessorNotificationListener.class,\n+                MessageProcessorNotification.class);\n+\n+        FlowStackAsserter.stackToAssert = null;\n+        FlowStackAsserter.stackLatch = null;\n+    }\n+\n+    @Test\n+    public void flowStatic() throws Exception\n+    {\n+        LocalMuleClient client = muleContext.getClient();\n+        client.send(\"vm://in-flowStatic\", new DefaultMuleMessage(\"payload\", muleContext));\n+\n+        assertThat(FlowStackAsserter.stackToAssert, not(nullValue()));\n+        List<FlowStackElement> flowStackElements = FlowStackAsserter.stackToAssert.getElements();\n+        assertThat(flowStackElements, hasSize(2));\n+        assertThat(flowStackElements.get(0).getFlowName(), is(\"flow\"));\n+        assertThat(flowStackElements.get(0).currentMessageProcessor(), startsWith(\"/flow/processors/0 @\"));\n+        assertThat(flowStackElements.get(1).getFlowName(), is(\"flowStatic\"));\n+        assertThat(flowStackElements.get(1).currentMessageProcessor(), startsWith(\"/flowStatic/processors/0 @\"));\n+\n+        List<String> flowStackProcessors = FlowStackAsserter.stackToAssert.getExecutedProcessors();\n+        assertThat(flowStackProcessors, hasSize(2));","path":"tests/integration/src/test/java/org/mule/context/notification/FlowStackTestCase.java","position":93,"original_position":93,"commit_id":"0626048421dcb48410fa8463bbd0b5d8d8b70022","original_commit_id":"0626048421dcb48410fa8463bbd0b5d8d8b70022","user":{"login":"pablokraan","id":561399,"avatar_url":"https://avatars.githubusercontent.com/u/561399?v=3","gravatar_id":"","url":"https://api.github.com/users/pablokraan","html_url":"https://github.com/pablokraan","followers_url":"https://api.github.com/users/pablokraan/followers","following_url":"https://api.github.com/users/pablokraan/following{/other_user}","gists_url":"https://api.github.com/users/pablokraan/gists{/gist_id}","starred_url":"https://api.github.com/users/pablokraan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pablokraan/subscriptions","organizations_url":"https://api.github.com/users/pablokraan/orgs","repos_url":"https://api.github.com/users/pablokraan/repos","events_url":"https://api.github.com/users/pablokraan/events{/privacy}","received_events_url":"https://api.github.com/users/pablokraan/received_events","type":"User","site_admin":false},"body":"Try to removing duplication extracting methods from the tests.","created_at":"2015-11-02T14:55:50Z","updated_at":"2015-11-02T14:55:50Z","html_url":"https://github.com/mulesoft/mule/pull/2120#discussion_r43635700","pull_request_url":"https://api.github.com/repos/mulesoft/mule/pulls/2120","_links":{"self":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/comments/43635700"},"html":{"href":"https://github.com/mulesoft/mule/pull/2120#discussion_r43635700"},"pull_request":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/2120"}}},"pull_request":{"url":"https://api.github.com/repos/mulesoft/mule/pulls/2120","id":48763955,"html_url":"https://github.com/mulesoft/mule/pull/2120","diff_url":"https://github.com/mulesoft/mule/pull/2120.diff","patch_url":"https://github.com/mulesoft/mule/pull/2120.patch","issue_url":"https://api.github.com/repos/mulesoft/mule/issues/2120","number":2120,"state":"open","locked":false,"title":"MULE-9011: Expand FlowStack functionality","user":{"login":"elrodro83","id":8010105,"avatar_url":"https://avatars.githubusercontent.com/u/8010105?v=3","gravatar_id":"","url":"https://api.github.com/users/elrodro83","html_url":"https://github.com/elrodro83","followers_url":"https://api.github.com/users/elrodro83/followers","following_url":"https://api.github.com/users/elrodro83/following{/other_user}","gists_url":"https://api.github.com/users/elrodro83/gists{/gist_id}","starred_url":"https://api.github.com/users/elrodro83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elrodro83/subscriptions","organizations_url":"https://api.github.com/users/elrodro83/orgs","repos_url":"https://api.github.com/users/elrodro83/repos","events_url":"https://api.github.com/users/elrodro83/events{/privacy}","received_events_url":"https://api.github.com/users/elrodro83/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-26T16:38:28Z","updated_at":"2015-11-02T14:55:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8174fb33250adaaa677879904dbdee1f2a62bded","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mulesoft/mule/pulls/2120/commits","review_comments_url":"https://api.github.com/repos/mulesoft/mule/pulls/2120/comments","review_comment_url":"https://api.github.com/repos/mulesoft/mule/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mulesoft/mule/issues/2120/comments","statuses_url":"https://api.github.com/repos/mulesoft/mule/statuses/0626048421dcb48410fa8463bbd0b5d8d8b70022","head":{"label":"mulesoft:MULE-9011","ref":"MULE-9011","sha":"0626048421dcb48410fa8463bbd0b5d8d8b70022","user":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars.githubusercontent.com/u/185740?v=3","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"repo":{"id":7058562,"name":"mule","full_name":"mulesoft/mule","owner":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars.githubusercontent.com/u/185740?v=3","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mulesoft/mule","description":"Mule Community Edition","fork":false,"url":"https://api.github.com/repos/mulesoft/mule","forks_url":"https://api.github.com/repos/mulesoft/mule/forks","keys_url":"https://api.github.com/repos/mulesoft/mule/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mulesoft/mule/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mulesoft/mule/teams","hooks_url":"https://api.github.com/repos/mulesoft/mule/hooks","issue_events_url":"https://api.github.com/repos/mulesoft/mule/issues/events{/number}","events_url":"https://api.github.com/repos/mulesoft/mule/events","assignees_url":"https://api.github.com/repos/mulesoft/mule/assignees{/user}","branches_url":"https://api.github.com/repos/mulesoft/mule/branches{/branch}","tags_url":"https://api.github.com/repos/mulesoft/mule/tags","blobs_url":"https://api.github.com/repos/mulesoft/mule/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mulesoft/mule/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mulesoft/mule/git/refs{/sha}","trees_url":"https://api.github.com/repos/mulesoft/mule/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mulesoft/mule/statuses/{sha}","languages_url":"https://api.github.com/repos/mulesoft/mule/languages","stargazers_url":"https://api.github.com/repos/mulesoft/mule/stargazers","contributors_url":"https://api.github.com/repos/mulesoft/mule/contributors","subscribers_url":"https://api.github.com/repos/mulesoft/mule/subscribers","subscription_url":"https://api.github.com/repos/mulesoft/mule/subscription","commits_url":"https://api.github.com/repos/mulesoft/mule/commits{/sha}","git_commits_url":"https://api.github.com/repos/mulesoft/mule/git/commits{/sha}","comments_url":"https://api.github.com/repos/mulesoft/mule/comments{/number}","issue_comment_url":"https://api.github.com/repos/mulesoft/mule/issues/comments{/number}","contents_url":"https://api.github.com/repos/mulesoft/mule/contents/{+path}","compare_url":"https://api.github.com/repos/mulesoft/mule/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mulesoft/mule/merges","archive_url":"https://api.github.com/repos/mulesoft/mule/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mulesoft/mule/downloads","issues_url":"https://api.github.com/repos/mulesoft/mule/issues{/number}","pulls_url":"https://api.github.com/repos/mulesoft/mule/pulls{/number}","milestones_url":"https://api.github.com/repos/mulesoft/mule/milestones{/number}","notifications_url":"https://api.github.com/repos/mulesoft/mule/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mulesoft/mule/labels{/name}","releases_url":"https://api.github.com/repos/mulesoft/mule/releases{/id}","created_at":"2012-12-07T19:23:06Z","updated_at":"2015-11-02T08:48:25Z","pushed_at":"2015-11-02T14:50:23Z","git_url":"git://github.com/mulesoft/mule.git","ssh_url":"git@github.com:mulesoft/mule.git","clone_url":"https://github.com/mulesoft/mule.git","svn_url":"https://github.com/mulesoft/mule","homepage":null,"size":488393,"stargazers_count":245,"watchers_count":245,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":292,"mirror_url":null,"open_issues_count":18,"forks":292,"open_issues":18,"watchers":245,"default_branch":"mule-3.x"}},"base":{"label":"mulesoft:mule-3.x","ref":"mule-3.x","sha":"7c52625a0dc22656470d9c973b412cf5f24978c1","user":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars.githubusercontent.com/u/185740?v=3","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"repo":{"id":7058562,"name":"mule","full_name":"mulesoft/mule","owner":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars.githubusercontent.com/u/185740?v=3","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mulesoft/mule","description":"Mule Community Edition","fork":false,"url":"https://api.github.com/repos/mulesoft/mule","forks_url":"https://api.github.com/repos/mulesoft/mule/forks","keys_url":"https://api.github.com/repos/mulesoft/mule/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mulesoft/mule/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mulesoft/mule/teams","hooks_url":"https://api.github.com/repos/mulesoft/mule/hooks","issue_events_url":"https://api.github.com/repos/mulesoft/mule/issues/events{/number}","events_url":"https://api.github.com/repos/mulesoft/mule/events","assignees_url":"https://api.github.com/repos/mulesoft/mule/assignees{/user}","branches_url":"https://api.github.com/repos/mulesoft/mule/branches{/branch}","tags_url":"https://api.github.com/repos/mulesoft/mule/tags","blobs_url":"https://api.github.com/repos/mulesoft/mule/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mulesoft/mule/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mulesoft/mule/git/refs{/sha}","trees_url":"https://api.github.com/repos/mulesoft/mule/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mulesoft/mule/statuses/{sha}","languages_url":"https://api.github.com/repos/mulesoft/mule/languages","stargazers_url":"https://api.github.com/repos/mulesoft/mule/stargazers","contributors_url":"https://api.github.com/repos/mulesoft/mule/contributors","subscribers_url":"https://api.github.com/repos/mulesoft/mule/subscribers","subscription_url":"https://api.github.com/repos/mulesoft/mule/subscription","commits_url":"https://api.github.com/repos/mulesoft/mule/commits{/sha}","git_commits_url":"https://api.github.com/repos/mulesoft/mule/git/commits{/sha}","comments_url":"https://api.github.com/repos/mulesoft/mule/comments{/number}","issue_comment_url":"https://api.github.com/repos/mulesoft/mule/issues/comments{/number}","contents_url":"https://api.github.com/repos/mulesoft/mule/contents/{+path}","compare_url":"https://api.github.com/repos/mulesoft/mule/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mulesoft/mule/merges","archive_url":"https://api.github.com/repos/mulesoft/mule/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mulesoft/mule/downloads","issues_url":"https://api.github.com/repos/mulesoft/mule/issues{/number}","pulls_url":"https://api.github.com/repos/mulesoft/mule/pulls{/number}","milestones_url":"https://api.github.com/repos/mulesoft/mule/milestones{/number}","notifications_url":"https://api.github.com/repos/mulesoft/mule/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mulesoft/mule/labels{/name}","releases_url":"https://api.github.com/repos/mulesoft/mule/releases{/id}","created_at":"2012-12-07T19:23:06Z","updated_at":"2015-11-02T08:48:25Z","pushed_at":"2015-11-02T14:50:23Z","git_url":"git://github.com/mulesoft/mule.git","ssh_url":"git@github.com:mulesoft/mule.git","clone_url":"https://github.com/mulesoft/mule.git","svn_url":"https://github.com/mulesoft/mule","homepage":null,"size":488393,"stargazers_count":245,"watchers_count":245,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":292,"mirror_url":null,"open_issues_count":18,"forks":292,"open_issues":18,"watchers":245,"default_branch":"mule-3.x"}},"_links":{"self":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/2120"},"html":{"href":"https://github.com/mulesoft/mule/pull/2120"},"issue":{"href":"https://api.github.com/repos/mulesoft/mule/issues/2120"},"comments":{"href":"https://api.github.com/repos/mulesoft/mule/issues/2120/comments"},"review_comments":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/2120/comments"},"review_comment":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/2120/commits"},"statuses":{"href":"https://api.github.com/repos/mulesoft/mule/statuses/0626048421dcb48410fa8463bbd0b5d8d8b70022"}}}}