Author: ningjiang
Date: Mon Aug 20 01:24:19 2012
New Revision: 1374891
URL: http://svn.apache.org/viewvc?rev=1374891&view=rev
Log:
Merged revisions 1374582-1374584,1374709 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1374582 | ningjiang | 2012-08-18 22:02:29 +0800 (Sat, 18 Aug 2012) | 1 line
CAMEL-5518 fix the issue that Camel Proxy,Export ignores camelContextId
property in Spring configuration
........
r1374583 | ningjiang | 2012-08-18 22:03:32 +0800 (Sat, 18 Aug 2012) | 1 line
CAMEL-5519 fix the issue that camel template, endpoint etc ignore
camelContextId property
........
r1374584 | ningjiang | 2012-08-18 22:04:14 +0800 (Sat, 18 Aug 2012) | 1 line
CAMEL-5518 fix a failed test
........
r1374709 | ningjiang | 2012-08-19 16:24:55 +0800 (Sun, 19 Aug 2012) | 1 line
CAMEL-5518 fix another failed test
........
Added:
camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/produce/ProduceTemplateWithTwoCamelContextTest.java
- copied unchanged from r1374584,
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/ProduceTemplateWithTwoCamelContextTest.java
camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java
- copied unchanged from r1374584,
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTemplateWithTwoCamelContextTest-context.xml
- copied unchanged from r1374584,
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTemplateWithTwoCamelContextTest-context.xml
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-two-camelcontext.xml
- copied unchanged from r1374584,
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-two-camelcontext.xml
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/echo-pojo-out-of-camelContext.xml
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1374582-1374584,1374709
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.10.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java?rev=1374891&r1=1374890&r2=1374891&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
(original)
+++
camel/branches/camel-2.10.x/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
Mon Aug 20 01:24:19 2012
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlTran
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.model.IdentifiedType;
+import org.apache.camel.util.ObjectHelper;
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class AbstractCamelFactoryBean<T> extends IdentifiedType
implements CamelContextAware {
@@ -46,13 +47,8 @@ public abstract class AbstractCamelFacto
}
public void afterPropertiesSet() throws Exception {
- }
-
- public void destroy() throws Exception {
- }
-
- public CamelContext getCamelContext() {
- if (camelContext == null && camelContextId != null) {
+ // Always try to resolved the camel context by using the camelContextId
+ if (ObjectHelper.isNotEmpty(camelContextId)) {
camelContext = getCamelContextWithId(camelContextId);
if (camelContext == null) {
throw new IllegalStateException("Cannot find CamelContext with
id: " + camelContextId);
@@ -61,6 +57,12 @@ public abstract class AbstractCamelFacto
if (camelContext == null) {
camelContext = discoverDefaultCamelContext();
}
+ }
+
+ public void destroy() throws Exception {
+ }
+
+ public CamelContext getCamelContext() {
return camelContext;
}
Modified:
camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java?rev=1374891&r1=1374890&r2=1374891&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
(original)
+++
camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
Mon Aug 20 01:24:19 2012
@@ -23,6 +23,7 @@ import org.apache.camel.FailedToCreatePr
import org.apache.camel.Producer;
import org.apache.camel.component.bean.ProxyHelper;
import org.apache.camel.spring.util.CamelContextResolverHelper;
+import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.ServiceHelper;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
@@ -46,14 +47,13 @@ public class CamelProxyFactoryBean exten
@Override
public void afterPropertiesSet() {
if (endpoint == null) {
- if (camelContext == null && camelContextId != null) {
+ if (ObjectHelper.isNotEmpty(camelContextId)) {
camelContext =
CamelContextResolverHelper.getCamelContextWithId(applicationContext,
camelContextId);
}
-
if (camelContext == null) {
throw new IllegalArgumentException("camelContext or
camelContextId must be specified");
}
-
+
if (getServiceUrl() == null && getServiceRef() == null) {
throw new IllegalArgumentException("serviceUrl or serviceRef
must be specified.");
}
Modified:
camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java?rev=1374891&r1=1374890&r2=1374891&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java
(original)
+++
camel/branches/camel-2.10.x/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java
Mon Aug 20 01:24:19 2012
@@ -23,6 +23,7 @@ import org.apache.camel.Endpoint;
import org.apache.camel.component.bean.BeanProcessor;
import org.apache.camel.spring.util.CamelContextResolverHelper;
import org.apache.camel.util.CamelContextHelper;
+import org.apache.camel.util.ObjectHelper;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
@@ -83,7 +84,8 @@ public class CamelServiceExporter extend
public void afterPropertiesSet() throws Exception {
// lets bind the URI to a pojo
notNull(uri, "uri");
- if (camelContext == null && camelContextId != null) {
+ // Always resolve the camel context by using the camelContextID
+ if (ObjectHelper.isNotEmpty(camelContextId)) {
camelContext =
CamelContextResolverHelper.getCamelContextWithId(applicationContext,
camelContextId);
}
notNull(camelContext, "camelContext");
Modified:
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml?rev=1374891&r1=1374890&r2=1374891&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml
(original)
+++
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml
Mon Aug 20 01:24:19 2012
@@ -23,7 +23,7 @@
">
<!-- START SNIPPET: e1 -->
- <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
<!-- create a proxy that will route to the direct:start endpoint when
invoked -->
<proxy id="myProxySender"
Modified:
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/echo-pojo-out-of-camelContext.xml
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/echo-pojo-out-of-camelContext.xml?rev=1374891&r1=1374890&r2=1374891&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/echo-pojo-out-of-camelContext.xml
(original)
+++
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/echo-pojo-out-of-camelContext.xml
Mon Aug 20 01:24:19 2012
@@ -29,7 +29,7 @@
<camel:export id="echo" camelContextId="camel"
serviceInterface="org.apache.camel.spring.remoting.Echo"
serviceRef="echoService" uri="direct:echo"/>
- <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
</camelContext>