Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3C6C81831B for ; Sat, 2 Jan 2016 22:54:53 +0000 (UTC) Received: (qmail 52567 invoked by uid 500); 2 Jan 2016 22:54:53 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 52510 invoked by uid 500); 2 Jan 2016 22:54:53 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 52495 invoked by uid 99); 2 Jan 2016 22:54:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Jan 2016 22:54:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E1F03DFDCC; Sat, 2 Jan 2016 22:54:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Sat, 02 Jan 2016 22:54:52 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] camel git commit: Component docs - fixed issue with file not including all of them Repository: camel Updated Branches: refs/heads/camel-2.16.x 920a0d5f9 -> b76ae1868 refs/heads/master b10c741fe -> c3d0322a1 Component docs - fixed issue with file not including all of them Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c3d0322a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c3d0322a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c3d0322a Branch: refs/heads/master Commit: c3d0322a1f971ec6f6732ac1347d818c7e09ef9e Parents: b10c741 Author: Claus Ibsen Authored: Sat Jan 2 23:38:25 2016 +0100 Committer: Claus Ibsen Committed: Sat Jan 2 23:49:37 2016 +0100 ---------------------------------------------------------------------- .../component/file/GenericFileEndpoint.java | 37 +++++++++++++------- .../AntPathMatcherGenericFileFilterTest.java | 12 ------- 2 files changed, 24 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/c3d0322a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java index 9c4586d..160fc9f 100644 --- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java @@ -145,6 +145,8 @@ public abstract class GenericFileEndpoint extends ScheduledPollEndpoint imple protected IdempotentRepository idempotentRepository; @UriParam(label = "consumer,filter") protected GenericFileFilter filter; + @UriParam(label = "consumer,filter", defaultValue = "true") + protected boolean antFilterCaseSensitive = true; protected volatile AntPathMatcherGenericFileFilter antFilter; @UriParam(label = "consumer,filter") protected String antInclude; @@ -451,10 +453,6 @@ public abstract class GenericFileEndpoint extends ScheduledPollEndpoint imple */ public void setAntInclude(String antInclude) { this.antInclude = antInclude; - if (this.antFilter == null) { - this.antFilter = new AntPathMatcherGenericFileFilter(); - } - this.antFilter.setIncludes(antInclude); } public String getAntExclude() { @@ -467,20 +465,17 @@ public abstract class GenericFileEndpoint extends ScheduledPollEndpoint imple */ public void setAntExclude(String antExclude) { this.antExclude = antExclude; - if (this.antFilter == null) { - this.antFilter = new AntPathMatcherGenericFileFilter(); - } - this.antFilter.setExcludes(antExclude); + } + + public boolean isAntFilterCaseSensitive() { + return antFilterCaseSensitive; } /** - * Sets case sensitive flag on {@link org.apache.camel.component.file.AntPathMatcherFileFilter} + * Sets case sensitive flag on ant fiter */ public void setAntFilterCaseSensitive(boolean antFilterCaseSensitive) { - if (this.antFilter == null) { - this.antFilter = new AntPathMatcherGenericFileFilter(); - } - this.antFilter.setCaseSensitive(antFilterCaseSensitive); + this.antFilterCaseSensitive = antFilterCaseSensitive; } public GenericFileFilter getAntFilter() { @@ -1417,6 +1412,22 @@ public abstract class GenericFileEndpoint extends ScheduledPollEndpoint imple throw new IllegalArgumentException("IdempotentRepository must be configured when using readLock=idempotent"); } + if (antInclude != null) { + if (antFilter == null) { + antFilter = new AntPathMatcherGenericFileFilter<>(); + } + antFilter.setIncludes(antInclude); + } + if (antExclude != null) { + if (antFilter == null) { + antFilter = new AntPathMatcherGenericFileFilter<>(); + } + antFilter.setExcludes(antExclude); + } + if (antFilter != null) { + antFilter.setCaseSensitive(antFilterCaseSensitive); + } + // idempotent repository may be used by others, so add it as a service so its stopped when CamelContext stops if (idempotentRepository != null) { getCamelContext().addService(idempotentRepository, true); http://git-wip-us.apache.org/repos/asf/camel/blob/c3d0322a/camel-core/src/test/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilterTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilterTest.java b/camel-core/src/test/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilterTest.java index 229bee8..1e4c36a 100644 --- a/camel-core/src/test/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilterTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilterTest.java @@ -49,7 +49,6 @@ public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport { public void testInclude() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result1"); mock.expectedBodiesReceivedInAnyOrder("Hello World"); - mock.setExpectedMessageCount(1); template.sendBodyAndHeader("file://target/files/ant-path-1/x/y/z", "Hello World", Exchange.FILE_NAME, "report.txt"); template.sendBodyAndHeader("file://target/files/ant-path-1/x/y/z", "Hello World 2", Exchange.FILE_NAME, "b.TXT"); @@ -60,7 +59,6 @@ public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport { public void testExclude() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result2"); mock.expectedBodiesReceivedInAnyOrder("Hello World 2", "Hello World 3", "Hello World 4"); - mock.setExpectedMessageCount(3); template.sendBodyAndHeader("file://target/files/ant-path-2/x/y/z", "Hello World 1", Exchange.FILE_NAME, "report.bak"); template.sendBodyAndHeader("file://target/files/ant-path-2/x/y/z", "Hello World 2", Exchange.FILE_NAME, "report.txt"); @@ -73,7 +71,6 @@ public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport { public void testIncludesAndExcludes() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result3"); mock.expectedBodiesReceivedInAnyOrder("Hello World 2", "Hello World 4"); - mock.setExpectedMessageCount(2); template.sendBodyAndHeader("file://target/files/ant-path-3/x/y/z", "Hello World 1", Exchange.FILE_NAME, "a.pdf"); template.sendBodyAndHeader("file://target/files/ant-path-3/x/y/z", "Hello World 2", Exchange.FILE_NAME, "m.pdf"); @@ -94,7 +91,6 @@ public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport { public void testIncludesAndExcludesAndFilter() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result4"); mock.expectedBodiesReceivedInAnyOrder("Hello World 3"); - mock.setExpectedMessageCount(1); template.sendBodyAndHeader("file://target/files/ant-path-4/x/y/z", "Hello World 1", Exchange.FILE_NAME, "a.txt"); template.sendBodyAndHeader("file://target/files/ant-path-4/x/y/z", "Hello World 2", Exchange.FILE_NAME, "b.txt"); @@ -108,7 +104,6 @@ public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport { public void testIncludeAndAntFilterNotCaseSensitive() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result5"); mock.expectedBodiesReceivedInAnyOrder("Hello World"); - mock.setExpectedMessageCount(1); template.sendBodyAndHeader("file://target/files/ant-path-5/x/y/z", "Hello World", Exchange.FILE_NAME, "report.TXT"); @@ -118,7 +113,6 @@ public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport { public void testExcludeAndAntFilterNotCaseSensitive() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result6"); mock.expectedBodiesReceivedInAnyOrder("Hello World 2", "Hello World 4"); - mock.setExpectedMessageCount(2); template.sendBodyAndHeader("file://target/files/ant-path-6/x/y/z", "Hello World 1", Exchange.FILE_NAME, "report.bak"); template.sendBodyAndHeader("file://target/files/ant-path-6/x/y/z", "Hello World 2", Exchange.FILE_NAME, "report.txt"); @@ -131,7 +125,6 @@ public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport { public void testIncludesAndExcludesAndAntFilterNotCaseSensitive() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result7"); mock.expectedBodiesReceivedInAnyOrder("Hello World 2", "Hello World 4", "Hello World 8", "Hello World 10"); - mock.setExpectedMessageCount(4); template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 1", Exchange.FILE_NAME, "a.pdf"); template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 2", Exchange.FILE_NAME, "m.pdf"); @@ -152,7 +145,6 @@ public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport { public void testIncludesAndExcludesAndFilterAndAntFilterNotCaseSensitive() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result8"); mock.expectedBodiesReceivedInAnyOrder("Hello World 3", "Hello World 4"); - mock.setExpectedMessageCount(2); template.sendBodyAndHeader("file://target/files/ant-path-8/x/y/z", "Hello World 1", Exchange.FILE_NAME, "a.txt"); template.sendBodyAndHeader("file://target/files/ant-path-8/x/y/z", "Hello World 2", Exchange.FILE_NAME, "b.txt"); @@ -177,10 +169,6 @@ public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport { from("file://target/files/ant-path-4?recursive=true&antInclude=**/*.txt&antExclude=**/a*&filter=#filter").convertBodyTo(String.class).to("mock:result4"); from("file://target/files/ant-path-8?recursive=true&antInclude=**/*.txt&antExclude=**/a*&filter=#caseInsensitiveFilter").convertBodyTo(String.class).to("mock:result8"); - - - - } }; }