{"action":"created","comment":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/comments/42858411","id":42858411,"diff_hunk":"@@ -0,0 +1,196 @@\n+/*\n+ * Copyright 2015 the original author or authors.\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+\n+package org.springframework.cloud.stream.module.file.source;\n+\n+import static org.junit.Assert.assertEquals;\n+import static org.junit.Assert.assertNotNull;\n+import static org.junit.Assert.assertNull;\n+import static org.junit.Assert.assertThat;\n+import static org.junit.Assert.assertTrue;\n+\n+import java.io.File;\n+import java.io.FileNotFoundException;\n+import java.io.FileOutputStream;\n+import java.io.IOException;\n+import java.util.concurrent.TimeUnit;\n+\n+import org.hamcrest.Matchers;\n+import org.junit.Test;\n+import org.junit.runner.RunWith;\n+\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.boot.test.IntegrationTest;\n+import org.springframework.boot.test.SpringApplicationConfiguration;\n+import org.springframework.cloud.stream.messaging.Source;\n+import org.springframework.cloud.stream.test.binder.MessageCollector;\n+import org.springframework.integration.file.splitter.FileSplitter;\n+import org.springframework.messaging.Message;\n+import org.springframework.test.annotation.DirtiesContext;\n+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\n+\n+/**\n+ * @author Gary Russell\n+ */\n+@RunWith(SpringJUnit4ClassRunner.class)\n+@SpringApplicationConfiguration(classes = FileSourceApplication.class)\n+@DirtiesContext\n+public abstract class FileSourceTests {\n+\n+\tprivate static final String TMPDIR = System.getProperty(\"java.io.tmpdir\");\n+\n+\tprivate static final String ROOT_DIR = TMPDIR + File.separator + \"dataflow-tests\"\n+\t\t\t+ File.separator + \"input\";\n+\n+\tprotected File atomicFileCreate(String filename) throws FileNotFoundException, IOException {\n+\t\tFile file = new File(ROOT_DIR, filename + \".tmp\");\n+\t\tFile fileFinal = new File(ROOT_DIR, \"test.txt\");\n+\t\tfile.delete();\n+\t\tfile.deleteOnExit();\n+\t\tfileFinal.delete();\n+\t\tfileFinal.deleteOnExit();\n+\t\tFileOutputStream fos = new FileOutputStream(file);\n+\t\tfos.write(\"this is a test\\nline2\\n\".getBytes());\n+\t\tfos.close();\n+\t\tassertTrue(file.renameTo(fileFinal));\n+\t\treturn fileFinal;\n+\t}\n+\n+\t@Autowired\n+\tprotected Source source;\n+\n+\t@Autowired\n+\tprotected MessageCollector messageCollector;\n+\n+\t@IntegrationTest({ \"directory = ${java.io.tmpdir}${file.separator}dataflow-tests${file.separator}input\",","path":"file-source/src/test/java/org/springframework/cloud/stream/module/file/source/FileSourceTests.java","position":78,"original_position":78,"commit_id":"bf8e6bebe24c2f5948e3f9485fd0131171a6e139","original_commit_id":"bf8e6bebe24c2f5948e3f9485fd0131171a6e139","user":{"login":"ericbottard","id":313494,"avatar_url":"https://avatars.githubusercontent.com/u/313494?v=3","gravatar_id":"","url":"https://api.github.com/users/ericbottard","html_url":"https://github.com/ericbottard","followers_url":"https://api.github.com/users/ericbottard/followers","following_url":"https://api.github.com/users/ericbottard/following{/other_user}","gists_url":"https://api.github.com/users/ericbottard/gists{/gist_id}","starred_url":"https://api.github.com/users/ericbottard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericbottard/subscriptions","organizations_url":"https://api.github.com/users/ericbottard/orgs","repos_url":"https://api.github.com/users/ericbottard/repos","events_url":"https://api.github.com/users/ericbottard/events{/privacy}","received_events_url":"https://api.github.com/users/ericbottard/received_events","type":"User","site_admin":false},"body":"Hmm, did not see that. Let's not get into a paternity war, shall we ;) Anyway, this is good (new) news to me!","created_at":"2015-10-23T12:19:16Z","updated_at":"2015-10-23T12:19:16Z","html_url":"https://github.com/spring-cloud/spring-cloud-stream-modules/pull/51#discussion_r42858411","pull_request_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/51","_links":{"self":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/comments/42858411"},"html":{"href":"https://github.com/spring-cloud/spring-cloud-stream-modules/pull/51#discussion_r42858411"},"pull_request":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/51"}}},"pull_request":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/51","id":48510670,"html_url":"https://github.com/spring-cloud/spring-cloud-stream-modules/pull/51","diff_url":"https://github.com/spring-cloud/spring-cloud-stream-modules/pull/51.diff","patch_url":"https://github.com/spring-cloud/spring-cloud-stream-modules/pull/51.patch","issue_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/issues/51","number":51,"state":"open","locked":false,"title":"XD-3622: File Source","user":{"login":"garyrussell","id":483832,"avatar_url":"https://avatars.githubusercontent.com/u/483832?v=3","gravatar_id":"","url":"https://api.github.com/users/garyrussell","html_url":"https://github.com/garyrussell","followers_url":"https://api.github.com/users/garyrussell/followers","following_url":"https://api.github.com/users/garyrussell/following{/other_user}","gists_url":"https://api.github.com/users/garyrussell/gists{/gist_id}","starred_url":"https://api.github.com/users/garyrussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyrussell/subscriptions","organizations_url":"https://api.github.com/users/garyrussell/orgs","repos_url":"https://api.github.com/users/garyrussell/repos","events_url":"https://api.github.com/users/garyrussell/events{/privacy}","received_events_url":"https://api.github.com/users/garyrussell/received_events","type":"User","site_admin":false},"body":"JIRA: https://jira.spring.io/browse/XD-3622\r\n\r\nPort file source from XD; add regex for pattern.","created_at":"2015-10-22T20:46:54Z","updated_at":"2015-10-23T12:19:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9eb0f75b41464bc82cf3b5d95d56b10a0bf08132","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/51/commits","review_comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/51/comments","review_comment_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/issues/51/comments","statuses_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/statuses/bf8e6bebe24c2f5948e3f9485fd0131171a6e139","head":{"label":"garyrussell:XD-3622","ref":"XD-3622","sha":"bf8e6bebe24c2f5948e3f9485fd0131171a6e139","user":{"login":"garyrussell","id":483832,"avatar_url":"https://avatars.githubusercontent.com/u/483832?v=3","gravatar_id":"","url":"https://api.github.com/users/garyrussell","html_url":"https://github.com/garyrussell","followers_url":"https://api.github.com/users/garyrussell/followers","following_url":"https://api.github.com/users/garyrussell/following{/other_user}","gists_url":"https://api.github.com/users/garyrussell/gists{/gist_id}","starred_url":"https://api.github.com/users/garyrussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyrussell/subscriptions","organizations_url":"https://api.github.com/users/garyrussell/orgs","repos_url":"https://api.github.com/users/garyrussell/repos","events_url":"https://api.github.com/users/garyrussell/events{/privacy}","received_events_url":"https://api.github.com/users/garyrussell/received_events","type":"User","site_admin":false},"repo":{"id":43704454,"name":"spring-cloud-stream-modules","full_name":"garyrussell/spring-cloud-stream-modules","owner":{"login":"garyrussell","id":483832,"avatar_url":"https://avatars.githubusercontent.com/u/483832?v=3","gravatar_id":"","url":"https://api.github.com/users/garyrussell","html_url":"https://github.com/garyrussell","followers_url":"https://api.github.com/users/garyrussell/followers","following_url":"https://api.github.com/users/garyrussell/following{/other_user}","gists_url":"https://api.github.com/users/garyrussell/gists{/gist_id}","starred_url":"https://api.github.com/users/garyrussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyrussell/subscriptions","organizations_url":"https://api.github.com/users/garyrussell/orgs","repos_url":"https://api.github.com/users/garyrussell/repos","events_url":"https://api.github.com/users/garyrussell/events{/privacy}","received_events_url":"https://api.github.com/users/garyrussell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/garyrussell/spring-cloud-stream-modules","description":"","fork":true,"url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules","forks_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/forks","keys_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/teams","hooks_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/hooks","issue_events_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/issues/events{/number}","events_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/events","assignees_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/assignees{/user}","branches_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/branches{/branch}","tags_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/tags","blobs_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/languages","stargazers_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/stargazers","contributors_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/contributors","subscribers_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/subscribers","subscription_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/subscription","commits_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/contents/{+path}","compare_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/merges","archive_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/downloads","issues_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/issues{/number}","pulls_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/labels{/name}","releases_url":"https://api.github.com/repos/garyrussell/spring-cloud-stream-modules/releases{/id}","created_at":"2015-10-05T18:18:21Z","updated_at":"2015-10-05T18:18:22Z","pushed_at":"2015-10-22T20:40:18Z","git_url":"git://github.com/garyrussell/spring-cloud-stream-modules.git","ssh_url":"git@github.com:garyrussell/spring-cloud-stream-modules.git","clone_url":"https://github.com/garyrussell/spring-cloud-stream-modules.git","svn_url":"https://github.com/garyrussell/spring-cloud-stream-modules","homepage":null,"size":1080,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spring-cloud:master","ref":"master","sha":"ed9a37782e155afd882874e44409c87e55084114","user":{"login":"spring-cloud","id":7815877,"avatar_url":"https://avatars.githubusercontent.com/u/7815877?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-cloud","html_url":"https://github.com/spring-cloud","followers_url":"https://api.github.com/users/spring-cloud/followers","following_url":"https://api.github.com/users/spring-cloud/following{/other_user}","gists_url":"https://api.github.com/users/spring-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-cloud/subscriptions","organizations_url":"https://api.github.com/users/spring-cloud/orgs","repos_url":"https://api.github.com/users/spring-cloud/repos","events_url":"https://api.github.com/users/spring-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/spring-cloud/received_events","type":"Organization","site_admin":false},"repo":{"id":40096018,"name":"spring-cloud-stream-modules","full_name":"spring-cloud/spring-cloud-stream-modules","owner":{"login":"spring-cloud","id":7815877,"avatar_url":"https://avatars.githubusercontent.com/u/7815877?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-cloud","html_url":"https://github.com/spring-cloud","followers_url":"https://api.github.com/users/spring-cloud/followers","following_url":"https://api.github.com/users/spring-cloud/following{/other_user}","gists_url":"https://api.github.com/users/spring-cloud/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-cloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-cloud/subscriptions","organizations_url":"https://api.github.com/users/spring-cloud/orgs","repos_url":"https://api.github.com/users/spring-cloud/repos","events_url":"https://api.github.com/users/spring-cloud/events{/privacy}","received_events_url":"https://api.github.com/users/spring-cloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spring-cloud/spring-cloud-stream-modules","description":"","fork":false,"url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules","forks_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/forks","keys_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/teams","hooks_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/hooks","issue_events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/issues/events{/number}","events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/events","assignees_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/assignees{/user}","branches_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/branches{/branch}","tags_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/tags","blobs_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/languages","stargazers_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/stargazers","contributors_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/contributors","subscribers_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/subscribers","subscription_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/subscription","commits_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/contents/{+path}","compare_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/merges","archive_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/downloads","issues_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/issues{/number}","pulls_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/labels{/name}","releases_url":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/releases{/id}","created_at":"2015-08-02T23:22:20Z","updated_at":"2015-10-15T20:02:14Z","pushed_at":"2015-10-22T20:46:54Z","git_url":"git://github.com/spring-cloud/spring-cloud-stream-modules.git","ssh_url":"git@github.com:spring-cloud/spring-cloud-stream-modules.git","clone_url":"https://github.com/spring-cloud/spring-cloud-stream-modules.git","svn_url":"https://github.com/spring-cloud/spring-cloud-stream-modules","homepage":null,"size":1820,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15,"mirror_url":null,"open_issues_count":5,"forks":15,"open_issues":5,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/51"},"html":{"href":"https://github.com/spring-cloud/spring-cloud-stream-modules/pull/51"},"issue":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/issues/51"},"comments":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/issues/51/comments"},"review_comments":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/51/comments"},"review_comment":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/pulls/51/commits"},"statuses":{"href":"https://api.github.com/repos/spring-cloud/spring-cloud-stream-modules/statuses/bf8e6bebe24c2f5948e3f9485fd0131171a6e139"}}}}