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: CAMEL-8509: camel-catalog - Add api to parse endpoint uri and reverse
Date Thu, 19 Mar 2015 10:01:42 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x 273b4756f -> f79d1d991
  refs/heads/master dcbb9fe4a -> 91945a86e


CAMEL-8509: camel-catalog - Add api to parse endpoint uri and reverse


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

Branch: refs/heads/master
Commit: 91945a86ec55a62c9f6235c4aed802a3930032cf
Parents: dcbb9fe
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Mar 19 11:02:54 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Mar 19 11:03:25 2015 +0100

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


http://git-wip-us.apache.org/repos/asf/camel/blob/91945a86/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 58e2069..e35fc37 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
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedSet;
+import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -616,8 +617,8 @@ public class DefaultCamelCatalog implements CamelCatalog {
 
         String originalSyntax = syntax;
 
-        // build at first according to syntax
-        Map<String, String> copy = new HashMap<String, String>();
+        // build at first according to syntax (use a tree map as we want the uri options
sorted)
+        Map<String, String> copy = new TreeMap<String, String>();
         for (Map.Entry<String, String> entry : properties.entrySet()) {
             String key = entry.getKey();
             String value = entry.getValue() != null ? entry.getValue() : "";
@@ -628,8 +629,6 @@ public class DefaultCamelCatalog implements CamelCatalog {
             }
         }
 
-        rows = JSonSchemaHelper.parseJsonSchema("properties", json, true);
-
         // the tokens between the options in the path
         String[] tokens = syntax.split("\\w+");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/91945a86/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 3e2913d..ad5c34c 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
@@ -117,9 +117,13 @@ public class CamelCatalogTest extends TestCase {
     public void testAsEndpointUriMapJmsRequiredOnly() throws Exception {
         Map<String, String> map = new HashMap<String, String>();
         map.put("destinationName", "foo");
-
         String uri = catalog.asEndpointUri("jms", map);
         assertEquals("jms:foo", uri);
+
+        map.put("deliveryPersistent", "false");
+        map.put("allowNullBody", "true");
+        uri = catalog.asEndpointUri("jms", map);
+        assertEquals("jms:foo?allowNullBody=true&deliveryPersistent=false", uri);
     }
 
     @Test
@@ -158,6 +162,14 @@ public class CamelCatalogTest extends TestCase {
         assertEquals(1, map.size());
 
         assertEquals("foo", map.get("destinationName"));
+
+        map = catalog.endpointProperties("jms:foo?allowNullBody=true&deliveryPersistent=false");
+        assertNotNull(map);
+        assertEquals(3, map.size());
+
+        assertEquals("foo", map.get("destinationName"));
+        assertEquals("true", map.get("allowNullBody"));
+        assertEquals("false", map.get("deliveryPersistent"));
     }
 
 }


Mime
View raw message