CAMEL-8951: RecipientList with RAW parameter do not work
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5e407128 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5e407128 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5e407128 Branch: refs/heads/master Commit: 5e40712823cf6558b6973accdf828037240db143 Parents: 4fc73b4 Author: Claus Ibsen <davscl...@apache.org> Authored: Fri Jul 10 16:38:16 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat Jul 11 08:15:48 2015 +0200 ---------------------------------------------------------------------- .../org/apache/camel/util/EndpointHelper.java | 8 ++-- .../processor/RecipientListMEPWithRawTest.java | 49 ++++++++++++++++++++ 2 files changed, 54 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5e407128/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java b/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java index 0fd0dac..524d8dc 100644 --- a/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java +++ b/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java @@ -16,7 +16,6 @@ */ package org.apache.camel.util; -import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; @@ -498,8 +497,11 @@ public final class EndpointHelper { * @throws URISyntaxException is thrown if uri is invalid */ public static ExchangePattern resolveExchangePatternFromUrl(String url) throws URISyntaxException { - URI uri = new URI(url); - Map<String, Object> parameters = URISupport.parseParameters(uri); + int idx = url.indexOf("?"); + if (idx > 0) { + url = url.substring(idx + 1); + } + Map<String, Object> parameters = URISupport.parseQuery(url, true); String pattern = (String) parameters.get("exchangePattern"); if (pattern != null) { return ExchangePattern.asEnum(pattern); http://git-wip-us.apache.org/repos/asf/camel/blob/5e407128/camel-core/src/test/java/org/apache/camel/processor/RecipientListMEPWithRawTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/processor/RecipientListMEPWithRawTest.java b/camel-core/src/test/java/org/apache/camel/processor/RecipientListMEPWithRawTest.java new file mode 100644 index 0000000..26b12456 --- /dev/null +++ b/camel-core/src/test/java/org/apache/camel/processor/RecipientListMEPWithRawTest.java @@ -0,0 +1,49 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.processor; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.builder.RouteBuilder; + +public class RecipientListMEPWithRawTest extends ContextTestSupport { + + public void testMEPInOnly() throws Exception { + getMockEndpoint("mock:foo").expectedBodiesReceived("Hello World", "Hello Again"); + getMockEndpoint("mock:result").expectedBodiesReceived("Bye World", "Bye World"); + + template.sendBody("direct:start", "Hello World"); + template.sendBody("direct:start", "Hello Again"); + + assertMockEndpointsSatisfied(); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start") + .recipientList().constant("seda:foo?exchangePattern=InOut&blockWhenFull=RAW(true)") + .to("mock:result"); + + from("seda:foo") + .to("mock:foo") + .transform().constant("Bye World"); + } + }; + } +}