camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [2/2] git commit: CAMEL-7466 Allow to configure flatpack from its unmarshall tag
Date Tue, 27 May 2014 07:02:38 GMT
CAMEL-7466 Allow to configure flatpack from its unmarshall tag


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

Branch: refs/heads/master
Commit: 5e52a08870fac21b06ee351327f2cd633c2858b0
Parents: bdcc16f
Author: Antoine DESSAIGNE <antoine.dessaigne@gmail.com>
Authored: Mon May 26 18:12:55 2014 +0200
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Tue May 27 15:02:15 2014 +0800

----------------------------------------------------------------------
 .../model/dataformat/FlatpackDataFormat.java    | 134 ++++++++++++++++++-
 .../flatpack/DelimitedAllowLongTest.java        |  24 +++-
 .../DelimitedAllowShortAndLongTest.java         |  24 +++-
 .../flatpack/DelimitedAllowShortTest.java       |  24 +++-
 .../flatpack/FixedLengthAllowLongTest.java      |  26 +++-
 .../FixedLengthAllowShortAndLongTest.java       |  26 +++-
 .../flatpack/FixedLengthAllowShortTest.java     |  26 +++-
 .../flatpack/DelimitedAllowLongTest-context.xml |   9 ++
 .../DelimitedAllowShortAndLongTest-context.xml  |   9 ++
 .../DelimitedAllowShortTest-context.xml         |   9 ++
 .../FixedLengthAllowLongTest-context.xml        |  69 +++++-----
 ...FixedLengthAllowShortAndLongTest-context.xml |  69 +++++-----
 .../FixedLengthAllowShortTest-context.xml       |  67 ++++++----
 13 files changed, 388 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/camel-core/src/main/java/org/apache/camel/model/dataformat/FlatpackDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/FlatpackDataFormat.java
b/camel-core/src/main/java/org/apache/camel/model/dataformat/FlatpackDataFormat.java
index 2b91204..f323349 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/FlatpackDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/FlatpackDataFormat.java
@@ -16,23 +16,145 @@
  */
 package org.apache.camel.model.dataformat;
 
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
+import javax.xml.bind.annotation.*;
+import org.apache.camel.CamelContext;
 import org.apache.camel.model.DataFormatDefinition;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.CamelContextHelper;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * Represents a <a href="http://camel.apache.org/flatpack.html">Flatpack</a>
{@link org.apache.camel.spi.DataFormat}.
- * 
- * @version 
  */
 @XmlRootElement(name = "flatpack")
 @XmlAccessorType(XmlAccessType.FIELD)
 public class FlatpackDataFormat extends DataFormatDefinition {
+    @XmlAttribute
+    private String parserFactoryRef;
+    @XmlAttribute
+    private String definition;
+    @XmlAttribute
+    private Boolean fixed;
+    @XmlAttribute
+    private Boolean ignoreFirstRecord;
+    @XmlAttribute
+    private String textQualifier;
+    @XmlAttribute
+    private String delimiter;
+    @XmlAttribute
+    private Boolean allowShortLines;
+    @XmlAttribute
+    private Boolean ignoreExtraColumns;
 
     public FlatpackDataFormat() {
         super("flatpack");
     }
 
+    public String getParserFactoryRef() {
+        return parserFactoryRef;
+    }
+
+    public void setParserFactoryRef(String parserFactoryRef) {
+        this.parserFactoryRef = parserFactoryRef;
+    }
+
+    public String getDefinition() {
+        return definition;
+    }
+
+    public void setDefinition(String definition) {
+        this.definition = definition;
+    }
+
+    public Boolean getFixed() {
+        return fixed;
+    }
+
+    public void setFixed(Boolean fixed) {
+        this.fixed = fixed;
+    }
+
+    public Boolean getIgnoreFirstRecord() {
+        return ignoreFirstRecord;
+    }
+
+    public void setIgnoreFirstRecord(Boolean ignoreFirstRecord) {
+        this.ignoreFirstRecord = ignoreFirstRecord;
+    }
+
+    public String getTextQualifier() {
+        return textQualifier;
+    }
+
+    public void setTextQualifier(String textQualifier) {
+        this.textQualifier = textQualifier;
+    }
+
+    public String getDelimiter() {
+        return delimiter;
+    }
+
+    public void setDelimiter(String delimiter) {
+        this.delimiter = delimiter;
+    }
+
+    public Boolean getAllowShortLines() {
+        return allowShortLines;
+    }
+
+    public void setAllowShortLines(Boolean allowShortLines) {
+        this.allowShortLines = allowShortLines;
+    }
+
+    public Boolean getIgnoreExtraColumns() {
+        return ignoreExtraColumns;
+    }
+
+    public void setIgnoreExtraColumns(Boolean ignoreExtraColumns) {
+        this.ignoreExtraColumns = ignoreExtraColumns;
+    }
+
+    @Override
+    protected DataFormat createDataFormat(RouteContext routeContext) {
+        DataFormat flatpack = super.createDataFormat(routeContext);
+
+        if (ObjectHelper.isNotEmpty(parserFactoryRef)) {
+            Object parserFactory = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(),
parserFactoryRef);
+            setProperty(routeContext.getCamelContext(), flatpack, "parserFactory", parserFactory);
+        }
+
+        return flatpack;
+    }
+
+    @Override
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext)
{
+        if (ObjectHelper.isNotEmpty(definition)) {
+            setProperty(camelContext, dataFormat, "definition", definition);
+        }
+        if (fixed != null) {
+            setProperty(camelContext, dataFormat, "fixed", fixed);
+        }
+        if (ignoreFirstRecord != null) {
+            setProperty(camelContext, dataFormat, "ignoreFirstRecord", ignoreFirstRecord);
+        }
+        if (ObjectHelper.isNotEmpty(textQualifier)) {
+            if (textQualifier.length() > 1) {
+                throw new IllegalArgumentException("Text qualifier must be one character
long!");
+            }
+            setProperty(camelContext, dataFormat, "textQualifier", textQualifier.charAt(0));
+        }
+        if (ObjectHelper.isNotEmpty(delimiter)) {
+            if (delimiter.length() > 1) {
+                throw new IllegalArgumentException("Delimiter must be one character long!");
+            }
+            setProperty(camelContext, dataFormat, "delimiter", delimiter.charAt(0));
+        }
+        if (allowShortLines != null) {
+            setProperty(camelContext, dataFormat, "allowShortLines", allowShortLines);
+        }
+        if (ignoreExtraColumns != null) {
+            setProperty(camelContext, dataFormat, "ignoreExtraColumns", ignoreExtraColumns);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowLongTest.java
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowLongTest.java
b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowLongTest.java
index d765236..85f680b 100644
--- a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowLongTest.java
+++ b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowLongTest.java
@@ -17,9 +17,7 @@
 
 package org.apache.camel.component.flatpack;
 
-import java.util.List;
-import java.util.Map;
-
+import java.util.*;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -31,8 +29,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 
 @ContextConfiguration
 public class DelimitedAllowLongTest extends AbstractJUnit4SpringContextTests {
@@ -44,6 +41,9 @@ public class DelimitedAllowLongTest extends AbstractJUnit4SpringContextTests
{
     @EndpointInject(uri = "mock:results-df")
     protected MockEndpoint resultsdf;
 
+    @EndpointInject(uri = "mock:results-xml")
+    protected MockEndpoint resultsxml;
+
     protected String[] expectedItemDescriptions = {"SOME VALVE", "AN ENGINE", "A BELT", "A
BOLT"};
 
     @Test
@@ -77,4 +77,18 @@ public class DelimitedAllowLongTest extends AbstractJUnit4SpringContextTests
{
             counter++;
         }
     }
+
+    @Test
+    public void testFlatpackDataFormatXML() throws Exception {
+        resultsxml.expectedMessageCount(1);
+        resultsxml.assertIsSatisfied();
+
+        Exchange exchange = resultsxml.getReceivedExchanges().get(0);
+        DataSetList data = exchange.getIn().getBody(DataSetList.class);
+        int counter = 0;
+        for (Map<String, Object> map : data) {
+            assertEquals("ITEM_DESC", expectedItemDescriptions[counter], map.get("ITEM_DESC"));
+            counter++;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest.java
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest.java
b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest.java
index 3abf417..7dacf23 100644
--- a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest.java
+++ b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest.java
@@ -17,9 +17,7 @@
 
 package org.apache.camel.component.flatpack;
 
-import java.util.List;
-import java.util.Map;
-
+import java.util.*;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -31,8 +29,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 
 @ContextConfiguration
 public class DelimitedAllowShortAndLongTest extends AbstractJUnit4SpringContextTests {
@@ -44,6 +41,9 @@ public class DelimitedAllowShortAndLongTest extends AbstractJUnit4SpringContextT
     @EndpointInject(uri = "mock:results-df")
     protected MockEndpoint resultsdf;
 
+    @EndpointInject(uri = "mock:results-xml")
+    protected MockEndpoint resultsxml;
+
     protected String[] expectedItemDescriptions = {"SOME VALVE", "AN ENGINE", "A BELT", "A
BOLT"};
 
     @Test
@@ -77,4 +77,18 @@ public class DelimitedAllowShortAndLongTest extends AbstractJUnit4SpringContextT
             counter++;
         }
     }
+
+    @Test
+    public void testFlatpackDataFormatXML() throws Exception {
+        resultsxml.expectedMessageCount(1);
+        resultsxml.assertIsSatisfied();
+
+        Exchange exchange = resultsxml.getReceivedExchanges().get(0);
+        DataSetList data = exchange.getIn().getBody(DataSetList.class);
+        int counter = 0;
+        for (Map<String, Object> map : data) {
+            assertEquals("ITEM_DESC", expectedItemDescriptions[counter], map.get("ITEM_DESC"));
+            counter++;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortTest.java
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortTest.java
b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortTest.java
index 211c4df..7334440 100644
--- a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortTest.java
+++ b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/DelimitedAllowShortTest.java
@@ -17,9 +17,7 @@
 
 package org.apache.camel.component.flatpack;
 
-import java.util.List;
-import java.util.Map;
-
+import java.util.*;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -31,8 +29,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 
 @ContextConfiguration
 public class DelimitedAllowShortTest extends AbstractJUnit4SpringContextTests {
@@ -44,6 +41,9 @@ public class DelimitedAllowShortTest extends AbstractJUnit4SpringContextTests
{
     @EndpointInject(uri = "mock:results-df")
     protected MockEndpoint resultsdf;
 
+    @EndpointInject(uri = "mock:results-xml")
+    protected MockEndpoint resultsxml;
+
     protected String[] expectedItemDescriptions = {"SOME VALVE", "AN ENGINE", "A BELT", "A
BOLT"};
 
     @Test
@@ -77,4 +77,18 @@ public class DelimitedAllowShortTest extends AbstractJUnit4SpringContextTests
{
             counter++;
         }
     }
+
+    @Test
+    public void testFlatpackDataFormatXML() throws Exception {
+        resultsxml.expectedMessageCount(1);
+        resultsxml.assertIsSatisfied();
+
+        Exchange exchange = resultsxml.getReceivedExchanges().get(0);
+        DataSetList data = exchange.getIn().getBody(DataSetList.class);
+        int counter = 0;
+        for (Map<String, Object> map : data) {
+            assertEquals("ITEM_DESC", expectedItemDescriptions[counter], map.get("ITEM_DESC"));
+            counter++;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowLongTest.java
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowLongTest.java
b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowLongTest.java
index 85ac73e..4d0a367 100644
--- a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowLongTest.java
+++ b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowLongTest.java
@@ -16,9 +16,7 @@
  */
 package org.apache.camel.component.flatpack;
 
-import java.util.List;
-import java.util.Map;
-
+import java.util.*;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -30,11 +28,10 @@ import org.slf4j.LoggerFactory;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 
 /**
- * @version 
+ * @version
  */
 @ContextConfiguration
 public class FixedLengthAllowLongTest extends AbstractJUnit4SpringContextTests {
@@ -46,6 +43,9 @@ public class FixedLengthAllowLongTest extends AbstractJUnit4SpringContextTests
{
     @EndpointInject(uri = "mock:results-df")
     protected MockEndpoint resultsdf;
 
+    @EndpointInject(uri = "mock:results-xml")
+    protected MockEndpoint resultsxml;
+
     protected String[] expectedFirstName = {"JOHN-LONG", "JIMMY-LONG", "JANE-LONG", "FRED-LONG"};
 
     @Test
@@ -79,4 +79,18 @@ public class FixedLengthAllowLongTest extends AbstractJUnit4SpringContextTests
{
             counter++;
         }
     }
+
+    @Test
+    public void testFlatpackDataFormatXML() throws Exception {
+        resultsxml.expectedMessageCount(1);
+        resultsxml.assertIsSatisfied();
+
+        Exchange exchange = resultsxml.getReceivedExchanges().get(0);
+        DataSetList data = exchange.getIn().getBody(DataSetList.class);
+        int counter = 0;
+        for (Map<String, Object> map : data) {
+            assertEquals("FIRSTNAME", expectedFirstName[counter], map.get("FIRSTNAME"));
+            counter++;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest.java
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest.java
b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest.java
index 8eb330d..637187a 100644
--- a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest.java
+++ b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest.java
@@ -16,9 +16,7 @@
  */
 package org.apache.camel.component.flatpack;
 
-import java.util.List;
-import java.util.Map;
-
+import java.util.*;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -30,11 +28,10 @@ import org.slf4j.LoggerFactory;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 
 /**
- * @version 
+ * @version
  */
 @ContextConfiguration
 public class FixedLengthAllowShortAndLongTest extends AbstractJUnit4SpringContextTests {
@@ -46,6 +43,9 @@ public class FixedLengthAllowShortAndLongTest extends AbstractJUnit4SpringContex
     @EndpointInject(uri = "mock:results-df")
     protected MockEndpoint resultsdf;
 
+    @EndpointInject(uri = "mock:results-xml")
+    protected MockEndpoint resultsxml;
+
     protected String[] expectedFirstName = {"JOHN-LONG", "JIMMY-SHORT", "JANE-LONG", "FRED-NORMAL"};
 
     @Test
@@ -79,4 +79,18 @@ public class FixedLengthAllowShortAndLongTest extends AbstractJUnit4SpringContex
             counter++;
         }
     }
+
+    @Test
+    public void testFlatpackDataFormatXML() throws Exception {
+        resultsxml.expectedMessageCount(1);
+        resultsxml.assertIsSatisfied();
+
+        Exchange exchange = resultsxml.getReceivedExchanges().get(0);
+        DataSetList data = exchange.getIn().getBody(DataSetList.class);
+        int counter = 0;
+        for (Map<String, Object> map : data) {
+            assertEquals("FIRSTNAME", expectedFirstName[counter], map.get("FIRSTNAME"));
+            counter++;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortTest.java
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortTest.java
b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortTest.java
index d6025b9..102ba14 100644
--- a/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortTest.java
+++ b/components/camel-flatpack/src/test/java/org/apache/camel/component/flatpack/FixedLengthAllowShortTest.java
@@ -16,9 +16,7 @@
  */
 package org.apache.camel.component.flatpack;
 
-import java.util.List;
-import java.util.Map;
-
+import java.util.*;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -30,11 +28,10 @@ import org.slf4j.LoggerFactory;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 
 /**
- * @version 
+ * @version
  */
 @ContextConfiguration
 public class FixedLengthAllowShortTest extends AbstractJUnit4SpringContextTests {
@@ -46,6 +43,9 @@ public class FixedLengthAllowShortTest extends AbstractJUnit4SpringContextTests
     @EndpointInject(uri = "mock:results-df")
     protected MockEndpoint resultsdf;
 
+    @EndpointInject(uri = "mock:results-xml")
+    protected MockEndpoint resultsxml;
+
     protected String[] expectedFirstName = {"JOHN-SHORT", "JIMMY-SHORT", "JANE-SHORT", "FRED-SHORT"};
 
     @Test
@@ -79,4 +79,18 @@ public class FixedLengthAllowShortTest extends AbstractJUnit4SpringContextTests
             counter++;
         }
     }
+
+    @Test
+    public void testFlatpackDataFormatXML() throws Exception {
+        resultsxml.expectedMessageCount(1);
+        resultsxml.assertIsSatisfied();
+
+        Exchange exchange = resultsxml.getReceivedExchanges().get(0);
+        DataSetList data = exchange.getIn().getBody(DataSetList.class);
+        int counter = 0;
+        for (Map<String, Object> map : data) {
+            assertEquals("FIRSTNAME", expectedFirstName[counter], map.get("FIRSTNAME"));
+            counter++;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowLongTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowLongTest-context.xml
b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowLongTest-context.xml
index cebe2c5..6ecc13b 100644
--- a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowLongTest-context.xml
+++ b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowLongTest-context.xml
@@ -33,6 +33,7 @@
             <multicast>
                 <to uri="flatpack:delim:INVENTORY-Delimited.pzmap.xml?ignoreExtraColumns=true"/>
                 <to uri="direct:df"/>
+                <to uri="direct:xml"/>
             </multicast>
         </route>
 
@@ -48,6 +49,14 @@
             <to uri="mock:results-df"/>
         </route>
 
+        <route>
+            <from uri="direct:xml"/>
+            <unmarshal>
+                <flatpack definition="INVENTORY-Delimited.pzmap.xml" fixed="false" ignoreExtraColumns="true"/>
+            </unmarshal>
+            <to uri="mock:results-xml"/>
+        </route>
+
     </camelContext>
 
 </beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest-context.xml
b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest-context.xml
index c5c95fa..4de44be 100644
--- a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest-context.xml
+++ b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortAndLongTest-context.xml
@@ -34,6 +34,7 @@
             <multicast>
                 <to uri="flatpack:delim:INVENTORY-Delimited.pzmap.xml?ignoreExtraColumns=true&amp;allowShortLines=true"/>
                 <to uri="direct:df"/>
+                <to uri="direct:xml"/>
             </multicast>
         </route>
 
@@ -49,6 +50,14 @@
             <to uri="mock:results-df"/>
         </route>
 
+        <route>
+            <from uri="direct:xml"/>
+            <unmarshal>
+                <flatpack definition="INVENTORY-Delimited.pzmap.xml" fixed="false" ignoreExtraColumns="true"
allowShortLines="true"/>
+            </unmarshal>
+            <to uri="mock:results-xml"/>
+        </route>
+
     </camelContext>
 
 </beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortTest-context.xml
b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortTest-context.xml
index dee941e..ff884b4 100644
--- a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortTest-context.xml
+++ b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/DelimitedAllowShortTest-context.xml
@@ -33,6 +33,7 @@
             <multicast>
                 <to uri="flatpack:delim:INVENTORY-Delimited.pzmap.xml?allowShortLines=true"/>
                 <to uri="direct:df"/>
+                <to uri="direct:xml"/>
             </multicast>
         </route>
 
@@ -48,6 +49,14 @@
             <to uri="mock:results-df"/>
         </route>
 
+        <route>
+            <from uri="direct:xml"/>
+            <unmarshal>
+                <flatpack definition="INVENTORY-Delimited.pzmap.xml" fixed="false" allowShortLines="true"/>
+            </unmarshal>
+            <to uri="mock:results-xml"/>
+        </route>
+
     </camelContext>
 
 </beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowLongTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowLongTest-context.xml
b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowLongTest-context.xml
index 96fd778..39cbb2d 100644
--- a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowLongTest-context.xml
+++ b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowLongTest-context.xml
@@ -22,35 +22,44 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <bean id="df" class="org.apache.camel.component.flatpack.FlatpackDataFormat">
-    <property name="definition" value="PEOPLE-FixedLength.pzmap.xml"/>
-    <property name="fixed" value="true"/>
-    <property name="ignoreExtraColumns" value="true"/>
-  </bean>
-
-  <!-- START SNIPPET: example -->
-  <camelContext xmlns="http://camel.apache.org/schema/spring">
-    <route>
-      <from uri="file://src/test/data/fixedLong?noop=true"/>
-      <multicast>
-          <to uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?ignoreExtraColumns=true"/>
-          <to uri="direct:df"/>
-      </multicast>
-    </route>
-
-    <route>
-      <from uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?ignoreExtraColumns=true"/>
-      <convertBodyTo type="java.util.Map"/>
-      <to uri="mock:results"/>
-    </route>
-
-    <route>
-      <from uri="direct:df"/>
-      <unmarshal ref="df"/>
-      <to uri="mock:results-df"/>
-    </route>
-
-  </camelContext>
-  <!-- END SNIPPET: example -->
+    <bean id="df" class="org.apache.camel.component.flatpack.FlatpackDataFormat">
+        <property name="definition" value="PEOPLE-FixedLength.pzmap.xml"/>
+        <property name="fixed" value="true"/>
+        <property name="ignoreExtraColumns" value="true"/>
+    </bean>
+
+    <!-- START SNIPPET: example -->
+    <camelContext xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="file://src/test/data/fixedLong?noop=true"/>
+            <multicast>
+                <to uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?ignoreExtraColumns=true"/>
+                <to uri="direct:df"/>
+                <to uri="direct:xml"/>
+            </multicast>
+        </route>
+
+        <route>
+            <from uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?ignoreExtraColumns=true"/>
+            <convertBodyTo type="java.util.Map"/>
+            <to uri="mock:results"/>
+        </route>
+
+        <route>
+            <from uri="direct:df"/>
+            <unmarshal ref="df"/>
+            <to uri="mock:results-df"/>
+        </route>
+
+        <route>
+            <from uri="direct:xml"/>
+            <unmarshal>
+                <flatpack definition="PEOPLE-FixedLength.pzmap.xml" fixed="true" ignoreExtraColumns="true"/>
+            </unmarshal>
+            <to uri="mock:results-xml"/>
+        </route>
+
+    </camelContext>
+    <!-- END SNIPPET: example -->
 
 </beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest-context.xml
b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest-context.xml
index ab8e449..06f4882 100644
--- a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest-context.xml
+++ b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortAndLongTest-context.xml
@@ -22,35 +22,44 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <bean id="df" class="org.apache.camel.component.flatpack.FlatpackDataFormat">
-    <property name="definition" value="PEOPLE-FixedLength.pzmap.xml"/>
-    <property name="fixed" value="true"/>
-    <property name="ignoreExtraColumns" value="true"/>
-    <property name="allowShortLines" value="true"/>
-  </bean>
-
-  <!-- START SNIPPET: example -->
-  <camelContext xmlns="http://camel.apache.org/schema/spring">
-    <route>
-      <from uri="file://src/test/data/fixedMixed?noop=true"/>
-      <multicast>
-        <to uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?ignoreExtraColumns=true&amp;allowShortLines=true"/>
-        <to uri="direct:df"/>
-      </multicast>
-    </route>
-
-    <route>
-      <from uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?ignoreExtraColumns=true&amp;allowShortLines=true"/>
-      <convertBodyTo type="java.util.Map"/>
-      <to uri="mock:results"/>
-    </route>
-
-    <route>
-      <from uri="direct:df"/>
-      <unmarshal ref="df"/>
-      <to uri="mock:results-df"/>
-    </route>
-  </camelContext>
-  <!-- END SNIPPET: example -->
+    <bean id="df" class="org.apache.camel.component.flatpack.FlatpackDataFormat">
+        <property name="definition" value="PEOPLE-FixedLength.pzmap.xml"/>
+        <property name="fixed" value="true"/>
+        <property name="ignoreExtraColumns" value="true"/>
+        <property name="allowShortLines" value="true"/>
+    </bean>
+
+    <!-- START SNIPPET: example -->
+    <camelContext xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="file://src/test/data/fixedMixed?noop=true"/>
+            <multicast>
+                <to uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?ignoreExtraColumns=true&amp;allowShortLines=true"/>
+                <to uri="direct:df"/>
+                <to uri="direct:xml"/>
+            </multicast>
+        </route>
+
+        <route>
+            <from uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?ignoreExtraColumns=true&amp;allowShortLines=true"/>
+            <convertBodyTo type="java.util.Map"/>
+            <to uri="mock:results"/>
+        </route>
+
+        <route>
+            <from uri="direct:df"/>
+            <unmarshal ref="df"/>
+            <to uri="mock:results-df"/>
+        </route>
+
+        <route>
+            <from uri="direct:xml"/>
+            <unmarshal>
+                <flatpack definition="PEOPLE-FixedLength.pzmap.xml" fixed="true" ignoreExtraColumns="true"
allowShortLines="true"/>
+            </unmarshal>
+            <to uri="mock:results-xml"/>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: example -->
 
 </beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/5e52a088/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortTest-context.xml
b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortTest-context.xml
index bce143e..5a27558 100644
--- a/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortTest-context.xml
+++ b/components/camel-flatpack/src/test/resources/org/apache/camel/component/flatpack/FixedLengthAllowShortTest-context.xml
@@ -22,34 +22,43 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <bean id="df" class="org.apache.camel.component.flatpack.FlatpackDataFormat">
-    <property name="definition" value="PEOPLE-FixedLength.pzmap.xml"/>
-    <property name="fixed" value="true"/>
-    <property name="allowShortLines" value="true"/>
-  </bean>
-
-  <!-- START SNIPPET: example -->
-  <camelContext xmlns="http://camel.apache.org/schema/spring" trace="true">
-    <route>
-      <from uri="file://src/test/data/fixedShort?noop=true"/>
-      <multicast>
-        <to uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?allowShortLines=true"/>
-        <to uri="direct:df"/>
-      </multicast>
-    </route>
-
-    <route>
-      <from uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?allowShortLines=true"/>
-      <convertBodyTo type="java.util.Map"/>
-      <to uri="mock:results"/>
-    </route>
-
-    <route>
-      <from uri="direct:df"/>
-      <unmarshal ref="df"/>
-      <to uri="mock:results-df"/>
-    </route>
-  </camelContext>
-  <!-- END SNIPPET: example -->
+    <bean id="df" class="org.apache.camel.component.flatpack.FlatpackDataFormat">
+        <property name="definition" value="PEOPLE-FixedLength.pzmap.xml"/>
+        <property name="fixed" value="true"/>
+        <property name="allowShortLines" value="true"/>
+    </bean>
+
+    <!-- START SNIPPET: example -->
+    <camelContext xmlns="http://camel.apache.org/schema/spring" trace="true">
+        <route>
+            <from uri="file://src/test/data/fixedShort?noop=true"/>
+            <multicast>
+                <to uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?allowShortLines=true"/>
+                <to uri="direct:df"/>
+                <to uri="direct:xml"/>
+            </multicast>
+        </route>
+
+        <route>
+            <from uri="flatpack:fixed:PEOPLE-FixedLength.pzmap.xml?allowShortLines=true"/>
+            <convertBodyTo type="java.util.Map"/>
+            <to uri="mock:results"/>
+        </route>
+
+        <route>
+            <from uri="direct:df"/>
+            <unmarshal ref="df"/>
+            <to uri="mock:results-df"/>
+        </route>
+
+        <route>
+            <from uri="direct:xml"/>
+            <unmarshal>
+                <flatpack definition="PEOPLE-FixedLength.pzmap.xml" fixed="true" allowShortLines="true"/>
+            </unmarshal>
+            <to uri="mock:results-xml"/>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: example -->
 
 </beans>
\ No newline at end of file


Mime
View raw message