You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/09/02 14:28:39 UTC

[camel] 04/11: CAMEL-13917: Configuring endpoints with consumer. prefix for consumer options is no longer supported as they should be regular options instead. This also avoid reflection setting properties.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit aa19fb2bb6e849fef35398c1dd31e30a5148a961
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Sep 2 10:35:06 2019 +0200

    CAMEL-13917: Configuring endpoints with consumer. prefix for consumer options is no longer supported as they should be regular options instead. This also avoid reflection setting properties.
---
 .../component/facebook/FacebookComponentConsumerTest.java  |  4 ++--
 .../java/org/apache/camel/component/mail/MailEndpoint.java |  4 ++--
 .../mail/security/SslContextParametersMailRouteTest.java   |  2 +-
 .../component/olingo2/Olingo2ComponentConsumerTest.java    | 14 +++++++-------
 .../component/olingo4/Olingo4ComponentConsumerTest.java    | 14 +++++++-------
 .../camel/component/twitter/AbstractTwitterEndpoint.java   |  2 +-
 .../org/apache/camel/support/ScheduledPollEndpoint.java    |  3 ---
 7 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/components/camel-facebook/src/test/java/org/apache/camel/component/facebook/FacebookComponentConsumerTest.java b/components/camel-facebook/src/test/java/org/apache/camel/component/facebook/FacebookComponentConsumerTest.java
index 6ac98b5..95f89a7 100644
--- a/components/camel-facebook/src/test/java/org/apache/camel/component/facebook/FacebookComponentConsumerTest.java
+++ b/components/camel-facebook/src/test/java/org/apache/camel/component/facebook/FacebookComponentConsumerTest.java
@@ -127,9 +127,9 @@ public class FacebookComponentConsumerTest extends CamelFacebookTestSupport {
 
                 for (String name : searchNames) {
                     if (!excludedNames.contains(name)) {
-                        // consumer.sendEmptyMessageWhenIdle is true since user may not have some items like events
+                        // sendEmptyMessageWhenIdle is true since user may not have some items like events
                         from("facebook://" + name + "?reading.limit=10&reading.locale=en.US&reading.since="
-                            + since + "&initialDelay=1000&consumer.sendEmptyMessageWhenIdle=true&"
+                            + since + "&initialDelay=1000&sendEmptyMessageWhenIdle=true&"
                             + getOauthParams())
                             .to("mock:consumeResult" + name);
                     }
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
index f925d8a..a1b9bbf 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
@@ -39,7 +39,7 @@ import org.apache.camel.support.ScheduledPollEndpoint;
         label = "mail")
 public class MailEndpoint extends ScheduledPollEndpoint implements HeaderFilterStrategyAware {
 
-    @UriParam(optionalPrefix = "consumer.", defaultValue = "" + MailConsumer.DEFAULT_CONSUMER_DELAY, label = "consumer,scheduler",
+    @UriParam(defaultValue = "" + MailConsumer.DEFAULT_CONSUMER_DELAY, label = "consumer,scheduler",
             description = "Milliseconds before the next poll.")
     private long delay = MailConsumer.DEFAULT_CONSUMER_DELAY;
 
@@ -78,7 +78,7 @@ public class MailEndpoint extends ScheduledPollEndpoint implements HeaderFilterS
         super(uri, component);
         this.configuration = configuration;
         // ScheduledPollConsumer default delay is 500 millis and that is too often for polling a mailbox,
-        // so we override with a new default value. End user can override this value by providing a consumer.delay parameter
+        // so we override with a new default value. End user can override this value by providing a delay parameter
         setDelay(MailConsumer.DEFAULT_CONSUMER_DELAY);
     }
 
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/security/SslContextParametersMailRouteTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/security/SslContextParametersMailRouteTest.java
index 0cefbe9..21208ab 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/security/SslContextParametersMailRouteTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/security/SslContextParametersMailRouteTest.java
@@ -55,7 +55,7 @@ public class SslContextParametersMailRouteTest extends CamelTestSupport {
             public void configure() {
 
                 from("imaps://" + imapHost + "?username=" + username + "&password=" + password
-                     + "&delete=false&unseen=true&fetchSize=1&consumer.useFixedDelay=true&initialDelay=100&delay=100").to("mock:in");
+                     + "&delete=false&unseen=true&fetchSize=1&useFixedDelay=true&initialDelay=100&delay=100").to("mock:in");
 
                 from("direct:in").to("smtps://" + smtpHost + "?username=" + username + "&password=" + password);
             }
diff --git a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentConsumerTest.java b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentConsumerTest.java
index 9226c57..9d3b875 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentConsumerTest.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2ComponentConsumerTest.java
@@ -88,7 +88,7 @@ public class Olingo2ComponentConsumerTest extends AbstractOlingo2TestSupport {
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                from("olingo2://read/Manufacturers?filterAlreadySeen=true&" + "delay=2&consumer.sendEmptyMessageWhenIdle=true&" + "consumer.splitResult=false")
+                from("olingo2://read/Manufacturers?filterAlreadySeen=true&" + "delay=2&sendEmptyMessageWhenIdle=true&" + "consumer.splitResult=false")
                     .to("mock:consumer-alreadyseen");
             };
         };
@@ -122,7 +122,7 @@ public class Olingo2ComponentConsumerTest extends AbstractOlingo2TestSupport {
      * get the correct number of exchanges before being satisfied. Note: -
      * consumer.splitResults is set to false since this ensures the first
      * returned message contains all the results. -
-     * consumer.sendEmptyMessageWhenIdle is set to false so only 1 message
+     * sendEmptyMessageWhenIdle is set to false so only 1 message
      * should even be returned.
      */
     @Test
@@ -138,7 +138,7 @@ public class Olingo2ComponentConsumerTest extends AbstractOlingo2TestSupport {
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                from("olingo2://read/Manufacturers?filterAlreadySeen=true&" + "delay=2&consumer.sendEmptyMessageWhenIdle=false&" + "consumer.splitResult=false")
+                from("olingo2://read/Manufacturers?filterAlreadySeen=true&" + "delay=2&sendEmptyMessageWhenIdle=false&" + "consumer.splitResult=false")
                     .to("mock:consumer-alreadyseen");
             };
         };
@@ -164,7 +164,7 @@ public class Olingo2ComponentConsumerTest extends AbstractOlingo2TestSupport {
 
     /**
      * WithPredicate in address FilterAlreadySeen: true SplitResults: true
-     * consumer.sendEmptyMessageWhenIdle: true
+     * sendEmptyMessageWhenIdle: true
      *
      * @throws Exception
      */
@@ -176,7 +176,7 @@ public class Olingo2ComponentConsumerTest extends AbstractOlingo2TestSupport {
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                from("olingo2://read/Manufacturers('1')?filterAlreadySeen=true&" + "delay=2&consumer.sendEmptyMessageWhenIdle=true&" + "consumer.splitResult=true")
+                from("olingo2://read/Manufacturers('1')?filterAlreadySeen=true&" + "delay=2&sendEmptyMessageWhenIdle=true&" + "consumer.splitResult=true")
                     .to("mock:consumer-splitresult-kp-manufacturer");
             };
         };
@@ -208,7 +208,7 @@ public class Olingo2ComponentConsumerTest extends AbstractOlingo2TestSupport {
 
     /**
      * WithPredicate in address FilterAlreadySeen: true SplitResults: true
-     * consumer.sendEmptyMessageWhenIdle: false
+     * sendEmptyMessageWhenIdle: false
      *
      * @throws Exception
      */
@@ -226,7 +226,7 @@ public class Olingo2ComponentConsumerTest extends AbstractOlingo2TestSupport {
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                from("olingo2://read/Manufacturers('1')?filterAlreadySeen=true&" + "delay=2&consumer.sendEmptyMessageWhenIdle=false&" + "consumer.splitResult=true")
+                from("olingo2://read/Manufacturers('1')?filterAlreadySeen=true&" + "delay=2&sendEmptyMessageWhenIdle=false&" + "consumer.splitResult=true")
                     .to("mock:consumer-splitresult-kp-manufacturer");
             };
         };
diff --git a/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4ComponentConsumerTest.java b/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4ComponentConsumerTest.java
index b5c3d01..55eaa40 100644
--- a/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4ComponentConsumerTest.java
+++ b/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4ComponentConsumerTest.java
@@ -97,7 +97,7 @@ public class Olingo4ComponentConsumerTest extends AbstractOlingo4TestSupport {
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                from("olingo4://read/" + PEOPLE + "?delay=2&consumer.sendEmptyMessageWhenIdle=true&consumer.splitResult=false&filterAlreadySeen=true")
+                from("olingo4://read/" + PEOPLE + "?delay=2&sendEmptyMessageWhenIdle=true&consumer.splitResult=false&filterAlreadySeen=true")
                     .to("mock:consumer-alreadyseen");
             };
         };
@@ -131,7 +131,7 @@ public class Olingo4ComponentConsumerTest extends AbstractOlingo4TestSupport {
      * get the correct number of exchanges before being satisfied. Note: -
      * consumer.splitResults is set to false since this ensures the first
      * returned message contains all the results. -
-     * consumer.sendEmptyMessageWhenIdle is set to false so only 1 message
+     * sendEmptyMessageWhenIdle is set to false so only 1 message
      * should even be returned.
      */
     @Test
@@ -148,7 +148,7 @@ public class Olingo4ComponentConsumerTest extends AbstractOlingo4TestSupport {
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                from("olingo4://read/" + PEOPLE + "?delay=2&consumer.sendEmptyMessageWhenIdle=false&consumer.splitResult=false&filterAlreadySeen=true")
+                from("olingo4://read/" + PEOPLE + "?delay=2&sendEmptyMessageWhenIdle=false&consumer.splitResult=false&filterAlreadySeen=true")
                     .to("mock:consumer-alreadyseen");
             };
         };
@@ -174,7 +174,7 @@ public class Olingo4ComponentConsumerTest extends AbstractOlingo4TestSupport {
 
     /**
      * WithPredicate in address FilterAlreadySeen: true SplitResults: true
-     * consumer.sendEmptyMessageWhenIdle: true
+     * sendEmptyMessageWhenIdle: true
      *
      * @throws Exception
      */
@@ -186,7 +186,7 @@ public class Olingo4ComponentConsumerTest extends AbstractOlingo4TestSupport {
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                from("olingo4://read/" + AIRPORTS + "('KSFO')" + "?filterAlreadySeen=true&" + "delay=2&consumer.sendEmptyMessageWhenIdle=true&"
+                from("olingo4://read/" + AIRPORTS + "('KSFO')" + "?filterAlreadySeen=true&" + "delay=2&sendEmptyMessageWhenIdle=true&"
                      + "consumer.splitResult=true").to("mock:consumer-splitresult-kp-airport");
             };
         };
@@ -218,7 +218,7 @@ public class Olingo4ComponentConsumerTest extends AbstractOlingo4TestSupport {
 
     /**
      * WithPredicate in address FilterAlreadySeen: true SplitResults: true
-     * consumer.sendEmptyMessageWhenIdle: false
+     * sendEmptyMessageWhenIdle: false
      *
      * @throws Exception
      */
@@ -236,7 +236,7 @@ public class Olingo4ComponentConsumerTest extends AbstractOlingo4TestSupport {
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                from("olingo4://read/" + AIRPORTS + "('KSFO')" + "?filterAlreadySeen=true&" + "delay=2&consumer.sendEmptyMessageWhenIdle=false&"
+                from("olingo4://read/" + AIRPORTS + "('KSFO')" + "?filterAlreadySeen=true&" + "delay=2&sendEmptyMessageWhenIdle=false&"
                      + "consumer.splitResult=true").to("mock:consumer-splitresult-kp-airport");
             };
         };
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/AbstractTwitterEndpoint.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/AbstractTwitterEndpoint.java
index 3c4ac98..bd4d659 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/AbstractTwitterEndpoint.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/AbstractTwitterEndpoint.java
@@ -29,7 +29,7 @@ public abstract class AbstractTwitterEndpoint extends DefaultPollingEndpoint imp
 
     public static final long DEFAULT_CONSUMER_DELAY = 30 * 1000L;
 
-    @UriParam(optionalPrefix = "consumer.", defaultValue = "" + DEFAULT_CONSUMER_DELAY, label = "consumer,scheduler",
+    @UriParam(defaultValue = "" + DEFAULT_CONSUMER_DELAY, label = "consumer,scheduler",
         description = "Milliseconds before the next poll.")
     private long delay = DEFAULT_CONSUMER_DELAY;
 
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java
index c3ec3d9..1533e45 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java
@@ -22,10 +22,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
-import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.LoggingLevel;
-import org.apache.camel.PollingConsumer;
-import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.spi.PollingConsumerPollStrategy;
 import org.apache.camel.spi.ScheduledPollConsumerScheduler;
 import org.apache.camel.spi.UriParam;