Repository: camel Updated Branches: refs/heads/master 3e7b1cfdd -> d6088eb51
CAMEL-11171 - camel-zookeeper-master, fix to support RAW() function Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d6088eb5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d6088eb5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d6088eb5 Branch: refs/heads/master Commit: d6088eb5175e4c66c7c8a467694a8d60ff8d3eb5 Parents: 3e7b1cf Author: Paolo Antinori <panti...@redhat.com> Authored: Wed Apr 19 17:56:40 2017 +0200 Committer: lburgazzoli <lburgazz...@gmail.com> Committed: Thu Apr 20 09:44:02 2017 +0200 ---------------------------------------------------------------------- components/camel-zookeeper-master/pom.xml | 5 +++++ .../component/zookeepermaster/MasterComponent.java | 3 +-- .../component/zookeepermaster/MasterEndpointTest.java | 13 +++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/d6088eb5/components/camel-zookeeper-master/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-zookeeper-master/pom.xml b/components/camel-zookeeper-master/pom.xml index a1e89a3..aa63895 100644 --- a/components/camel-zookeeper-master/pom.xml +++ b/components/camel-zookeeper-master/pom.xml @@ -122,6 +122,11 @@ <artifactId>camel-quartz2</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-ftp</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>org.apache.camel</groupId> http://git-wip-us.apache.org/repos/asf/camel/blob/d6088eb5/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/MasterComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/MasterComponent.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/MasterComponent.java index 59749ae..b89dc48 100644 --- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/MasterComponent.java +++ b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/MasterComponent.java @@ -21,7 +21,6 @@ import java.util.Map; import org.apache.camel.Endpoint; import org.apache.camel.spi.Metadata; import org.apache.camel.util.ObjectHelper; -import org.apache.camel.util.URISupport; /** * The zookeeper-master camel component ensures that only a single endpoint in a cluster is active at any @@ -72,7 +71,7 @@ public class MasterComponent extends ZookeeperComponentSupport { String childUri = remaining.substring(idx + 1); // we need to apply the params here if (params != null && params.size() > 0) { - childUri = childUri + "?" + URISupport.createQueryString(params); + childUri = childUri + "?" + uri.substring(uri.indexOf('?') + 1); } MasterEndpoint answer = new MasterEndpoint(uri, this, name, childUri); return answer; http://git-wip-us.apache.org/repos/asf/camel/blob/d6088eb5/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointTest.java b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointTest.java index 03051b7..b1d88e5 100644 --- a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointTest.java +++ b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointTest.java @@ -23,7 +23,9 @@ import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.Route; +import org.apache.camel.component.file.remote.SftpEndpoint; import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.util.ServiceHelper; import org.junit.After; import org.junit.AfterClass; @@ -97,4 +99,15 @@ public class MasterEndpointTest extends AbstractJUnit4SpringContextTests { MockEndpoint.assertIsSatisfied(camelContext); } + + @Test + public void testRawPropertiesOnChild() throws Exception { + final String uri = "zookeeper-master://name:sftp://myhost/inbox?password=RAW(_BEFORE_AMPERSAND_&_AFTER_AMPERSAND_)&username=jdoe"; + + DefaultCamelContext ctx = new DefaultCamelContext(); + MasterEndpoint master = (MasterEndpoint) ctx.getEndpoint(uri); + SftpEndpoint sftp = (SftpEndpoint) master.getEndpoint(); + + assertEquals("_BEFORE_AMPERSAND_&_AFTER_AMPERSAND_", sftp.getConfiguration().getPassword()); + } }