camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-8951: RecipientList with RAW parameter do not work
Date Sat, 11 Jul 2015 06:10:26 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x cb0935e3a -> 48004fb11


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/48004fb1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/48004fb1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/48004fb1

Branch: refs/heads/camel-2.15.x
Commit: 48004fb11760bbbc34180c40aa26a14ac9ba597e
Parents: cb0935e
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Jul 10 16:38:16 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Jul 11 08:16:30 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/48004fb1/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/48004fb1/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");
+            }
+        };
+    }
+}


Mime
View raw message