camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: Fixed CamelCatalog to construct endpoint uris for timer endpoints
Date Tue, 03 Nov 2015 14:55:33 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 8e1695557 -> 999fe637b
  refs/heads/master c88cf0f73 -> 0e80e9ba2


Fixed CamelCatalog to construct endpoint uris for timer endpoints


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0e80e9ba
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0e80e9ba
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0e80e9ba

Branch: refs/heads/master
Commit: 0e80e9ba2ee5e9b8538c0dfd2638e2489a610baa
Parents: c88cf0f
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Nov 3 15:57:58 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Nov 3 15:57:58 2015 +0100

----------------------------------------------------------------------
 .../apache/camel/catalog/DefaultCamelCatalog.java   | 16 +++++++++++-----
 .../org/apache/camel/catalog/CamelCatalogTest.java  | 10 ++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0e80e9ba/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
index 59e2ded..5374194 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
@@ -720,14 +720,17 @@ public class DefaultCamelCatalog implements CamelCatalog {
         for (int i = 0; i < options.size(); i++) {
             String key = options.get(i);
             String key2 = options2.get(i);
-            String token = tokens[i];
+            String token = null;
+            if (tokens.length > i) {
+                token = tokens[i];
+            }
 
             // was the option provided?
             if (properties.containsKey(key)) {
-                if (!first) {
+                if (!first && token != null) {
                     sb.append(token);
                 }
-                hasQuestionmark |= token.contains("?") || key.contains("?");
+                hasQuestionmark |= key.contains("?") || (token != null && token.contains("?"));
                 sb.append(key2);
                 first = false;
             }
@@ -735,11 +738,14 @@ public class DefaultCamelCatalog implements CamelCatalog {
         }
         // append any extra options that was in surplus for the last
         while (range < options2.size()) {
-            String token = tokens[range];
+            String token = null;
+            if (tokens.length > range) {
+                token = tokens[range];
+            }
             String key2 = options2.get(range);
             sb.append(token);
             sb.append(key2);
-            hasQuestionmark |= token.contains("?") || key2.contains("?");
+            hasQuestionmark |= key2.contains("?") || (token != null && token.contains("?"));
             range++;
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/0e80e9ba/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
index 5f0b6bb..4b8dc31 100644
--- a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
+++ b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
@@ -170,6 +170,16 @@ public class CamelCatalogTest extends TestCase {
     }
 
     @Test
+    public void testAsEndpointUriTimer() throws Exception {
+        Map<String, String> map = new HashMap<String, String>();
+        map.put("timerName", "foo");
+        map.put("period", "5000");
+
+        String uri = catalog.asEndpointUri("timer", map);
+        assertEquals("timer:foo?period=5000", uri);
+    }
+
+    @Test
     public void testAsEndpointUriMapJmsRequiredOnly() throws Exception {
         Map<String, String> map = new HashMap<String, String>();
         map.put("destinationName", "foo");


Mime
View raw message