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 2020/03/16 06:09:17 UTC

[camel] branch master updated (7210bd4 -> b0c7a44)

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

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


    from 7210bd4  CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern
     new f9c1896  CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern
     new 92e65a2  CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern
     new b0c7a44  CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/jgroups/JGroupsClusterRouteTest.java  |  2 +-
 .../org/apache/camel/component/mail/MailComponent.java    |  4 ++--
 .../org/apache/camel/component/mail/MailConverters.java   | 15 ++++++++-------
 .../resources/org/apache/camel/component/nsq/nsq.json     |  2 +-
 components/camel-nsq/src/main/docs/nsq-component.adoc     |  2 +-
 .../org/apache/camel/component/nsq/NsqConfiguration.java  |  2 +-
 .../org/apache/camel/component/nsq/NsqConsumerTest.java   |  2 +-
 docs/components/modules/ROOT/pages/nsq-component.adoc     |  2 +-
 8 files changed, 16 insertions(+), 15 deletions(-)


[camel] 03/03: CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern

Posted by da...@apache.org.
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 b0c7a4401e4edac010329386b570d3ba4e096be6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Mar 16 07:08:58 2020 +0100

    CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern
---
 .../src/generated/resources/org/apache/camel/component/nsq/nsq.json     | 2 +-
 components/camel-nsq/src/main/docs/nsq-component.adoc                   | 2 +-
 .../src/main/java/org/apache/camel/component/nsq/NsqConfiguration.java  | 2 +-
 .../src/test/java/org/apache/camel/component/nsq/NsqConsumerTest.java   | 2 +-
 docs/components/modules/ROOT/pages/nsq-component.adoc                   | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/components/camel-nsq/src/generated/resources/org/apache/camel/component/nsq/nsq.json b/components/camel-nsq/src/generated/resources/org/apache/camel/component/nsq/nsq.json
index a05967d..d8c6d2e 100644
--- a/components/camel-nsq/src/generated/resources/org/apache/camel/component/nsq/nsq.json
+++ b/components/camel-nsq/src/generated/resources/org/apache/camel/component/nsq/nsq.json
@@ -27,7 +27,7 @@
   },
   "properties": {
     "topic": { "kind": "path", "displayName": "Topic", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "configurationClass": "org.apache.camel.component.nsq.NsqConfiguration", "configurationField": "configuration", "description": "The NSQ topic" },
-    "servers": { "kind": "parameter", "displayName": "Servers", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.nsq.NsqConfiguration", "configurationField": "configuration", "description": "The hostnames of one or more nsqlookupd servers (consumer) or nsqd servers (producer)." },
+    "servers": { "kind": "parameter", "displayName": "Servers", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.nsq.NsqConfiguration", "configurationField": "configuration", "description": "The hostnames of one or more nsqlookupd servers (consumer) or nsqd servers (producer)" },
     "userAgent": { "kind": "parameter", "displayName": "User Agent", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.nsq.NsqConfiguration", "configurationField": "configuration", "description": "A String to identify the kind of client" },
     "autoFinish": { "kind": "parameter", "displayName": "Auto Finish", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.nsq.NsqConfiguration", "configurationField": "configuration", "description": "Automatically finish the NSQ Message when it is retrieved from the queue and before the Exchange is processed" },
     "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled b [...]
diff --git a/components/camel-nsq/src/main/docs/nsq-component.adoc b/components/camel-nsq/src/main/docs/nsq-component.adoc
index c53ee56..7e9e186 100644
--- a/components/camel-nsq/src/main/docs/nsq-component.adoc
+++ b/components/camel-nsq/src/main/docs/nsq-component.adoc
@@ -79,7 +79,7 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *servers* (common) | The hostnames of one or more nsqlookupd servers (consumer) or nsqd servers (producer). |  | String
+| *servers* (common) | The hostnames of one or more nsqlookupd servers (consumer) or nsqd servers (producer) |  | String
 | *userAgent* (common) | A String to identify the kind of client |  | String
 | *autoFinish* (consumer) | Automatically finish the NSQ Message when it is retrieved from the queue and before the Exchange is processed | true | Boolean
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
diff --git a/components/camel-nsq/src/main/java/org/apache/camel/component/nsq/NsqConfiguration.java b/components/camel-nsq/src/main/java/org/apache/camel/component/nsq/NsqConfiguration.java
index c9e1e92..43723b6 100644
--- a/components/camel-nsq/src/main/java/org/apache/camel/component/nsq/NsqConfiguration.java
+++ b/components/camel-nsq/src/main/java/org/apache/camel/component/nsq/NsqConfiguration.java
@@ -35,7 +35,7 @@ public class NsqConfiguration {
     @UriPath(description = "The NSQ topic")
     @Metadata(required = true)
     private String topic;
-    @UriParam(description = "The hostnames of one or more nsqlookupd servers (consumer) or nsqd servers (producer).")
+    @UriParam(description = "The hostnames of one or more nsqlookupd servers (consumer) or nsqd servers (producer)")
     private String servers;
     @UriParam(label = "consumer", description = "The NSQ channel")
     private String channel;
diff --git a/components/camel-nsq/src/test/java/org/apache/camel/component/nsq/NsqConsumerTest.java b/components/camel-nsq/src/test/java/org/apache/camel/component/nsq/NsqConsumerTest.java
index 48197bb..583b274 100644
--- a/components/camel-nsq/src/test/java/org/apache/camel/component/nsq/NsqConsumerTest.java
+++ b/components/camel-nsq/src/test/java/org/apache/camel/component/nsq/NsqConsumerTest.java
@@ -86,7 +86,7 @@ public class NsqConsumerTest extends NsqTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                fromF("nsq://%s?servers=%s&lookupInterval=2s&autoFinish=false&requeueInterval=1s", TOPIC, getNsqConsumerUrl()).process(new Processor() {
+                fromF("nsq://%s?servers=%s&lookupInterval=2000&autoFinish=false&requeueInterval=1000", TOPIC, getNsqConsumerUrl()).process(new Processor() {
                     @Override
                     public void process(Exchange exchange) throws Exception {
                         String messageText = exchange.getIn().getBody(String.class);
diff --git a/docs/components/modules/ROOT/pages/nsq-component.adoc b/docs/components/modules/ROOT/pages/nsq-component.adoc
index d74f29d..7a11fb0 100644
--- a/docs/components/modules/ROOT/pages/nsq-component.adoc
+++ b/docs/components/modules/ROOT/pages/nsq-component.adoc
@@ -80,7 +80,7 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *servers* (common) | The hostnames of one or more nsqlookupd servers (consumer) or nsqd servers (producer). |  | String
+| *servers* (common) | The hostnames of one or more nsqlookupd servers (consumer) or nsqd servers (producer) |  | String
 | *userAgent* (common) | A String to identify the kind of client |  | String
 | *autoFinish* (consumer) | Automatically finish the NSQ Message when it is retrieved from the queue and before the Exchange is processed | true | Boolean
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean


[camel] 02/03: CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern

Posted by da...@apache.org.
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 92e65a220f0fe1a5faaf0bdc649b9fbcf6d2f88c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Mar 16 07:05:53 2020 +0100

    CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern
---
 .../org/apache/camel/component/mail/MailComponent.java    |  4 ++--
 .../org/apache/camel/component/mail/MailConverters.java   | 15 ++++++++-------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
index 3a72a9a..7494529 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
@@ -76,7 +76,7 @@ public class MailComponent extends HeaderFilterStrategyComponent implements SSLC
             SearchTerm st;
             if (searchTerm instanceof SimpleSearchTerm) {
                 // okay its a SimpleSearchTerm then lets convert that to SearchTerm
-                st = MailConverters.toSearchTerm((SimpleSearchTerm) searchTerm, getCamelContext().getTypeConverter());
+                st = MailConverters.toSearchTerm((SimpleSearchTerm) searchTerm);
             } else {
                 st = getCamelContext().getTypeConverter().mandatoryConvertTo(SearchTerm.class, searchTerm);
             }
@@ -104,7 +104,7 @@ public class MailComponent extends HeaderFilterStrategyComponent implements SSLC
             // use SimpleSearchTerm as POJO to store the configuration and then convert that to the actual SearchTerm
             SimpleSearchTerm sst = new SimpleSearchTerm();
             setProperties(sst, sstParams);
-            SearchTerm st = MailConverters.toSearchTerm(sst, getCamelContext().getTypeConverter());
+            SearchTerm st = MailConverters.toSearchTerm(sst);
             endpoint.setSearchTerm(st);
         }
 
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConverters.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConverters.java
index cab140e..ad17f51 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConverters.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConverters.java
@@ -40,6 +40,7 @@ import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.TypeConverter;
 import org.apache.camel.spi.TypeConverterRegistry;
 import org.apache.camel.support.ExchangeHelper;
+import org.apache.camel.util.TimeUtils;
 
 /**
  * JavaMail specific converters.
@@ -143,7 +144,7 @@ public final class MailConverters {
      *
      * This should not be a @Converter method
      */
-    public static SearchTerm toSearchTerm(SimpleSearchTerm simple, TypeConverter typeConverter) throws ParseException, NoTypeConversionAvailableException {
+    public static SearchTerm toSearchTerm(SimpleSearchTerm simple) throws ParseException {
         SearchTermBuilder builder = new SearchTermBuilder();
         if (simple.isUnseen()) {
             builder = builder.unseen();
@@ -170,7 +171,7 @@ public final class MailConverters {
         if (simple.getFromSentDate() != null) {
             String s = simple.getFromSentDate();
             if (s.startsWith("now")) {
-                long offset = extractOffset(s, typeConverter);
+                long offset = extractOffset(s);
                 builder = builder.and(new NowSearchTerm(SearchTermBuilder.Comparison.GE.asNum(), true, offset));
             } else {
                 SimpleDateFormat sdf = new SimpleDateFormat(NOW_DATE_FORMAT);
@@ -181,7 +182,7 @@ public final class MailConverters {
         if (simple.getToSentDate() != null) {
             String s = simple.getToSentDate();
             if (s.startsWith("now")) {
-                long offset = extractOffset(s, typeConverter);
+                long offset = extractOffset(s);
                 builder = builder.and(new NowSearchTerm(SearchTermBuilder.Comparison.LE.asNum(), true, offset));
             } else {
                 SimpleDateFormat sdf = new SimpleDateFormat(NOW_DATE_FORMAT);
@@ -192,7 +193,7 @@ public final class MailConverters {
         if (simple.getFromReceivedDate() != null) {
             String s = simple.getFromReceivedDate();
             if (s.startsWith("now")) {
-                long offset = extractOffset(s, typeConverter);
+                long offset = extractOffset(s);
                 builder = builder.and(new NowSearchTerm(SearchTermBuilder.Comparison.GE.asNum(), false, offset));
             } else {
                 SimpleDateFormat sdf = new SimpleDateFormat(NOW_DATE_FORMAT);
@@ -203,7 +204,7 @@ public final class MailConverters {
         if (simple.getToReceivedDate() != null) {
             String s = simple.getToReceivedDate();
             if (s.startsWith("now")) {
-                long offset = extractOffset(s, typeConverter);
+                long offset = extractOffset(s);
                 builder = builder.and(new NowSearchTerm(SearchTermBuilder.Comparison.LE.asNum(), false, offset));
             } else {
                 SimpleDateFormat sdf = new SimpleDateFormat(NOW_DATE_FORMAT);
@@ -253,7 +254,7 @@ public final class MailConverters {
         }
     }
     
-    private static long extractOffset(String now, TypeConverter typeConverter) throws NoTypeConversionAvailableException {
+    private static long extractOffset(String now) {
         Matcher matcher = NOW_PATTERN.matcher(now);
         if (matcher.matches()) {
             String op = matcher.group(1);
@@ -261,7 +262,7 @@ public final class MailConverters {
 
             // convert remainder to a time millis (eg we have a String -> long converter that supports
             // syntax with hours, days, minutes: eg 5h30m for 5 hours and 30 minutes).
-            long offset = typeConverter.mandatoryConvertTo(long.class, remainder);
+            long offset = TimeUtils.toMilliSeconds(remainder);
 
             if ("+".equals(op)) {
                 return offset;


[camel] 01/03: CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern

Posted by da...@apache.org.
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 f9c1896375fa712167714f7df8b1c784fd6396af
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Mar 16 07:02:18 2020 +0100

    CAMEL-14575: camel-core - TypeConverter from String to Long - drop time pattern
---
 .../org/apache/camel/component/jgroups/JGroupsClusterRouteTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/JGroupsClusterRouteTest.java b/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/JGroupsClusterRouteTest.java
index ec9da3d..218c511 100644
--- a/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/JGroupsClusterRouteTest.java
+++ b/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/JGroupsClusterRouteTest.java
@@ -39,7 +39,7 @@ public class JGroupsClusterRouteTest extends Assert {
 
     String clusterName = randomUUID().toString();
 
-    String masterMockUri = "mock:master?resultWaitTime=2m";
+    String masterMockUri = "mock:master?resultWaitTime=1200000";
 
     class Builder extends RouteBuilder {