You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cm...@apache.org on 2014/10/17 10:39:54 UTC
[01/50] git commit: CAMEL-7796 camel-cxfrs consumer: Allow setting a
custom binding.
Repository: camel
Updated Branches:
refs/remotes/origin/camel-2.13.x 653f8d6f2 -> f0ddb5ef7
CAMEL-7796 camel-cxfrs consumer: Allow setting a custom binding.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c7d05d4c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c7d05d4c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c7d05d4c
Branch: refs/remotes/origin/camel-2.13.x
Commit: c7d05d4cf659914234c3c1a043c428c1acec911c
Parents: 9fca194
Author: Raul Kripalani <ra...@apache.org>
Authored: Tue Sep 9 15:45:59 2014 +0100
Committer: Raul Kripalani <ra...@apache.org>
Committed: Tue Sep 9 15:49:25 2014 +0100
----------------------------------------------------------------------
.../component/cxf/jaxrs/CxfRsEndpoint.java | 29 ++++-
.../CxfRsBindingConfigurationSelectionTest.java | 127 +++++++++++++++++++
2 files changed, 153 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c7d05d4c/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
index dec2747..d3e29c2 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
@@ -65,7 +65,13 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
* This is the traditional binding style, which simply dumps the {@link org.apache.cxf.message.MessageContentsList} coming in from the CXF stack
* onto the IN message body. The user is then responsible for processing it according to the contract defined by the JAX-RS method signature.
*/
- Default
+ Default,
+
+ /**
+ * A custom binding set by the user.
+ */
+ Custom
+
}
private static final Logger LOG = LoggerFactory.getLogger(CxfRsEndpoint.class);
@@ -473,8 +479,25 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
if (headerFilterStrategy == null) {
headerFilterStrategy = new CxfRsHeaderFilterStrategy();
}
-
- binding = bindingStyle == null || bindingStyle == BindingStyle.Default ? new DefaultCxfRsBinding() : new SimpleCxfRsBinding();
+
+ // if the user explicitly selected the Custom binding style, he must provide a binding
+ if (bindingStyle == BindingStyle.Custom && binding == null) {
+ throw new IllegalArgumentException("Custom binding style selected, but no binding was supplied");
+ }
+
+ // if the user has set a binding, do nothing, just make sure that BindingStyle = Custom for coherency purposes
+ if (binding != null) {
+ bindingStyle = BindingStyle.Custom;
+ }
+
+ // set the right binding based on the binding style
+ if (bindingStyle == BindingStyle.SimpleConsumer) {
+ binding = new SimpleCxfRsBinding();
+ } else if (bindingStyle == BindingStyle.Custom) {
+ // do nothing
+ } else {
+ binding = new DefaultCxfRsBinding();
+ }
if (binding instanceof HeaderFilterStrategyAware) {
((HeaderFilterStrategyAware) binding).setHeaderFilterStrategy(getHeaderFilterStrategy());
http://git-wip-us.apache.org/repos/asf/camel/blob/c7d05d4c/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java
new file mode 100644
index 0000000..e5d94af
--- /dev/null
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java
@@ -0,0 +1,127 @@
+/**
+ * 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.component.cxf.jaxrs;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.CXFTestSupport;
+import org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.BindingStyle;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+/**
+ * Tests different binding configuration options of the CXFRS consumer.
+ */
+public class CxfRsBindingConfigurationSelectionTest extends CamelTestSupport {
+
+ private static final String RESOURCE_CLASS = "resourceClasses=org.apache.camel.component.cxf.jaxrs.simplebinding.testbean.CustomerServiceResource";
+ private static final String CXF_RS_ENDPOINT_URI_CUSTOM = String.format("cxfrs://http://localhost:%s/CxfRsConsumerTest/rest?bindingStyle=Custom&", CXFTestSupport.getPort2())
+ + RESOURCE_CLASS + "&binding=#binding";
+ private static final String CXF_RS_ENDPOINT_URI_SIMPLE = String.format("cxfrs://http://localhost:%s/CxfRsConsumerTest/rest?bindingStyle=SimpleConsumer&", CXFTestSupport.getPort1())
+ + RESOURCE_CLASS;
+ private static final String CXF_RS_ENDPOINT_URI_DEFAULT = String.format("cxfrs://http://localhost:%s/CxfRsConsumerTest/rest?bindingStyle=Default&", CXFTestSupport.getPort3()) + RESOURCE_CLASS;
+ private static final String CXF_RS_ENDPOINT_URI_NONE = String.format("cxfrs://http://localhost:%s/CxfRsConsumerTest/rest?", CXFTestSupport.getPort4()) + RESOURCE_CLASS;
+
+ @Test
+ public void testCxfRsBindingConfiguration() {
+ // check binding styles
+ assertEquals(BindingStyle.Custom, endpointForRouteId("custom").getBindingStyle());
+ assertEquals(BindingStyle.SimpleConsumer, endpointForRouteId("simple").getBindingStyle());
+ assertEquals(BindingStyle.Default, endpointForRouteId("default").getBindingStyle());
+ assertEquals(BindingStyle.Default, endpointForRouteId("none").getBindingStyle());
+
+ // check binding implementations
+ assertEquals(DummyCxfRsBindingImplementation.class, endpointForRouteId("custom").getBinding().getClass());
+ assertEquals(SimpleCxfRsBinding.class, endpointForRouteId("simple").getBinding().getClass());
+ assertEquals(DefaultCxfRsBinding.class, endpointForRouteId("default").getBinding().getClass());
+ assertEquals(DefaultCxfRsBinding.class, endpointForRouteId("default").getBinding().getClass());
+ }
+
+ private CxfRsEndpoint endpointForRouteId(String routeId) {
+ return (CxfRsEndpoint) context.getRoute(routeId).getConsumer().getEndpoint();
+ }
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry answer = super.createRegistry();
+ answer.bind("binding", new DummyCxfRsBindingImplementation());
+ return answer;
+ }
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+
+ from(CXF_RS_ENDPOINT_URI_CUSTOM).routeId("custom")
+ .to("log:foo");
+
+ from(CXF_RS_ENDPOINT_URI_SIMPLE).routeId("simple")
+ .to("log:foo");
+
+ from(CXF_RS_ENDPOINT_URI_DEFAULT).routeId("default")
+ .to("log:foo");
+
+ from(CXF_RS_ENDPOINT_URI_NONE).routeId("none")
+ .to("log:foo");
+
+ }
+ };
+ }
+
+ private final class DummyCxfRsBindingImplementation implements CxfRsBinding {
+ @Override
+ public void populateExchangeFromCxfRsRequest(org.apache.cxf.message.Exchange cxfExchange, Exchange camelExchange, Method method, Object[] paramArray) {
+ }
+
+ @Override
+ public Object populateCxfRsResponseFromExchange(Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Object bindResponseToCamelBody(Object response, Exchange camelExchange) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, Object> bindResponseHeadersToCamelHeaders(Object response, Exchange camelExchange) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object bindCamelMessageBodyToRequestBody(Message camelMessage, Exchange camelExchange) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public MultivaluedMap<String, String> bindCamelHeadersToRequestHeaders(Map<String, Object> camelHeaders, Exchange camelExchange) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+}
[08/50] git commit: CAMEL-7803 Fixed the CS errors
Posted by cm...@apache.org.
CAMEL-7803 Fixed the CS errors
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6df20285
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6df20285
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6df20285
Branch: refs/remotes/origin/camel-2.13.x
Commit: 6df202851ddb017df8129fbd06c662f42c387fff
Parents: 75c973a
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Sep 16 20:53:52 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Sep 16 21:04:43 2014 +0800
----------------------------------------------------------------------
.../component/jdbc/DefaultJdbcPrepareStatementStrategy.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6df20285/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
index b412ff2..a88fd0e 100644
--- a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
+++ b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
@@ -72,8 +72,8 @@ public class DefaultJdbcPrepareStatementStrategy implements JdbcPrepareStatement
return new Iterator<Object>() {
private NamedQueryParser parser = new NamedQueryParser(query);
private Object next;
- private boolean done = false;
- private boolean preFetched = false;
+ private boolean done;
+ private boolean preFetched;
@Override
public boolean hasNext() {
@@ -81,7 +81,7 @@ public class DefaultJdbcPrepareStatementStrategy implements JdbcPrepareStatement
next();
preFetched = true;
}
- return (!done);
+ return !done;
}
@Override
[35/50] git commit: CAMEL-7885: Restarting a timer endpoint may not
trigger at expected time the first time
Posted by cm...@apache.org.
CAMEL-7885: Restarting a timer endpoint may not trigger at expected time the first time
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/077e1e21
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/077e1e21
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/077e1e21
Branch: refs/remotes/origin/camel-2.13.x
Commit: 077e1e21795684159d7723a17298b6f84a533da7
Parents: b9ca479
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Oct 1 11:17:14 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Oct 1 11:18:40 2014 +0200
----------------------------------------------------------------------
.../camel/component/timer/TimerComponent.java | 39 ++++++++++++++++---
.../camel/component/timer/TimerConsumer.java | 13 ++++++-
.../camel/component/timer/TimerEndpoint.java | 41 ++++++++++++++------
3 files changed, 74 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/077e1e21/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
index aed97e0..ec67f01 100644
--- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
@@ -22,6 +22,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.UriEndpointComponent;
@@ -34,14 +35,15 @@ import org.apache.camel.impl.UriEndpointComponent;
*/
public class TimerComponent extends UriEndpointComponent {
private final Map<String, Timer> timers = new HashMap<String, Timer>();
+ private final Map<String, AtomicInteger> refCounts = new HashMap<>();
public TimerComponent() {
super(TimerEndpoint.class);
}
- public Timer getTimer(TimerEndpoint endpoint) {
- String key = endpoint.getTimerName();
- if (!endpoint.isDaemon()) {
+ public Timer getTimer(TimerConsumer consumer) {
+ String key = consumer.getEndpoint().getTimerName();
+ if (!consumer.getEndpoint().isDaemon()) {
key = "nonDaemon:" + key;
}
@@ -50,14 +52,40 @@ public class TimerComponent extends UriEndpointComponent {
answer = timers.get(key);
if (answer == null) {
// the timer name is also the thread name, so lets resolve a name to be used
- String name = endpoint.getCamelContext().getExecutorServiceManager().resolveThreadName("timer://" + endpoint.getTimerName());
- answer = new Timer(name, endpoint.isDaemon());
+ String name = consumer.getEndpoint().getCamelContext().getExecutorServiceManager().resolveThreadName("timer://" + consumer.getEndpoint().getTimerName());
+ answer = new Timer(name, consumer.getEndpoint().isDaemon());
timers.put(key, answer);
+ // store new reference counter
+ refCounts.put(key, new AtomicInteger(1));
+ } else {
+ // increase reference counter
+ AtomicInteger counter = refCounts.get(key);
+ counter.incrementAndGet();
}
}
return answer;
}
+ public void removeTimer(TimerConsumer consumer) {
+ String key = consumer.getEndpoint().getTimerName();
+ if (!consumer.getEndpoint().isDaemon()) {
+ key = "nonDaemon:" + key;
+ }
+
+ synchronized (timers) {
+ // decrease reference counter
+ AtomicInteger counter = refCounts.get(key);
+ if (counter.decrementAndGet() <= 0) {
+ refCounts.remove(key);
+ // remove timer as its no longer in use
+ Timer timer = timers.remove(key);
+ if (timer != null) {
+ timer.cancel();
+ }
+ }
+ }
+ }
+
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
TimerEndpoint answer = new TimerEndpoint(uri, this, remaining);
@@ -89,5 +117,6 @@ public class TimerComponent extends UriEndpointComponent {
timer.cancel();
}
timers.clear();
+ refCounts.clear();
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/077e1e21/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
index 66617d2..d0b2e6b 100644
--- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
@@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.camel.AsyncCallback;
import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.StartupListener;
@@ -47,6 +48,11 @@ public class TimerConsumer extends DefaultConsumer implements StartupListener {
}
@Override
+ public TimerEndpoint getEndpoint() {
+ return (TimerEndpoint) super.getEndpoint();
+ }
+
+ @Override
protected void doStart() throws Exception {
task = new TimerTask() {
// counter
@@ -81,7 +87,7 @@ public class TimerConsumer extends DefaultConsumer implements StartupListener {
// only configure task if CamelContext already started, otherwise the StartupListener
// is configuring the task later
if (!configured && endpoint.getCamelContext().getStatus().isStarted()) {
- Timer timer = endpoint.getTimer();
+ Timer timer = endpoint.getTimer(this);
configureTask(task, timer);
}
}
@@ -93,12 +99,15 @@ public class TimerConsumer extends DefaultConsumer implements StartupListener {
}
task = null;
configured = false;
+
+ // remove timer
+ endpoint.removeTimer(this);
}
@Override
public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception {
if (task != null && !configured) {
- Timer timer = endpoint.getTimer();
+ Timer timer = endpoint.getTimer(this);
configureTask(task, timer);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/077e1e21/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
index 5b4dc3f..89c170e 100644
--- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
@@ -64,6 +64,11 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS
this.timerName = timerName;
}
+ @Override
+ public TimerComponent getComponent() {
+ return (TimerComponent) super.getComponent();
+ }
+
public Producer createProducer() throws Exception {
throw new RuntimeCamelException("Cannot produce to a TimerEndpoint: " + getEndpointUri());
}
@@ -167,18 +172,6 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS
return true;
}
- public synchronized Timer getTimer() {
- if (timer == null) {
- TimerComponent tc = (TimerComponent)getComponent();
- timer = tc.getTimer(this);
- }
- return timer;
- }
-
- public synchronized void setTimer(Timer timer) {
- this.timer = timer;
- }
-
@ManagedAttribute(description = "Camel id")
public String getCamelId() {
return this.getCamelContext().getName();
@@ -198,4 +191,28 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS
public String getState() {
return getStatus().name();
}
+
+ protected TimerEndpoint(String endpointUri, Component component) {
+ super(endpointUri, component);
+ }
+
+ public Timer getTimer(TimerConsumer consumer) {
+ if (timer != null) {
+ // use custom timer
+ return timer;
+ }
+ return getComponent().getTimer(consumer);
+ }
+
+ public void setTimer(Timer timer) {
+ this.timer = timer;
+ }
+
+ public void removeTimer(TimerConsumer consumer) {
+ if (timer == null) {
+ // only remove timer if we are not using a custom timer
+ getComponent().removeTimer(consumer);
+ }
+ }
+
}
[20/50] git commit: CAMEL-7863 Updated the java doc for the operation
name lookup.
Posted by cm...@apache.org.
CAMEL-7863 Updated the java doc for the operation name lookup.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/55c5c4b4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/55c5c4b4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/55c5c4b4
Branch: refs/remotes/origin/camel-2.13.x
Commit: 55c5c4b4d26b97a4f61d660a0951e617dc9fdb68
Parents: 94c748c
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Sep 26 11:29:36 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Sep 26 15:07:02 2014 +0800
----------------------------------------------------------------------
.../java/org/apache/camel/component/cxf/CxfProducer.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/55c5c4b4/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
index 28e9913..ea0e6d7 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
@@ -324,8 +324,14 @@ public class CxfProducer extends DefaultProducer implements AsyncProcessor {
}
/**
- * Get operation name from header and use it to lookup and return a
- * {@link BindingOperationInfo}.
+ * <p>Get operation name from header and use it to lookup and return a
+ * {@link BindingOperationInfo}.</p>
+ * <p>CxfProducer lookups the operation name lookup with below order, and it uses the first found one which is not null:</p>
+ * <ul>
+ * <li> Using the in message header "operationName". </li>
+ * <li> Using the defaultOperationName option value from the CxfEndpoint. </li>
+ * <li> Using the first operation which is find from the CxfEndpoint Operations list. </li>
+ * <ul>
*/
private BindingOperationInfo getBindingOperationInfo(Exchange ex) {
CxfEndpoint endpoint = (CxfEndpoint)this.getEndpoint();
[36/50] git commit: CAMEL-7885: Restarting a timer endpoint may not
trigger at expected time the first time
Posted by cm...@apache.org.
CAMEL-7885: Restarting a timer endpoint may not trigger at expected time the first time
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/845410e8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/845410e8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/845410e8
Branch: refs/remotes/origin/camel-2.13.x
Commit: 845410e83ab12f5b88cbdb5891e2ccb241e8608d
Parents: 077e1e2
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Oct 1 11:22:39 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Oct 1 11:22:53 2014 +0200
----------------------------------------------------------------------
.../org/apache/camel/component/timer/TimerComponent.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/845410e8/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
index ec67f01..6c6ab01 100644
--- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
@@ -35,7 +35,7 @@ import org.apache.camel.impl.UriEndpointComponent;
*/
public class TimerComponent extends UriEndpointComponent {
private final Map<String, Timer> timers = new HashMap<String, Timer>();
- private final Map<String, AtomicInteger> refCounts = new HashMap<>();
+ private final Map<String, AtomicInteger> refCounts = new HashMap<String, AtomicInteger>();
public TimerComponent() {
super(TimerEndpoint.class);
@@ -60,7 +60,9 @@ public class TimerComponent extends UriEndpointComponent {
} else {
// increase reference counter
AtomicInteger counter = refCounts.get(key);
- counter.incrementAndGet();
+ if (counter != null) {
+ counter.incrementAndGet();
+ }
}
}
return answer;
@@ -75,7 +77,7 @@ public class TimerComponent extends UriEndpointComponent {
synchronized (timers) {
// decrease reference counter
AtomicInteger counter = refCounts.get(key);
- if (counter.decrementAndGet() <= 0) {
+ if (counter != null && counter.decrementAndGet() <= 0) {
refCounts.remove(key);
// remove timer as its no longer in use
Timer timer = timers.remove(key);
[49/50] git commit: CAMEL-7910 Netty {Client|Server}ChannelHandler
need to pass the close and open event around
Posted by cm...@apache.org.
CAMEL-7910 Netty {Client|Server}ChannelHandler need to pass the close and open event around
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b41b8d05
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b41b8d05
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b41b8d05
Branch: refs/remotes/origin/camel-2.13.x
Commit: b41b8d05adcb3bd3bac8fd8948bef128f646d42a
Parents: 9cf11bd
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Oct 14 10:24:46 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Oct 17 11:36:33 2014 +0800
----------------------------------------------------------------------
.../camel/component/netty/handlers/ClientChannelHandler.java | 4 ++++
.../camel/component/netty/handlers/ServerChannelHandler.java | 4 ++++
2 files changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/b41b8d05/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
index ea9d578..7a6d31f 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
@@ -56,6 +56,8 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
}
// to keep track of open sockets
producer.getAllChannels().add(channelStateEvent.getChannel());
+ // make sure the event can be processed by other handlers
+ super.channelOpen(ctx, channelStateEvent);
}
@Override
@@ -119,6 +121,8 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
// signal callback
callback.done(false);
}
+ // make sure the event can be processed by other handlers
+ super.channelClosed(ctx, e);
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/b41b8d05/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java
index 6bafe7b..f966dee 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java
@@ -56,6 +56,8 @@ public class ServerChannelHandler extends SimpleChannelUpstreamHandler {
}
// to keep track of open sockets
consumer.getNettyServerBootstrapFactory().addChannel(e.getChannel());
+ // make sure the event can be processed by other handlers
+ super.channelOpen(ctx, e);
}
@Override
@@ -65,6 +67,8 @@ public class ServerChannelHandler extends SimpleChannelUpstreamHandler {
}
// to keep track of open sockets
consumer.getNettyServerBootstrapFactory().removeChannel(e.getChannel());
+ // make sure the event can be processed by other handlers
+ super.channelClosed(ctx, e);
}
@Override
[27/50] git commit: CAMEL-7848 Added support for registry's encoders
and decoders
Posted by cm...@apache.org.
CAMEL-7848 Added support for registry's encoders and decoders
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/229890c4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/229890c4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/229890c4
Branch: refs/remotes/origin/camel-2.13.x
Commit: 229890c49ce0aefdefa2d8dc17b12ae0abdc16ab
Parents: ca14720
Author: Willem Jiang <wi...@gmail.com>
Authored: Sun Sep 28 13:59:49 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sun Sep 28 14:41:05 2014 +0800
----------------------------------------------------------------------
.../netty/http/HttpClientPipelineFactory.java | 24 +++++++++++++++++++-
.../netty/http/HttpServerPipelineFactory.java | 23 +++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/229890c4/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
index b5d2d4d..846d690 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientPipelineFactory.java
@@ -16,11 +16,13 @@
*/
package org.apache.camel.component.netty.http;
+import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
+import org.apache.camel.component.netty.ChannelHandlerFactory;
import org.apache.camel.component.netty.ClientPipelineFactory;
import org.apache.camel.component.netty.NettyComponent;
import org.apache.camel.component.netty.NettyConfiguration;
@@ -79,6 +81,26 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
LOG.debug("Client SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
pipeline.addLast("ssl", sslHandler);
}
+
+ List<ChannelHandler> decoders = producer.getConfiguration().getDecoders();
+ for (int x = 0; x < decoders.size(); x++) {
+ ChannelHandler decoder = decoders.get(x);
+ if (decoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ decoder = ((ChannelHandlerFactory) decoder).newChannelHandler();
+ }
+ pipeline.addLast("decoder-" + x, decoder);
+ }
+
+ List<ChannelHandler> encoders = producer.getConfiguration().getEncoders();
+ for (int x = 0; x < encoders.size(); x++) {
+ ChannelHandler encoder = encoders.get(x);
+ if (encoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ encoder = ((ChannelHandlerFactory) encoder).newChannelHandler();
+ }
+ pipeline.addLast("encoder-" + x, encoder);
+ }
pipeline.addLast("http", new HttpClientCodec());
@@ -89,7 +111,7 @@ public class HttpClientPipelineFactory extends ClientPipelineFactory {
ChannelHandler timeout = new ReadTimeoutHandler(NettyComponent.getTimer(), producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
pipeline.addLast("timeout", timeout);
}
-
+
// handler to route Camel messages
pipeline.addLast("handler", new HttpClientChannelHandler(producer));
http://git-wip-us.apache.org/repos/asf/camel/blob/229890c4/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
index 5d705ad..37fc58b 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpServerPipelineFactory.java
@@ -16,10 +16,13 @@
*/
package org.apache.camel.component.netty.http;
+import java.util.List;
+
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import org.apache.camel.CamelContext;
+import org.apache.camel.component.netty.ChannelHandlerFactory;
import org.apache.camel.component.netty.NettyConsumer;
import org.apache.camel.component.netty.NettyServerBootstrapConfiguration;
import org.apache.camel.component.netty.ServerPipelineFactory;
@@ -82,6 +85,26 @@ public class HttpServerPipelineFactory extends ServerPipelineFactory {
LOG.debug("Server SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
pipeline.addLast("ssl", sslHandler);
}
+
+ List<ChannelHandler> decoders = consumer.getConfiguration().getDecoders();
+ for (int x = 0; x < decoders.size(); x++) {
+ ChannelHandler decoder = decoders.get(x);
+ if (decoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ decoder = ((ChannelHandlerFactory) decoder).newChannelHandler();
+ }
+ pipeline.addLast("decoder-" + x, decoder);
+ }
+
+ List<ChannelHandler> encoders = consumer.getConfiguration().getEncoders();
+ for (int x = 0; x < encoders.size(); x++) {
+ ChannelHandler encoder = encoders.get(x);
+ if (encoder instanceof ChannelHandlerFactory) {
+ // use the factory to create a new instance of the channel as it may not be shareable
+ encoder = ((ChannelHandlerFactory) encoder).newChannelHandler();
+ }
+ pipeline.addLast("encoder-" + x, encoder);
+ }
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new HttpChunkAggregator(configuration.getChunkedMaxContentLength()));
[14/50] git commit: CAMEL-7842 Avoid using InputStreamEntity for
byte[] input
Posted by cm...@apache.org.
CAMEL-7842 Avoid using InputStreamEntity for byte[] input
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/97801146
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/97801146
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/97801146
Branch: refs/remotes/origin/camel-2.13.x
Commit: 978011461d929f96b185449c70fd8418baf7c786
Parents: 64aa22d
Author: Willem Jiang <wi...@gmail.com>
Authored: Sun Sep 21 20:11:59 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sun Sep 21 20:50:19 2014 +0800
----------------------------------------------------------------------
.../org/apache/camel/component/http4/HttpEntityConverter.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/97801146/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java
index e88ceb5..8236da8 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java
@@ -25,6 +25,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.GZIPHelper;
import org.apache.http.HttpEntity;
+import org.apache.http.entity.AbstractHttpEntity;
+import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.InputStreamEntity;
/**
@@ -77,14 +79,15 @@ public final class HttpEntityConverter {
}
private static HttpEntity asHttpEntity(byte[] data, Exchange exchange) throws Exception {
- InputStreamEntity entity;
+ AbstractHttpEntity entity;
if (exchange != null && !exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) {
String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
InputStream stream = GZIPHelper.compressGzip(contentEncoding, data);
entity = new InputStreamEntity(stream, stream instanceof ByteArrayInputStream
? stream.available() != 0 ? stream.available() : -1 : -1);
} else {
- entity = new InputStreamEntity(new ByteArrayInputStream(data), data.length);
+ // create the Repeatable HttpEntity
+ entity = new ByteArrayEntity(data);
}
if (exchange != null) {
String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
[26/50] git commit: CAMEL-7856 Fixed the test error with JDK7
Posted by cm...@apache.org.
CAMEL-7856 Fixed the test error with JDK7
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ca14720c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ca14720c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ca14720c
Branch: refs/remotes/origin/camel-2.13.x
Commit: ca14720c727f2f26005f41135460223642b37cc3
Parents: 234df76
Author: Willem Jiang <wi...@gmail.com>
Authored: Sun Sep 28 10:59:39 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sun Sep 28 14:08:37 2014 +0800
----------------------------------------------------------------------
.../org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java | 4 ++--
.../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml | 4 ++--
.../camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml | 6 +-----
3 files changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ca14720c/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
index b4b63a1..9cf869f 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
@@ -392,8 +392,8 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
return ignoreDeleteMethodMessageBody;
}
- public void setIgnoreDELETEMethodMessageBody(boolean ignoreDELETEMethodMessageBody) {
- this.ignoreDeleteMethodMessageBody = ignoreDELETEMethodMessageBody;
+ public void setIgnoreDeleteMethodMessageBody(boolean ignoreDeleteMethodMessageBody) {
+ this.ignoreDeleteMethodMessageBody = ignoreDeleteMethodMessageBody;
}
public BindingStyle getBindingStyle() {
http://git-wip-us.apache.org/repos/asf/camel/blob/ca14720c/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
index 172aac1..52d9d7f 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
@@ -64,9 +64,9 @@
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- Just need to ignoreDeleteMethodMessageBody -->
- <from uri="cxfrs://bean://rsServer?ignoreDeleteMethodMessageBody=true"/>
+ <from uri="cxfrs://bean://rsServer"/>
<to uri="log:body?level=INFO"/>
- <to uri="cxfrs://bean://rsClient"/>
+ <to uri="cxfrs://bean://rsClient?ignoreDeleteMethodMessageBody=true"/>
</route>
</camelContext>
http://git-wip-us.apache.org/repos/asf/camel/blob/ca14720c/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml
index 074bf89..0a2adce 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml
@@ -52,11 +52,7 @@
<route>
<!-- Jetty server can be used to proxy the request to cxfrs client -->
<from uri="jetty://http://localhost:{{CXFTestSupport.port5}}/CxfRsRouterTest/route?matchOnUriPrefix=true&bridgeEndpoint=true"/>
- <!-- We can remove this configure as the CXFRS producer is using the HttpAPI by default -->
- <setHeader headerName="CamelCxfRsUsingHttpAPI">
- <constant>True</constant>
- </setHeader>
- <to uri="cxfrs://bean://rsClient"/>
+ <to uri="cxfrs://bean://rsClient?ignoreDeleteMethodMessageBody=true"/>
</route>
</camelContext>
[12/50] git commit: CAMEL-7053 remove the dependency of hibernat
Posted by cm...@apache.org.
CAMEL-7053 remove the dependency of hibernat
Conflicts:
components/camel-jpa/pom.xml
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ee02b82d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ee02b82d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ee02b82d
Branch: refs/remotes/origin/camel-2.13.x
Commit: ee02b82d61af5cff753ee4f7ec7c45f7f212db13
Parents: d1628b4
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Sep 17 09:54:43 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Sep 17 11:03:46 2014 +0800
----------------------------------------------------------------------
components/camel-jpa/pom.xml | 9 +--------
.../processor/jpa/JpaRouteSkipLockedEntityTest.java | 11 +++++------
.../src/test/resources/META-INF/persistence.xml | 14 ++++++++------
.../processor/jpa/springJpaRouteSkipLockedTest.xml | 6 +++---
4 files changed, 17 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ee02b82d/components/camel-jpa/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-jpa/pom.xml b/components/camel-jpa/pom.xml
index e133fce..4912c73 100644
--- a/components/camel-jpa/pom.xml
+++ b/components/camel-jpa/pom.xml
@@ -65,7 +65,7 @@
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<scope>provided</scope>
</dependency>
-
+
<!-- test dependencies -->
<dependency>
<groupId>org.apache.camel</groupId>
@@ -102,12 +102,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>${hibernate-version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
@@ -119,7 +113,6 @@
<configuration>
<persistenceXmlFile>${project.basedir}/src/test/resources/META-INF/persistence.xml</persistenceXmlFile>
<includes>org/apache/camel/examples/*.class</includes>
- <excludes>org/apache/camel/examples/VersionedItem.class</excludes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
http://git-wip-us.apache.org/repos/asf/camel/blob/ee02b82d/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSkipLockedEntityTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSkipLockedEntityTest.java b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSkipLockedEntityTest.java
index 3c95a06..c61d9b1 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSkipLockedEntityTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaRouteSkipLockedEntityTest.java
@@ -26,12 +26,13 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.examples.VersionedItem;
import org.apache.camel.spring.SpringRouteBuilder;
-import org.hibernate.engine.spi.SessionImplementor;
+import org.junit.Ignore;
import org.junit.Test;
/**
* @version
*/
+@Ignore("Need the fix of OPENJPA-2461")
public class JpaRouteSkipLockedEntityTest extends AbstractJpaTest {
protected static final String SELECT_ALL_STRING = "select x from " + VersionedItem.class.getName() + " x";
@@ -50,9 +51,9 @@ public class JpaRouteSkipLockedEntityTest extends AbstractJpaTest {
template.sendBody("jpa://" + VersionedItem.class.getName(), new VersionedItem("two"));
template.sendBody("jpa://" + VersionedItem.class.getName(), new VersionedItem("three"));
template.sendBody("jpa://" + VersionedItem.class.getName(), new VersionedItem("four"));
-
- this.context.startRoute("first");
+
this.context.startRoute("second");
+ this.context.startRoute("first");
assertMockEndpointsSatisfied();
@@ -93,7 +94,6 @@ public class JpaRouteSkipLockedEntityTest extends AbstractJpaTest {
try {
count++;
-
// if (count != 1) {
cond1.signal();
// }
@@ -116,8 +116,7 @@ public class JpaRouteSkipLockedEntityTest extends AbstractJpaTest {
public void setLockTimeout(int timeout) throws SQLException {
entityManager.getTransaction().begin();
- SessionImplementor session = entityManager.unwrap(SessionImplementor.class);
- Connection connection = session.connection();
+ Connection connection = (Connection)entityManager.unwrap(java.sql.Connection.class);
connection.createStatement().execute("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.locks.waitTimeout', '" + timeout + "')");
entityManager.getTransaction().commit();
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ee02b82d/components/camel-jpa/src/test/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/resources/META-INF/persistence.xml b/components/camel-jpa/src/test/resources/META-INF/persistence.xml
index b6cdcdf..439adea 100644
--- a/components/camel-jpa/src/test/resources/META-INF/persistence.xml
+++ b/components/camel-jpa/src/test/resources/META-INF/persistence.xml
@@ -88,15 +88,17 @@
</persistence-unit>
<!-- END SNIPPET: e2 -->
- <persistence-unit name="hibernate" transaction-type="RESOURCE_LOCAL">
- <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <persistence-unit name="skipLockedEntiy" transaction-type="RESOURCE_LOCAL">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>org.apache.camel.examples.VersionedItem</class>
<properties>
- <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver" />
- <property name="hibernate.connection.url" value="jdbc:derby:target/hibernate;create=true" />
- <property name="hibernate.hbm2ddl.auto" value="create"/>
- </properties>
+ <property name="openjpa.ConnectionURL" value="jdbc:derby:target/derby;create=true"/>
+ <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
+ <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
+ <property name="openjpa.Multithreaded" value="false"/>
+ </properties>
</persistence-unit>
</persistence>
http://git-wip-us.apache.org/repos/asf/camel/blob/ee02b82d/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml b/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml
index 7cff3ee..1235f75 100644
--- a/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml
+++ b/components/camel-jpa/src/test/resources/org/apache/camel/processor/jpa/springJpaRouteSkipLockedTest.xml
@@ -17,10 +17,10 @@
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
- <property name="persistenceUnitName" value="hibernate" />
- <property name="jpaDialect">
+ <property name="persistenceUnitName" value="skipLockedEntiy"/>
+ <!--property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
- </property>
+ </property-->
</bean>
<bean class="org.apache.camel.component.jpa.JpaComponent" id="jpa">
[02/50] git commit: Default CXFRS Binding: Fix a wrong usage of
HeaderFilterStrategy#applyFilterTo...
Posted by cm...@apache.org.
Default CXFRS Binding: Fix a wrong usage of HeaderFilterStrategy#applyFilterTo...
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5a05109e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5a05109e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5a05109e
Branch: refs/remotes/origin/camel-2.13.x
Commit: 5a05109eec7216a2aee1b053bd2117f2f7514d1e
Parents: c7d05d4
Author: Raul Kripalani <ra...@apache.org>
Authored: Tue Sep 9 17:49:28 2014 +0100
Committer: Raul Kripalani <ra...@apache.org>
Committed: Tue Sep 9 17:49:55 2014 +0100
----------------------------------------------------------------------
.../org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5a05109e/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java
index d72ceab..4d0464a 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java
@@ -283,7 +283,7 @@ public class DefaultCxfRsBinding implements CxfRsBinding, HeaderFilterStrategyAw
Map<String, List<String>> headers = (Map<String, List<String>>)cxfMessage.get(org.apache.cxf.message.Message.PROTOCOL_HEADERS);
for (Map.Entry<String, List<String>>entry : headers.entrySet()) {
// just make sure the first String element is not null
- if (headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), camelExchange)
+ if (headerFilterStrategy.applyFilterToExternalHeaders(entry.getKey(), entry.getValue(), camelExchange)
|| entry.getValue().get(0) == null) {
LOG.trace("Drop CXF message protocol header: {}={}", entry.getKey(), entry.getValue());
} else {
[41/50] git commit: CAMEL-7900 Honored chunksize in camel-hdfs
Posted by cm...@apache.org.
CAMEL-7900 Honored chunksize in camel-hdfs
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/607ab4e8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/607ab4e8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/607ab4e8
Branch: refs/remotes/origin/camel-2.13.x
Commit: 607ab4e83cb4af96b88d90a62bfdd1b609c53ce0
Parents: 4ff0ee9
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Oct 10 21:58:47 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sat Oct 11 13:57:24 2014 +0800
----------------------------------------------------------------------
.../main/java/org/apache/camel/component/hdfs/HdfsFileType.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/607ab4e8/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsFileType.java
----------------------------------------------------------------------
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsFileType.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsFileType.java
index a3b2112..97c174f 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsFileType.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsFileType.java
@@ -75,7 +75,7 @@ public enum HdfsFileType {
public long next(HdfsInputStream hdfsistr, Holder<Object> key, Holder<Object> value) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream(hdfsistr.getChunkSize());
- byte buf[] = new byte[HdfsConstants.DEFAULT_BUFFERSIZE];
+ byte buf[] = new byte[hdfsistr.getChunkSize()];
int bytesRead = ((InputStream) hdfsistr.getIn()).read(buf);
if (bytesRead >= 0) {
bos.write(buf, 0, bytesRead);
[40/50] git commit: CAMEL-7886 Fixed the ContentType charset setting
issue of camel-http4
Posted by cm...@apache.org.
CAMEL-7886 Fixed the ContentType charset setting issue of camel-http4
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4ff0ee9f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4ff0ee9f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4ff0ee9f
Branch: refs/remotes/origin/camel-2.13.x
Commit: 4ff0ee9f0d3779205c3f5839e7627f3161ae28ae
Parents: 3580582
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Oct 9 16:11:17 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Oct 9 16:15:05 2014 +0800
----------------------------------------------------------------------
.../java/org/apache/camel/component/http4/HttpProducer.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/4ff0ee9f/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
index 2fb8380..d41dbe1 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
@@ -412,7 +412,12 @@ public class HttpProducer extends DefaultProducer {
//When ContentType.parse parse method parse "multipart/form-data;boundary=---------------------------j2radvtrk",
//it removes "boundary" from Content-Type; I have to use contentType.create method.
if (contentTypeString != null) {
- contentType = ContentType.create(contentTypeString);
+ // using ContentType.parser for charset
+ if (contentTypeString.indexOf("charset") > 0) {
+ contentType = ContentType.parse(contentTypeString);
+ } else {
+ contentType = ContentType.create(contentTypeString);
+ }
}
if (contentTypeString != null && HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT.equals(contentTypeString)) {
[23/50] git commit: CAMEL-7864: Updates to allow setting Kafka's
zookeeper.connect directly.
Posted by cm...@apache.org.
CAMEL-7864: Updates to allow setting Kafka's zookeeper.connect directly.
- Fixed a few accidental tabs...
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b840c4dd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b840c4dd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b840c4dd
Branch: refs/remotes/origin/camel-2.13.x
Commit: b840c4dd265e1c1a9d1c0246de5ca4b8fa83ca6f
Parents: daccc8e
Author: john.shields <jo...@tubemogul.com>
Authored: Thu Sep 25 21:15:16 2014 -0500
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Sep 27 13:23:19 2014 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/component/kafka/KafkaEndpoint.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/b840c4dd/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
index deed68a..af1bcd1 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
@@ -103,13 +103,13 @@ public class KafkaEndpoint extends DefaultEndpoint {
//-------------------------------------------------------------------------
public String getZookeeperConnect() {
- return configuration.getZookeeperConnect();
+ return configuration.getZookeeperConnect();
}
public void setZookeeperConnect(String zookeeperConnect) {
- configuration.setZookeeperConnect(zookeeperConnect);
- }
-
+ configuration.setZookeeperConnect(zookeeperConnect);
+ }
+
public String getZookeeperHost() {
return configuration.getZookeeperHost();
}
[15/50] git commit: CAMEL-7839 Fixed the issue that Xpath is not
namespace aware in choice
Posted by cm...@apache.org.
CAMEL-7839 Fixed the issue that Xpath is not namespace aware in choice
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/61867a06
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/61867a06
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/61867a06
Branch: refs/remotes/origin/camel-2.13.x
Commit: 61867a06054b57d8e6b218d78cec0c9e4ed8c8ea
Parents: 9780114
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Sep 22 15:05:59 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Sep 22 15:08:24 2014 +0800
----------------------------------------------------------------------
.../camel/model/ProcessorDefinitionHelper.java | 3 ++
.../model/ProcessorDefinitionHelperTest.java | 6 ++-
...erWithNamespaceOnImportRouteContextTest.java | 38 +++++++++++++++++++
.../xpathChoiceWithNamespaceOnRouteContext.xml | 32 ++++++++++++++++
...eWithNamespaceOnRouteContextRouteContext.xml | 39 ++++++++++++++++++++
5 files changed, 116 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
index 2ae283b..a46502f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
@@ -210,6 +210,9 @@ public final class ProcessorDefinitionHelper {
if (out instanceof ChoiceDefinition) {
ChoiceDefinition choice = (ChoiceDefinition) out;
for (WhenDefinition when : choice.getWhenClauses()) {
+ if (type.isInstance(when)) {
+ found.add((T)when);
+ }
List<ProcessorDefinition<?>> children = when.getOutputs();
doFindType(children, type, found);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java b/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
index 4aa1d7e..8aa7b0c 100644
--- a/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/model/ProcessorDefinitionHelperTest.java
@@ -29,7 +29,9 @@ public class ProcessorDefinitionHelperTest extends ContextTestSupport {
Iterator<ProcessorDefinition> it = ProcessorDefinitionHelper.filterTypeInOutputs(route.getOutputs(), ProcessorDefinition.class);
assertNotNull(it);
+ assertEquals("whenfoo", it.next().getId());
assertEquals("foo", it.next().getId());
+ assertEquals("whenbar", it.next().getId());
assertEquals("bar", it.next().getId());
assertEquals("baz", it.next().getId());
assertFalse(it.hasNext());
@@ -42,8 +44,8 @@ public class ProcessorDefinitionHelperTest extends ContextTestSupport {
public void configure() throws Exception {
from("direct:start")
.choice()
- .when(header("foo")).to("mock:foo").id("foo")
- .when(header("bar")).to("mock:bar").id("bar")
+ .when(header("foo")).id("whenfoo").to("mock:foo").id("foo")
+ .when(header("bar")).id("whenbar").to("mock:bar").id("bar")
.otherwise()
.to("mock:baz").id("baz");
}
http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
new file mode 100644
index 0000000..0a1a42e
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathFilterWithNamespaceOnImportRouteContextTest.java
@@ -0,0 +1,38 @@
+/**
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.XPathFilterTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+/**
+ *
+ */
+public class SpringXPathFilterWithNamespaceOnImportRouteContextTest extends XPathFilterTest {
+
+ @Override
+ protected void setUp() throws Exception {
+ matchingBody = "<person name='James' city='London' xmlns='http://example.com/person'/>";
+ super.setUp();
+ }
+
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this, "org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
new file mode 100644
index 0000000..d39bd34
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContext.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:foo="http://example.com/person"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="xpathChoiceWithNamespaceOnRouteContextRouteContext.xml" />
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <routeContextRef ref="myCoolRoutes"/>
+ </camelContext>
+
+
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/61867a06/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
new file mode 100644
index 0000000..885a837
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathChoiceWithNamespaceOnRouteContextRouteContext.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:foo="http://example.com/person"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <routeContext id="myCoolRoutes" xmlns="http://camel.apache.org/schema/spring">
+
+ <route>
+ <from uri="direct:start" />
+ <choice>
+ <when>
+ <xpath>/foo:person[@name='James']</xpath>
+ <to uri="mock:result" />
+ </when>
+ </choice>
+ </route>
+
+ </routeContext>
+
+</beans>
\ No newline at end of file
[05/50] git commit: upgrade jruby from 1.7.12 to 1.7.15
Posted by cm...@apache.org.
upgrade jruby from 1.7.12 to 1.7.15
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5805379c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5805379c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5805379c
Branch: refs/remotes/origin/camel-2.13.x
Commit: 5805379c0c521da031e45d23604a13b7e1d5db0b
Parents: d91dfb3
Author: cmueller <cm...@apache.org>
Authored: Thu Sep 11 23:15:40 2014 +0200
Committer: cmueller <cm...@apache.org>
Committed: Thu Sep 11 23:17:28 2014 +0200
----------------------------------------------------------------------
parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5805379c/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 1a7a15e..ebfe0b3 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -237,7 +237,7 @@
<jodatime2-bundle-version>2.3</jodatime2-bundle-version>
<josql-bundle-version>1.5_5</josql-bundle-version>
<josql-version>1.5</josql-version>
- <jruby-version>1.7.12</jruby-version>
+ <jruby-version>1.7.15</jruby-version>
<jsendnsca-version>1.3.1</jsendnsca-version>
<jsmpp-version>2.1.0_4</jsmpp-version>
<jsch-version>0.1.50</jsch-version>
[34/50] git commit: Overrdie the httpclient version in camel-restlet
pom
Posted by cm...@apache.org.
Overrdie the httpclient version in camel-restlet pom
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b9ca4798
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b9ca4798
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b9ca4798
Branch: refs/remotes/origin/camel-2.13.x
Commit: b9ca47981dd2c43da3d6e5d5c225043ec9c4c213
Parents: b23ab8b
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Sep 30 13:28:03 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Sep 30 13:29:48 2014 +0800
----------------------------------------------------------------------
components/camel-restlet/pom.xml | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/b9ca4798/components/camel-restlet/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-restlet/pom.xml b/components/camel-restlet/pom.xml
index 382bb45..c66a241 100644
--- a/components/camel-restlet/pom.xml
+++ b/components/camel-restlet/pom.xml
@@ -6,9 +6,9 @@
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.
@@ -29,7 +29,7 @@
<packaging>bundle</packaging>
<name>Camel :: Restlet</name>
<description>Camel REST (Restlet baesd) Component</description>
-
+
<properties>
<camel.osgi.export.pkg>
org.apache.camel.component.restlet.*
@@ -63,10 +63,16 @@
<version>${restlet-version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>${httpclient4-version}</version>
+ </dependency>
+
<!-- test dependencies -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test-spring</artifactId>
<scope>test</scope>
</dependency>
[50/50] git commit: CAMEL-7920 Make sure the JAXB fallback converter
is the last one loaded
Posted by cm...@apache.org.
CAMEL-7920 Make sure the JAXB fallback converter is the last one loaded
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f0ddb5ef
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f0ddb5ef
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f0ddb5ef
Branch: refs/remotes/origin/camel-2.13.x
Commit: f0ddb5ef76a37bd0b7715ed6ee28165d814f2d95
Parents: b41b8d0
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Oct 17 11:07:26 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Oct 17 11:39:26 2014 +0800
----------------------------------------------------------------------
.../converter/BaseTypeConverterRegistry.java | 1 +
.../org/apache/camel/impl/osgi/Activator.java | 18 ++++++++---
.../camel/core/osgi/OsgiTypeConverter.java | 33 ++++++++++++++------
3 files changed, 38 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f0ddb5ef/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
index 5443e75..a71d46e 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
@@ -389,6 +389,7 @@ public abstract class BaseTypeConverterRegistry extends ServiceSupport implement
log.trace("Adding fallback type converter: {} which can promote: {}", typeConverter, canPromote);
// add in top of fallback as the toString() fallback will nearly always be able to convert
+ // the last one which is add to the FallbackTypeConverter will be called at the first place
fallbackConverters.add(0, new FallbackTypeConverter(typeConverter, canPromote));
if (typeConverter instanceof TypeConverterAware) {
TypeConverterAware typeConverterAware = (TypeConverterAware) typeConverter;
http://git-wip-us.apache.org/repos/asf/camel/blob/f0ddb5ef/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index 9be601b..36d8249 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -61,8 +61,8 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
+import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -176,7 +176,8 @@ public class Activator implements BundleActivator, BundleTrackerCustomizer {
URL url1 = bundle.getEntry(META_INF_TYPE_CONVERTER);
URL url2 = bundle.getEntry(META_INF_FALLBACK_TYPE_CONVERTER);
if (url1 != null || url2 != null) {
- resolvers.add(new BundleTypeConverterLoader(bundle));
+ LOG.debug("Found TypeConverter in bundle {}", bundle.getSymbolicName());
+ resolvers.add(new BundleTypeConverterLoader(bundle, url2 != null));
}
}
}
@@ -264,11 +265,13 @@ public class Activator implements BundleActivator, BundleTrackerCustomizer {
private final AnnotationTypeConverterLoader loader = new Loader();
private final Bundle bundle;
+ private final boolean hasFallbackTypeConverter;
- public BundleTypeConverterLoader(Bundle bundle) {
+ public BundleTypeConverterLoader(Bundle bundle, boolean hasFallbackTypeConverter) {
super(bundle, TypeConverter.class);
ObjectHelper.notNull(bundle, "bundle");
this.bundle = bundle;
+ this.hasFallbackTypeConverter = hasFallbackTypeConverter;
}
public synchronized void load(TypeConverterRegistry registry) throws TypeConverterLoaderException {
@@ -282,7 +285,13 @@ public class Activator implements BundleActivator, BundleTrackerCustomizer {
}
public void register() {
- doRegister(TypeConverterLoader.class);
+ if (hasFallbackTypeConverter) {
+ // The FallbackTypeConverter should have a higher ranking
+ doRegister(TypeConverterLoader.class, Constants.SERVICE_RANKING, new Integer(100));
+ } else {
+ // The default service ranking is Integer(0);
+ doRegister(TypeConverterLoader.class);
+ }
}
class Loader extends AnnotationTypeConverterLoader {
@@ -360,6 +369,7 @@ public class Activator implements BundleActivator, BundleTrackerCustomizer {
// register fallback converters
URL fallbackUrl = bundle.getEntry(META_INF_FALLBACK_TYPE_CONVERTER);
if (fallbackUrl != null) {
+ LOG.debug("Found {} to load the FallbackTypeConverter", META_INF_FALLBACK_TYPE_CONVERTER);
TypeConverter tc = createInstance("FallbackTypeConverter", fallbackUrl, registry.getInjector());
registry.addFallbackTypeConverter(tc, false);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/f0ddb5ef/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
index e5452fe..1ac5fa7 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.core.osgi;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -60,12 +62,16 @@ public class OsgiTypeConverter extends ServiceSupport implements TypeConverter,
public Object addingService(ServiceReference<TypeConverterLoader> serviceReference) {
LOG.trace("AddingService: {}", serviceReference);
TypeConverterLoader loader = bundleContext.getService(serviceReference);
- if (loader != null) {
+ // just make sure we don't load the bundle converter this time
+ if (delegate != null) {
try {
- loader.load(getDelegate());
- } catch (Throwable t) {
- throw ObjectHelper.wrapRuntimeCamelException(t);
+ ServiceHelper.stopService(this.delegate);
+ } catch (Exception e) {
+ // ignore
+ LOG.debug("Error stopping service due: " + e.getMessage() + ". This exception will be ignored.", e);
}
+ // It can force camel to reload the type converter again
+ this.delegate = null;
}
return loader;
}
@@ -81,6 +87,7 @@ public class OsgiTypeConverter extends ServiceSupport implements TypeConverter,
// ignore
LOG.debug("Error stopping service due: " + e.getMessage() + ". This exception will be ignored.", e);
}
+ // It can force camel to reload the type converter again
this.delegate = null;
}
@@ -185,14 +192,20 @@ public class OsgiTypeConverter extends ServiceSupport implements TypeConverter,
throw new RuntimeCamelException("Error loading CoreTypeConverter due: " + e.getMessage(), e);
}
- // load the type converters the tracker has been tracking
- Object[] services = this.tracker.getServices();
- if (services != null) {
- for (Object o : services) {
+ // Load the type converters the tracker has been tracking
+ // Here we need to use the ServiceReference to check the ranking
+ ServiceReference<TypeConverterLoader>[] serviceReferences = this.tracker.getServiceReferences();
+ if (serviceReferences != null) {
+ ArrayList<ServiceReference<TypeConverterLoader>> servicesList =
+ new ArrayList<ServiceReference<TypeConverterLoader>>(Arrays.asList(serviceReferences));
+ // Just make sure we install the high ranking fallback converter at last
+ Collections.sort(servicesList);
+ for (ServiceReference<TypeConverterLoader> sr : servicesList) {
try {
- ((TypeConverterLoader) o).load(answer);
+ LOG.debug("loading the type converter from bundle{} ", sr.getBundle().getSymbolicName());
+ ((TypeConverterLoader)this.tracker.getService(sr)).load(answer);
} catch (Throwable t) {
- throw new RuntimeCamelException("Error loading type converters from service: " + o + " due: " + t.getMessage(), t);
+ throw new RuntimeCamelException("Error loading type converters from service: " + sr + " due: " + t.getMessage(), t);
}
}
}
[46/50] git commit: fixed a CS error
Posted by cm...@apache.org.
fixed a CS error
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f424d824
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f424d824
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f424d824
Branch: refs/remotes/origin/camel-2.13.x
Commit: f424d824314afb00bdb92bcb9b597b30b5e3393a
Parents: 217c81c
Author: Christian Mueller <cm...@apache.org>
Authored: Thu Oct 16 08:59:41 2014 +0200
Committer: Christian Mueller <cm...@apache.org>
Committed: Thu Oct 16 08:59:41 2014 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/component/timer/TimerEndpoint.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f424d824/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
index 89c170e..bc39989 100644
--- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
@@ -64,6 +64,10 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS
this.timerName = timerName;
}
+ protected TimerEndpoint(String endpointUri, Component component) {
+ super(endpointUri, component);
+ }
+
@Override
public TimerComponent getComponent() {
return (TimerComponent) super.getComponent();
@@ -192,10 +196,6 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS
return getStatus().name();
}
- protected TimerEndpoint(String endpointUri, Component component) {
- super(endpointUri, component);
- }
-
public Timer getTimer(TimerConsumer consumer) {
if (timer != null) {
// use custom timer
[25/50] git commit: Camel 2.13.x - upgraded to CXF 2.7.12.
Posted by cm...@apache.org.
Camel 2.13.x - upgraded to CXF 2.7.12.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/234df765
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/234df765
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/234df765
Branch: refs/remotes/origin/camel-2.13.x
Commit: 234df76517b32395404a311a26ebb1b6dcb670a0
Parents: 5c33121
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Sep 27 14:25:42 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Sep 27 14:25:42 2014 +0200
----------------------------------------------------------------------
parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/234df765/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 42338d6..75cd7bf 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -107,7 +107,7 @@
<commons-vfs2-version>2.0</commons-vfs2-version>
<concurrentlinkedhashmap.version>1.4</concurrentlinkedhashmap.version>
<cobertura-maven-plugin-version>2.5.2</cobertura-maven-plugin-version>
- <cxf-version>2.7.11</cxf-version>
+ <cxf-version>2.7.12</cxf-version>
<cxf-version-range>[2.6,4.0)</cxf-version-range>
<cxf-xjc-utils-version>2.7.0</cxf-xjc-utils-version>
<deltaspike-version>0.7</deltaspike-version>
[13/50] git commit: CAMEL-7836: Fixed potential
ConcurrentModificationException when calling getRoutes.
Posted by cm...@apache.org.
CAMEL-7836: Fixed potential ConcurrentModificationException when calling getRoutes.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/64aa22d6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/64aa22d6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/64aa22d6
Branch: refs/remotes/origin/camel-2.13.x
Commit: 64aa22d6f52408678955685549cd66fb29735aba
Parents: ee02b82
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Sep 21 11:23:03 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Sep 21 11:23:42 2014 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/camel/impl/DefaultCamelContext.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/64aa22d6/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index d84d20b..9ade095 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -644,7 +644,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
return routeStartupOrder;
}
- public List<Route> getRoutes() {
+ public synchronized List<Route> getRoutes() {
// lets return a copy of the collection as objects are removed later when services are stopped
if (routes.isEmpty()) {
return Collections.emptyList();
[03/50] git commit: CAMEL-7795 Fixed the regression of MDCResetTest
Posted by cm...@apache.org.
CAMEL-7795 Fixed the regression of MDCResetTest
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/59e467d8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/59e467d8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/59e467d8
Branch: refs/remotes/origin/camel-2.13.x
Commit: 59e467d816ef86181020455c97da42c15249d2ec
Parents: 5a05109
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Sep 10 09:56:34 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Sep 10 09:59:16 2014 +0800
----------------------------------------------------------------------
.../src/main/java/org/apache/camel/impl/MDCUnitOfWork.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/59e467d8/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java b/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
index 62f6b16..1726b80 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
@@ -217,13 +217,15 @@ public class MDCUnitOfWork extends DefaultUnitOfWork {
if (correlationId != null) {
MDC.put(MDC_CORRELATION_ID, correlationId);
}
- if (routeId != null) {
- MDC.put(MDC_ROUTE_ID, routeId);
- }
if (camelContextId != null) {
MDC.put(MDC_CAMEL_CONTEXT_ID, camelContextId);
}
}
+ // need to setup the routeId finally
+ if (routeId != null) {
+ MDC.put(MDC_ROUTE_ID, routeId);
+ }
+
} finally {
// muse ensure delegate is invoked
delegate.done(doneSync);
[17/50] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not
send the message body when using DELETE method
Posted by cm...@apache.org.
CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb61
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5b4abb61
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5b4abb61
Branch: refs/remotes/origin/camel-2.13.x
Commit: 5b4abb619b808d317da99037b734e78fc4398d29
Parents: 2b1296e
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Sep 24 13:41:41 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Sep 24 13:43:43 2014 +0800
----------------------------------------------------------------------
.../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 4 ++--
.../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
index 572e991..c580445 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
@@ -158,8 +158,8 @@ public class CxfRsProducer extends DefaultProducer {
// set the body
Object body = null;
- if (!"GET".equals(httpMethod)) {
- // need to check the request object.
+ if (!"GET".equals(httpMethod) && !"DELETE".equals(httpMethod)) {
+ // need to check the request object if the http Method is not GET or DELETE
body = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);
if (LOG.isTraceEnabled()) {
LOG.trace("Request body = " + body);
http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
index 154b572..9f51dd6 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
@@ -64,6 +64,7 @@
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxfrs://bean://rsServer"/>
+ <to uri="log:body?level=INFO"/>
<!-- We can remove this configure as the CXFRS producer is using the HttpAPI by default -->
<setHeader headerName="CamelCxfRsUsingHttpAPI">
<constant>True</constant>
[43/50] git commit: CAMEL-7890 Enable the NamespaceAware option of
SAXParserFactory in XmlConverter
Posted by cm...@apache.org.
CAMEL-7890 Enable the NamespaceAware option of SAXParserFactory in XmlConverter
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/21ff6985
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/21ff6985
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/21ff6985
Branch: refs/remotes/origin/camel-2.13.x
Commit: 21ff698571bcfa04d59f93f044b243a7ab587dff
Parents: 246014f
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Oct 10 23:32:15 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sat Oct 11 13:57:44 2014 +0800
----------------------------------------------------------------------
.../src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/21ff6985/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
index 0532011..a3f4a29 100644
--- a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
@@ -579,6 +579,7 @@ public class XmlConverter {
} catch (Exception e) {
LOG.warn("SAXParser doesn't support the feature {} with value {}, due to {}.", new Object[]{javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, "true", e});
}
+ sfactory.setNamespaceAware(true);
SAXParser parser = sfactory.newSAXParser();
xmlReader = parser.getXMLReader();
} catch (Exception ex) {
[42/50] git commit: CAMEL-7900 Honored chunksize in camel-hdfs2
Posted by cm...@apache.org.
CAMEL-7900 Honored chunksize in camel-hdfs2
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/246014f2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/246014f2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/246014f2
Branch: refs/remotes/origin/camel-2.13.x
Commit: 246014f27e77205541416b911a8fdb2c9756efee
Parents: 607ab4e
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Oct 10 21:58:11 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sat Oct 11 13:57:33 2014 +0800
----------------------------------------------------------------------
.../main/java/org/apache/camel/component/hdfs2/HdfsFileType.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/246014f2/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsFileType.java
----------------------------------------------------------------------
diff --git a/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsFileType.java b/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsFileType.java
index bb08440..bc97355 100644
--- a/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsFileType.java
+++ b/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsFileType.java
@@ -76,7 +76,7 @@ public enum HdfsFileType {
public long next(HdfsInputStream hdfsistr, Holder<Object> key, Holder<Object> value) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream(hdfsistr.getChunkSize());
- byte buf[] = new byte[HdfsConstants.DEFAULT_BUFFERSIZE];
+ byte buf[] = new byte[hdfsistr.getChunkSize()];
int bytesRead = ((InputStream) hdfsistr.getIn()).read(buf);
if (bytesRead >= 0) {
bos.write(buf, 0, bytesRead);
[22/50] git commit: CAMEL-7864: Updates to allow setting Kafka's
zookeeper.connect directly.
Posted by cm...@apache.org.
CAMEL-7864: Updates to allow setting Kafka's zookeeper.connect directly.
- Added new property to KafkaConfiguration for zookeeperConnection and
configured it to override the zookeeperHost and zookeeperPort
properties.
- Created getZookeeperConnect method on KafkaConfiguration to return
the zookeeperConnect property if set or the combination of host ":"
port if zookeeperConnect is not set.
- Added zookeeperConnect get and set methods on KafkaEndpoint to
delegate to KafkaConfiguration.
- Updated KafkaConsumer to use the getZookeeperConnect method on the
KafkaEndpoint.
- Added tests for the changes.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/daccc8e0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/daccc8e0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/daccc8e0
Branch: refs/remotes/origin/camel-2.13.x
Commit: daccc8e063ec3b305ddb1ef20a9a57b982c45328
Parents: 3a5497a
Author: john.shields <jo...@tubemogul.com>
Authored: Thu Sep 25 20:57:23 2014 -0500
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Sep 27 13:23:14 2014 +0200
----------------------------------------------------------------------
.../component/kafka/KafkaConfiguration.java | 25 +++++++++++++++++--
.../camel/component/kafka/KafkaConsumer.java | 9 +++----
.../camel/component/kafka/KafkaEndpoint.java | 9 +++++++
.../component/kafka/KafkaComponentTest.java | 26 ++++++++++++++++++++
.../component/kafka/KafkaConsumerTest.java | 14 ++++++++---
5 files changed, 71 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/daccc8e0/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java
index 88d5017..881ef3c 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConfiguration.java
@@ -21,6 +21,7 @@ import java.util.Properties;
import kafka.producer.DefaultPartitioner;
public class KafkaConfiguration {
+ private String zookeeperConnect;
private String zookeeperHost;
private int zookeeperPort = 2181;
private String topic;
@@ -127,13 +128,31 @@ public class KafkaConfiguration {
props.put(key, value.toString());
}
}
+
+ public String getZookeeperConnect() {
+ if (this.zookeeperConnect != null) {
+ return zookeeperConnect;
+ } else {
+ return getZookeeperHost() + ":" + getZookeeperPort();
+ }
+ }
+
+ public void setZookeeperConnect(String zookeeperConnect) {
+ this.zookeeperConnect = zookeeperConnect;
+
+ // connect overrides host and port
+ this.zookeeperHost = null;
+ this.zookeeperPort = -1;
+ }
public String getZookeeperHost() {
return zookeeperHost;
}
public void setZookeeperHost(String zookeeperHost) {
- this.zookeeperHost = zookeeperHost;
+ if (this.zookeeperConnect == null) {
+ this.zookeeperHost = zookeeperHost;
+ }
}
public int getZookeeperPort() {
@@ -141,7 +160,9 @@ public class KafkaConfiguration {
}
public void setZookeeperPort(int zookeeperPort) {
- this.zookeeperPort = zookeeperPort;
+ if (this.zookeeperConnect == null) {
+ this.zookeeperPort = zookeeperPort;
+ }
}
public String getGroupId() {
http://git-wip-us.apache.org/repos/asf/camel/blob/daccc8e0/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
index 3087a14..f801328 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
@@ -46,11 +46,8 @@ public class KafkaConsumer extends DefaultConsumer {
super(endpoint, processor);
this.endpoint = endpoint;
this.processor = processor;
- if (endpoint.getZookeeperHost() == null) {
- throw new IllegalArgumentException("zookeeper host must be specified");
- }
- if (endpoint.getZookeeperPort() == 0) {
- throw new IllegalArgumentException("zookeeper port must be specified");
+ if (endpoint.getZookeeperConnect() == null) {
+ throw new IllegalArgumentException("zookeeper host or zookeeper connect must be specified");
}
if (endpoint.getGroupId() == null) {
throw new IllegalArgumentException("groupId must not be null");
@@ -59,7 +56,7 @@ public class KafkaConsumer extends DefaultConsumer {
Properties getProps() {
Properties props = endpoint.getConfiguration().createConsumerProperties();
- props.put("zookeeper.connect", endpoint.getZookeeperHost() + ":" + endpoint.getZookeeperPort());
+ props.put("zookeeper.connect", endpoint.getZookeeperConnect());
props.put("group.id", endpoint.getGroupId());
return props;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/daccc8e0/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
index 002d15e..deed68a 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaEndpoint.java
@@ -102,6 +102,14 @@ public class KafkaEndpoint extends DefaultEndpoint {
// Delegated properties from the configuration
//-------------------------------------------------------------------------
+ public String getZookeeperConnect() {
+ return configuration.getZookeeperConnect();
+ }
+
+ public void setZookeeperConnect(String zookeeperConnect) {
+ configuration.setZookeeperConnect(zookeeperConnect);
+ }
+
public String getZookeeperHost() {
return configuration.getZookeeperHost();
}
@@ -417,4 +425,5 @@ public class KafkaEndpoint extends DefaultEndpoint {
public int getRequestTimeoutMs() {
return configuration.getRequestTimeoutMs();
}
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/daccc8e0/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaComponentTest.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaComponentTest.java
index c11edaf..15cef7a 100644
--- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaComponentTest.java
+++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaComponentTest.java
@@ -24,6 +24,7 @@ import org.junit.Test;
import org.mockito.Mockito;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
public class KafkaComponentTest {
@@ -43,6 +44,7 @@ public class KafkaComponentTest {
String remaining = "broker1:12345,broker2:12566";
KafkaEndpoint endpoint = new KafkaComponent(context).createEndpoint(uri, remaining, params);
+ assertEquals("somehost:2987", endpoint.getZookeeperConnect());
assertEquals("somehost", endpoint.getZookeeperHost());
assertEquals(2987, endpoint.getZookeeperPort());
assertEquals("broker1:12345,broker2:12566", endpoint.getBrokers());
@@ -50,4 +52,28 @@ public class KafkaComponentTest {
assertEquals(3, endpoint.getConsumerStreams());
assertEquals("com.class.Party", endpoint.getPartitioner());
}
+
+ @Test
+ public void testZookeeperConnectPropertyOverride() throws Exception {
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put("zookeeperConnect", "thehost:2181/chroot");
+ params.put("zookeeperHost", "somehost");
+ params.put("zookeeperPort", 2987);
+ params.put("portNumber", 14123);
+ params.put("consumerStreams", "3");
+ params.put("topic", "mytopic");
+ params.put("partitioner", "com.class.Party");
+
+ String uri = "kafka:broker1:12345,broker2:12566";
+ String remaining = "broker1:12345,broker2:12566";
+
+ KafkaEndpoint endpoint = new KafkaComponent(context).createEndpoint(uri, remaining, params);
+ assertEquals("thehost:2181/chroot", endpoint.getZookeeperConnect());
+ assertNull(endpoint.getZookeeperHost());
+ assertEquals(-1, endpoint.getZookeeperPort());
+ assertEquals("broker1:12345,broker2:12566", endpoint.getBrokers());
+ assertEquals("mytopic", endpoint.getTopic());
+ assertEquals(3, endpoint.getConsumerStreams());
+ assertEquals("com.class.Party", endpoint.getPartitioner());
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/daccc8e0/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaConsumerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaConsumerTest.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaConsumerTest.java
index 740f116..b51c09e 100644
--- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaConsumerTest.java
+++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaConsumerTest.java
@@ -28,15 +28,21 @@ public class KafkaConsumerTest {
private Processor processor = mock(Processor.class);
@Test(expected = IllegalArgumentException.class)
- public void consumerRequiresZookeeperHost() throws Exception {
- Mockito.when(endpoint.getZookeeperPort()).thenReturn(2181);
+ public void consumerRequiresZookeeperConnect() throws Exception {
+ Mockito.when(endpoint.getGroupId()).thenReturn("groupOne");
new KafkaConsumer(endpoint, processor);
}
@Test(expected = IllegalArgumentException.class)
- public void consumerRequiresZookeeperPort() throws Exception {
- Mockito.when(endpoint.getZookeeperHost()).thenReturn("localhost");
+ public void consumerRequiresGroupId() throws Exception {
+ Mockito.when(endpoint.getZookeeperConnect()).thenReturn("localhost:2181/chroot");
new KafkaConsumer(endpoint, processor);
}
+ @Test
+ public void consumerOnlyRequiresZookeeperConnectAndGroupId() throws Exception {
+ Mockito.when(endpoint.getGroupId()).thenReturn("groupOne");
+ Mockito.when(endpoint.getZookeeperConnect()).thenReturn("localhost:2181/chroot");
+ new KafkaConsumer(endpoint, processor);
+ }
}
[48/50] git commit: CAMEL-7909 camel-netty-http consumer need to
close the connection if the response connection header is close
Posted by cm...@apache.org.
CAMEL-7909 camel-netty-http consumer need to close the connection if the response connection header is close
Conflicts:
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9cf11bd5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9cf11bd5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9cf11bd5
Branch: refs/remotes/origin/camel-2.13.x
Commit: 9cf11bd58146abb4938d0b546d3308d6e086b6da
Parents: f0e3e20
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Oct 14 10:14:12 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Oct 17 11:35:34 2014 +0800
----------------------------------------------------------------------
.../netty/http/DefaultNettyHttpBinding.java | 9 +++++++--
.../http/handlers/HttpServerChannelHandler.java | 19 ++-----------------
.../camel/component/netty/NettyHelper.java | 2 +-
.../camel/component/netty/NettyProducer.java | 13 ++++++++++---
.../handlers/ServerResponseFutureListener.java | 5 +++++
5 files changed, 25 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/9cf11bd5/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
index 23cae6c..fa8fa81 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
@@ -34,6 +34,7 @@ import org.apache.camel.Message;
import org.apache.camel.NoTypeConversionAvailableException;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.TypeConverter;
+import org.apache.camel.component.netty.NettyConstants;
import org.apache.camel.spi.HeaderFilterStrategy;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.IOHelper;
@@ -67,7 +68,7 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
public DefaultNettyHttpBinding(HeaderFilterStrategy headerFilterStrategy) {
this.headerFilterStrategy = headerFilterStrategy;
}
-
+
public DefaultNettyHttpBinding copy() {
try {
return (DefaultNettyHttpBinding)this.clone();
@@ -384,7 +385,7 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
if (buffer.readerIndex() == buffer.writerIndex()) {
buffer.setIndex(0, buffer.writerIndex());
}
- // TODO How to enable the chunk transport
+ // TODO How to enable the chunk transport
int len = buffer.readableBytes();
// set content-length
response.setHeader(HttpHeaders.Names.CONTENT_LENGTH, len);
@@ -411,6 +412,10 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
}
}
response.setHeader(HttpHeaders.Names.CONNECTION, connection);
+ // Just make sure we close the channel when the connection value is close
+ if (connection.equalsIgnoreCase(HttpHeaders.Values.CLOSE)) {
+ message.setHeader(NettyConstants.NETTY_CLOSE_CHANNEL_WHEN_COMPLETE, true);
+ }
LOG.trace("Connection: {}", connection);
return response;
http://git-wip-us.apache.org/repos/asf/camel/blob/9cf11bd5/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java
index 8894f6a..63edef7 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.netty.http.handlers;
-import java.net.SocketAddress;
import java.net.URI;
import java.nio.channels.ClosedChannelException;
import java.nio.charset.Charset;
@@ -26,7 +25,6 @@ import javax.security.auth.login.LoginException;
import org.apache.camel.Exchange;
import org.apache.camel.LoggingLevel;
-import org.apache.camel.component.netty.NettyConsumer;
import org.apache.camel.component.netty.NettyHelper;
import org.apache.camel.component.netty.handlers.ServerChannelHandler;
import org.apache.camel.component.netty.http.HttpPrincipal;
@@ -37,7 +35,6 @@ import org.apache.camel.util.CamelLogger;
import org.apache.camel.util.ObjectHelper;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.ChannelFutureListener;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
@@ -49,8 +46,6 @@ import org.jboss.netty.handler.codec.http.HttpResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.jboss.netty.handler.codec.http.HttpHeaders.is100ContinueExpected;
-import static org.jboss.netty.handler.codec.http.HttpHeaders.isKeepAlive;
import static org.jboss.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST;
import static org.jboss.netty.handler.codec.http.HttpResponseStatus.CONTINUE;
import static org.jboss.netty.handler.codec.http.HttpResponseStatus.METHOD_NOT_ALLOWED;
@@ -58,6 +53,7 @@ import static org.jboss.netty.handler.codec.http.HttpResponseStatus.SERVICE_UNAV
import static org.jboss.netty.handler.codec.http.HttpResponseStatus.UNAUTHORIZED;
import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1;
+
/**
* Netty HTTP {@link ServerChannelHandler} that handles the incoming HTTP requests and routes
* the received message in Camel.
@@ -268,7 +264,7 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent exceptionEvent) throws Exception {
-
+
// only close if we are still allowed to run
if (consumer.isRunAllowed()) {
@@ -282,17 +278,6 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
}
}
- @Override
- protected ChannelFutureListener createResponseFutureListener(NettyConsumer consumer, Exchange exchange, SocketAddress remoteAddress) {
- // make sure to close channel if not keep-alive
- if (request != null && isKeepAlive(request)) {
- LOG.trace("Request has Connection: keep-alive so Channel is not being closed");
- return null;
- } else {
- LOG.trace("Request is not Connection: close so Channel is being closed");
- return ChannelFutureListener.CLOSE;
- }
- }
@Override
protected Object getResponseBody(Exchange exchange) throws Exception {
http://git-wip-us.apache.org/repos/asf/camel/blob/9cf11bd5/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyHelper.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyHelper.java
index 05f3e4d..b9368fa 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyHelper.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyHelper.java
@@ -111,7 +111,7 @@ public final class NettyHelper {
public static void close(Channel channel) {
if (channel != null) {
LOG.trace("Closing channel: {}", channel);
- channel.close();
+ channel.close().syncUninterruptibly();
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/9cf11bd5/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
index 50de736..87ad2be 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
@@ -498,8 +498,11 @@ public class NettyProducer extends DefaultAsyncProducer {
public void done(boolean doneSync) {
// put back in pool
try {
- LOG.trace("Putting channel back to pool {}", channel);
- pool.returnObject(channel);
+ // Only put the connected channel back to the pool
+ if (channel.isConnected()) {
+ LOG.trace("Putting channel back to pool {}", channel);
+ pool.returnObject(channel);
+ }
} catch (Exception e) {
LOG.warn("Error returning channel to pool {}. This exception will be ignored.", channel);
} finally {
@@ -525,7 +528,9 @@ public class NettyProducer extends DefaultAsyncProducer {
@Override
public void destroyObject(Channel channel) throws Exception {
LOG.trace("Destroying channel: {}", channel);
- NettyHelper.close(channel);
+ if (channel.isOpen()) {
+ NettyHelper.close(channel);
+ }
allChannels.remove(channel);
}
@@ -540,11 +545,13 @@ public class NettyProducer extends DefaultAsyncProducer {
@Override
public void activateObject(Channel channel) throws Exception {
// noop
+ LOG.trace("activateObject channel: {} -> {}", channel);
}
@Override
public void passivateObject(Channel channel) throws Exception {
// noop
+ LOG.trace("passivateObject channel: {} -> {}", channel);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/9cf11bd5/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerResponseFutureListener.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerResponseFutureListener.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerResponseFutureListener.java
index 619a62e..90dc9e6 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerResponseFutureListener.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerResponseFutureListener.java
@@ -61,6 +61,11 @@ public class ServerResponseFutureListener implements ChannelFutureListener {
} else {
close = exchange.getIn().getHeader(NettyConstants.NETTY_CLOSE_CHANNEL_WHEN_COMPLETE, Boolean.class);
}
+
+ // check the setting on the exchange property
+ if (close == null) {
+ close = exchange.getProperty(NettyConstants.NETTY_CLOSE_CHANNEL_WHEN_COMPLETE, Boolean.class);
+ }
// should we disconnect, the header can override the configuration
boolean disconnect = consumer.getConfiguration().isDisconnect();
[24/50] git commit: CAMEL-7855: Fixed resuming JMS consumer to work
if the route has never been initialized before.
Posted by cm...@apache.org.
CAMEL-7855: Fixed resuming JMS consumer to work if the route has never been initialized before.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5c331211
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5c331211
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5c331211
Branch: refs/remotes/origin/camel-2.13.x
Commit: 5c331211e22691eb3c3fe74746a90542b9a1326d
Parents: b840c4d
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Sep 27 13:55:53 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Sep 27 14:15:48 2014 +0200
----------------------------------------------------------------------
.../apache/camel/component/jms/JmsConsumer.java | 9 +-
.../jms/issues/JmsLifecycleIssueTest.java | 93 ++++++++++++++++++++
2 files changed, 100 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5c331211/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java
index 87f39fa..5d66555 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java
@@ -230,8 +230,13 @@ public class JmsConsumer extends DefaultConsumer implements SuspendableService {
@Override
protected void doResume() throws Exception {
- if (listenerContainer != null) {
- startListenerContainer();
+ // we may not have been started before, and now the end user calls resume, so lets handle that and start it first
+ if (!initialized) {
+ doStart();
+ } else {
+ if (listenerContainer != null) {
+ startListenerContainer();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/5c331211/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsLifecycleIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsLifecycleIssueTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsLifecycleIssueTest.java
new file mode 100644
index 0000000..32fb137
--- /dev/null
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsLifecycleIssueTest.java
@@ -0,0 +1,93 @@
+/**
+ * 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.component.jms.issues;
+
+import javax.jms.ConnectionFactory;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ServiceStatus;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jms.CamelJmsTestHelper;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+import static org.apache.camel.ServiceStatus.Started;
+import static org.apache.camel.ServiceStatus.Stopped;
+import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge;
+
+public class JmsLifecycleIssueTest extends CamelTestSupport {
+
+ public static final String ROUTE_ID = "simpleRoute";
+ public static final String ENDPOINT_URI = "activemq:processOrder";
+
+ @Test
+ public void routeThatIsStoppedAndThenResumedAcceptsMessage() throws Exception {
+ assertThatRouteIs(Stopped);
+
+ context.resumeRoute(ROUTE_ID);
+
+ assertRouteWorks();
+ }
+
+ @Test
+ public void routeThatIsStoppedSuspendedAndThenResumedAcceptsMessage() throws Exception {
+ assertThatRouteIs(Stopped);
+
+ context.suspendRoute(ROUTE_ID);
+ context.resumeRoute(ROUTE_ID);
+
+ assertRouteWorks();
+ }
+
+ private void assertThatRouteIs(ServiceStatus expectedStatus) {
+ assertEquals(expectedStatus, context.getRouteStatus(ROUTE_ID));
+ }
+
+ private void assertRouteWorks() throws Exception {
+ assertThatRouteIs(Started);
+
+ getMockEndpoint("mock:result").expectedBodiesReceived("anything");
+
+ template.sendBody(ENDPOINT_URI, "anything");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ protected CamelContext createCamelContext() throws Exception {
+ CamelContext camelContext = super.createCamelContext();
+ ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+ camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory));
+ return camelContext;
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from(ENDPOINT_URI).routeId(ROUTE_ID).autoStartup(false)
+ .to("log:input")
+ .to("mock:result");
+ }
+ });
+ }
+ };
+ }
+}
[38/50] git commit: CAMEL-7896 netty http producer should close the
channel when theresponse connection header is close
Posted by cm...@apache.org.
CAMEL-7896 netty http producer should close the channel when theresponse connection header is close
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d843918a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d843918a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d843918a
Branch: refs/remotes/origin/camel-2.13.x
Commit: d843918a90126e177026cfdfe7a727580bb3a79a
Parents: a5eb8c0
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Oct 8 21:32:39 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Oct 9 10:32:38 2014 +0800
----------------------------------------------------------------------
.../netty/http/handlers/HttpClientChannelHandler.java | 7 +++++++
.../camel/component/netty/handlers/ClientChannelHandler.java | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d843918a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpClientChannelHandler.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpClientChannelHandler.java
index 0f3a7a9..f1abaac 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpClientChannelHandler.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpClientChannelHandler.java
@@ -20,6 +20,7 @@ import java.util.Map;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
+import org.apache.camel.component.netty.NettyConstants;
import org.apache.camel.component.netty.handlers.ClientChannelHandler;
import org.apache.camel.component.netty.http.NettyHttpProducer;
import org.jboss.netty.buffer.ChannelBuffer;
@@ -28,6 +29,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.handler.codec.http.HttpChunk;
import org.jboss.netty.handler.codec.http.HttpChunkTrailer;
+import org.jboss.netty.handler.codec.http.HttpHeaders;
import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.slf4j.Logger;
@@ -91,6 +93,11 @@ public class HttpClientChannelHandler extends ClientChannelHandler {
}
} else if (msg instanceof HttpResponse) {
response = (HttpResponse) msg;
+ Exchange exchange = super.getExchange(ctx);
+ if (!HttpHeaders.isKeepAlive(response)) {
+ // just want to make sure we close the channel if the keepAlive is not true
+ exchange.setProperty(NettyConstants.NETTY_CLOSE_CHANNEL_WHEN_COMPLETE, true);
+ }
if (LOG.isTraceEnabled()) {
LOG.trace("HttpResponse received: {} chunked:", response, response.isChunked());
}
http://git-wip-us.apache.org/repos/asf/camel/blob/d843918a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
index e0ddb9f..ea9d578 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
@@ -222,7 +222,7 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
}
}
- private Exchange getExchange(ChannelHandlerContext ctx) {
+ protected Exchange getExchange(ChannelHandlerContext ctx) {
NettyCamelState state = producer.getState(ctx.getChannel());
return state != null ? state.getExchange() : null;
}
[33/50] git commit: Fixed build error of RestletHeaderFilterStrategy
Posted by cm...@apache.org.
Fixed build error of RestletHeaderFilterStrategy
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b23ab8b5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b23ab8b5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b23ab8b5
Branch: refs/remotes/origin/camel-2.13.x
Commit: b23ab8b5958db102f8621172b46015c59e8c147e
Parents: e737849
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Sep 30 13:29:04 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Sep 30 13:29:04 2014 +0800
----------------------------------------------------------------------
.../restlet/RestletHeaderFilterStrategy.java | 23 ++++++++++----------
1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/b23ab8b5/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java
index 662328c..d2f727d 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java
@@ -21,27 +21,28 @@ import org.apache.camel.impl.DefaultHeaderFilterStrategy;
/**
* Default header filtering strategy for Restlet
- *
- * @version
+ *
+ * @version
*/
public class RestletHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
public RestletHeaderFilterStrategy() {
// No IN filters and copy all headers from Restlet to Camel
-
+
// OUT filters (from Camel headers to Restlet headers)
// filter headers used internally by this component
- getOutFilter().add(RestletConstants.RESTLET_LOGIN);
- getOutFilter().add(RestletConstants.RESTLET_PASSWORD);
-
- // The "CamelAcceptContentType" header is not added to the outgoing HTTP
+ getOutFilter().add(RestletConstants.RESTLET_LOGIN.toLowerCase());
+ getOutFilter().add(RestletConstants.RESTLET_PASSWORD.toLowerCase());
+
+ // The "CamelAcceptContentType" header is not added to the outgoing HTTP
// headers but it will be going out as "Accept.
- getOutFilter().add(Exchange.ACCEPT_CONTENT_TYPE);
-
+ getOutFilter().add(Exchange.ACCEPT_CONTENT_TYPE.toLowerCase());
+
// As we don't set the transfer_encoding protocol header for the restlet service
// we need to remove the transfer_encoding which could let the client wait forever
- getOutFilter().add(Exchange.TRANSFER_ENCODING);
- setCaseInsensitive(true);
+ getOutFilter().add(Exchange.TRANSFER_ENCODING.toLowerCase());
+ // Support to filter case insensitive
+ setLowerCase(true);
}
}
[06/50] git commit: CAMEL-7804: MessageHelper - dump message for
logging should catch throwable
Posted by cm...@apache.org.
CAMEL-7804: MessageHelper - dump message for logging should catch throwable
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e5d9899f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e5d9899f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e5d9899f
Branch: refs/remotes/origin/camel-2.13.x
Commit: e5d9899ff90ee495e759ddc66194964ce9ea86d8
Parents: 5805379
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Sep 11 18:59:44 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Sep 12 07:27:53 2014 +0200
----------------------------------------------------------------------
.../org/apache/camel/util/MessageHelper.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e5d9899f/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
index 0182594..ec088f3 100644
--- a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
@@ -251,13 +251,17 @@ public final class MessageHelper {
String body = null;
if (message.getExchange() != null) {
try {
- body = message.getExchange().getContext().getTypeConverter().convertTo(String.class, message.getExchange(), obj);
- } catch (Exception e) {
+ body = message.getExchange().getContext().getTypeConverter().tryConvertTo(String.class, message.getExchange(), obj);
+ } catch (Throwable e) {
// ignore as the body is for logging purpose
}
}
if (body == null) {
- body = obj.toString();
+ try {
+ body = obj.toString();
+ } catch (Throwable e) {
+ // ignore as the body is for logging purpose
+ }
}
// reset stream cache after use
@@ -359,13 +363,13 @@ public final class MessageHelper {
// to String
if (value != null) {
try {
- String xml = message.getExchange().getContext().getTypeConverter().convertTo(String.class,
+ String xml = message.getExchange().getContext().getTypeConverter().tryConvertTo(String.class,
message.getExchange(), value);
if (xml != null) {
// must always xml encode
sb.append(StringHelper.xmlEncode(xml));
}
- } catch (Exception e) {
+ } catch (Throwable e) {
// ignore as the body is for logging purpose
}
}
@@ -433,7 +437,8 @@ public final class MessageHelper {
// must not cause new exceptions so run this in a try catch block
try {
return doDumpMessageHistoryStacktrace(exchange, exchangeFormatter, logStackTrace);
- } catch (Exception e) {
+ } catch (Throwable e) {
+ // ignore as the body is for logging purpose
return "";
}
}
@@ -472,7 +477,7 @@ public final class MessageHelper {
for (MessageHistory history : list) {
routeId = history.getRouteId() != null ? history.getRouteId() : "";
id = history.getNode().getId();
- // we need to avoid leak the sensibale information here
+ // we need to avoid leak the sensible information here
label = URISupport.sanitizeUri(history.getNode().getLabel());
elapsed = history.getElapsed();
[07/50] git commit: downgrade jruby from 1.7.15 to 1.7.13 as the
later ones are not valid OSGI bundles
Posted by cm...@apache.org.
downgrade jruby from 1.7.15 to 1.7.13 as the later ones are not valid OSGI bundles
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/543e3a5f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/543e3a5f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/543e3a5f
Branch: refs/remotes/origin/camel-2.13.x
Commit: 543e3a5fb37ec71bcd277599febffb2535a086c6
Parents: e5d9899
Author: cmueller <cm...@apache.org>
Authored: Sun Sep 14 13:09:49 2014 +0200
Committer: cmueller <cm...@apache.org>
Committed: Sun Sep 14 13:13:46 2014 +0200
----------------------------------------------------------------------
parent/pom.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/543e3a5f/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index ebfe0b3..42338d6 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -237,7 +237,8 @@
<jodatime2-bundle-version>2.3</jodatime2-bundle-version>
<josql-bundle-version>1.5_5</josql-bundle-version>
<josql-version>1.5</josql-version>
- <jruby-version>1.7.15</jruby-version>
+ <!-- jruby-core 1.7.14 and 1.7.15 are not valid OSGI bundles: see https://github.com/jruby/jruby/issues/1971 -->
+ <jruby-version>1.7.13</jruby-version>
<jsendnsca-version>1.3.1</jsendnsca-version>
<jsmpp-version>2.1.0_4</jsmpp-version>
<jsch-version>0.1.50</jsch-version>
[04/50] git commit: CAMEL-7798 Exchange formatter configured on Log
Component may lead to incoherent results.
Posted by cm...@apache.org.
CAMEL-7798 Exchange formatter configured on Log Component may lead to incoherent results.
Conflicts:
camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d91dfb39
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d91dfb39
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d91dfb39
Branch: refs/remotes/origin/camel-2.13.x
Commit: d91dfb39b51b4b76aa610770de6eb731ba78f5d4
Parents: 59e467d
Author: Raul Kripalani <ra...@apache.org>
Authored: Wed Sep 10 13:43:33 2014 +0100
Committer: Raul Kripalani <ra...@apache.org>
Committed: Wed Sep 10 14:41:24 2014 +0100
----------------------------------------------------------------------
.../camel/component/log/LogComponent.java | 23 ++++----
.../log/CustomExchangeFormatterTest.java | 62 ++++++++++++++++++++
.../component/log/TestExchangeFormatter.java | 42 +++++++++++++
.../log/custom-exchange-formatter-context.xml | 36 ++++++++++++
4 files changed, 151 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d91dfb39/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java b/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
index 1e9e18b..4fc838a 100644
--- a/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
@@ -70,6 +70,7 @@ public class LogComponent extends UriEndpointComponent {
} else {
camelLogger = new CamelLogger(providedLogger, level, endpoint.getMarker());
}
+
Processor logger;
if (endpoint.getGroupSize() != null) {
logger = new ThroughputLogger(camelLogger, endpoint.getGroupSize());
@@ -78,18 +79,16 @@ public class LogComponent extends UriEndpointComponent {
Long groupDelay = endpoint.getGroupDelay();
logger = new ThroughputLogger(camelLogger, this.getCamelContext(), endpoint.getGroupInterval(), groupDelay, groupActiveOnly);
} else {
- // first, try to use the user-specified formatter (or the one picked up from the Registry and transferred to
- // the property by a previous endpoint initialisation); if null, try to pick it up from the Registry now
- ExchangeFormatter localFormatter = exchangeFormatter;
- if (localFormatter == null) {
- localFormatter = getCamelContext().getRegistry().lookupByNameAndType("logFormatter", ExchangeFormatter.class);
- if (localFormatter != null) {
- exchangeFormatter = localFormatter;
- setProperties(exchangeFormatter, parameters);
- }
- }
- // if no formatter is available in the Registry, create a local one of the default type, for a single use
- if (localFormatter == null) {
+ // first, try to pick up the ExchangeFormatter from the registry
+ ExchangeFormatter localFormatter = getCamelContext().getRegistry().lookupByNameAndType("logFormatter", ExchangeFormatter.class);
+ if (localFormatter != null) {
+ setProperties(localFormatter, parameters);
+ } else if (localFormatter == null && exchangeFormatter != null) {
+ // do not set properties, the exchangeFormatter is explicitly set, thefore the
+ // user would have set its properties explicitly too
+ localFormatter = exchangeFormatter;
+ } else {
+ // if no formatter is available in the Registry, create a local one of the default type, for a single use
localFormatter = new DefaultExchangeFormatter();
setProperties(localFormatter, parameters);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/d91dfb39/components/camel-spring/src/test/java/org/apache/camel/component/log/CustomExchangeFormatterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/log/CustomExchangeFormatterTest.java b/components/camel-spring/src/test/java/org/apache/camel/component/log/CustomExchangeFormatterTest.java
new file mode 100644
index 0000000..4d6a15a
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/component/log/CustomExchangeFormatterTest.java
@@ -0,0 +1,62 @@
+/**
+ * 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.component.log;
+
+import java.lang.reflect.Field;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.processor.CamelLogProcessor;
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version
+ */
+public class CustomExchangeFormatterTest extends SpringTestSupport {
+
+ public void testExchangeFormattersConfiguredProperly() throws Exception {
+ // the exchangeFormatter field is not a property, therefore we have to inspect it via reflection
+ Field f = CamelLogProcessor.class.getDeclaredField("formatter");
+ f.setAccessible(true);
+
+ TestExchangeFormatter aaa = null;
+ TestExchangeFormatter bbb = null;
+ for (Endpoint ep : context.getEndpoints()) {
+ if (!(ep instanceof LogEndpoint)) {
+ continue;
+ }
+
+ LogEndpoint log = (LogEndpoint) ep;
+
+ aaa = log.getEndpointUri().contains("aaa") ?
+ (TestExchangeFormatter) f.get(((CamelLogProcessor) log.getLogger())) : aaa;
+ bbb = log.getEndpointUri().contains("bbb") ?
+ (TestExchangeFormatter) f.get(((CamelLogProcessor) log.getLogger())) : bbb;
+ }
+
+ assertNotNull(aaa);
+ assertNotNull(bbb);
+ assertNotSame(aaa, bbb);
+ assertEquals("aaa", aaa.getTestProperty());
+ assertEquals("bbb", bbb.getTestProperty());
+ }
+
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/log/custom-exchange-formatter-context.xml");
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/d91dfb39/components/camel-spring/src/test/java/org/apache/camel/component/log/TestExchangeFormatter.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/log/TestExchangeFormatter.java b/components/camel-spring/src/test/java/org/apache/camel/component/log/TestExchangeFormatter.java
new file mode 100644
index 0000000..7b0bc33
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/component/log/TestExchangeFormatter.java
@@ -0,0 +1,42 @@
+/**
+ * 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.component.log;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.ExchangeFormatter;
+
+/**
+ * A test exchange formatter.
+ */
+public class TestExchangeFormatter implements ExchangeFormatter {
+
+ private String testProperty;
+
+ @Override
+ public String format(Exchange exchange) {
+ return exchange.toString();
+ }
+
+ public String getTestProperty() {
+ return testProperty;
+ }
+
+ public void setTestProperty(String testProperty) {
+ this.testProperty = testProperty;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/d91dfb39/components/camel-spring/src/test/resources/org/apache/camel/component/log/custom-exchange-formatter-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/log/custom-exchange-formatter-context.xml b/components/camel-spring/src/test/resources/org/apache/camel/component/log/custom-exchange-formatter-context.xml
new file mode 100644
index 0000000..4abdcd0
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/log/custom-exchange-formatter-context.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean id="logFormatter" class="org.apache.camel.component.log.TestExchangeFormatter" scope="prototype" />
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <to uri="log:aaa?testProperty=aaa" id="log.aaa" />
+ <to uri="log:bbb?testProperty=bbb" id="log.bbb" />
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+</beans>
[29/50] git commit: CAMEL-7867 Fixed the NPE when using CXF endpoint
to enrich
Posted by cm...@apache.org.
CAMEL-7867 Fixed the NPE when using CXF endpoint to enrich
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/baac1676
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/baac1676
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/baac1676
Branch: refs/remotes/origin/camel-2.13.x
Commit: baac167688cbd135a56fac78ef0f0492ddb3663b
Parents: 66803bc
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Sep 29 21:12:56 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Sep 29 21:40:55 2014 +0800
----------------------------------------------------------------------
.../apache/camel/impl/DefaultRouteContext.java | 7 +++
.../component/cxf/CXFGreeterEnrichTest.java | 48 +++++++++++++++
.../cxf/GreeterEnrichRouterContext.xml | 61 ++++++++++++++++++++
3 files changed, 116 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/baac1676/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
index aeb8b91..8109c1f 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
@@ -28,6 +28,7 @@ import org.apache.camel.Endpoint;
import org.apache.camel.NoSuchEndpointException;
import org.apache.camel.Processor;
import org.apache.camel.Route;
+import org.apache.camel.RuntimeCamelException;
import org.apache.camel.ShutdownRoute;
import org.apache.camel.ShutdownRunningTask;
import org.apache.camel.model.FromDefinition;
@@ -123,6 +124,12 @@ public class DefaultRouteContext implements RouteContext {
if (!this.getCamelContext().equals(endpoint.getCamelContext())) {
throw new NoSuchEndpointException("ref:" + ref, "make sure the endpoint has the same camel context as the route does.");
}
+ try {
+ // need add the endpoint into service
+ getCamelContext().addService(endpoint);
+ } catch (Exception ex) {
+ throw new RuntimeCamelException(ex);
+ }
}
if (endpoint == null) {
throw new IllegalArgumentException("Either 'uri' or 'ref' must be specified on: " + this);
http://git-wip-us.apache.org/repos/asf/camel/blob/baac1676/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterEnrichTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterEnrichTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterEnrichTest.java
new file mode 100644
index 0000000..da4c564
--- /dev/null
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterEnrichTest.java
@@ -0,0 +1,48 @@
+/**
+ * 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.component.cxf;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.hello_world_soap_http.GreeterImpl;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class CXFGreeterEnrichTest extends AbstractCXFGreeterRouterTest {
+ protected static Endpoint endpoint;
+ @AfterClass
+ public static void stopService() {
+ if (endpoint != null) {
+ endpoint.stop();
+ }
+ }
+
+
+ @BeforeClass
+ public static void startService() {
+ Object implementor = new GreeterImpl();
+ String address = "http://localhost:" + getPort1() + "/CXFGreeterEnrichTest/SoapContext/SoapPort";
+ endpoint = Endpoint.publish(address, implementor);
+ }
+
+ protected ClassPathXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/GreeterEnrichRouterContext.xml");
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/baac1676/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEnrichRouterContext.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEnrichRouterContext.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEnrichRouterContext.xml
new file mode 100644
index 0000000..c6ff1c5
--- /dev/null
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEnrichRouterContext.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+ <!-- START SNIPPET: example -->
+ <cxf:cxfEndpoint id="routerEndpoint" address="http://localhost:${CXFTestSupport.port2}/CXFGreeterEnrichTest/CamelContext/RouterPort"
+ serviceClass="org.apache.hello_world_soap_http.GreeterImpl"
+ skipFaultLogging="true">
+ <cxf:outInterceptors>
+ <!-- This interceptor will force the CXF server send the XML start document to client -->
+ <bean class="org.apache.camel.component.cxf.WriteXmlDeclarationInterceptor"/>
+ </cxf:outInterceptors>
+ <cxf:properties>
+ <!-- Set the publishedEndpointUrl which could override the service address from generated WSDL as you want -->
+ <entry key="publishedEndpointUrl" value="http://www.simple.com/services/test" />
+ </cxf:properties>
+ </cxf:cxfEndpoint>
+ <!-- END SNIPPET: example -->
+
+ <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:${CXFTestSupport.port1}/CXFGreeterEnrichTest/SoapContext/SoapPort"
+ wsdlURL="testutils/hello_world.wsdl"
+ serviceClass="org.apache.hello_world_soap_http.Greeter"
+ endpointName="s:SoapPort"
+ serviceName="s:SOAPService"
+ xmlns:s="http://apache.org/hello_world_soap_http" />
+
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <route errorHandlerRef="noErrorHandler">
+ <from ref="routerEndpoint" />
+ <enrich ref="serviceEndpoint" />
+ </route>
+ </camelContext>
+
+ <bean id="noErrorHandler" class="org.apache.camel.builder.NoErrorHandlerBuilder"/>
+
+</beans>
\ No newline at end of file
[09/50] git commit: CAMEL-7803
Posted by cm...@apache.org.
CAMEL-7803
Patch added new boolean flag "preFetched" to allow inserts with parameters that have null values
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/75c973a2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/75c973a2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/75c973a2
Branch: refs/remotes/origin/camel-2.13.x
Commit: 75c973a25e3a12d749dc7da8d5e6f3d92d15cc26
Parents: 543e3a5
Author: nathanwray <na...@users.noreply.github.com>
Authored: Thu Sep 11 11:57:09 2014 -0400
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Sep 16 21:04:43 2014 +0800
----------------------------------------------------------------------
.../DefaultJdbcPrepareStatementStrategy.java | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/75c973a2/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
index cceafae..b412ff2 100644
--- a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
+++ b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/DefaultJdbcPrepareStatementStrategy.java
@@ -72,22 +72,21 @@ public class DefaultJdbcPrepareStatementStrategy implements JdbcPrepareStatement
return new Iterator<Object>() {
private NamedQueryParser parser = new NamedQueryParser(query);
private Object next;
- private boolean done;
+ private boolean done = false;
+ private boolean preFetched = false;
@Override
public boolean hasNext() {
- if (done) {
- return false;
+ if (!done && !preFetched) {
+ next();
+ preFetched = true;
}
- if (next == null) {
- next = next();
- }
- return next != null;
+ return (!done);
}
@Override
public Object next() {
- if (next == null) {
+ if (!preFetched) {
String key = parser.next();
if (key == null) {
done = true;
@@ -100,9 +99,8 @@ public class DefaultJdbcPrepareStatementStrategy implements JdbcPrepareStatement
}
next = headerMap.get(key);
}
- Object answer = next;
- next = null;
- return answer;
+ preFetched = false;
+ return next;
}
@Override
[31/50] git commit: Fixed the unit test issue of upgrade to CXF 2.7.12
Posted by cm...@apache.org.
Fixed the unit test issue of upgrade to CXF 2.7.12
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3bf3aefa
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3bf3aefa
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3bf3aefa
Branch: refs/remotes/origin/camel-2.13.x
Commit: 3bf3aefa3cb21230b36cda933746635c88f51a23
Parents: 84aa5c6
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Jul 16 15:42:51 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Sep 29 22:14:20 2014 +0800
----------------------------------------------------------------------
.../cxf/mtom/CxfMtomProducerPayloadModeTest.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3bf3aefa/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java
index f1a70a1..794e39e 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomProducerPayloadModeTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.cxf.mtom;
import java.awt.image.BufferedImage;
import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -124,16 +125,17 @@ public class CxfMtomProducerPayloadModeTest extends AbstractJUnit4SpringContextT
Element ele = (Element)xu.getValue("//ns:DetailResponse/ns:photo/xop:Include", oute,
XPathConstants.NODE);
String photoId = ele.getAttribute("href").substring(4); // skip "cid:"
-
+
ele = (Element)xu.getValue("//ns:DetailResponse/ns:image/xop:Include", oute,
XPathConstants.NODE);
String imageId = ele.getAttribute("href").substring(4); // skip "cid:"
- DataHandler dr = exchange.getOut().getAttachment(photoId);
+
+ DataHandler dr = exchange.getOut().getAttachment(decodingReference(photoId));
Assert.assertEquals("application/octet-stream", dr.getContentType());
MtomTestHelper.assertEquals(MtomTestHelper.RESP_PHOTO_DATA, IOUtils.readBytesFromStream(dr.getInputStream()));
- dr = exchange.getOut().getAttachment(imageId);
+ dr = exchange.getOut().getAttachment(decodingReference(imageId));
Assert.assertEquals("image/jpeg", dr.getContentType());
BufferedImage image = ImageIO.read(dr.getInputStream());
@@ -144,6 +146,11 @@ public class CxfMtomProducerPayloadModeTest extends AbstractJUnit4SpringContextT
}
+ // CXF encoding the XOP reference since 3.0.1
+ private String decodingReference(String reference) throws UnsupportedEncodingException {
+ return java.net.URLDecoder.decode(reference, "UTF-8");
+ }
+
protected boolean isMtomEnabled() {
return true;
}
[11/50] git commit: CAMEL-7830 RestLetHeaderFilterStrategy should
filter the header of "Transfer-Encoding"
Posted by cm...@apache.org.
CAMEL-7830 RestLetHeaderFilterStrategy should filter the header of "Transfer-Encoding"
Conflicts:
components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d1628b4b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d1628b4b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d1628b4b
Branch: refs/remotes/origin/camel-2.13.x
Commit: d1628b4bd59d5b6bb4187b0164e07026bbb065cd
Parents: aca61d1
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Sep 17 10:48:41 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Sep 17 10:56:53 2014 +0800
----------------------------------------------------------------------
.../component/restlet/RestletHeaderFilterStrategy.java | 5 +++++
.../camel/component/restlet/RestletSetBodyTest.java | 12 ++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d1628b4b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java
index 3a102c5..662328c 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletHeaderFilterStrategy.java
@@ -37,6 +37,11 @@ public class RestletHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
// The "CamelAcceptContentType" header is not added to the outgoing HTTP
// headers but it will be going out as "Accept.
getOutFilter().add(Exchange.ACCEPT_CONTENT_TYPE);
+
+ // As we don't set the transfer_encoding protocol header for the restlet service
+ // we need to remove the transfer_encoding which could let the client wait forever
+ getOutFilter().add(Exchange.TRANSFER_ENCODING);
+ setCaseInsensitive(true);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/d1628b4b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
index 74906ff..be12f05 100644
--- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
@@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.AvailablePortFinder;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
@@ -32,16 +33,18 @@ import org.restlet.representation.InputRepresentation;
* @version
*/
public class RestletSetBodyTest extends RestletTestSupport {
+ protected static int portNum2 = AvailablePortFinder.getNextAvailable(4000);
@Test
public void testSetBody() throws Exception {
String response = template.requestBody("restlet:http://0.0.0.0:" + portNum + "/stock/ORCL?restletMethod=get", null, String.class);
assertEquals("110", response);
+
}
@Test
public void testSetBodyRepresentation() throws Exception {
- HttpGet get = new HttpGet("http://0.0.0.0:" + "1234" + "/images/123");
+ HttpGet get = new HttpGet("http://0.0.0.0:" + portNum + "/images/123");
CloseableHttpClient httpclient = HttpClientBuilder.create().build();
InputStream is = null;
try {
@@ -70,7 +73,12 @@ public class RestletSetBodyTest extends RestletTestSupport {
@Override
public void configure() throws Exception {
from("restlet:http://0.0.0.0:" + portNum + "/stock/{symbol}?restletMethods=get")
+ .to("http://127.0.0.1:" + portNum2 + "/test?bridgeEndpoint=true")
+ //.removeHeader("Transfer-Encoding")
.setBody().constant("110");
+
+ from("jetty:http://0.0.0.0:" + portNum2 + "/test").setBody().constant("response is back");
+
// create ByteArrayRepresentation for response
byte[] image = new byte[10];
for (int i = 0; i < 10; i++) {
@@ -78,7 +86,7 @@ public class RestletSetBodyTest extends RestletTestSupport {
}
ByteArrayInputStream inputStream = new ByteArrayInputStream(image);
- from("restlet:http://0.0.0.0:" + "1234" + "/images/{symbol}?restletMethods=get")
+ from("restlet:http://0.0.0.0:" + portNum + "/images/{symbol}?restletMethods=get")
.setBody().constant(new InputRepresentation(inputStream, MediaType.IMAGE_PNG, 10));
}
};
[32/50] git commit: CAMEL-7881 Fixed the camel-restlet feature
install issue
Posted by cm...@apache.org.
CAMEL-7881 Fixed the camel-restlet feature install issue
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e737849d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e737849d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e737849d
Branch: refs/remotes/origin/camel-2.13.x
Commit: e737849d8fd4919593507e03441cdb9d1ee54b35
Parents: 3bf3aef
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Sep 30 10:23:19 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Sep 30 10:24:33 2014 +0800
----------------------------------------------------------------------
platforms/karaf/features/src/main/resources/features.xml | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e737849d/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index a140257..0d35a98 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -875,6 +875,9 @@
<feature name='camel-restlet' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='${project.version}'>camel-core</feature>
<bundle dependency='true'>mvn:http://maven.restlet.org!org.restlet.osgi/org.restlet/${restlet-version}</bundle>
+ <bundle dependency='true'>mvn:commons-codec/commons-codec/${commons-codec-version}</bundle>
+ <bundle dependency='true'>mvn:org.apache.httpcomponents/httpcore-osgi/${httpcore4-version}</bundle>
+ <bundle dependency='true'>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient4-version}</bundle>
<bundle dependency='true'>mvn:http://maven.restlet.org!org.restlet.osgi/org.restlet.ext.httpclient/${restlet-version}</bundle>
<bundle>mvn:org.apache.camel/camel-restlet/${project.version}</bundle>
</feature>
[28/50] git commit: Case when uri has fragment and does not have query
Posted by cm...@apache.org.
Case when uri has fragment and does not have query
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/66803bcc
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/66803bcc
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/66803bcc
Branch: refs/remotes/origin/camel-2.13.x
Commit: 66803bcc6e0c789a0f309bc769daf520a6e2ec91
Parents: 229890c
Author: Vitaly Lavrov <la...@osinka.ru>
Authored: Mon Sep 8 21:11:02 2014 +0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Sep 29 08:32:37 2014 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/camel/util/URISupport.java | 3 +++
.../src/test/java/org/apache/camel/util/URISupportTest.java | 7 +++++++
2 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/66803bcc/camel-core/src/main/java/org/apache/camel/util/URISupport.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/URISupport.java b/camel-core/src/main/java/org/apache/camel/util/URISupport.java
index 0f37a2c..607f859 100644
--- a/camel-core/src/main/java/org/apache/camel/util/URISupport.java
+++ b/camel-core/src/main/java/org/apache/camel/util/URISupport.java
@@ -321,6 +321,9 @@ public final class URISupport {
// assemble string as new uri and replace parameters with the query instead
String s = uri.toString();
String before = ObjectHelper.before(s, "?");
+ if (before == null) {
+ before = ObjectHelper.before(s, "#");
+ }
if (before != null) {
s = before;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/66803bcc/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java b/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
index 0e6f1b1..cdefcec 100644
--- a/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
@@ -155,6 +155,13 @@ public class URISupportTest extends ContextTestSupport {
assertEquals("smtp://localhost#fragmentOne", resultUri.toString());
}
+ public void testCreateURIWithQueryHasOneFragmentAndQueryParameter() throws Exception {
+ URI uri = new URI("smtp://localhost#fragmentOne");
+ URI resultUri = URISupport.createURIWithQuery(uri, "utm_campaign=launch");
+ assertNotNull(resultUri);
+ assertEquals("smtp://localhost?utm_campaign=launch#fragmentOne", resultUri.toString());
+ }
+
public void testNormalizeEndpointWithEqualSignInParameter() throws Exception {
String out = URISupport.normalizeUri("jms:queue:foo?selector=somekey='somevalue'&foo=bar");
assertNotNull(out);
[16/50] git commit: CAMEL-7852 Fixed the issue that camel-msv
component cannot be resolved in OSGi
Posted by cm...@apache.org.
CAMEL-7852 Fixed the issue that camel-msv component cannot be resolved in OSGi
Conflicts:
tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMsvTest.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2b1296e7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2b1296e7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2b1296e7
Branch: refs/remotes/origin/camel-2.13.x
Commit: 2b1296e7758a1e0377e602796c1d8b23db745a94
Parents: 61867a0
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Sep 23 20:16:47 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Tue Sep 23 20:27:29 2014 +0800
----------------------------------------------------------------------
components/camel-msv/pom.xml | 1 +
.../src/test/java/org/apache/camel/itest/karaf/CamelMsvTest.java | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2b1296e7/components/camel-msv/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-msv/pom.xml b/components/camel-msv/pom.xml
index d7186e2..24a457a 100644
--- a/components/camel-msv/pom.xml
+++ b/components/camel-msv/pom.xml
@@ -31,6 +31,7 @@
<properties>
<camel.osgi.export.pkg>org.apache.camel.component.validator.msv.*</camel.osgi.export.pkg>
+ <camel.osgi.import.pkg>org.apache.camel,*</camel.osgi.import.pkg>
<camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=msv</camel.osgi.export.service>
</properties>
http://git-wip-us.apache.org/repos/asf/camel/blob/2b1296e7/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMsvTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMsvTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMsvTest.java
index 08dbecb..007d927 100644
--- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMsvTest.java
+++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMsvTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.itest.karaf;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
@@ -24,7 +23,6 @@ import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
@RunWith(JUnit4TestRunner.class)
-@Ignore("Fails for some unknown reason")
public class CamelMsvTest extends AbstractFeatureTest {
public static final String COMPONENT = extractName(CamelMsvTest.class);
@@ -39,4 +37,4 @@ public class CamelMsvTest extends AbstractFeatureTest {
return configure(COMPONENT);
}
-}
\ No newline at end of file
+}
[39/50] git commit: CAMEL-7892 Fixed the restlet DELETE with no
entity issue
Posted by cm...@apache.org.
CAMEL-7892 Fixed the restlet DELETE with no entity issue
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3580582d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3580582d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3580582d
Branch: refs/remotes/origin/camel-2.13.x
Commit: 3580582d42358ec073c6d7bf7bdcf59420052b9f
Parents: d843918
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Oct 8 22:16:39 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Oct 9 10:32:49 2014 +0800
----------------------------------------------------------------------
.../restlet/DefaultRestletBinding.java | 6 +-
.../restlet/RestletProducerGetTest.java | 52 -----------------
.../component/restlet/RestletProducerTest.java | 60 ++++++++++++++++++++
3 files changed, 65 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3580582d/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
index cd3d62d..e671749 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
@@ -171,7 +171,11 @@ public class DefaultRestletBinding implements RestletBinding, HeaderFilterStrate
if (request.getMethod() == Method.GET || (request.getMethod() == Method.POST && mediaType == MediaType.APPLICATION_WWW_FORM)) {
request.setEntity(form.getWebRepresentation());
} else {
- request.setEntity(body, mediaType);
+ if (body == null) {
+ request.setEntity(null);
+ } else {
+ request.setEntity(body, mediaType);
+ }
}
MediaType acceptedMediaType = exchange.getIn().getHeader(Exchange.ACCEPT_CONTENT_TYPE, MediaType.class);
http://git-wip-us.apache.org/repos/asf/camel/blob/3580582d/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetTest.java
deleted file mode 100644
index 8a81980..0000000
--- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.component.restlet;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-
-/**
- * @version
- */
-public class RestletProducerGetTest extends RestletTestSupport {
-
- @Test
- public void testRestletProducerGet() throws Exception {
- String out = template.requestBodyAndHeader("direct:start", null, "id", 123, String.class);
- assertEquals("123;Donald Duck", out);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").to("restlet:http://localhost:" + portNum + "/users/123/basic").to("log:reply");
-
- from("restlet:http://localhost:" + portNum + "/users/{id}/basic")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String id = exchange.getIn().getHeader("id", String.class);
- exchange.getOut().setBody(id + ";Donald Duck");
- }
- });
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/3580582d/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerTest.java
new file mode 100644
index 0000000..4ea65b6
--- /dev/null
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.component.restlet;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+/**
+ * @version
+ */
+public class RestletProducerTest extends RestletTestSupport {
+
+ @Test
+ public void testRestletProducerGet() throws Exception {
+ String out = template.requestBodyAndHeader("direct:start", null, "id", 123, String.class);
+ assertEquals("123;Donald Duck", out);
+ }
+
+ @Test
+ public void testRestletProducerDelete() throws Exception {
+ String out = template.requestBodyAndHeader("direct:delete", null, "id", 123, String.class);
+ assertEquals("123;Donald Duck", out);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").to("restlet:http://localhost:" + portNum + "/users/123/basic").to("log:reply");
+
+ from("direct:delete").to("restlet:http://localhost:" + portNum + "/users/123/basic?restletMethod=DELETE");
+
+ from("restlet:http://localhost:" + portNum + "/users/{id}/basic?restletMethods=GET,DELETE")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ String id = exchange.getIn().getHeader("id", String.class);
+ exchange.getOut().setBody(id + ";Donald Duck");
+ }
+ });
+ }
+ };
+ }
+}
[10/50] git commit: CAMEL-7633 Reenable the unit test
Posted by cm...@apache.org.
CAMEL-7633 Reenable the unit test
Conflicts:
components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/aca61d12
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/aca61d12
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/aca61d12
Branch: refs/remotes/origin/camel-2.13.x
Commit: aca61d12eba3c908cea3e89446c104abdf870a52
Parents: 6df2028
Author: Willem Jiang <wi...@gmail.com>
Authored: Tue Sep 16 23:07:38 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Sep 17 10:55:34 2014 +0800
----------------------------------------------------------------------
.../component/restlet/RestletSetBodyTest.java | 21 ++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/aca61d12/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
index a436ec5..74906ff 100644
--- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
@@ -21,15 +21,15 @@ import java.io.InputStream;
import org.apache.camel.builder.RouteBuilder;
import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
import org.junit.Test;
import org.restlet.data.MediaType;
import org.restlet.representation.InputRepresentation;
/**
- * @version
+ * @version
*/
public class RestletSetBodyTest extends RestletTestSupport {
@@ -38,31 +38,31 @@ public class RestletSetBodyTest extends RestletTestSupport {
String response = template.requestBody("restlet:http://0.0.0.0:" + portNum + "/stock/ORCL?restletMethod=get", null, String.class);
assertEquals("110", response);
}
-
+
@Test
public void testSetBodyRepresentation() throws Exception {
- HttpGet get = new HttpGet("http://0.0.0.0:" + portNum + "/images/123");
- HttpClient httpclient = new DefaultHttpClient();
+ HttpGet get = new HttpGet("http://0.0.0.0:" + "1234" + "/images/123");
+ CloseableHttpClient httpclient = HttpClientBuilder.create().build();
InputStream is = null;
try {
HttpResponse response = httpclient.execute(get);
assertEquals(200, response.getStatusLine().getStatusCode());
assertEquals("image/png", response.getEntity().getContentType().getValue());
is = response.getEntity().getContent();
- assertEquals("Get wrong available size", 10, is.available());
+ assertEquals("Get wrong available size", 10, response.getEntity().getContentLength());
byte[] buffer = new byte[10];
is.read(buffer);
for (int i = 0; i < 10; i++) {
assertEquals(i + 1, buffer[i]);
}
} finally {
- httpclient.getConnectionManager().shutdown();
+ httpclient.close();
if (is != null) {
is.close();
}
}
}
-
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
@@ -77,7 +77,8 @@ public class RestletSetBodyTest extends RestletTestSupport {
image[i] = (byte)(i + 1);
}
ByteArrayInputStream inputStream = new ByteArrayInputStream(image);
- from("restlet:http://0.0.0.0:" + portNum + "/images/{symbol}?restletMethods=get")
+
+ from("restlet:http://0.0.0.0:" + "1234" + "/images/{symbol}?restletMethods=get")
.setBody().constant(new InputRepresentation(inputStream, MediaType.IMAGE_PNG, 10));
}
};
[21/50] git commit: CAMEL-7856 Added igoreDeleteMethodMessageBody
option to CxfRsEndpoint
Posted by cm...@apache.org.
CAMEL-7856 Added igoreDeleteMethodMessageBody option to CxfRsEndpoint
Conflicts:
components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3a5497af
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3a5497af
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3a5497af
Branch: refs/remotes/origin/camel-2.13.x
Commit: 3a5497afcb533f083cb726f57c0153b44e7f52ed
Parents: 55c5c4b
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Sep 26 15:02:27 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Sep 26 15:08:56 2014 +0800
----------------------------------------------------------------------
.../component/cxf/jaxrs/CxfRsEndpoint.java | 85 +++++++++++---------
.../component/cxf/jaxrs/CxfRsProducer.java | 17 ++--
.../component/cxf/jaxrs/CxfRsSpringRouter.xml | 7 +-
3 files changed, 61 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3a5497af/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
index d3e29c2..b4b63a1 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
@@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware, Service {
-
+
public enum BindingStyle {
/**
* <i>Only available for consumers.</i>
@@ -60,7 +60,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
* It also also adds more flexibility and simplicity to the response mapping.
*/
SimpleConsumer,
-
+
/**
* This is the traditional binding style, which simply dumps the {@link org.apache.cxf.message.MessageContentsList} coming in from the CXF stack
* onto the IN message body. The user is then responsible for processing it according to the contract defined by the JAX-RS method signature.
@@ -77,9 +77,9 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
private static final Logger LOG = LoggerFactory.getLogger(CxfRsEndpoint.class);
protected Bus bus;
-
+
protected List<Object> entityProviders = new LinkedList<Object>();
-
+
protected List<String> schemaLocations;
private Map<String, String> parameters;
@@ -87,6 +87,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
private HeaderFilterStrategy headerFilterStrategy;
private CxfRsBinding binding;
private boolean httpClientAPI = true;
+ private boolean ignoreDeleteMethodMessageBody;
private String address;
private boolean throwExceptionOnFailure = true;
private int maxClientCacheSize = 10;
@@ -94,13 +95,13 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
private int loggingSizeLimit;
private boolean skipFaultLogging;
private BindingStyle bindingStyle = BindingStyle.Default;
-
+
private boolean isSetDefaultBus;
-
+
private List<Feature> features = new ModCountCopyOnWriteArrayList<Feature>();
private InterceptorHolder interceptorHolder = new InterceptorHolder();
private Map<String, Object> properties;
-
+
@Deprecated
public CxfRsEndpoint(String endpointUri, CamelContext camelContext) {
@@ -171,7 +172,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
public CxfRsBinding getBinding() {
return binding;
}
-
+
public boolean isSkipFaultLogging() {
return skipFaultLogging;
}
@@ -179,7 +180,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
public void setSkipFaultLogging(boolean skipFaultLogging) {
this.skipFaultLogging = skipFaultLogging;
}
-
+
protected void checkBeanType(Object object, Class<?> clazz) {
if (!clazz.isAssignableFrom(object.getClass())) {
throw new IllegalArgumentException("The configure bean is not the instance of " + clazz.getName());
@@ -215,7 +216,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
setupCommonFactoryProperties(cfb);
cfb.setThreadSafe(true);
}
-
+
protected void setupCommonFactoryProperties(AbstractJAXRSFactoryBean factory) {
// let customer to override the default setting of provider
if (!getProviders().isEmpty()) {
@@ -225,11 +226,11 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
if (!getFeatures().isEmpty()) {
factory.getFeatures().addAll(getFeatures());
}
-
+
// we need to avoid flushing the setting from spring or blueprint
if (!interceptorHolder.getInInterceptors().isEmpty()) {
factory.setInInterceptors(interceptorHolder.getInInterceptors());
- }
+ }
if (!interceptorHolder.getOutInterceptors().isEmpty()) {
factory.setOutInterceptors(interceptorHolder.getOutInterceptors());
}
@@ -237,9 +238,9 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
factory.setOutFaultInterceptors(interceptorHolder.getOutFaultInterceptors());
}
if (!interceptorHolder.getInFaultInterceptors().isEmpty()) {
- factory.setInFaultInterceptors(interceptorHolder.getInFaultInterceptors());
+ factory.setInFaultInterceptors(interceptorHolder.getInFaultInterceptors());
}
-
+
if (getProperties() != null) {
if (factory.getProperties() != null) {
// add to existing properties
@@ -249,7 +250,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
}
LOG.debug("JAXRS FactoryBean: {} added properties: {}", factory, getProperties());
}
-
+
if (isLoggingFeatureEnabled()) {
if (getLoggingSizeLimit() > 0) {
factory.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
@@ -264,15 +265,15 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
factory.getProperties().put(FaultListener.class.getName(), new NullFaultListener());
}
}
-
+
protected JAXRSServerFactoryBean newJAXRSServerFactoryBean() {
return new JAXRSServerFactoryBean();
}
-
+
protected JAXRSClientFactoryBean newJAXRSClientFactoryBean() {
return new JAXRSClientFactoryBean();
}
-
+
protected String resolvePropertyPlaceholders(String str) {
try {
if (getCamelContext() != null) {
@@ -291,12 +292,12 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
setupJAXRSServerFactoryBean(answer);
return answer;
}
-
+
public JAXRSClientFactoryBean createJAXRSClientFactoryBean() {
return createJAXRSClientFactoryBean(getAddress());
}
-
+
public JAXRSClientFactoryBean createJAXRSClientFactoryBean(String address) {
JAXRSClientFactoryBean answer = newJAXRSClientFactoryBean();
setupJAXRSClientFactoryBean(answer, address);
@@ -320,7 +321,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
public void setResourceClasses(Class<?>... classes) {
setResourceClasses(Arrays.asList(classes));
}
-
+
public void setAddress(String address) {
this.address = address;
}
@@ -366,7 +367,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
public int getMaxClientCacheSize() {
return maxClientCacheSize;
}
-
+
public void setBus(Bus bus) {
this.bus = bus;
if (isSetDefaultBus) {
@@ -378,7 +379,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
public Bus getBus() {
return bus;
}
-
+
public void setSetDefaultBus(boolean isSetDefaultBus) {
this.isSetDefaultBus = isSetDefaultBus;
}
@@ -386,31 +387,39 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
public boolean isSetDefaultBus() {
return isSetDefaultBus;
}
-
+
+ public boolean isIgnoreDeleteMethodMessageBody() {
+ return ignoreDeleteMethodMessageBody;
+ }
+
+ public void setIgnoreDELETEMethodMessageBody(boolean ignoreDELETEMethodMessageBody) {
+ this.ignoreDeleteMethodMessageBody = ignoreDELETEMethodMessageBody;
+ }
+
public BindingStyle getBindingStyle() {
return bindingStyle;
}
-
+
public List<?> getProviders() {
return entityProviders;
}
-
+
public void setProviders(List<?> providers) {
this.entityProviders.addAll(providers);
}
-
+
public void setProvider(Object provider) {
entityProviders.add(provider);
}
-
+
public void setSchemaLocation(String schema) {
- setSchemaLocations(Collections.singletonList(schema));
+ setSchemaLocations(Collections.singletonList(schema));
}
-
+
public void setSchemaLocations(List<String> schemas) {
- this.schemaLocations = schemas;
+ this.schemaLocations = schemas;
}
-
+
public List<String> getSchemaLocations() {
return schemaLocations;
}
@@ -446,7 +455,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
public void setOutFaultInterceptors(List<Interceptor<? extends Message>> interceptors) {
interceptorHolder.setOutFaultInterceptors(interceptors);
}
-
+
public List<Feature> getFeatures() {
return features;
}
@@ -458,7 +467,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
public Map<String, Object> getProperties() {
return properties;
}
-
+
public void setProperties(Map<String, Object> properties) {
if (this.properties == null) {
this.properties = properties;
@@ -466,14 +475,14 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
this.properties.putAll(properties);
}
}
-
+
/**
* See documentation of {@link BindingStyle}.
*/
public void setBindingStyle(BindingStyle bindingStyle) {
this.bindingStyle = bindingStyle;
}
-
+
@Override
protected void doStart() throws Exception {
if (headerFilterStrategy == null) {
@@ -488,7 +497,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
// if the user has set a binding, do nothing, just make sure that BindingStyle = Custom for coherency purposes
if (binding != null) {
bindingStyle = BindingStyle.Custom;
- }
+ }
// set the right binding based on the binding style
if (bindingStyle == BindingStyle.SimpleConsumer) {
@@ -498,7 +507,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate
} else {
binding = new DefaultCxfRsBinding();
}
-
+
if (binding instanceof HeaderFilterStrategyAware) {
((HeaderFilterStrategyAware) binding).setHeaderFilterStrategy(getHeaderFilterStrategy());
}
http://git-wip-us.apache.org/repos/asf/camel/blob/3a5497af/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
index c580445..7129829 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
@@ -57,12 +57,15 @@ public class CxfRsProducer extends DefaultProducer {
private boolean throwException;
+ private CxfRsEndpoint cxfRsEndpoint;
+
// using a cache of factory beans instead of setting the address of a single cfb
// to avoid concurrent issues
private ClientFactoryBeanCache clientFactoryBeanCache;
public CxfRsProducer(CxfRsEndpoint endpoint) {
super(endpoint);
+ cxfRsEndpoint = endpoint;
this.throwException = endpoint.isThrowExceptionOnFailure();
clientFactoryBeanCache = new ClientFactoryBeanCache(endpoint.getMaxClientCacheSize());
}
@@ -158,11 +161,15 @@ public class CxfRsProducer extends DefaultProducer {
// set the body
Object body = null;
- if (!"GET".equals(httpMethod) && !"DELETE".equals(httpMethod)) {
- // need to check the request object if the http Method is not GET or DELETE
- body = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);
- if (LOG.isTraceEnabled()) {
- LOG.trace("Request body = " + body);
+ if (!"GET".equals(httpMethod)) {
+ // need to check the request object if the http Method is not GET
+ if ("DELETE".equals(httpMethod) && cxfRsEndpoint.isIgnoreDeleteMethodMessageBody()) {
+ // just ignore the message body if the ignoreDeleteMethodMessageBody is true
+ } else {
+ body = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Request body = " + body);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/3a5497af/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
index 9f51dd6..172aac1 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
@@ -63,12 +63,9 @@
<!-- The camel route context -->
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
- <from uri="cxfrs://bean://rsServer"/>
+ <!-- Just need to ignoreDeleteMethodMessageBody -->
+ <from uri="cxfrs://bean://rsServer?ignoreDeleteMethodMessageBody=true"/>
<to uri="log:body?level=INFO"/>
- <!-- We can remove this configure as the CXFRS producer is using the HttpAPI by default -->
- <setHeader headerName="CamelCxfRsUsingHttpAPI">
- <constant>True</constant>
- </setHeader>
<to uri="cxfrs://bean://rsClient"/>
</route>
</camelContext>
[37/50] git commit: Update README.md - Add Prefix "camelSalesforce"
Posted by cm...@apache.org.
Update README.md - Add Prefix "camelSalesforce"
The suffix "camelSalesforce" needs to be added as prefix to the properties.
The command should be corrected as:
mvn camel-salesforce:generate -DcamelSalesforce.clientId=<clientid> -DcamelSalesforce.clientSecret=<clientsecret> -DcamelSalesforce.userName=<username> -DcamelSalesforce.password=<password>
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a5eb8c08
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a5eb8c08
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a5eb8c08
Branch: refs/remotes/origin/camel-2.13.x
Commit: a5eb8c08353bf578ef7b1edd0fa923c0a1a8ee1a
Parents: 845410e
Author: yelamanchili-murali <ye...@gmail.com>
Authored: Fri Oct 3 15:48:34 2014 +1000
Committer: Dhiraj Bokde <dh...@yahoo.com>
Committed: Fri Oct 3 11:35:44 2014 -0700
----------------------------------------------------------------------
.../camel-salesforce/camel-salesforce-maven-plugin/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a5eb8c08/components/camel-salesforce/camel-salesforce-maven-plugin/README.md
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/README.md b/components/camel-salesforce/camel-salesforce-maven-plugin/README.md
index 5bfd808..0424771 100644
--- a/components/camel-salesforce/camel-salesforce-maven-plugin/README.md
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/README.md
@@ -21,6 +21,6 @@ The plugin configuration has the following properties.
Fro obvious security reasons it is recommended that the clientId, clientSecret, userName and password fields be not set in the pom.xml.
The plugin should be configured for the rest of the properties, and can be executed using the following command:
- mvn camel-salesforce:generate -DclientId=<clientid> -DclientSecret=<clientsecret> -DuserName=<username> -Dpassword=<password>
+ mvn camel-salesforce:generate -DcamelSalesforce.clientId=<clientid> -DcamelSalesforce.clientSecret=<clientsecret> -DcamelSalesforce.userName=<username> -DcamelSalesforce.password=<password>
The generated DTOs use Jackson and XStream annotations. All Salesforce field types are supported. Date and time fields are mapped to Joda DateTime, and picklist fields are mapped to generated Java Enumerations.
[19/50] git commit: CAMEL-7863: Improve logging message and reduce
verbosity from INFO to debug
Posted by cm...@apache.org.
CAMEL-7863: Improve logging message and reduce verbosity from INFO to debug
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/94c748ca
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/94c748ca
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/94c748ca
Branch: refs/remotes/origin/camel-2.13.x
Commit: 94c748ca5e850dcaec8605e2ae77fc1091069771
Parents: a7b7206
Author: david <da...@davidkarlsen.com>
Authored: Thu Sep 25 19:57:06 2014 +0200
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Sep 26 15:06:58 2014 +0800
----------------------------------------------------------------------
.../main/java/org/apache/camel/component/cxf/CxfProducer.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/94c748ca/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
index 8246c4f..28e9913 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
@@ -332,11 +332,11 @@ public class CxfProducer extends DefaultProducer implements AsyncProcessor {
BindingOperationInfo answer = null;
String lp = ex.getIn().getHeader(CxfConstants.OPERATION_NAME, String.class);
if (lp == null) {
- LOG.info("CxfProducer cannot find the {} from message header, try to use the defaultOperationName", CxfConstants.OPERATION_NAME);
+ LOG.debug("CxfProducer cannot find the {} from message header, trying with defaultOperationName", CxfConstants.OPERATION_NAME);
lp = endpoint.getDefaultOperationName();
}
if (lp == null) {
- LOG.info("CxfProducer cannot find the {} from message header and there is no DefaultOperationName setting, CxfProducer will pick up the first available operation.",
+ LOG.debug("CxfProducer cannot find the {} from message header and there is no DefaultOperationName setting, CxfProducer will pick up the first available operation.",
CxfConstants.OPERATION_NAME);
Collection<BindingOperationInfo> bois =
client.getEndpoint().getEndpointInfo().getBinding().getOperations();
[45/50] git commit: CAMEL-7917: camel-jsch unit tests are failing
Posted by cm...@apache.org.
CAMEL-7917: camel-jsch unit tests are failing
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/217c81cc
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/217c81cc
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/217c81cc
Branch: refs/remotes/origin/camel-2.13.x
Commit: 217c81ccbd476d1614e41099d890974b325de081
Parents: b1379c6
Author: Christian Mueller <cm...@apache.org>
Authored: Wed Oct 15 21:51:39 2014 +0200
Committer: Christian Mueller <cm...@apache.org>
Committed: Wed Oct 15 21:51:39 2014 +0200
----------------------------------------------------------------------
parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/217c81cc/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index e2a0d93..9ec4f30 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -242,7 +242,7 @@
<jsendnsca-version>1.3.1</jsendnsca-version>
<jsmpp-version>2.1.0_4</jsmpp-version>
<jsch-version>0.1.51</jsch-version>
- <jsch-bundle-version>0.1.50_1</jsch-bundle-version>
+ <jsch-bundle-version>0.1.51_1</jsch-bundle-version>
<jsendnsca-bundle-version>1.3.1_3</jsendnsca-bundle-version>
<jsonlib-bundle-version>2.4_1</jsonlib-bundle-version>
<jsonlib-version>2.4</jsonlib-version>
[18/50] git commit: Fixed the camel-web build error with Windows
Posted by cm...@apache.org.
Fixed the camel-web build error with Windows
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a7b7206d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a7b7206d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a7b7206d
Branch: refs/remotes/origin/camel-2.13.x
Commit: a7b7206dbc0b12adb55280418b9c2f3d6fa1bf0f
Parents: 5b4abb6
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Sep 25 11:42:47 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Sep 25 11:45:35 2014 +0800
----------------------------------------------------------------------
components/camel-web/pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a7b7206d/components/camel-web/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-web/pom.xml b/components/camel-web/pom.xml
index 626bb35..eeb925f 100644
--- a/components/camel-web/pom.xml
+++ b/components/camel-web/pom.xml
@@ -245,9 +245,9 @@
</plugin>
<!-- mvn tomcat7:run -->
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat7-maven-plugin</artifactId>
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
</plugin>
@@ -371,7 +371,7 @@
</docletArtifact>
</docletArtifacts>
<additionalparam>-output
- ${project.build.outputDirectory}/resourcedoc.xml
+ ${project.build.outputDirectory}${file.separator}resourcedoc.xml
</additionalparam>
</configuration>
</plugin>
[30/50] git commit: CAMEL-7848 Disable the AllowDefaultCodec option
in camel-netty-http
Posted by cm...@apache.org.
CAMEL-7848 Disable the AllowDefaultCodec option in camel-netty-http
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/84aa5c6c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/84aa5c6c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/84aa5c6c
Branch: refs/remotes/origin/camel-2.13.x
Commit: 84aa5c6ca18b308dd371d4cf8341f559e66a5dd1
Parents: baac167
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon Sep 29 09:03:25 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Sep 29 22:10:58 2014 +0800
----------------------------------------------------------------------
.../camel/component/netty/http/NettyHttpConfiguration.java | 9 +++++++++
.../apache/camel/component/netty/NettyConfiguration.java | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/84aa5c6c/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConfiguration.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConfiguration.java
index 420a448..9c5dd4c 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConfiguration.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConfiguration.java
@@ -160,5 +160,14 @@ public class NettyHttpConfiguration extends NettyConfiguration {
public void setChunkedMaxContentLength(int chunkedMaxContentLength) {
this.chunkedMaxContentLength = chunkedMaxContentLength;
}
+
+ // Don't support allowDefaultCodec
+ public boolean isAllowDefaultCodec() {
+ return false;
+ }
+
+ public void setAllowDefaultCodec(boolean allowDefaultCodec) {
+ throw new UnsupportedOperationException("You cannot setAllowDefaultCodec here.");
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/84aa5c6c/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
index 83ab62d..cf3aa0d 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
@@ -161,7 +161,7 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem
// add default encoders and decoders
if (encoders.isEmpty() && decoders.isEmpty()) {
- if (allowDefaultCodec) {
+ if (isAllowDefaultCodec()) {
// are we textline or object?
if (isTextline()) {
Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8;
[44/50] git commit: upgraded jsch 0.1.50 to 0.1.51 and fixed the
failing unit tests
Posted by cm...@apache.org.
upgraded jsch 0.1.50 to 0.1.51 and fixed the failing unit tests
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b1379c6c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b1379c6c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b1379c6c
Branch: refs/remotes/origin/camel-2.13.x
Commit: b1379c6cf24add7da74995bcfe7968ddb436c4ae
Parents: 21ff698
Author: Christian Mueller <cm...@apache.org>
Authored: Wed Oct 15 20:13:25 2014 +0200
Committer: Christian Mueller <cm...@apache.org>
Committed: Wed Oct 15 20:13:25 2014 +0200
----------------------------------------------------------------------
.../camel/component/jsch/ScpServerTestSupport.java | 11 +++--------
components/camel-jsch/src/test/resources/scp/known_hosts | 0
parent/pom.xml | 2 +-
3 files changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/b1379c6c/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpServerTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpServerTestSupport.java b/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpServerTestSupport.java
index 1213e9d..8793f44 100644
--- a/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpServerTestSupport.java
+++ b/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpServerTestSupport.java
@@ -48,12 +48,9 @@ import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- * @version
- */
public abstract class ScpServerTestSupport extends CamelTestSupport {
protected static final Logger LOG = LoggerFactory.getLogger(ScpServerTestSupport.class);
- protected static final String SCP_ROOT_DIR = "target/scp";
+ protected static final String SCP_ROOT_DIR = "target/test-classes/scp";
protected static final String KNOWN_HOSTS = "known_hosts";
protected static int port;
@@ -109,7 +106,6 @@ public abstract class ScpServerTestSupport extends CamelTestSupport {
// and get errors when the ssh server is stopping.
}
}
- FileUtil.deleteFile(new File(knownHostsFile));
deleteDirectory(getScpPath());
}
@@ -153,8 +149,7 @@ public abstract class ScpServerTestSupport extends CamelTestSupport {
}
protected void setupKnownHosts() {
- knownHostsFile = SCP_ROOT_DIR + "/" + KNOWN_HOSTS + "-" + getPort();
- FileUtil.deleteFile(new File(knownHostsFile));
+ knownHostsFile = SCP_ROOT_DIR + "/" + KNOWN_HOSTS;
if (!acceptLocalhostConnections) {
return;
}
@@ -163,7 +158,7 @@ public abstract class ScpServerTestSupport extends CamelTestSupport {
// camel-jsch will only connect to known hosts. For unit testing
// we use a known key, but since the port it dynamic, the
// known_hosts file will be generated by the following code and
- // should should contain a line like below (if
+ // should contain a line like below (if
// "HashKnownHosts"=="yes" the hostname:port part will be
// hashed and look a bit more complicated).
//
http://git-wip-us.apache.org/repos/asf/camel/blob/b1379c6c/components/camel-jsch/src/test/resources/scp/known_hosts
----------------------------------------------------------------------
diff --git a/components/camel-jsch/src/test/resources/scp/known_hosts b/components/camel-jsch/src/test/resources/scp/known_hosts
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/camel/blob/b1379c6c/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 75cd7bf..e2a0d93 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -241,7 +241,7 @@
<jruby-version>1.7.13</jruby-version>
<jsendnsca-version>1.3.1</jsendnsca-version>
<jsmpp-version>2.1.0_4</jsmpp-version>
- <jsch-version>0.1.50</jsch-version>
+ <jsch-version>0.1.51</jsch-version>
<jsch-bundle-version>0.1.50_1</jsch-bundle-version>
<jsendnsca-bundle-version>1.3.1_3</jsendnsca-bundle-version>
<jsonlib-bundle-version>2.4_1</jsonlib-bundle-version>
[47/50] git commit: fixed some more CS errors
Posted by cm...@apache.org.
fixed some more CS errors
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f0e3e201
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f0e3e201
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f0e3e201
Branch: refs/remotes/origin/camel-2.13.x
Commit: f0e3e2015c7a5297b19e741f11c9fb9753bae5ba
Parents: f424d82
Author: Christian Mueller <cm...@apache.org>
Authored: Thu Oct 16 10:33:13 2014 +0200
Committer: Christian Mueller <cm...@apache.org>
Committed: Thu Oct 16 10:33:13 2014 +0200
----------------------------------------------------------------------
.../camel/component/sjms/SjmsConsumer.java | 2 +-
.../camel/component/sjms/SjmsProducer.java | 2 +-
.../sjms/threadpool/ThreadPoolTest.java | 131 ++++++++++---------
.../log/CustomExchangeFormatterTest.java | 8 +-
4 files changed, 73 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f0e3e201/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
index 4ae566d..017acbe 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
@@ -157,7 +157,7 @@ public class SjmsConsumer extends DefaultConsumer {
consumers.drainPool();
consumers = null;
}
- if(this.executor!=null){
+ if (this.executor != null) {
getEndpoint().getCamelContext().getExecutorServiceManager().shutdownGraceful(this.executor);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/f0e3e201/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
index 582d657..8e9e878 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
@@ -146,7 +146,7 @@ public abstract class SjmsProducer extends DefaultAsyncProducer {
getProducers().drainPool();
setProducers(null);
}
- if(this.executor!=null){
+ if (this.executor != null) {
getEndpoint().getCamelContext().getExecutorServiceManager().shutdownGraceful(this.executor);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/f0e3e201/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/threadpool/ThreadPoolTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/threadpool/ThreadPoolTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/threadpool/ThreadPoolTest.java
index 1bff29e..3c67133 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/threadpool/ThreadPoolTest.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/threadpool/ThreadPoolTest.java
@@ -36,77 +36,80 @@ import org.slf4j.LoggerFactory;
*/
public class ThreadPoolTest extends JmsTestSupport {
- private static final Logger LOGGER = LoggerFactory.getLogger(ThreadPoolTest.class);
- private static final String FROM_ROUTE = "from";
- private static final String TO_ROUTE = "to";
+ private static final Logger LOGGER = LoggerFactory.getLogger(ThreadPoolTest.class);
+ private static final String FROM_ROUTE = "from";
+ private static final String TO_ROUTE = "to";
- @Override
- protected boolean useJmx() {
- return true;
- }
+ @Override
+ protected boolean useJmx() {
+ return true;
+ }
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").to("sjms:queue:foo").routeId(FROM_ROUTE);
- from("sjms:queue:foo").to("log:test.log.1?showBody=true").routeId(TO_ROUTE);
- }
- };
- }
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").to("sjms:queue:foo").routeId(FROM_ROUTE);
+ from("sjms:queue:foo").to("log:test.log.1?showBody=true").routeId(TO_ROUTE);
+ }
+ };
+ }
- /**
- * Test that only 2 thread pools are created on start
- *
- * @throws Exception
- */
- @Test
- public void testContextStart() throws Exception {
- assertProducerThreadPoolCount(1);
- assertConsumerThreadPoolCount(1);
- }
+ /**
+ * Test that only 2 thread pools are created on start
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testContextStart() throws Exception {
+ assertProducerThreadPoolCount(1);
+ assertConsumerThreadPoolCount(1);
+ }
- /**
- * Test that ThreadPool is removed when producer is removed
- * @throws Exception
- */
- @Test
- public void testProducerThreadThreadPoolRemoved() throws Exception {
- context.stopRoute(FROM_ROUTE);
- assertProducerThreadPoolCount(0);
- }
+ /**
+ * Test that ThreadPool is removed when producer is removed
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testProducerThreadThreadPoolRemoved() throws Exception {
+ context.stopRoute(FROM_ROUTE);
+ assertProducerThreadPoolCount(0);
+ }
- /**
- * Test that ThreadPool is removed when consumer is removed
- * @throws Exception
- */
- @Test
- public void testConsumerThreadThreadPoolRemoved() throws Exception {
- context.stopRoute(TO_ROUTE);
- assertConsumerThreadPoolCount(0);
- }
+ /**
+ * Test that ThreadPool is removed when consumer is removed
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testConsumerThreadThreadPoolRemoved() throws Exception {
+ context.stopRoute(TO_ROUTE);
+ assertConsumerThreadPoolCount(0);
+ }
- private void assertProducerThreadPoolCount(final int count) throws Exception {
- assertEquals(count, getMbeanCount("\"InOnlyProducer"));
- }
+ private void assertProducerThreadPoolCount(final int count) throws Exception {
+ assertEquals(count, getMbeanCount("\"InOnlyProducer"));
+ }
- private void assertConsumerThreadPoolCount(final int count) throws Exception {
- assertEquals(count, getMbeanCount("\"SjmsConsumer"));
- }
+ private void assertConsumerThreadPoolCount(final int count) throws Exception {
+ assertEquals(count, getMbeanCount("\"SjmsConsumer"));
+ }
- private int getMbeanCount(final String name) throws MalformedObjectNameException {
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- Set<ObjectInstance> mbeans = mbs.queryMBeans(new ObjectName("org.apache.camel:type=threadpools,*"), null);
- LOGGER.debug("mbeans size: " + mbeans.size());
- int count = 0;
- for (ObjectInstance mbean : mbeans) {
- LOGGER.debug("mbean: {}", mbean);
- if (mbean.getObjectName().getKeyProperty("name").startsWith(name)) {
- count++;
- }
- }
- return count;
- }
+ private int getMbeanCount(final String name) throws MalformedObjectNameException {
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ Set<ObjectInstance> mbeans = mbs.queryMBeans(new ObjectName("org.apache.camel:type=threadpools,*"),
+ null);
+ LOGGER.debug("mbeans size: " + mbeans.size());
+ int count = 0;
+ for (ObjectInstance mbean : mbeans) {
+ LOGGER.debug("mbean: {}", mbean);
+ if (mbean.getObjectName().getKeyProperty("name").startsWith(name)) {
+ count++;
+ }
+ }
+ return count;
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/f0e3e201/components/camel-spring/src/test/java/org/apache/camel/component/log/CustomExchangeFormatterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/log/CustomExchangeFormatterTest.java b/components/camel-spring/src/test/java/org/apache/camel/component/log/CustomExchangeFormatterTest.java
index 4d6a15a..9d44689 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/component/log/CustomExchangeFormatterTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/component/log/CustomExchangeFormatterTest.java
@@ -43,10 +43,10 @@ public class CustomExchangeFormatterTest extends SpringTestSupport {
LogEndpoint log = (LogEndpoint) ep;
- aaa = log.getEndpointUri().contains("aaa") ?
- (TestExchangeFormatter) f.get(((CamelLogProcessor) log.getLogger())) : aaa;
- bbb = log.getEndpointUri().contains("bbb") ?
- (TestExchangeFormatter) f.get(((CamelLogProcessor) log.getLogger())) : bbb;
+ aaa = log.getEndpointUri().contains("aaa")
+ ? (TestExchangeFormatter) f.get((CamelLogProcessor) log.getLogger()) : aaa;
+ bbb = log.getEndpointUri().contains("bbb")
+ ? (TestExchangeFormatter) f.get((CamelLogProcessor) log.getLogger()) : bbb;
}
assertNotNull(aaa);