You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2010/08/26 09:02:03 UTC
svn commit: r989470 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/component/bean/
components/camel-spring/src/test/java/org/apache/camel/spring/remoting/
components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/
Author: ningjiang
Date: Thu Aug 26 07:02:03 2010
New Revision: 989470
URL: http://svn.apache.org/viewvc?rev=989470&view=rev
Log:
CAMEL-3082 fix the issue of BeanConveter
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Bean.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Invoker.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/beanConverter.xml (with props)
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanConverter.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanConverter.java?rev=989470&r1=989469&r2=989470&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanConverter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanConverter.java Thu Aug 26 07:02:03 2010
@@ -48,7 +48,7 @@ public final class BeanConverter {
Object body = bi.getArgs()[0];
// maybe from is already the type we want
- if (from.isAssignableFrom(type)) {
+ if (type.isAssignableFrom(from)) {
return body;
}
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Bean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Bean.java?rev=989470&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Bean.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Bean.java Thu Aug 26 07:02:03 2010
@@ -0,0 +1,40 @@
+/**
+ * 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.remoting;
+
+import org.apache.camel.Message;
+
+public class Bean {
+
+ public String sayHi(final BaseClass baseClass, Message message) {
+ return baseClass.hi();
+ }
+
+ public static class BaseClass {
+ public String hi() {
+ return "Hello from Base";
+ }
+ }
+
+ public static class SubClass extends BaseClass {
+ public String hi() {
+ return "Hello from Sub";
+ }
+ }
+
+}
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Bean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Bean.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Invoker.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Invoker.java?rev=989470&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Invoker.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Invoker.java Thu Aug 26 07:02:03 2010
@@ -0,0 +1,25 @@
+/**
+ * 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.remoting;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface Invoker extends Remote {
+ String invoke(Bean.BaseClass base) throws RemoteException;
+}
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Invoker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/Invoker.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java?rev=989470&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java Thu Aug 26 07:02:03 2010
@@ -0,0 +1,46 @@
+/**
+ * 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.remoting;
+
+import junit.framework.TestCase;
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.SpringCamelContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringRemotingBeanConverterTest extends TestCase {
+
+ public void testBeanRoutes() throws Exception {
+ AbstractXmlApplicationContext applicationContext = createApplicationContext();
+
+ CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext);
+
+ Invoker invoker = (Invoker) applicationContext.getBean("invokerProxy");
+ String response = invoker.invoke(new Bean.SubClass());
+ assertEquals("Hello from Sub" , response);
+
+ camelContext.stop();
+ applicationContext.destroy();
+ }
+
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/spring/remoting/beanConverter.xml");
+ }
+}
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/beanConverter.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/beanConverter.xml?rev=989470&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/beanConverter.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/beanConverter.xml Thu Aug 26 07:02:03 2010
@@ -0,0 +1,40 @@
+<?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
+ ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:invoker"/>
+ <to uri="bean:myBean"/>
+ </route>
+ </camelContext>
+
+ <bean id="myBean" class="org.apache.camel.spring.remoting.Bean" />
+
+ <bean id="invokerProxy" class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
+ <property name="serviceUrl" value="direct:invoker"/>
+ <property name="serviceInterface" value="org.apache.camel.spring.remoting.Invoker"/>
+ </bean>
+
+
+</beans>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/beanConverter.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/beanConverter.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/beanConverter.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml