camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r790882 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/model/dataformat/ camel-core/src/main/resources/org/apache/camel/model/dataformat/ components/camel-bindy/src/main/java/...
Date Fri, 03 Jul 2009 12:06:39 GMT
Author: davsclaus
Date: Fri Jul  3 12:06:38 2009
New Revision: 790882

URL: http://svn.apache.org/viewvc?rev=790882&view=rev
Log:
CAMEL-1792: added bindy to dataformat DSL.

Added:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
      - copied, changed from r790848, camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/StringDataFormat.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyType.java
  (with props)
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
      - copied, changed from r790848, camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest.java
      - copied, changed from r790848, camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java
      - copied, changed from r790848, camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
      - copied, changed from r790848, camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
    camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java?rev=790882&r1=790881&r2=790882&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java Fri
Jul  3 12:06:38 2009
@@ -24,6 +24,8 @@
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.model.dataformat.ArtixDSContentType;
 import org.apache.camel.model.dataformat.ArtixDSDataFormat;
+import org.apache.camel.model.dataformat.BindyDataFormat;
+import org.apache.camel.model.dataformat.BindyType;
 import org.apache.camel.model.dataformat.CsvDataFormat;
 import org.apache.camel.model.dataformat.GzipDataFormat;
 import org.apache.camel.model.dataformat.HL7DataFormat;
@@ -102,6 +104,19 @@
     }
 
     /**
+     * Uses the Bindy data format
+     *
+     * @param type the type of bindy data format to use
+     * @param packages packages to scan for Bindy annotated POJO classes
+     */
+    public T bindy(BindyType type,  String... packages) {
+        BindyDataFormat bindy = new BindyDataFormat();
+        bindy.setType(type);
+        bindy.setPackages(packages);
+        return dataFormat(bindy);
+    }
+
+    /**
      * Uses the CSV data format
      */
     public T csv() {

Copied: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
(from r790848, camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/StringDataFormat.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/StringDataFormat.java&r1=790848&r2=790882&rev=790882&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/StringDataFormat.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
Fri Jul  3 12:06:38 2009
@@ -26,28 +26,41 @@
 import org.apache.camel.spi.RouteContext;
 
 /**
- * Represents the String (text based) {@link DataFormat}
+ * Represents the Bindy {@link org.apache.camel.spi.DataFormat}
  *
  * @version $Revision$
  */
-@XmlRootElement(name = "string")
+@XmlRootElement(name = "bindy")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class StringDataFormat extends DataFormatDefinition {
+public class BindyDataFormat extends DataFormatDefinition {
 
-    @XmlAttribute(required = false)
-    private String charset;
+    @XmlAttribute(required = true)
+    private BindyType type;
 
-    @Override
-    protected DataFormat createDataFormat(RouteContext routeContext) {
-        return new org.apache.camel.impl.StringDataFormat(charset);
+    @XmlAttribute(required = true)
+    private String[] packages;
+
+    public void setPackages(String[] packages) {
+        this.packages = packages;
+    }
+
+    public void setType(BindyType type) {
+        this.type = type;
     }
 
-    public String getCharset() {
-        return charset;
+    protected DataFormat createDataFormat(RouteContext routeContext) {
+        if (type == BindyType.Csv) {
+            setProperty(this, "dataFormatName", "org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat");
+        } else {
+            setProperty(this, "dataFormatName", "org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat");
+        }
+        return super.createDataFormat(routeContext);
     }
 
-    public void setCharset(String charset) {
-        this.charset = charset;
+
+    @Override
+    protected void configureDataFormat(DataFormat dataFormat) {
+        setProperty(dataFormat, "packages", packages);
     }
 
-}
+}
\ No newline at end of file

Added: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyType.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyType.java?rev=790882&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyType.java
(added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyType.java
Fri Jul  3 12:06:38 2009
@@ -0,0 +1,16 @@
+package org.apache.camel.model.dataformat;
+
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ * Represents the different types of bindy data formats.
+ *
+ * @version $Revision$
+ */
+@XmlType
+@XmlEnum(String.class)
+public enum BindyType {
+
+    Csv, KeyValue
+}

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java?rev=790882&r1=790881&r2=790882&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
Fri Jul  3 12:06:38 2009
@@ -38,13 +38,15 @@
     // cannot use @XmlElementRef as it doesn't allow optional properties
     @XmlElements({
         @XmlElement(required = false, name = "artixDS", type = ArtixDSDataFormat.class),
-        @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),   
-        @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
+        @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
+        @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
         @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class),
+        @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class),
         @XmlElement(required = false, name = "hl7", type = HL7DataFormat.class),
         @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
         @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
         @XmlElement(required = false, name = "rss", type = RssDataFormat.class),
+        @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
         @XmlElement(required = false, name = "serialization", type = SerializationDataFormat.class),
         @XmlElement(required = false, name = "string", type = StringDataFormat.class),
         @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
       

Modified: camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index?rev=790882&r1=790881&r2=790882&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index
(original)
+++ camel/trunk/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index
Fri Jul  3 12:06:38 2009
@@ -16,6 +16,8 @@
 ## ------------------------------------------------------------------------
 ArtixDSContentType
 ArtixDSDataFormat
+BindyDataFormat
+BindyType
 CsvDataFormat
 DataFormatsDefinition
 FlatpackDataFormat
@@ -23,6 +25,7 @@
 HL7DataFormat
 JaxbDataFormat
 JsonDataFormat
+JsonLibrary
 RssDataFormat
 SerializationDataFormat
 StringDataFormat

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java?rev=790882&r1=790881&r2=790882&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
(original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
Fri Jul  3 12:06:38 2009
@@ -41,14 +41,14 @@
 public class BindyCsvDataFormat implements DataFormat {
     private static final transient Log LOG = LogFactory.getLog(BindyCsvDataFormat.class);
     
-    private String[] packageName;
+    private String[] packages;
     private BindyCsvFactory modelFactory;
 
     public BindyCsvDataFormat() {
     }
 
-    public BindyCsvDataFormat(String... packageName) {
-        this.packageName = packageName;
+    public BindyCsvDataFormat(String... packages) {
+        this.packages = packages;
     }
 
     @SuppressWarnings("unchecked")
@@ -150,7 +150,7 @@
      */
     public BindyCsvFactory getFactory(PackageScanClassResolver resolver) throws Exception
{
         if (modelFactory == null) {
-            modelFactory = new BindyCsvFactory(resolver, packageName);
+            modelFactory = new BindyCsvFactory(resolver, packages);
         }
         return modelFactory;
     }
@@ -159,12 +159,12 @@
         this.modelFactory = modelFactory;
     }
 
-    public String[] getPackageName() {
-        return packageName;
+    public String[] getPackages() {
+        return packages;
     }
 
-    public void setPackageName(String[] packageName) {
-        this.packageName = packageName;
+    public void setPackages(String[] packages) {
+        this.packages = packages;
     }
 
 }

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java?rev=790882&r1=790881&r2=790882&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
(original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
Fri Jul  3 12:06:38 2009
@@ -26,7 +26,6 @@
 import java.util.Scanner;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.dataformat.bindy.BindyCsvFactory;
 import org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory;
 import org.apache.camel.dataformat.bindy.util.Converter;
 import org.apache.camel.spi.DataFormat;
@@ -43,14 +42,14 @@
     
     private static final transient Log LOG = LogFactory.getLog(BindyKeyValuePairDataFormat.class);
     
-    private String[] packageNames;
+    private String[] packages;
     private BindyKeyValuePairFactory modelFactory;
 
     public BindyKeyValuePairDataFormat() {
     }
 
-    public BindyKeyValuePairDataFormat(String... packageNames) {
-        this.packageNames = packageNames;
+    public BindyKeyValuePairDataFormat(String... packages) {
+        this.packages = packages;
     }
 
     @SuppressWarnings("unchecked")
@@ -142,7 +141,7 @@
      */
     public BindyKeyValuePairFactory getFactory(PackageScanClassResolver resolver) throws
Exception {
         if (modelFactory == null) {
-            modelFactory = new BindyKeyValuePairFactory(resolver, this.packageNames);
+            modelFactory = new BindyKeyValuePairFactory(resolver, this.packages);
         }
         return modelFactory;
     }
@@ -151,12 +150,12 @@
         this.modelFactory = modelFactory;
     }
 
-    public String[] getPackageNames() {
-        return packageNames;
+    public String[] getPackages() {
+        return packages;
     }
 
-    public void setPackageNames(String... packageNames) {
-        this.packageNames = packageNames;
+    public void setPackages(String... packages) {
+        this.packages = packages;
     }
 
 }

Copied: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
(from r790848, camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java?p2=camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java&p1=camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java&r1=790848&r2=790882&rev=790882&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
(original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
Fri Jul  3 12:06:38 2009
@@ -30,6 +30,7 @@
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.bindy.model.simple.oneclass.Order;
+import org.apache.camel.model.dataformat.BindyType;
 import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
 import org.junit.Test;
 import org.springframework.config.java.annotation.Bean;
@@ -39,7 +40,7 @@
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
 @ContextConfiguration(locations = "org.apache.camel.dataformat.bindy.csv.BindySimpleCsvMarshallTest$ContextConfig",
loader = JavaConfigContextLoader.class)
-public class BindySimpleCsvMarshallTest extends AbstractJUnit4SpringContextTests {
+public class BindySimpleCsvMarshallDslTest extends AbstractJUnit4SpringContextTests {
 
     private List<Map<String, Object>> models = new ArrayList<Map<String,
Object>>();
     private String result = "1,B2,Keira,Knightley,ISIN,XX23456789,BUY,Share,450.45,EUR,14-01-2009\r\n";
@@ -87,18 +88,18 @@
 
     @Configuration
     public static class ContextConfig extends SingleRouteCamelConfiguration {
-        BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
-
         @Override
         @Bean
         public RouteBuilder route() {
             return new RouteBuilder() {
                 @Override
                 public void configure() {
-                    from("direct:start").marshal(camelDataFormat).to("mock:result");
+                    from("direct:start")
+                        .marshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.model.simple.oneclass")
+                        .to("mock:result");
                 }
             };
         }
     }
 
-}
+}
\ No newline at end of file

Copied: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest.java
(from r790848, camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest.java?p2=camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest.java&p1=camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java&r1=790848&r2=790882&rev=790882&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
(original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest.java
Fri Jul  3 12:06:38 2009
@@ -17,6 +17,7 @@
 package org.apache.camel.dataformat.bindy.csv;
 
 import org.apache.camel.EndpointInject;
+import org.apache.camel.model.dataformat.BindyType;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
@@ -28,7 +29,7 @@
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
 @ContextConfiguration(locations = "org.apache.camel.dataformat.bindy.csv.BindySimpleCsvUnmarshallTest$ContextConfig",
loader = JavaConfigContextLoader.class)
-public class BindySimpleCsvUnmarshallTest extends AbstractJUnit4SpringContextTests {
+public class BindySimpleCsvUnmarshallDslTest extends AbstractJUnit4SpringContextTests {
 
     @EndpointInject(uri = "mock:result")
     private MockEndpoint resultEndpoint;
@@ -41,17 +42,17 @@
 
     @Configuration
     public static class ContextConfig extends SingleRouteCamelConfiguration {
-        BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
-
         @Override
         @Bean
         public RouteBuilder route() {
             return new RouteBuilder() {
                 @Override
                 public void configure() {
-                    from("file://src/test/data?noop=true").unmarshal(camelDataFormat).to("mock:result");
+                    from("file://src/test/data?noop=true")
+                        .unmarshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.model.simple.oneclass")
+                        .to("mock:result");
                 }
             };
         }
     }
-}
+}
\ No newline at end of file

Copied: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java
(from r790848, camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java?p2=camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java&p1=camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java&r1=790848&r2=790882&rev=790882&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java
(original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java
Fri Jul  3 12:06:38 2009
@@ -24,9 +24,9 @@
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.model.dataformat.BindyType;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
 import org.apache.camel.dataformat.bindy.model.fix.simple.Header;
 import org.apache.camel.dataformat.bindy.model.fix.simple.Order;
 import org.apache.camel.dataformat.bindy.model.fix.simple.Trailer;
@@ -39,7 +39,7 @@
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
 @ContextConfiguration(locations = "org.apache.camel.dataformat.bindy.fix.BindySimpleKeyValuePairMarshallTest$ContextConfig",
loader = JavaConfigContextLoader.class)
-public class BindySimpleKeyValuePairMarshallTest extends AbstractJUnit4SpringContextTests
{
+public class BindySimpleKeyValuePairMarshallDslTest extends AbstractJUnit4SpringContextTests
{
 
     private List<Map<String, Object>> models = new ArrayList<Map<String,
Object>>();
     private String result = "1=BE.CHM.0018=FIX 4.19=2010=22011=CHM0001-0122=434=135=048=BE000124567849=INVMGR54=156=BRKR58=this
is a camel - bindy test\r\n";
@@ -68,10 +68,10 @@
         header.setMsgType("0");
         header.setSendCompId("INVMGR");
         header.setTargetCompId("BRKR");
-        
+
         Trailer trailer = new Trailer();
-        trailer.setCheckSum(220); 
-        
+        trailer.setCheckSum(220);
+
         Order order = new Order();
         order.setAccount("BE.CHM.001");
         order.setClOrdId("CHM0001-01");
@@ -79,31 +79,31 @@
         order.setSecurityId("BE0001245678");
         order.setSide("1");
         order.setText("this is a camel - bindy test");
-        
+
         order.setHeader(header);
         order.setTrailer(trailer);
-        
+
         modelObjects.put(order.getClass().getName(), order);
         modelObjects.put(header.getClass().getName(), header);
         modelObjects.put(trailer.getClass().getName(), trailer);
- 
+
         models.add(modelObjects);
         return models;
     }
 
     @Configuration
     public static class ContextConfig extends SingleRouteCamelConfiguration {
-        BindyKeyValuePairDataFormat camelDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.simple");
-
         @Override
         @Bean
         public RouteBuilder route() {
             return new RouteBuilder() {
                 @Override
                 public void configure() {
-                    from("direct:start").marshal(camelDataFormat).to("mock:result");
+                    from("direct:start")
+                        .marshal().bindy(BindyType.KeyValue, "org.apache.camel.dataformat.bindy.model.fix.simple")
+                        .to("mock:result");
                 }
             };
         }
     }
-}
+}
\ No newline at end of file

Copied: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
(from r790848, camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java?p2=camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java&p1=camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java&r1=790848&r2=790882&rev=790882&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
(original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
Fri Jul  3 12:06:38 2009
@@ -17,6 +17,7 @@
 package org.apache.camel.dataformat.bindy.fix;
 
 import org.apache.camel.EndpointInject;
+import org.apache.camel.model.dataformat.BindyType;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
@@ -29,7 +30,7 @@
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
 @ContextConfiguration(locations = "org.apache.camel.dataformat.bindy.fix.BindySimpleKeyValuePairUnmarshallTest$ContextConfig",
loader = JavaConfigContextLoader.class)
-public class BindySimpleKeyValuePairUnmarshallTest extends AbstractJUnit4SpringContextTests
{
+public class BindySimpleKeyValuePairUnmarshallDslTest extends AbstractJUnit4SpringContextTests
{
 
     @EndpointInject(uri = "mock:result")
     private MockEndpoint resultEndpoint;
@@ -42,18 +43,18 @@
 
     @Configuration
     public static class ContextConfig extends SingleRouteCamelConfiguration {
-        BindyKeyValuePairDataFormat camelDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.simple");
-
         @Override
         @Bean
         public RouteBuilder route() {
             return new RouteBuilder() {
                 @Override
                 public void configure() {
-                    from("file://src/test/data/fix?noop=true").unmarshal(camelDataFormat).to("mock:result");
+                    from("file://src/test/data/fix?noop=true")
+                        .unmarshal().bindy(BindyType.KeyValue, "org.apache.camel.dataformat.bindy.model.fix.simple")
+                        .to("mock:result");
                 }
             };
         }
     }
 
-}
+}
\ No newline at end of file



Mime
View raw message