Author: cmoulliard
Date: Fri Oct  2 09:45:21 2009
New Revision: 820944

URL: http://svn.apache.org/viewvc?rev=820944&view=rev
Log:
Change position from 0 to 1 (that was requested by user counting field positon 
from 1 instead of zero), remove null text in the CSV generated, add new unit 
test

Added:
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
   (with props)
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassdifferentposition/
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassdifferentposition/Order.java
   (with props)
Modified:
    
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
    
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Client.java
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Order.java
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Security.java
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassandskipfirstline/Order.java
    
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassmandatory/Order.java

Modified: 
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
 Fri Oct  2 09:45:21 2009
@@ -138,14 +138,14 @@
 
     public void bind(List<String> tokens, Map<String, Object> model, int line) 
throws Exception {
 
-        int pos = 0;
+        int pos = 1;
         int counterMandatoryFields = 0;
  
         for (String data : tokens) {
         
             // Get DataField from model
             DataField dataField = dataFields.get(pos);
-            ObjectHelper.notNull(dataField, "No position " + pos + " defined 
for the field : " + data + ", line nber : " + line);
+            ObjectHelper.notNull(dataField, "No position " + pos + " defined 
for the field : " + data + ", line : " + line);
             
             if (dataField.required()) {
                 // Increment counter of mandatory fields
@@ -155,7 +155,7 @@
                 // This is not possible for mandatory fields
                 if (data.equals("")) {
                     throw new IllegalArgumentException("The mandatory field 
defined at the position " + pos
-                                                       + " is empty for the 
line nber : " + line);
+                                                       + " is empty for the 
line : " + line);
                 }
             }
             
@@ -185,9 +185,9 @@
                 try {
                     value = format.parse(data);
                 } catch (FormatException ie) {
-                    throw new IllegalArgumentException(ie.getMessage() + ", 
position : " + pos + ", line nber : " + line, ie);
+                    throw new IllegalArgumentException(ie.getMessage() + ", 
position : " + pos + ", line : " + line, ie);
                 } catch (Exception e) {
-                    throw new IllegalArgumentException("Parsing error detected 
for field defined at the position : " + pos  + ", line nber : " + line, e);
+                    throw new IllegalArgumentException("Parsing error detected 
for field defined at the position : " + pos  + ", line : " + line, e);
                 }
             } else {
                 value = getDefaultValueforPrimitive(field.getType());
@@ -205,11 +205,11 @@
         
      
         if (pos < totalFields) {
-            throw new IllegalArgumentException("Some fields are missing 
(optional or mandatory), line nber : " + line);
+            throw new IllegalArgumentException("Some fields are missing 
(optional or mandatory), line : " + line);
         }
 
         if (counterMandatoryFields < numberMandatoryFields) {
-            throw new IllegalArgumentException("Some mandatory fields are 
missing, line nber : " + line);
+            throw new IllegalArgumentException("Some mandatory fields are 
missing, line : " + line);
         }
         
     }
@@ -261,7 +261,7 @@
             if (modelField != null) {
                 // Get field value
                 Object value = field.get(modelField);
-                String strValue = null;
+                String strValue = "";
 
                 if (this.isMessageOrdered()) {
 
@@ -311,9 +311,9 @@
                         }
 
                     }
-
+                    
                     if (LOG.isDebugEnabled()) {
-                        LOG.debug("Data : " + value + ", value : " + strValue);
+                        LOG.debug("Value to be formatted : " + value + ", 
position : " + dataField.pos() + ", and its formated value : " + strValue);
                     }
 
                     builder.append(strValue);

Modified: 
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
 Fri Oct  2 09:45:21 2009
@@ -140,7 +140,7 @@
                 }
 
                 KeyValuePairField keyValuePairField = 
keyValuePairFields.get(tag);
-                ObjectHelper.notNull(keyValuePairField, "No tag defined for 
the field : " + tag + ", line nber : " + line);
+                ObjectHelper.notNull(keyValuePairField, "No tag defined for 
the field : " + tag + ", line : " + line);
 
                 Field field = annotedFields.get(tag);
                 field.setAccessible(true);
@@ -166,7 +166,7 @@
                     value = format.parse(keyValue);
                 } catch (Exception e) {
                     throw new IllegalArgumentException("Parsing error detected 
for field defined at the tag : " + tag
-                        + ", line nber : " + line, e);
+                        + ", line : " + line, e);
                 }
 
                 field.set(modelField, value);
@@ -261,6 +261,10 @@
                         // Create the key value string
                         String value = keyValuePairField.tag() + 
this.getKeyValuePairSeparator()
                                        + valueFormated;
+                                       
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug("Value to be formatted : " + keyValue + 
", for the tag : " + keyValuePairField.tag() + ", and its formated value : " + 
valueFormated);
+                        }
 
                         // Add the content to the TreeMap according to the
                         // position defined

Modified: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
 Fri Oct  2 09:45:21 2009
@@ -42,7 +42,7 @@
 public class BindySimpleCsvNullMarshallTest extends 
AbstractJUnit4SpringContextTests {
 
     private List<Map<String, Object>> models = new ArrayList<Map<String, 
Object>>();
-    private String result = 
"1,B2,Keira,Knightley,ISIN,XX23456789,BUY,null,450.45,EUR,14-01-2009\r\n";
+    private String result = 
"1,B2,Keira,Knightley,ISIN,XX23456789,BUY,,450.45,EUR,14-01-2009\r\n";
 
     @Produce(uri = "direct:start")
     private ProducerTemplate template;

Modified: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
 Fri Oct  2 09:45:21 2009
@@ -36,8 +36,8 @@
     protected ProducerTemplate template;
     
     private String record = "order nr,client ref,first name, last 
name,instrument code,instrument name,order type, instrument type, 
quantity,currency,date\r\n"
-                            + 
"01,,Albert,Cartier,ISIN,BE12345678,SELL,,1500,EUR,08-01-2009\r\n"
-                            + 
"02,A1,,Preud'Homme,ISIN,XD12345678,BUY,,2500,USD,08-01-2009\r\n"
+                            + 
"1,,Albert,Cartier,ISIN,BE12345678,SELL,,1500,EUR,08-01-2009\r\n"
+                            + 
"2,A1,,Preud'Homme,ISIN,XD12345678,BUY,,2500,USD,08-01-2009\r\n"
                             + 
"03,A2,Jacques,,,BE12345678,SELL,,1500,EUR,08-01-2009\r\n"
                             + 
"04,A3,Michel,Dupond,,,BUY,,2500,USD,08-01-2009\r\n"
                             + 
"05,A4,Annie,Dutronc,ISIN,BE12345678,,,1500,EUR,08-01-2009\r\n"

Added: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java?rev=820944&view=auto
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
 (added)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
 Fri Oct  2 09:45:21 2009
@@ -0,0 +1,131 @@
+/**
+ * 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.dataformat.bindy.csv;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.TestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.bindy.format.FormatException;
+import org.apache.camel.processor.interceptor.Tracer;
+import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
+import org.springframework.config.java.annotation.Bean;
+import org.springframework.config.java.annotation.Configuration;
+import org.springframework.config.java.test.JavaConfigContextLoader;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import 
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+...@contextconfiguration(locations = 
"org.apache.camel.dataformat.bindy.csv.BindySimpleCsvUnmarshallPositionModifiedTest$ContextConfig",
 loader = JavaConfigContextLoader.class)
+public class BindySimpleCsvUnmarshallPositionModifiedTest extends 
AbstractJUnit4SpringContextTests {
+
+    private static final transient Log LOG = 
LogFactory.getLog(BindySimpleCsvUnmarshallPositionModifiedTest.class);
+
+    private static final String uriMockResult = "mock:result";
+    private static final String uriMockError = "mock:error";  
+    private static final String uriDirectStart = "direct:start";
+    private String record;
+    
+    @EndpointInject(uri = uriMockResult)
+    private MockEndpoint result;
+    
+    @EndpointInject(uri = uriMockError)
+    private MockEndpoint error;
+
+    @Produce(uri = uriDirectStart)
+    protected ProducerTemplate template;
+    
+    @Test
+    @DirtiesContext
+    public void testUnMarshallMessage() throws Exception {
+       
+       record = 
"1,25,Albert,Cartier,ISIN,BE12345678,SELL,Share,1500,EUR,08-01-2009\r\n";
+
+        template.sendBody(record);
+
+        result.expectedMessageCount(1);
+        result.assertIsSatisfied();
+
+    }
+    
+    @Test
+    @DirtiesContext
+    public void testUnmarshallErrorMessage() throws Exception {
+       record = 
"1,25,Albert,Cartier,ISIN,BE12345678,SELL,Share,1500,EUR,08-01-2009-01\r\n";
+       
+        template.sendBody(record);
+       
+       // We don't expect to have a message as an error will be raised
+       result.expectedMessageCount(0);
+       
+       // Message has been delivered to the mock error
+        error.expectedMessageCount(1);
+        
+       result.assertIsSatisfied();
+       error.assertIsSatisfied();
+       
+        // and check that we have the caused exception stored
+        Exception cause = 
error.getReceivedExchanges().get(0).getProperty(Exchange.EXCEPTION_CAUGHT, 
Exception.class);
+        TestSupport.assertIsInstanceOf(FormatException.class, 
cause.getCause());
+        assertEquals("Date provided does not fit the pattern defined, position 
: 11, line : 1", cause.getMessage());
+       
+    }
+
+    @Configuration
+    public static class ContextConfig extends SingleRouteCamelConfiguration {
+       
+        BindyCsvDataFormat orderBindyDataFormat = new 
BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassdifferentposition");
+
+        @Override
+        @Bean
+        public RouteBuilder route() {
+            return new RouteBuilder() {
+               
+                @Override
+                public void configure() {
+               
+                Tracer tracer = new Tracer();
+                tracer.setLogLevel(LoggingLevel.FATAL);
+                tracer.setLogName("org.apache.camel.bindy");
+
+                getContext().addInterceptStrategy(tracer);
+               
+                // default should errors go to mock:error
+                
errorHandler(deadLetterChannel(uriMockError).redeliverDelay(0));
+                
+                
onException(Exception.class).maximumRedeliveries(0).handled(true);
+
+                
from(uriDirectStart).unmarshal(orderBindyDataFormat).to(uriMockResult);
+                
+                }
+            };
+        }
+    }
+}
+
+    
\ No newline at end of file

Propchange: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Client.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Client.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Client.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Client.java
 Fri Oct  2 09:45:21 2009
@@ -22,13 +22,13 @@
 @Link
 public class Client {
 
-    @DataField(pos = 1)
+    @DataField(pos = 2)
     private String clientNr;
 
-    @DataField(pos = 2)
+    @DataField(pos = 3)
     private String firstName;
 
-    @DataField(pos = 3)
+    @DataField(pos = 4)
     private String lastName;
 
     public String getClientNr() {

Modified: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Order.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Order.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Order.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Order.java
 Fri Oct  2 09:45:21 2009
@@ -26,7 +26,7 @@
 @CsvRecord(separator = ",")
 public class Order {
 
-    @DataField(pos = 0)
+    @DataField(pos = 1)
     private int orderNr;
 
     @Link
@@ -35,19 +35,19 @@
     @Link
     private Security security;
 
-    @DataField(pos = 6)
+    @DataField(pos = 7)
     private String orderType;
 
-    @DataField(name = "Name", pos = 7)
+    @DataField(name = "Name", pos = 8)
     private String instrumentType;
 
-    @DataField(pos = 8, precision = 2)
+    @DataField(pos = 9, precision = 2)
     private BigDecimal amount;
 
-    @DataField(pos = 9)
+    @DataField(pos = 10)
     private String currency;
 
-    @DataField(pos = 10, pattern = "dd-MM-yyyy")
+    @DataField(pos = 11, pattern = "dd-MM-yyyy")
     private Date orderDate;
 
     public int getOrderNr() {

Modified: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Security.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Security.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Security.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Security.java
 Fri Oct  2 09:45:21 2009
@@ -22,10 +22,10 @@
 @Link
 public class Security {
 
-    @DataField(pos = 5)
+    @DataField(pos = 6)
     private String instrumentNumber;
 
-    @DataField(pos = 4)
+    @DataField(pos = 5)
     private String instrumentCode;
 
     public String getInstrumentNumber() {

Modified: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
 Fri Oct  2 09:45:21 2009
@@ -25,37 +25,37 @@
 @CsvRecord(separator = ",")
 public class Order {
 
-    @DataField(pos = 0)
+    @DataField(pos = 1)
     private int orderNr;
 
-    @DataField(pos = 1)
+    @DataField(pos = 2)
     private String clientNr;
 
-    @DataField(pos = 2)
+    @DataField(pos = 3)
     private String firstName;
 
-    @DataField(pos = 3)
+    @DataField(pos = 4)
     private String lastName;
 
-    @DataField(pos = 4)
+    @DataField(pos = 5)
     private String instrumentCode;
 
-    @DataField(pos = 5)
+    @DataField(pos = 6)
     private String instrumentNumber;
 
-    @DataField(pos = 6)
+    @DataField(pos = 7)
     private String orderType;
 
-    @DataField(name = "Name", pos = 7)
+    @DataField(name = "Name", pos = 8)
     private String instrumentType;
 
-    @DataField(pos = 8, precision = 2)
+    @DataField(pos = 9, precision = 2)
     private BigDecimal amount;
 
-    @DataField(pos = 9)
+    @DataField(pos = 10)
     private String currency;
 
-    @DataField(pos = 10, pattern = "dd-MM-yyyy")
+    @DataField(pos = 11, pattern = "dd-MM-yyyy")
     private Date orderDate;
 
     public int getOrderNr() {

Modified: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassandskipfirstline/Order.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassandskipfirstline/Order.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassandskipfirstline/Order.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassandskipfirstline/Order.java
 Fri Oct  2 09:45:21 2009
@@ -25,37 +25,37 @@
 @CsvRecord(separator = ",", skipFirstLine = true)
 public class Order {
 
-    @DataField(pos = 0)
+    @DataField(pos = 1)
     private int orderNr;
 
-    @DataField(pos = 1)
+    @DataField(pos = 2)
     private String clientNr;
 
-    @DataField(pos = 2)
+    @DataField(pos = 3)
     private String firstName;
 
-    @DataField(pos = 3)
+    @DataField(pos = 4)
     private String lastName;
 
-    @DataField(pos = 4)
+    @DataField(pos = 5)
     private String instrumentCode;
 
-    @DataField(pos = 5)
+    @DataField(pos = 6)
     private String instrumentNumber;
 
-    @DataField(pos = 6)
+    @DataField(pos = 7)
     private String orderType;
 
-    @DataField(name = "Name", pos = 7)
+    @DataField(name = "Name", pos = 8)
     private String instrumentType;
 
-    @DataField(pos = 8, precision = 2)
+    @DataField(pos = 9, precision = 2)
     private BigDecimal amount;
 
-    @DataField(pos = 9)
+    @DataField(pos = 10)
     private String currency;
 
-    @DataField(pos = 10, pattern = "dd-MM-yyyy")
+    @DataField(pos = 11, pattern = "dd-MM-yyyy")
     private Date orderDate;
 
     public int getOrderNr() {

Added: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassdifferentposition/Order.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassdifferentposition/Order.java?rev=820944&view=auto
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassdifferentposition/Order.java
 (added)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassdifferentposition/Order.java
 Fri Oct  2 09:45:21 2009
@@ -0,0 +1,158 @@
+/**
+ * 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.dataformat.bindy.model.simple.oneclassdifferentposition;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import org.apache.camel.dataformat.bindy.annotation.CsvRecord;
+import org.apache.camel.dataformat.bindy.annotation.DataField;
+
+...@csvrecord(separator = ",")
+public class Order {
+
+       // Positions of the fields start from 1 and not from 0
+       
+    @DataField(pos = 1)
+    private int orderNr;
+
+    @DataField(pos = 2)
+    private String clientNr;
+
+    @DataField(pos = 3)
+    private String firstName;
+
+    @DataField(pos = 4)
+    private String lastName;
+
+    @DataField(pos = 5)
+    private String instrumentCode;
+
+    @DataField(pos = 6)
+    private String instrumentNumber;
+
+    @DataField(pos = 7)
+    private String orderType;
+
+    @DataField(name = "Name", pos = 8)
+    private String instrumentType;
+
+    @DataField(pos = 9, precision = 2)
+    private BigDecimal amount;
+
+    @DataField(pos = 10)
+    private String currency;
+
+    @DataField(pos = 11, pattern = "dd-MM-yyyy")
+    private Date orderDate;
+
+    public int getOrderNr() {
+        return orderNr;
+    }
+
+    public void setOrderNr(int orderNr) {
+        this.orderNr = orderNr;
+    }
+
+    public String getClientNr() {
+        return clientNr;
+    }
+
+    public void setClientNr(String clientNr) {
+        this.clientNr = clientNr;
+    }
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getInstrumentCode() {
+        return instrumentCode;
+    }
+
+    public void setInstrumentCode(String instrumentCode) {
+        this.instrumentCode = instrumentCode;
+    }
+
+    public String getInstrumentNumber() {
+        return instrumentNumber;
+    }
+
+    public void setInstrumentNumber(String instrumentNumber) {
+        this.instrumentNumber = instrumentNumber;
+    }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    public String getInstrumentType() {
+        return instrumentType;
+    }
+
+    public void setInstrumentType(String instrumentType) {
+        this.instrumentType = instrumentType;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public String getCurrency() {
+        return currency;
+    }
+
+    public void setCurrency(String currency) {
+        this.currency = currency;
+    }
+
+    public Date getOrderDate() {
+        return orderDate;
+    }
+
+    public void setOrderDate(Date orderDate) {
+        this.orderDate = orderDate;
+    }
+
+    @Override
+    public String toString() {
+        return "Model : " + Order.class.getName() + " : " + this.orderNr + ", 
" + this.orderType + ", "
+               + String.valueOf(this.amount) + ", " + this.instrumentCode + ", 
" + this.instrumentNumber
+               + ", " + this.instrumentType + ", " + this.currency + ", " + 
this.clientNr + ", "
+               + this.firstName + ", " + this.lastName + ", " + 
String.valueOf(this.orderDate);
+    }
+}

Propchange: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassdifferentposition/Order.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassmandatory/Order.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassmandatory/Order.java?rev=820944&r1=820943&r2=820944&view=diff
==============================================================================
--- 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassmandatory/Order.java
 (original)
+++ 
camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassmandatory/Order.java
 Fri Oct  2 09:45:21 2009
@@ -25,37 +25,37 @@
 @CsvRecord(separator = ",", skipFirstLine = true)
 public class Order {
 
-    @DataField(pos = 0)
+    @DataField(pos = 1)
     private int orderNr;
 
-    @DataField(pos = 1, required = true)
+    @DataField(pos = 2, required = true)
     private String clientNr;
 
-    @DataField(pos = 2, required = true)
+    @DataField(pos = 3, required = true)
     private String firstName;
 
-    @DataField(pos = 3, required = true)
+    @DataField(pos = 4, required = true)
     private String lastName;
 
-    @DataField(pos = 4)
+    @DataField(pos = 5)
     private String instrumentCode;
 
-    @DataField(pos = 5)
+    @DataField(pos = 6)
     private String instrumentNumber;
 
-    @DataField(pos = 6)
+    @DataField(pos = 7)
     private String orderType;
 
-    @DataField(name = "Name", pos = 7)
+    @DataField(name = "Name", pos = 8)
     private String instrumentType;
 
-    @DataField(pos = 8, precision = 2)
+    @DataField(pos = 9, precision = 2)
     private BigDecimal amount;
 
-    @DataField(pos = 9)
+    @DataField(pos = 10)
     private String currency;
 
-    @DataField(pos = 10, pattern = "dd-MM-yyyy")
+    @DataField(pos = 11, pattern = "dd-MM-yyyy")
     private Date orderDate;
 
     public int getOrderNr() {


Reply via email to