Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 52810 invoked from network); 12 Feb 2009 13:16:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Feb 2009 13:16:02 -0000 Received: (qmail 41065 invoked by uid 500); 12 Feb 2009 13:15:54 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 41049 invoked by uid 500); 12 Feb 2009 13:15:54 -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 40951 invoked by uid 99); 12 Feb 2009 13:15:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2009 05:15:54 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2009 13:15:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9F9F523889C1; Thu, 12 Feb 2009 13:15:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r743724 - in /camel/trunk/components/camel-mail/src: main/java/org/apache/camel/component/mail/ test/java/org/apache/camel/component/mail/ Date: Thu, 12 Feb 2009 13:15:31 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090212131531.9F9F523889C1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davsclaus Date: Thu Feb 12 13:15:30 2009 New Revision: 743724 URL: http://svn.apache.org/viewvc?rev=743724&view=rev Log: CAMEL-1289: moved filter strategy from component to endpoint Modified: camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java Modified: camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java?rev=743724&r1=743723&r2=743724&view=diff ============================================================================== --- camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java (original) +++ camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java Thu Feb 12 13:15:30 2009 @@ -23,10 +23,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; -import org.apache.camel.HeaderFilterStrategyAware; import org.apache.camel.impl.DefaultComponent; -import org.apache.camel.impl.DefaultHeaderFilterStrategy; -import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.util.ObjectHelper; /** @@ -34,9 +31,8 @@ * * @version $Revision:520964 $ */ -public class MailComponent extends DefaultComponent implements HeaderFilterStrategyAware { +public class MailComponent extends DefaultComponent { private MailConfiguration configuration; - private HeaderFilterStrategy headerFilterStrategy = new DefaultHeaderFilterStrategy(); public MailComponent() { this.configuration = new MailConfiguration(); @@ -116,11 +112,4 @@ return path; } - public HeaderFilterStrategy getHeaderFilterStrategy() { - return headerFilterStrategy; - } - - public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) { - headerFilterStrategy = strategy; - } } Modified: camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java?rev=743724&r1=743723&r2=743724&view=diff ============================================================================== --- camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java (original) +++ camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java Thu Feb 12 13:15:30 2009 @@ -25,6 +25,7 @@ import org.apache.camel.Producer; import org.apache.camel.impl.DefaultHeaderFilterStrategy; import org.apache.camel.impl.ScheduledPollEndpoint; +import org.apache.camel.spi.HeaderFilterStrategy; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; @@ -36,15 +37,14 @@ public class MailEndpoint extends ScheduledPollEndpoint { private MailBinding binding; private MailConfiguration configuration; + private HeaderFilterStrategy headerFilterStrategy = new DefaultHeaderFilterStrategy(); public MailEndpoint() { - this.binding = new MailBinding(); } public MailEndpoint(String uri, MailComponent component, MailConfiguration configuration) { super(uri, component); this.configuration = configuration; - this.binding = new MailBinding(component.getHeaderFilterStrategy()); } public MailEndpoint(String endpointUri, MailConfiguration configuration) { @@ -102,20 +102,22 @@ return new MailExchange(this, getExchangePattern(), getBinding(), message); } + public boolean isSingleton() { + return false; + } + // Properties // ------------------------------------------------------------------------- + public MailBinding getBinding() { if (binding == null) { - binding = new MailBinding(); + binding = new MailBinding(headerFilterStrategy); } return binding; } /** - * Sets the binding used to convert from a Camel message to and from a Mail - * message - * - * @param binding the binding to use + * Sets the binding used to convert from a Camel message to and from a Mail message */ public void setBinding(MailBinding binding) { this.binding = binding; @@ -129,7 +131,12 @@ this.configuration = configuration; } - public boolean isSingleton() { - return false; + public HeaderFilterStrategy getHeaderFilterStrategy() { + return headerFilterStrategy; } + + public void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy) { + this.headerFilterStrategy = headerFilterStrategy; + } + } Modified: camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java?rev=743724&r1=743723&r2=743724&view=diff ============================================================================== --- camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java (original) +++ camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDefaultDelayForMailConsumeTest.java Thu Feb 12 13:15:30 2009 @@ -37,18 +37,19 @@ mock.reset(); template.sendBody("smtp://bond@localhost", "Hello Paris"); mock.expectedBodiesReceived("Hello Paris"); - // poll next mail and that is should be done within the default delay + 2 sec slack - mock.setResultWaitTime(MailConsumer.DEFAULT_CONSUMER_DELAY + 2000L); + // poll next mail and that is should be done within the default delay (overrule to 5 sec) + 2 sec slack + mock.setResultWaitTime(5000L + 2000L); mock.assertIsSatisfied(); long delta = System.currentTimeMillis() - start; - assertTrue("Camel should not default poll the mailbox to often", delta > MailConsumer.DEFAULT_CONSUMER_DELAY - 1000L); + assertTrue("Camel should not default poll the mailbox to often", delta > 5000 - 1000L); } protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { - from("pop3://bond@localhost").to("mock:result"); + // we overrule the default of 60 sec to 5 so the unit test is faster + from("pop3://bond@localhost?delay=5000").to("mock:result"); } }; }