camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject camel git commit: CAMEL-8453 - allow avro dataformat to be used from spring
Date Fri, 06 Mar 2015 16:50:28 GMT
Repository: camel
Updated Branches:
  refs/heads/master 665c84739 -> fa38e09b9


CAMEL-8453 - allow avro dataformat to be used from spring


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fa38e09b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fa38e09b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fa38e09b

Branch: refs/heads/master
Commit: fa38e09b92ce6b4495413ced3e42d391462de72f
Parents: 665c847
Author: Jonathan Anstey <janstey@gmail.com>
Authored: Fri Mar 6 13:19:41 2015 -0330
Committer: Jonathan Anstey <janstey@gmail.com>
Committed: Fri Mar 6 13:19:41 2015 -0330

----------------------------------------------------------------------
 .../camel/model/dataformat/AvroDataFormat.java  |  2 +-
 .../camel/dataformat/avro/AvroDataFormat.java   |  2 +-
 .../avro/AvroMarshalAndUnmarshalSpringTest.java | 21 ++++++++++++++++++--
 .../camel/dataformat/avro/springDataFormat.xml  | 10 +++++-----
 4 files changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fa38e09b/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
b/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
index 67c1db1..a7c6064 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
@@ -72,7 +72,7 @@ public class AvroDataFormat extends DataFormatDefinition {
     @Override
     protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext)
{
         if (this.instanceClassName != null) {
-            setProperty(camelContext, dataFormat, "instanceClass", instanceClassName);
+            setProperty(camelContext, dataFormat, "instanceClassName", instanceClassName);
         }
         if (this.schema != null) {
             setProperty(camelContext, dataFormat, "schema", schema);

http://git-wip-us.apache.org/repos/asf/camel/blob/fa38e09b/components/camel-avro/src/main/java/org/apache/camel/dataformat/avro/AvroDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-avro/src/main/java/org/apache/camel/dataformat/avro/AvroDataFormat.java
b/components/camel-avro/src/main/java/org/apache/camel/dataformat/avro/AvroDataFormat.java
index 6528dd4..51ee131 100644
--- a/components/camel-avro/src/main/java/org/apache/camel/dataformat/avro/AvroDataFormat.java
+++ b/components/camel-avro/src/main/java/org/apache/camel/dataformat/avro/AvroDataFormat.java
@@ -94,7 +94,7 @@ public class AvroDataFormat extends ServiceSupport implements DataFormat,
CamelC
         return instanceClassName;
     }
 
-    public void setInstanceClass(String className) throws Exception {
+    public void setInstanceClassName(String className) throws Exception {
         instanceClassName = className;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/fa38e09b/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java
----------------------------------------------------------------------
diff --git a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java
b/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java
index 40d9278..2744504 100644
--- a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java
+++ b/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java
@@ -16,12 +16,29 @@
  */
 package org.apache.camel.dataformat.avro;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.builder.RouteBuilder;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 public class AvroMarshalAndUnmarshalSpringTest extends AvroMarshalAndUnmarshallTest {
 
-    protected ClassPathXmlApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/avro/springDataFormat.xml");
+    private AbstractXmlApplicationContext applicationContext;
+
+    protected CamelContext createCamelContext() throws Exception {
+        applicationContext =  new ClassPathXmlApplicationContext("org/apache/camel/dataformat/avro/springDataFormat.xml");
+        return SpringCamelContext.springCamelContext(applicationContext);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+            }
+        };
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/fa38e09b/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml
----------------------------------------------------------------------
diff --git a/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml
b/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml
index b8e8400..265df72 100644
--- a/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml
+++ b/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml
@@ -24,18 +24,18 @@
 
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
         <dataFormats>
-            <avro id="avro1" instanceClass="org.apache.camel.dataformat.avro.Message"/>
+            <avro id="avro1" instanceClassName="org.apache.camel.avro.generated.Value"/>
         </dataFormats>
         <route>
             <from uri="direct:in"/>
             <marshal>
-                <avro instanceClass="org.apache.camel.dataformat.avro.Message"/>
+                <avro instanceClassName="org.apache.camel.avro.generated.Value"/>
             </marshal>
         </route>
         <route>
             <from uri="direct:back"/>
             <unmarshal>
-                <avro instanceClass="org.apache.camel.dataformat.avro.Message"/>
+                <avro instanceClassName="org.apache.camel.avro.generated.Value"/>
             </unmarshal>
             <to uri="mock:reverse"/>
         </route>
@@ -55,8 +55,8 @@
         </route>
     </camelContext>
 
-    <bean id="avro2" class="org.apache.camel.datafromat.avro.AvrofDataFormat">
-        <property name="instanceClassName" value="org.apache.camel.dataformat.avro.Message"/>
+    <bean id="avro2" class="org.apache.camel.dataformat.avro.AvroDataFormat">
+        <property name="instanceClassName" value="org.apache.camel.avro.generated.Value"/>
     </bean>
 
 </beans>


Mime
View raw message