Author: davsclaus
Date: Sun Feb  5 11:23:35 2012
New Revision: 1240698

URL: http://svn.apache.org/viewvc?rev=1240698&view=rev
Log:
CAMEL-4964: Improved camel-beanio, added to kit etc.

Added:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java
      - copied, changed from r1240678, 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
    
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.java
      - copied, changed from r1240692, 
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java
    
camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
    
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java
   (with props)
Modified:
    camel/trunk/apache-camel/pom.xml
    camel/trunk/apache-camel/src/main/descriptors/common-bin.xml
    
camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.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-beanio/pom.xml
    
camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
    camel/trunk/parent/pom.xml
    camel/trunk/platforms/karaf/features/src/main/resources/features.xml

Modified: camel/trunk/apache-camel/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/apache-camel/pom.xml?rev=1240698&r1=1240697&r2=1240698&view=diff
==============================================================================
--- camel/trunk/apache-camel/pom.xml (original)
+++ camel/trunk/apache-camel/pom.xml Sun Feb  5 11:23:35 2012
@@ -77,6 +77,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-beanio</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-bean-validator</artifactId>
     </dependency>
     <dependency>

Modified: camel/trunk/apache-camel/src/main/descriptors/common-bin.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/apache-camel/src/main/descriptors/common-bin.xml?rev=1240698&r1=1240697&r2=1240698&view=diff
==============================================================================
--- camel/trunk/apache-camel/src/main/descriptors/common-bin.xml (original)
+++ camel/trunk/apache-camel/src/main/descriptors/common-bin.xml Sun Feb  5 
11:23:35 2012
@@ -39,6 +39,7 @@
         <include>org.apache.camel:camel-atom</include>
         <include>org.apache.camel:camel-aws</include>
         <include>org.apache.camel:camel-bam</include>
+        <include>org.apache.camel:camel-beanio</include>
         <include>org.apache.camel:camel-bean-validator</include>
         <include>org.apache.camel:camel-bindy</include>
         <include>org.apache.camel:camel-blueprint</include>

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java?rev=1240698&r1=1240697&r2=1240698&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
 Sun Feb  5 11:23:35 2012
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlRoot
 
 import org.apache.camel.Processor;
 import org.apache.camel.model.dataformat.AvroDataFormat;
+import org.apache.camel.model.dataformat.BeanioDataFormat;
 import org.apache.camel.model.dataformat.BindyDataFormat;
 import org.apache.camel.model.dataformat.CastorDataFormat;
 import org.apache.camel.model.dataformat.CryptoDataFormat;
@@ -69,6 +70,7 @@ public class MarshalDefinition extends N
     // cannot use @XmlElementRef as it doesn't allow optional properties
     @XmlElements({
     @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
+    @XmlElement(required = false, name = "beanio", type = 
BeanioDataFormat.class),
     @XmlElement(required = false, name = "bindy", type = 
BindyDataFormat.class),
     @XmlElement(required = false, name = "castor", type = 
CastorDataFormat.class),
     @XmlElement(required = false, name = "crypto", type = 
CryptoDataFormat.class),

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java?rev=1240698&r1=1240697&r2=1240698&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
 Sun Feb  5 11:23:35 2012
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlRoot
 
 import org.apache.camel.Processor;
 import org.apache.camel.model.dataformat.AvroDataFormat;
+import org.apache.camel.model.dataformat.BeanioDataFormat;
 import org.apache.camel.model.dataformat.BindyDataFormat;
 import org.apache.camel.model.dataformat.CastorDataFormat;
 import org.apache.camel.model.dataformat.CryptoDataFormat;
@@ -69,6 +70,7 @@ public class UnmarshalDefinition extends
     // cannot use @XmlElementRef as it doesn't allow optional properties
     @XmlElements({
     @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
+    @XmlElement(required = false, name = "beanio", type = 
BeanioDataFormat.class),
     @XmlElement(required = false, name = "bindy", type = 
BindyDataFormat.class),
     @XmlElement(required = false, name = "castor", type = 
CastorDataFormat.class),
     @XmlElement(required = false, name = "crypto", type = 
CryptoDataFormat.class),

Copied: 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java
 (from r1240678, 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java&r1=1240678&r2=1240698&rev=1240698&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java
 Sun Feb  5 11:23:35 2012
@@ -23,65 +23,47 @@ import javax.xml.bind.annotation.XmlRoot
 
 import org.apache.camel.model.DataFormatDefinition;
 import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.RouteContext;
 
 /**
- * Represents the Bindy {@link org.apache.camel.spi.DataFormat}
+ * Represents the BeanIO {@link org.apache.camel.spi.DataFormat}
  *
  * @version 
  */
-@XmlRootElement(name = "bindy")
+@XmlRootElement(name = "beanio")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class BindyDataFormat extends DataFormatDefinition {
+public class BeanioDataFormat extends DataFormatDefinition {
+
     @XmlAttribute(required = true)
-    private BindyType type;
+    private String mapping;
     @XmlAttribute(required = true)
-    private String[] packages;
+    private String streamName;
     @XmlAttribute
-    private String locale;
-
-    public BindyDataFormat() {
-    }
-
-    public BindyType getType() {
-        return type;
-    }
-
-    public void setType(BindyType type) {
-        this.type = type;
-    }
-
-    public String[] getPackages() {
-        return packages;
-    }
-
-    public void setPackages(String[] packages) {
-        this.packages = packages;
-    }
-
-    public String getLocale() {
-        return locale;
-    }
-
-    public void setLocale(String locale) {
-        this.locale = locale;
-    }
+    private Boolean ignoreUnidentifiedRecords;
+    @XmlAttribute
+    private Boolean ignoreUnexpectedRecords;
+    @XmlAttribute
+    private Boolean ignoreInvalidRecords;
+    @XmlAttribute
+    private String encoding;
 
-    protected DataFormat createDataFormat(RouteContext routeContext) {
-        if (type == BindyType.Csv) {
-            setDataFormatName("bindy-csv");
-        } else if (type == BindyType.Fixed) {
-            setDataFormatName("bindy-fixed");
-        } else {
-            setDataFormatName("bindy-kvp");
-        }
-        return super.createDataFormat(routeContext);
+    public BeanioDataFormat() {
+        super("beanio");
     }
 
     @Override
     protected void configureDataFormat(DataFormat dataFormat) {
-        setProperty(dataFormat, "packages", packages);
-        setProperty(dataFormat, "locale", locale);
+        setProperty(dataFormat, "mapping", mapping);
+        setProperty(dataFormat, "streamName", streamName);
+        if (ignoreUnidentifiedRecords != null) {
+            setProperty(dataFormat, "ignoreUnidentifiedRecords", 
ignoreUnidentifiedRecords);
+        }
+        if (ignoreUnexpectedRecords != null) {
+            setProperty(dataFormat, "ignoreUnexpectedRecords", 
ignoreUnexpectedRecords);
+        }
+        if (ignoreInvalidRecords != null) {
+            setProperty(dataFormat, "ignoreInvalidRecords", 
ignoreInvalidRecords);
+        }
+        setProperty(dataFormat, "encoding", encoding);
     }
 
 }
\ No newline at end of file

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=1240698&r1=1240697&r2=1240698&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
 Sun Feb  5 11:23:35 2012
@@ -37,6 +37,8 @@ public class DataFormatsDefinition {
 
     // cannot use @XmlElementRef as it doesn't allow optional properties
     @XmlElements({
+        @XmlElement(required = false, name = "avro", type = 
AvroDataFormat.class),
+        @XmlElement(required = false, name = "beanio", type = 
BeanioDataFormat.class),
         @XmlElement(required = false, name = "bindy", type = 
BindyDataFormat.class),
         @XmlElement(required = false, name = "castor", type = 
CastorDataFormat.class),
         @XmlElement(required = false, name = "crypto", type = 
CryptoDataFormat.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=1240698&r1=1240697&r2=1240698&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
 Sun Feb  5 11:23:35 2012
@@ -15,6 +15,7 @@
 ## limitations under the License.
 ## ------------------------------------------------------------------------
 AvroDataFormat
+BeanioDataFormat
 BindyDataFormat
 BindyType
 CastorDataFormat

Modified: camel/trunk/components/camel-beanio/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/pom.xml?rev=1240698&r1=1240697&r2=1240698&view=diff
==============================================================================
--- camel/trunk/components/camel-beanio/pom.xml (original)
+++ camel/trunk/components/camel-beanio/pom.xml Sun Feb  5 11:23:35 2012
@@ -54,7 +54,7 @@
     <!-- testing -->
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-test</artifactId>
+      <artifactId>camel-test-spring</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

Modified: 
camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java?rev=1240698&r1=1240697&r2=1240698&view=diff
==============================================================================
--- 
camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
 (original)
+++ 
camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
 Sun Feb  5 11:23:35 2012
@@ -27,9 +27,14 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Exchange;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.ResourceHelper;
 import org.beanio.BeanReader;
 import org.beanio.BeanReaderErrorHandlerSupport;
 import org.beanio.BeanWriter;
@@ -44,41 +49,65 @@ import org.slf4j.LoggerFactory;
  * A <a href="http://camel.apache.org/data-format.html";>data format</a> (
  * {@link DataFormat}) for beanio data.
  */
-public class BeanIODataFormat implements DataFormat {
+public class BeanIODataFormat extends ServiceSupport implements DataFormat, 
CamelContextAware {
 
     private static final String LOG_PREFIX = "BeanIO: ";
     private static final transient Logger LOG = 
LoggerFactory.getLogger(BeanIODataFormat.class);
 
-    private StreamFactory factory;
+    private transient CamelContext camelContext;
+    private transient StreamFactory factory;
     private String streamName;
+    private String mapping;
     private boolean ignoreUnidentifiedRecords;
     private boolean ignoreUnexpectedRecords;
     private boolean ignoreInvalidRecords;
-    private Charset characterSet = Charset.defaultCharset();
+    private Charset encoding = Charset.defaultCharset();
+
+    public BeanIODataFormat() {
+    }
 
     public BeanIODataFormat(String mapping, String streamName) {
-        // Create the stream factory that will be used to read/write objects.
-        factory = StreamFactory.newInstance();
+        this.mapping = mapping;
+        this.streamName = streamName;
+    }
 
-        // Load the mapping file
-        factory.loadResource(mapping);
+    @Override
+    protected void doStart() throws Exception {
+        ObjectHelper.notNull(streamName, "Stream name not configured.");
+        if (factory == null) {
+            // Create the stream factory that will be used to read/write 
objects.
+            factory = StreamFactory.newInstance();
+
+            // Load the mapping file using the resource helper to ensure it 
can be loaded in OSGi and other environments
+            InputStream is = 
ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(),
 mapping);
+            try {
+                factory.load(is);
+            } finally {
+                IOHelper.close(is);
+            }
+        }
+    }
 
-        // Save the stream name that we want to read
-        this.streamName = streamName;
+    @Override
+    protected void doStop() throws Exception {
+        factory = null;
     }
 
-    public void marshal(Exchange exchange, Object body, OutputStream stream) 
throws Exception {
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
 
-        validateRequiredProperties();
+    public void setCamelContext(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
 
+    public void marshal(Exchange exchange, Object body, OutputStream stream) 
throws Exception {
         List<Object> models = getModels(exchange, body);
-
         writeModels(stream, models);
     }
 
-    private void validateRequiredProperties() {
-        ObjectHelper.notNull(factory, "StreamFactory not configured.");
-        ObjectHelper.notNull(streamName, "Stream name not configured.");
+    public Object unmarshal(Exchange exchange, InputStream stream) throws 
Exception {
+        return readModels(exchange, stream);
     }
 
     @SuppressWarnings("unchecked")
@@ -95,7 +124,7 @@ public class BeanIODataFormat implements
     }
 
     private void writeModels(OutputStream stream, List<Object> models) {
-        BufferedWriter streamWriter = new BufferedWriter(new 
OutputStreamWriter(stream, characterSet));
+        BufferedWriter streamWriter = new BufferedWriter(new 
OutputStreamWriter(stream, encoding));
         BeanWriter out = factory.createWriter(streamName, streamWriter);
 
         for (Object obj : models) {
@@ -106,14 +135,9 @@ public class BeanIODataFormat implements
         out.close();
     }
 
-    public Object unmarshal(Exchange exchange, InputStream stream) throws 
Exception {
-        validateRequiredProperties();
-        return readModels(exchange, stream);
-    }
-
     private List<Object> readModels(Exchange exchange, InputStream stream) {
         List<Object> results = new ArrayList<Object>();
-        BufferedReader streamReader = new BufferedReader(new 
InputStreamReader(stream, characterSet));
+        BufferedReader streamReader = new BufferedReader(new 
InputStreamReader(stream, encoding));
 
         BeanReader in = factory.createReader(streamName, streamReader);
 
@@ -166,41 +190,51 @@ public class BeanIODataFormat implements
         });
     }
 
-    /**
-     * @param streamName The beanio stream that will be marshaled/unmarshaled.
-     */
-    public void setStreamName(String streamName) {
-        this.streamName = streamName;
+    public Charset getEncoding() {
+        return encoding;
     }
 
-    /**
-     * @param ignoreUnidentifiedRecords When true any unidentified records 
will be ignored when
-     *                                  unmarshaling.
-     */
-    public void setIgnoreUnidentifiedRecords(boolean 
ignoreUnidentifiedRecords) {
-        this.ignoreUnidentifiedRecords = ignoreUnidentifiedRecords;
+    public void setEncoding(Charset encoding) {
+        this.encoding = encoding;
     }
 
-    /**
-     * @param ignoreUnexpectedRecords When true any unexpected records will be 
ignored when
-     *                                unmarshaling.
-     */
-    public void setIgnoreUnexpectedRecords(boolean ignoreUnexpectedRecords) {
-        this.ignoreUnexpectedRecords = ignoreUnexpectedRecords;
+    public boolean isIgnoreInvalidRecords() {
+        return ignoreInvalidRecords;
     }
 
-    /**
-     * @param ignoreInvalidRecords When true any invalid records will be 
ignored when
-     *                             unmarshaling.
-     */
     public void setIgnoreInvalidRecords(boolean ignoreInvalidRecords) {
         this.ignoreInvalidRecords = ignoreInvalidRecords;
     }
 
-    /**
-     * @param characterSet the characterSet to set
-     */
-    public void setCharacterSet(String characterSet) {
-        this.characterSet = Charset.forName(characterSet);
+    public boolean isIgnoreUnexpectedRecords() {
+        return ignoreUnexpectedRecords;
+    }
+
+    public void setIgnoreUnexpectedRecords(boolean ignoreUnexpectedRecords) {
+        this.ignoreUnexpectedRecords = ignoreUnexpectedRecords;
+    }
+
+    public boolean isIgnoreUnidentifiedRecords() {
+        return ignoreUnidentifiedRecords;
+    }
+
+    public void setIgnoreUnidentifiedRecords(boolean 
ignoreUnidentifiedRecords) {
+        this.ignoreUnidentifiedRecords = ignoreUnidentifiedRecords;
+    }
+
+    public String getMapping() {
+        return mapping;
+    }
+
+    public void setMapping(String mapping) {
+        this.mapping = mapping;
+    }
+
+    public String getStreamName() {
+        return streamName;
+    }
+
+    public void setStreamName(String streamName) {
+        this.streamName = streamName;
     }
 }

Copied: 
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.java
 (from r1240692, 
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.java?p2=camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.java&p1=camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java&r1=1240692&r2=1240698&rev=1240698&view=diff
==============================================================================
--- 
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java
 (original)
+++ 
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.java
 Sun Feb  5 11:23:35 2012
@@ -21,18 +21,23 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
 import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-public class BeanIODataFormatSimpleTest extends CamelTestSupport {
+public class SpringBeanIODataFormatSimpleTest extends CamelSpringTestSupport {
 
     private static final String FIXED_DATA = 
"Joe,Smith,Developer,75000,10012009" + LS
             + "Jane,Doe,Architect,80000,01152008" + LS
             + "Jon,Anderson,Manager,85000,03182007" + LS;
 
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new 
ClassPathXmlApplicationContext("org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml");
+    }
+
     @Test
     public void testMarshal() throws Exception {
         List<Employee> employees = getEmployees();
@@ -57,24 +62,6 @@ public class BeanIODataFormatSimpleTest 
         mock.assertIsSatisfied();
     }
 
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                DataFormat format = new BeanIODataFormat(
-                        "org/apache/camel/dataformat/beanio/mappings.xml",
-                        "employeeFile");
-
-                from("direct:unmarshal").unmarshal(format)
-                        .split(simple("body")).to("mock:beanio-unmarshal");
-
-                from("direct:marshal").marshal(format)
-                        .to("mock:beanio-marshal");
-            }
-        };
-    }
-
     private List<Employee> getEmployees() throws ParseException {
         List<Employee> employees = new ArrayList<Employee>();
         Employee one = new Employee();

Added: 
camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml?rev=1240698&view=auto
==============================================================================
--- 
camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
 (added)
+++ 
camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
 Sun Feb  5 11:23:35 2012
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="
+     http://www.springframework.org/schema/beans
+     http://www.springframework.org/schema/beans/spring-beans.xsd
+     http://camel.apache.org/schema/spring
+     http://camel.apache.org/schema/spring/camel-spring.xsd";>
+
+<!-- START SNIPPET: e1 -->
+  <camelContext xmlns="http://camel.apache.org/schema/spring";>
+    <!-- setup beanio data format -->
+    <dataFormats>
+      <beanio id="myBeanio" 
mapping="org/apache/camel/dataformat/beanio/mappings.xml" 
streamName="employeeFile"/>
+    </dataFormats>
+
+    <route>
+      <from uri="direct:unmarshal"/>
+      <unmarshal ref="myBeanio"/>
+      <split>
+        <simple>body</simple>
+        <to uri="mock:beanio-unmarshal"/>
+      </split>
+    </route>
+    
+    <route>
+      <from uri="direct:marshal"/>
+      <marshal ref="myBeanio"/>
+      <to uri="mock:beanio-marshal"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+</beans>

Modified: camel/trunk/parent/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1240698&r1=1240697&r2=1240698&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Sun Feb  5 11:23:35 2012
@@ -44,6 +44,7 @@
     <avro-version>1.6.1</avro-version>
     <avro-bundle-version>1.6.1_2-SNAPSHOT</avro-bundle-version>
     <axiom-version>1.2.12</axiom-version>
+    <beanio-version>1.2.2</beanio-version>
     <bouncycastle-version>1.46</bouncycastle-version>
     <castor-bundle-version>1.3.1_2</castor-bundle-version>
     <cometd-bayeux-version>6.1.11</cometd-bayeux-version>
@@ -269,6 +270,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-beanio</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-bean-validator</artifactId>
         <version>${project.version}</version>
       </dependency>

Modified: camel/trunk/platforms/karaf/features/src/main/resources/features.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/src/main/resources/features.xml?rev=1240698&r1=1240697&r2=1240698&view=diff
==============================================================================
--- camel/trunk/platforms/karaf/features/src/main/resources/features.xml 
(original)
+++ camel/trunk/platforms/karaf/features/src/main/resources/features.xml Sun 
Feb  5 11:23:35 2012
@@ -215,6 +215,11 @@
     <feature version='${project.version}'>camel-core</feature>
     <bundle>mvn:org.apache.camel/camel-bam/${project.version}</bundle>
   </feature>
+  <feature name='camel-beanio' version='${project.version}' resolver='(obr)' 
start-level='50'>
+    <feature version='${project.version}'>camel-core</feature>
+    <bundle 
dependency='true'>wrap:mvn:org.beanio/beanio/${beanio-version}</bundle>
+    <bundle>mvn:org.apache.camel/camel-beanio/${project.version}</bundle>
+  </feature>
   <feature name='camel-bean-validator' version='${project.version}' 
resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <bundle 
dependency='true'>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr303-api-1.0.0/${servicemix-specs-version}</bundle>

Added: 
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java?rev=1240698&view=auto
==============================================================================
--- 
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java
 (added)
+++ 
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java
 Sun Feb  5 11:23:35 2012
@@ -0,0 +1,46 @@
+/**
+ * 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.itest.karaf;
+
+import org.apache.camel.model.DataFormatDefinition;
+import org.apache.camel.model.dataformat.BeanioDataFormat;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+
+@RunWith(JUnit4TestRunner.class)
+public class CamelBeanioTest extends AbstractFeatureTest {
+
+    public static final String COMPONENT = extractName(CamelBeanioTest.class);
+    
+    protected DataFormatDefinition createDataformatDefinition(String format) { 
       
+        return new BeanioDataFormat();
+    }
+
+    @Test
+    public void test() throws Exception {
+        testDataFormat(COMPONENT);
+    }
+
+    @Configuration
+    public static Option[] configure() {
+        return configure(COMPONENT);
+    }
+
+}
\ No newline at end of file

Propchange: 
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date


Reply via email to