camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [06/12] camel git commit: CAMEL-5958: Bindy ignores bean class type
Date Fri, 07 Aug 2015 09:14:32 GMT
CAMEL-5958: Bindy ignores bean class type


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

Branch: refs/heads/master
Commit: b0e76edce376aa7b1379ffd4636a51c548dd41a0
Parents: 355becb
Author: lburgazzoli <lburgazzoli@gmail.com>
Authored: Wed Dec 18 16:57:51 2013 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Aug 7 11:05:47 2015 +0200

----------------------------------------------------------------------
 .../dataformat/bindy/BindyFixedLengthFactory.java  | 14 ++------------
 .../bindy/fixed/BindyFixedLengthDataFormat.java    |  4 ++--
 .../bindy/csv/BindyTabSeparatorTest.java           | 17 ++++++-----------
 3 files changed, 10 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b0e76edc/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
index 08ca7b9..920d9e6 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
@@ -81,24 +81,14 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements
Bin
      * bind the data. This process will scan for classes according to the
      * package name provided, check the annotated classes and fields
      */
-    public void initFixedLengthModel() throws Exception {
-
+    public void initFixedLengthModel() throws Exception {      
+        
         // Find annotated fields declared in the Model classes
         initAnnotatedFields();
 
         // initialize Fixed length parameter(s)
         // from @FixedLengthrecord annotation
         initFixedLengthRecordParameters();
-        
-        if(header != void.class) {
-            models.add(header);
-            modelClassNames.add(header.getName());
-        }
-        
-        if(footer != void.class) {
-            models.add(footer);
-            modelClassNames.add(footer.getName());
-        }
     }
 
     public void initAnnotatedFields() {

http://git-wip-us.apache.org/repos/asf/camel/blob/b0e76edc/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
index 9d19874..8194612 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
@@ -265,12 +265,12 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat
{
         
         // Optionally initialize the header factory... using header model classes
         if (factory.hasHeader()) {
-            this.headerFactory = new BindyFixedLengthFactory(getClassType());
+            this.headerFactory = new BindyFixedLengthFactory(factory.header());
         }
         
         // Optionally initialize the footer factory... using footer model classes
         if (factory.hasFooter()) {
-            this.footerFactory = new BindyFixedLengthFactory(getClassType());
+            this.footerFactory = new BindyFixedLengthFactory(factory.footer());
         }
         
         return factory;

http://git-wip-us.apache.org/repos/asf/camel/blob/b0e76edc/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java
index fb7bd77..384e79a 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.dataformat.bindy.csv;
 
+import java.util.List;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -37,11 +39,6 @@ public class BindyTabSeparatorTest extends CamelTestSupport {
 
         assertMockEndpointsSatisfied();
 
-        // TODO: check
-        /*
-        List<Map<?, PurchaseOrder>> rows = CastUtils.cast(mock.getReceivedExchanges().get(0).getIn().getBody(List.class));
-        PurchaseOrder order = rows.get(0).get(PurchaseOrder.class.getName());
-        */
         PurchaseOrder order = mock.getReceivedExchanges().get(0).getIn().getBody(PurchaseOrder.class);
         
         assertEquals(123, order.getId());
@@ -70,6 +67,7 @@ public class BindyTabSeparatorTest extends CamelTestSupport {
         assertMockEndpointsSatisfied();
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testUnmarshalEmptyTrailingNoneRequiredFields() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:unmarshal");
@@ -81,11 +79,9 @@ public class BindyTabSeparatorTest extends CamelTestSupport {
 
         assertMockEndpointsSatisfied();
 
-        //List<Map<?, PurchaseOrder>> rows = CastUtils.cast(mock.getReceivedExchanges().get(0).getIn().getBody(List.class));
-        //PurchaseOrder order = rows.get(0).get(PurchaseOrder.class.getName());
-
-        /*TODO: cjeck
-        PurchaseOrder order = mock.getReceivedExchanges().get(0).getIn().getBody(PurchaseOrder.class);
+              
+        List<PurchaseOrder> orders = (List<PurchaseOrder>)mock.getReceivedExchanges().get(0).getIn().getBody();
+        PurchaseOrder order = orders.get(0);
         
         assertEquals(123, order.getId());
         assertEquals("Camel in Action", order.getName());
@@ -93,7 +89,6 @@ public class BindyTabSeparatorTest extends CamelTestSupport {
         assertNull(order.getOrderText());
         assertNull(order.getSalesRef());
         assertNull(order.getCustomerRef());
-        */
     }
 
     @Test


Mime
View raw message