You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/08/07 11:14:27 UTC
[01/12] camel git commit: CAMEL-5958: Bindy ignores bean class type
(initial work)
Repository: camel
Updated Branches:
refs/heads/master d7803241b -> 3fc9de754
CAMEL-5958: Bindy ignores bean class type (initial work)
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cfb8f920
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cfb8f920
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cfb8f920
Branch: refs/heads/master
Commit: cfb8f920746556a4aadc5b7412c322797224be3e
Parents: ce6bf6e
Author: lburgazzoli <lb...@gmail.com>
Authored: Wed Nov 6 22:17:23 2013 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:05:04 2015 +0200
----------------------------------------------------------------------
.../dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/cfb8f920/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
index 72ca66d..59f7ec5 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
@@ -49,9 +49,12 @@ public class BindyComplexCsvUnmarshallTest extends AbstractJUnit4SpringContextTe
public static class ContextConfig extends RouteBuilder {
public void configure() {
- BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Order.class);
- from("direct:start").unmarshal(camelDataFormat).to("mock:result");
+ Class<?> type =
+ org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Order.class;
+
+ from("direct:start")
+ .unmarshal(new BindyCsvDataFormat(type))
+ .to("mock:result");
}
}
}
[02/12] camel git commit: CAMEL-5958: Bindy ignores bean class type
(initial work)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
index 2afcd16..35c382d 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
@@ -101,7 +101,7 @@ public class BindySimpleCsvUnmarshallBadIntegerTest extends AbstractJUnit4Spring
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat orderBindyDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassmath");
+ BindyCsvDataFormat orderBindyDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassmath.Math.class);
public void configure() {
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
index 4e0b613..8ad7d83 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
@@ -89,7 +89,7 @@ public class BindySimpleCsvUnmarshallPositionModifiedTest extends AbstractJUnit4
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat orderBindyDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassdifferentposition");
+ BindyCsvDataFormat orderBindyDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassdifferentposition.Order.class);
public void configure() {
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
index f0fdcb5..d42085e 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
@@ -134,7 +134,7 @@ public class BindySimpleCsvUnmarshallTest extends AbstractJUnit4SpringContextTes
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
public void configure() {
// from("file://src/test/data?move=./target/done").unmarshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java
index e5e8094..8d28291 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java
@@ -64,7 +64,7 @@ public class BindySingleQuoteStartWordCsvUnmarshallTest extends AbstractJUnit4Sp
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
public void configure() {
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesCsvUnmarshallTest.java
index 5db995a..162ab2e 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuotesCsvUnmarshallTest.java
@@ -53,7 +53,7 @@ public class BindySingleQuotesCsvUnmarshallTest extends AbstractJUnit4SpringCont
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclasssinglequote");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclasssinglequote.Order.class);
public void configure() {
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/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 d40a6b9..67abf4d 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
@@ -41,6 +41,8 @@ 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());
@@ -50,6 +52,7 @@ public class BindyTabSeparatorTest extends CamelTestSupport {
assertEquals("Please hurry", order.getOrderText());
assertEquals("Jane Doe", order.getSalesRef());
assertEquals("John Doe", order.getCustomerRef());
+ */
}
@Test
@@ -81,6 +84,8 @@ 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());
@@ -90,6 +95,7 @@ public class BindyTabSeparatorTest extends CamelTestSupport {
assertNull(order.getOrderText());
assertNull(order.getSalesRef());
assertNull(order.getCustomerRef());
+ */
}
@Test
@@ -115,7 +121,7 @@ public class BindyTabSeparatorTest extends CamelTestSupport {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- BindyCsvDataFormat bindy = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.tab");
+ BindyCsvDataFormat bindy = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.tab.PurchaseOrder.class);
from("direct:marshal")
.marshal(bindy)
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java
index d30193b..91df474 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java
@@ -58,11 +58,11 @@ public class BindyMarshalUnmarshalssueTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:start")
- .marshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.csv2")
+ .marshal().bindy(BindyType.Csv, org.apache.camel.dataformat.bindy.csv2.WeatherModel.class)
.to("direct:middle");
from("direct:middle")
- .unmarshal(new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.csv2"))
+ .unmarshal(new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.csv2.WeatherModel.class))
.to("mock:result");
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalWithQuoteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalWithQuoteTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalWithQuoteTest.java
index 5798c3a..fb95137 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalWithQuoteTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalWithQuoteTest.java
@@ -49,7 +49,7 @@ public class BindyMarshalWithQuoteTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:start")
- .marshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.csv2")
+ .marshal().bindy(BindyType.Csv, org.apache.camel.dataformat.bindy.csv2.WeatherModel.class)
.to("mock:result");
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssue2Test.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssue2Test.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssue2Test.java
index 330d8fb..699476a 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssue2Test.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssue2Test.java
@@ -30,7 +30,7 @@ public class BindyUnmarshalCommaIssue2Test extends BindyUnmarshalCommaIssueTest
@Override
public void configure() throws Exception {
from("direct:start")
- .unmarshal(new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.csv2"))
+ .unmarshal(new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.csv2.WeatherModel.class))
.to("mock:result");
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
index 80c8133..c63b711 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
@@ -110,7 +110,7 @@ public class BindyUnmarshalCommaIssueTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:start")
- .unmarshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.csv2")
+ .unmarshal().bindy(BindyType.Csv, org.apache.camel.dataformat.bindy.csv2.WeatherModel.class)
.to("mock:result");
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
index 3683826..f88b3f7 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
@@ -48,8 +48,7 @@ public class BindyComplexKeyValuePairStandaloneTest {
public void init() throws Exception {
// Set factory
- PackageScanClassResolver res = new DefaultPackageScanClassResolver();
- factory = new BindyKeyValuePairFactory(res, "org.apache.camel.dataformat.bindy.model.fix.complex.onetomany");
+ factory = new BindyKeyValuePairFactory(org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Order.class);
// Set model class
models.add(org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Order.class);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
index 5f579ac..b9c222c 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
@@ -51,7 +51,7 @@ public class BindyComplexOneToManyKeyValuePairUnMarshallTest extends CommonBindy
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.complex.onetomany");
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Order.class);
public void configure() {
from(URI_DIRECT_START).unmarshal(kvpBindyDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java
index f435efa..1a0ed18 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java
@@ -82,7 +82,7 @@ public class BindySimpleKeyValuePairMarshallDslTest extends AbstractJUnit4Spring
public void configure() {
from("direct:start").marshal()
- .bindy(BindyType.KeyValue, "org.apache.camel.dataformat.bindy.model.fix.simple")
+ .bindy(BindyType.KeyValue, org.apache.camel.dataformat.bindy.model.fix.simple.Order.class)
.to("mock:result");
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java
index 680c9b1..3406dc9 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java
@@ -88,7 +88,7 @@ public class BindySimpleKeyValuePairMarshallTest extends AbstractJUnit4SpringCon
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat camelDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.simple");
+ BindyKeyValuePairDataFormat camelDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.simple.Order.class);
public void configure() {
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairNullMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairNullMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairNullMarshallTest.java
index 779dfca..2ec0959 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairNullMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairNullMarshallTest.java
@@ -91,7 +91,7 @@ public class BindySimpleKeyValuePairNullMarshallTest extends AbstractJUnit4Sprin
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.simple");
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.simple.Order.class);
public void configure() {
from("direct:start").marshal(kvpBindyDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java
index defff2b..6290a62 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java
@@ -91,7 +91,7 @@ public class BindySimpleKeyValuePairSortedMarshallTest extends CommonBindyTest {
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.sorted");
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.sorted.body.Order.class);
public void configure() {
from(URI_DIRECT_START).marshal(kvpBindyDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java
index a941972..a9e640b 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java
@@ -41,7 +41,7 @@ public class BindySimpleKeyValuePairSortedUnmarshallTest extends CommonBindyTest
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.sorted");
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.sorted.body.Order.class);
public void configure() {
from(URI_FILE_FIX).unmarshal(kvpBindyDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java
index 18030e0..9f72d32 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java
@@ -83,7 +83,7 @@ public class BindySimpleKeyValuePairTabMarshallTest extends CommonBindyTest {
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.tab");
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.tab.Order.class);
public void configure() {
from(URI_DIRECT_START).marshal(kvpBindyDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java
index c44556f..3e1a637 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java
@@ -40,7 +40,7 @@ public class BindySimpleKeyValuePairTabUnmarshallTest extends CommonBindyTest {
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.tab");
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.tab.Order.class);
public void configure() {
from(URI_FILE_FIX_TAB).unmarshal(kvpBindyDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
index 2c38ca9..fa08c65 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
@@ -43,7 +43,7 @@ public class BindySimpleKeyValuePairUnmarshallDslTest extends CommonBindyTest {
public void configure() {
from(URI_FILE_FIX).unmarshal()
- .bindy(BindyType.KeyValue, "org.apache.camel.dataformat.bindy.model.fix.simple")
+ .bindy(BindyType.KeyValue, org.apache.camel.dataformat.bindy.model.fix.simple.Order.class)
.to(URI_MOCK_RESULT);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
index b251333..df063de 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
@@ -40,7 +40,7 @@ public class BindySimpleKeyValuePairUnmarshallTest extends CommonBindyTest {
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.simple");
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.simple.Order.class);
public void configure() {
from(URI_FILE_FIX).unmarshal(kvpBindyDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairWithoutSectionMarshallDslTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairWithoutSectionMarshallDslTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairWithoutSectionMarshallDslTest.java
index 2c25998..244eb59 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairWithoutSectionMarshallDslTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairWithoutSectionMarshallDslTest.java
@@ -96,7 +96,7 @@ public class BindySimpleKeyValuePairWithoutSectionMarshallDslTest extends Abstra
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat orderBindyDataFormat = new BindyKeyValuePairDataFormat("org.apache.camel.dataformat.bindy.model.fix.withoutsection");
+ BindyKeyValuePairDataFormat orderBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.withoutsection.Order.class);
public void configure() {
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java
index c3dd33d..0bc6fcc 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java
@@ -92,7 +92,7 @@ public class BindySimpleFixedLengthWithLinkTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
BindyDataFormat bindy = new BindyDataFormat();
- bindy.setPackages(new String[]{"org.apache.camel.dataformat.bindy.fixed.link"});
+ bindy.setClassType(Order.class);
bindy.setLocale("en");
bindy.setType(BindyType.Fixed);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallTest.java
index d0cb173..33142a0 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallTest.java
@@ -110,7 +110,7 @@ public class BindySimpleFixedLengthMarshallTest extends AbstractJUnit4SpringCont
BindyDataFormat bindy = new BindyDataFormat();
bindy.setLocale("en");
- bindy.setPackages(new String[] {"org.apache.camel.dataformat.bindy.fixed.marshall.simple"});
+ bindy.setClassType(Order.class);
bindy.setType(BindyType.Fixed);
from(URI_DIRECT_START)
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipAndTrimTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipAndTrimTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipAndTrimTest.java
index 5e74db1..8bf1447 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipAndTrimTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipAndTrimTest.java
@@ -41,7 +41,7 @@ public class BindySimpleFixedLengthMarshallWithClipAndTrimTest extends CamelTest
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat("org.apache.camel.dataformat.bindy.fixed.marshall.simple");
+ BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat(Order.class);
bindy.setLocale("en");
from("direct:start")
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipTest.java
index 4247b3f..24e0953 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithClipTest.java
@@ -41,7 +41,7 @@ public class BindySimpleFixedLengthMarshallWithClipTest extends CamelTestSupport
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat("org.apache.camel.dataformat.bindy.fixed.marshall.simple");
+ BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat(Order.class);
bindy.setLocale("en");
from("direct:start")
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithNoClipTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithNoClipTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithNoClipTest.java
index afc4ca0..3283df0 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithNoClipTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/marshall/simple/BindySimpleFixedLengthMarshallWithNoClipTest.java
@@ -42,7 +42,7 @@ public class BindySimpleFixedLengthMarshallWithNoClipTest extends CamelTestSuppo
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat("org.apache.camel.dataformat.bindy.fixed.marshall.simple");
+ BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat(Order.class);
from("direct:start")
.marshal(bindy)
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
index a74abeb..b5f268b 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
@@ -71,7 +71,7 @@ public class BindySimpleFixedLengthUnmarshallTest extends AbstractJUnit4SpringCo
}
public static class ContextConfig extends RouteBuilder {
- BindyFixedLengthDataFormat camelDataFormat = new BindyFixedLengthDataFormat("org.apache.camel.dataformat.bindy.fixed.unmarshall.simple.trim");
+ BindyFixedLengthDataFormat camelDataFormat = new BindyFixedLengthDataFormat(Order.class);
public void configure() {
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
index 7f65c8d..f121a7a 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
@@ -71,7 +71,7 @@ public class BindySimpleFixedLengthUnmarshallTrimFieldTest extends AbstractJUnit
}
public static class ContextConfig extends RouteBuilder {
- BindyFixedLengthDataFormat camelDataFormat = new BindyFixedLengthDataFormat("org.apache.camel.dataformat.bindy.fixed.unmarshall.simple.trimfield");
+ BindyFixedLengthDataFormat camelDataFormat = new BindyFixedLengthDataFormat(Order.class);
public void configure() {
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/date/BindyDatePatternCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/date/BindyDatePatternCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/date/BindyDatePatternCsvUnmarshallTest.java
index 71184ce..e3bd410 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/date/BindyDatePatternCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/date/BindyDatePatternCsvUnmarshallTest.java
@@ -58,7 +58,7 @@ public class BindyDatePatternCsvUnmarshallTest extends AbstractJUnit4SpringConte
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.date");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(Order.class);
public void configure() {
from(URI_DIRECT_START)
[05/12] camel git commit: CAMEL-5958: Bindy ignores bean class type
Posted by da...@apache.org.
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/355becba
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/355becba
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/355becba
Branch: refs/heads/master
Commit: 355becba84321062c22223364fa56845e3e6391f
Parents: 222f5fd
Author: lburgazzoli <lb...@gmail.com>
Authored: Wed Dec 18 15:03:34 2013 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:05:47 2015 +0200
----------------------------------------------------------------------
.../bindy/BindyAbstractDataFormat.java | 1 +
.../dataformat/bindy/BindyAbstractFactory.java | 1 -
.../bindy/BindyFixedLengthFactory.java | 52 +++++++++++++++++---
.../bindy/annotation/FixedLengthRecord.java | 14 +-----
.../bindy/kvp/BindyKeyValuePairDataFormat.java | 1 -
.../csv/BindyCarQuoteAndCommaDelimiterTest.java | 14 ++----
.../BindyInlinedQuotesCsvUnmarshallTest.java | 6 +--
.../bindy/csv/BindyPipeDelimiterTest.java | 11 ++---
.../csv/BindySimpleCsvAutospanLineTest.java | 18 +++----
.../BindySimpleCsvUnmarshallBadIntegerTest.java | 16 ++----
.../bindy/csv/BindySimpleCsvUnmarshallTest.java | 14 +++---
...dySingleQuoteStartWordCsvUnmarshallTest.java | 6 +--
.../bindy/csv/BindyTabSeparatorTest.java | 18 +++----
.../csv2/BindyMarshalUnmarshalssueTest.java | 8 +--
.../csv2/BindyUnmarshalCommaIssueTest.java | 15 +++---
.../BindyComplexKeyValuePairStandaloneTest.java | 2 -
...plexOneToManyKeyValuePairUnMarshallTest.java | 17 ++++---
...ySimpleKeyValuePairSortedUnmarshallTest.java | 14 +++---
...indySimpleKeyValuePairTabUnmarshallTest.java | 13 ++---
...indySimpleKeyValuePairUnmarshallDslTest.java | 12 +++--
.../BindySimpleKeyValuePairUnmarshallTest.java | 11 +++--
.../bindy/fixed/headerfooter/Order.java | 2 +-
.../bindy/fixed/headerfooter/OrderFooter.java | 2 +-
.../bindy/fixed/headerfooter/OrderHeader.java | 2 +-
.../BindySimpleFixedLengthWithLinkTest.java | 26 ++--------
.../bindy/fixed/skipheader/Order.java | 2 +-
.../bindy/fixed/skipheader/OrderFooter.java | 2 +-
.../bindy/fixed/skipheader/OrderHeader.java | 2 +-
.../BindySimpleFixedLengthUnmarshallTest.java | 5 +-
...impleFixedLengthUnmarshallTrimFieldTest.java | 6 +--
.../BindySimpleCsvUnmarshallDslTest-context.xml | 2 +-
31 files changed, 147 insertions(+), 168 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
index b790424..a4365e3 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
@@ -29,6 +29,7 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
public BindyAbstractDataFormat() {
}
+
protected BindyAbstractDataFormat(Class<?> classType) {
this.classType = classType;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
index a23383a..959e40c 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
@@ -41,7 +41,6 @@ public abstract class BindyAbstractFactory implements BindyFactory {
protected Set<String> modelClassNames;
protected String crlf;
- private String[] packageNames;
private String locale;
private Class<?> type;
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/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 ac3bfbc..08ca7b9 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
@@ -62,10 +62,16 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
private char paddingChar;
private int recordLength;
private boolean ignoreTrailingChars;
+
+ private Class<?> header;
+ private Class<?> footer;
public BindyFixedLengthFactory(Class<?> type) throws Exception {
super(type);
+ header = void.class;
+ footer = void.class;
+
// initialize specific parameters of the fixed length model
initFixedLengthModel();
}
@@ -83,6 +89,16 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
// 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() {
@@ -459,16 +475,20 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
crlf = record.crlf();
LOG.debug("Carriage return defined for the CSV: {}", crlf);
- // Get hasHeader parameter
- hasHeader = record.hasHeader();
+ // Get header parameter
+ header = record.header();
+ LOG.debug("Header: {}", header);
+ hasHeader = header != void.class;
LOG.debug("Has Header: {}", hasHeader);
-
+
// Get skipHeader parameter
skipHeader = record.skipHeader();
LOG.debug("Skip Header: {}", skipHeader);
- // Get hasFooter parameter
- hasFooter = record.hasFooter();
+ // Get footer parameter
+ footer = record.footer();
+ LOG.debug("Footer: {}", footer);
+ hasFooter = record.footer() != void.class;
LOG.debug("Has Footer: {}", hasFooter);
// Get skipFooter parameter
@@ -476,11 +496,11 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
LOG.debug("Skip Footer: {}", skipFooter);
// Get isHeader parameter
- isHeader = record.isHeader();
+ isHeader = hasHeader ? cl.equals(header) : false;
LOG.debug("Is Header: {}", isHeader);
// Get isFooter parameter
- isFooter = record.isFooter();
+ isFooter = hasFooter ? cl.equals(footer) : false;
LOG.debug("Is Footer: {}", isFooter);
// Get padding character
@@ -511,12 +531,28 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
}
}
-
+
+ /**
+ *
+ * @return
+ */
+ public Class<?> header() {
+ return header;
+ }
+
/**
* Flag indicating if we have a header
*/
public boolean hasHeader() {
return hasHeader;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Class<?> footer() {
+ return footer;
}
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/FixedLengthRecord.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/FixedLengthRecord.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/FixedLengthRecord.java
index cf88a2d..eca6fd1 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/FixedLengthRecord.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/FixedLengthRecord.java
@@ -59,12 +59,12 @@ public @interface FixedLengthRecord {
/**
* Indicates that the record(s) of this type may be preceded by a single header record at the beginning of in the file
*/
- boolean hasHeader() default false;
+ Class<?> header() default void.class;
/**
* Indicates that the record(s) of this type may be followed by a single footer record at the end of the file
*/
- boolean hasFooter() default false;
+ Class<?> footer() default void.class;
/**
* Configures the data format to skip marshalling / unmarshalling of the header record
@@ -77,16 +77,6 @@ public @interface FixedLengthRecord {
boolean skipFooter() default false;
/**
- * Identifies this FixedLengthRecord as a header record, which may precede all other records in the file
- */
- boolean isHeader() default false;
-
- /**
- * Identifies this FixedLengthRecord as a footer record, which may be used as the last record in the file
- */
- boolean isFooter() default false;
-
- /**
* Indicates whether trailing characters beyond the last mapped field may be ignored
*/
boolean ignoreTrailingChars() default false;
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
index 7c4a028..112330f 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
@@ -32,7 +32,6 @@ import org.apache.camel.dataformat.bindy.BindyAbstractFactory;
import org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
index 87b67e6..a51fad9 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import java.util.List;
-import java.util.Map;
-
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.model.car.Car;
@@ -51,10 +48,8 @@ public class BindyCarQuoteAndCommaDelimiterTest extends CamelTestSupport {
template.sendBody("direct:out", HEADER + "\n" + ROW);
assertMockEndpointsSatisfied();
-
- Map<?, ?> map1 = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
-
- Car rec1 = (Car) map1.values().iterator().next();
+
+ Car rec1 = mock.getReceivedExchanges().get(0).getIn().getBody(Car.class);
assertEquals("SS552", rec1.getStockid());
assertEquals("TOYOTA", rec1.getMake());
@@ -87,12 +82,13 @@ public class BindyCarQuoteAndCommaDelimiterTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
+ Class<?> type = org.apache.camel.dataformat.bindy.model.car.Car.class;
BindyCsvDataFormat dataFormat = new BindyCsvDataFormat();
- dataFormat.setClassType(org.apache.camel.dataformat.bindy.model.car.Car.class);
+ dataFormat.setClassType(type);
dataFormat.setLocale("en");
from("direct:out")
- .unmarshal().bindy(BindyType.Csv,org.apache.camel.dataformat.bindy.model.car.Car.class)
+ .unmarshal().bindy(BindyType.Csv,type)
.to("mock:out");
from("direct:in")
.marshal(dataFormat)
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
index 0356209..a7339c8 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import java.util.List;
-import java.util.Map;
-
import org.apache.camel.EndpointInject;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
@@ -56,8 +53,7 @@ public class BindyInlinedQuotesCsvUnmarshallTest extends AbstractJUnit4SpringCon
result.expectedMessageCount(1);
result.assertIsSatisfied();
- Map<?, ?> map = (Map<?, ?>) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- Order order = (Order) map.values().iterator().next();
+ Order order = result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
Assert.assertEquals(10, order.getOrderNr());
Assert.assertEquals("Pauline", order.getFirstName());
Assert.assertEquals("O'Donald", order.getLastName());
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
index 6202404..f6dabc8 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
@@ -17,7 +17,6 @@
package org.apache.camel.dataformat.bindy.csv;
import java.util.List;
-import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -40,11 +39,11 @@ public class BindyPipeDelimiterTest extends CamelTestSupport {
assertMockEndpointsSatisfied();
- Map<?, ?> map1 = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- Map<?, ?> map2 = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(1);
-
- MyData rec1 = (MyData) map1.values().iterator().next();
- MyData rec2 = (MyData) map2.values().iterator().next();
+ MyData rec1 = (MyData) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ MyData rec2 = (MyData) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(1);
+
+ //MyData rec1 = (MyData) map1.values().iterator().next();
+ //MyData rec2 = (MyData) map2.values().iterator().next();
assertEquals("COL1", rec1.getCol1());
assertEquals("COL2", rec1.getCol2());
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java
index 0df3f6d..1f6dc57 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java
@@ -16,14 +16,10 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import java.util.List;
-import java.util.Map;
-
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.model.simple.spanLastRecord.SpanLastRecord;
import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.CastUtils;
import org.junit.Test;
public class BindySimpleCsvAutospanLineTest extends CamelTestSupport {
@@ -37,9 +33,11 @@ public class BindySimpleCsvAutospanLineTest extends CamelTestSupport {
assertMockEndpointsSatisfied();
- final List<Map<?, SpanLastRecord>> rows = CastUtils.cast(mock.getReceivedExchanges().get(0).getIn().getBody(List.class));
- final SpanLastRecord order = rows.get(0).get(SpanLastRecord.class.getName());
+ //final List<Map<?, SpanLastRecord>> rows = CastUtils.cast(mock.getReceivedExchanges().get(0).getIn().getBody(List.class));
+ //final SpanLastRecord order = rows.get(0).get(SpanLastRecord.class.getName());
+ final SpanLastRecord order = mock.getReceivedExchanges().get(0).getIn().getBody(SpanLastRecord.class);
+
assertEquals(1, order.getRecordId());
assertEquals("hei", order.getName());
assertEquals("kommentar", order.getComment());
@@ -54,9 +52,8 @@ public class BindySimpleCsvAutospanLineTest extends CamelTestSupport {
assertMockEndpointsSatisfied();
- final List<Map<?, SpanLastRecord>> rows = CastUtils.cast(mock.getReceivedExchanges().get(0).getIn().getBody(List.class));
- final SpanLastRecord order = rows.get(0).get(SpanLastRecord.class.getName());
-
+ final SpanLastRecord order = mock.getReceivedExchanges().get(0).getIn().getBody(SpanLastRecord.class);
+
assertEquals(1, order.getRecordId());
assertEquals("hei", order.getName());
assertEquals("kommentar,test,noe,hei", order.getComment());
@@ -67,7 +64,8 @@ public class BindySimpleCsvAutospanLineTest extends CamelTestSupport {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- final BindyCsvDataFormat bindy = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.spanLastRecord");
+ final BindyCsvDataFormat bindy = new BindyCsvDataFormat(
+ org.apache.camel.dataformat.bindy.model.simple.spanLastRecord.SpanLastRecord.class);
from("direct:unmarshal")
.unmarshal(bindy)
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
index 35c382d..71993d4 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
@@ -16,8 +16,7 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import java.util.List;
-import java.util.Map;
+import static org.junit.Assert.assertEquals;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
@@ -35,8 +34,6 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import static org.junit.Assert.assertEquals;
-
@ContextConfiguration
public class BindySimpleCsvUnmarshallBadIntegerTest extends AbstractJUnit4SpringContextTests {
@@ -57,7 +54,6 @@ public class BindySimpleCsvUnmarshallBadIntegerTest extends AbstractJUnit4Spring
@EndpointInject(uri = URI_MOCK_ERROR)
private MockEndpoint error;
- @SuppressWarnings("unchecked")
@Test
@DirtiesContext
public void testIntegerMessage() throws Exception {
@@ -68,12 +64,10 @@ public class BindySimpleCsvUnmarshallBadIntegerTest extends AbstractJUnit4Spring
result.expectedMessageCount(1);
result.assertIsSatisfied();
-
- List<Map<String, org.apache.camel.dataformat.bindy.model.simple.oneclassmath.Math>> model = (List<Map<String, org.apache.camel.dataformat.bindy.model.simple.oneclassmath.Math>>)result
- .getExchanges().get(0).getIn().getBody();
-
- LOG.info(">>> Model generated : " + model.get(0).get("org.apache.camel.dataformat.bindy.model.simple.oneclassmath.Math").toString());
-
+
+ Object data = result.getReceivedExchanges().get(0).getIn().getBody();
+
+ LOG.info(">>> Model generated : " + data.getClass().getName());
}
@Test
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
index d42085e..52abc59 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.dataformat.bindy.csv;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
import java.util.List;
-import java.util.Map;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
@@ -35,11 +38,6 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-
@ContextConfiguration
public class BindySimpleCsvUnmarshallTest extends AbstractJUnit4SpringContextTests {
@@ -122,7 +120,7 @@ public class BindySimpleCsvUnmarshallTest extends AbstractJUnit4SpringContextTes
template.sendBody(expected);
- List<Map<String, Order>> orders = (List<Map<String, Order>>) result.getExchanges().get(0).getIn().getBody();
+ List<Order> orders = (List<Order>) result.getExchanges().get(0).getIn().getBody();
result.expectedMessageCount(1);
result.assertIsSatisfied();
@@ -130,7 +128,7 @@ public class BindySimpleCsvUnmarshallTest extends AbstractJUnit4SpringContextTes
assertNotNull(orders);
// As the @DataField defines a default value for the firstName, the
// value might not be empty
- assertFalse(orders.get(0).get(Order.class.getName()).getFirstName().isEmpty());
+ assertFalse(orders.get(0).getFirstName().isEmpty());
}
public static class ContextConfig extends RouteBuilder {
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java
index 8d28291..e58f49c 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySingleQuoteStartWordCsvUnmarshallTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import java.util.List;
-import java.util.Map;
-
import org.apache.camel.EndpointInject;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
@@ -56,8 +53,7 @@ public class BindySingleQuoteStartWordCsvUnmarshallTest extends AbstractJUnit4Sp
result.expectedMessageCount(1);
result.assertIsSatisfied();
- Map<?, ?> map = (Map<?, ?>) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- Order order = (Order) map.values().iterator().next();
+ Order order = result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
Assert.assertEquals(10, order.getOrderNr());
Assert.assertEquals("Patric", order.getFirstName());
Assert.assertEquals("'T jo", order.getLastName());
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/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 67abf4d..fb7bd77 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,15 +16,11 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import java.util.List;
-import java.util.Map;
-
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.model.tab.PurchaseOrder;
import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.CastUtils;
import org.junit.Test;
/**
@@ -45,14 +41,15 @@ public class BindyTabSeparatorTest extends CamelTestSupport {
/*
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());
assertEquals("Camel in Action", order.getName());
assertEquals(2, order.getAmount());
assertEquals("Please hurry", order.getOrderText());
assertEquals("Jane Doe", order.getSalesRef());
assertEquals("John Doe", order.getCustomerRef());
- */
}
@Test
@@ -84,11 +81,12 @@ 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());
+ //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);
+
assertEquals(123, order.getId());
assertEquals("Camel in Action", order.getName());
assertEquals(2, order.getAmount());
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java
index 91df474..b5af2b7 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyMarshalUnmarshalssueTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.camel.dataformat.bindy.csv2;
-import java.util.List;
-import java.util.Map;
-
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat;
@@ -44,9 +41,8 @@ public class BindyMarshalUnmarshalssueTest extends CamelTestSupport {
assertMockEndpointsSatisfied();
- Map<?, ?> map = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- WeatherModel model = (WeatherModel) map.values().iterator().next();
-
+ WeatherModel model = mock.getReceivedExchanges().get(0).getIn().getBody(WeatherModel.class);
+
assertEquals(123, model.getId());
assertEquals("Wednesday November 9 2011", model.getDate());
assertEquals("Central California", model.getPlace());
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
index c63b711..7516313 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
@@ -40,10 +40,9 @@ public class BindyUnmarshalCommaIssueTest extends CamelTestSupport {
template.sendBody("direct:start", body);
assertMockEndpointsSatisfied();
-
- Map<?, ?> map = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- WeatherModel model = (WeatherModel) map.values().iterator().next();
-
+
+ WeatherModel model = mock.getReceivedExchanges().get(0).getIn().getBody(WeatherModel.class);
+
assertEquals(123, model.getId());
assertEquals("Wednesday November 9 2011", model.getDate());
assertEquals("Central California", model.getPlace());
@@ -59,8 +58,7 @@ public class BindyUnmarshalCommaIssueTest extends CamelTestSupport {
assertMockEndpointsSatisfied();
- Map<?, ?> map = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- WeatherModel model = (WeatherModel) map.values().iterator().next();
+ WeatherModel model = mock.getReceivedExchanges().get(0).getIn().getBody(WeatherModel.class);
assertEquals(123, model.getId());
assertEquals("Wednesday, November 9, 2011", model.getDate());
@@ -77,9 +75,8 @@ public class BindyUnmarshalCommaIssueTest extends CamelTestSupport {
assertMockEndpointsSatisfied();
- Map<?, ?> map = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- WeatherModel model = (WeatherModel) map.values().iterator().next();
-
+ WeatherModel model = mock.getReceivedExchanges().get(0).getIn().getBody(WeatherModel.class);
+
assertEquals(123, model.getId());
assertEquals("Wednesday, November 9, 2011", model.getDate());
assertEquals("Central California, United States", model.getPlace());
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
index f88b3f7..a6f826a 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
@@ -27,8 +27,6 @@ import org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory;
import org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Header;
import org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Order;
import org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Trailer;
-import org.apache.camel.impl.DefaultPackageScanClassResolver;
-import org.apache.camel.spi.PackageScanClassResolver;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
index b9c222c..36ab6f4 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.dataformat.bindy.fix;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.bindy.CommonBindyTest;
import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
+import org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Order;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.test.annotation.DirtiesContext;
@@ -41,13 +42,15 @@ public class BindyComplexOneToManyKeyValuePairUnMarshallTest extends CommonBindy
result.assertIsSatisfied();
- String body = result.getReceivedExchanges().get(0).getIn().getBody(String.class);
- Assert.assertTrue(body.contains("BE.CHM.001, 11: CHM0001-01, 58: this is a camel - bindy test"));
- Assert.assertTrue(body.contains("22: 4, 48: BE0001245678, 54: 1"));
- Assert.assertTrue(body.contains("22: 5, 48: BE0009876543, 54: 2"));
- Assert.assertTrue(body.contains("22: 6, 48: BE0009999999, 54: 3"));
- Assert.assertTrue(body.contains("FIX 4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
- Assert.assertTrue(body.contains("10: 220"));
+ Order order1 = result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
+ Order order2 = result.getReceivedExchanges().get(1).getIn().getBody(Order.class);
+
+ Assert.assertTrue(order1.toString().contains("BE.CHM.001, 11: CHM0001-01, 58: this is a camel - bindy test"));
+ Assert.assertTrue(order1.getSecurities().get(0).toString().contains("22: 4, 48: BE0001245678, 54: 1"));
+ Assert.assertTrue(order1.getSecurities().get(1).toString().contains("22: 5, 48: BE0009876543, 54: 2"));
+ Assert.assertTrue(order1.getSecurities().get(2).toString().contains("22: 6, 48: BE0009999999, 54: 3"));
+ Assert.assertTrue(order2.getHeader().toString().contains("FIX 4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
+ Assert.assertTrue(order2.getTrailer().toString().contains("10: 220"));
}
public static class ContextConfig extends RouteBuilder {
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java
index a9e640b..b93f1d0 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.dataformat.bindy.fix;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.bindy.CommonBindyTest;
import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
+import org.apache.camel.dataformat.bindy.model.fix.sorted.body.Order;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.test.annotation.DirtiesContext;
@@ -26,22 +27,23 @@ import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration
public class BindySimpleKeyValuePairSortedUnmarshallTest extends CommonBindyTest {
-
+
+
@Test
@DirtiesContext
public void testUnMarshallMessage() throws Exception {
result.expectedMessageCount(1);
result.assertIsSatisfied();
- String body = result.getReceivedExchanges().get(0).getIn().getBody(String.class);
+ Order order = result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
- Assert.assertTrue(body.contains("10: 220"));
- Assert.assertTrue(body.contains("BE.CHM.001, 11: CHM0001-01, 22: 4, 48: BE0001245678, 54: 1, 58: this is a camel - bindy test"));
- Assert.assertTrue(body.contains("FIX.4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
+ Assert.assertTrue(order.getTrailer().toString().contains("10: 220"));
+ Assert.assertTrue(order.toString().contains("BE.CHM.001, 11: CHM0001-01, 22: 4, 48: BE0001245678, 54: 1, 58: this is a camel - bindy test"));
+ Assert.assertTrue(order.getHeader().toString().contains("FIX.4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.sorted.body.Order.class);
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(Order.class);
public void configure() {
from(URI_FILE_FIX).unmarshal(kvpBindyDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java
index 3e1a637..b3689c6 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.dataformat.bindy.fix;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.bindy.CommonBindyTest;
import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
+import org.apache.camel.dataformat.bindy.model.fix.tab.Order;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.test.annotation.DirtiesContext;
@@ -33,18 +34,18 @@ public class BindySimpleKeyValuePairTabUnmarshallTest extends CommonBindyTest {
result.expectedMessageCount(1);
result.assertIsSatisfied();
- String body = result.getReceivedExchanges().get(0).getIn().getBody(String.class);
- Assert.assertTrue(body.contains("FIX.4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
- Assert.assertTrue(body.contains("BE.CHM.001, 11: CHM0001-01, 22: 4, 48: BE0001245678, 54: 1, 58: this is a camel - bindy test"));
- Assert.assertTrue(body.contains("10: 220"));
+ Order order = result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
+
+ Assert.assertTrue(order.getHeader().toString().contains("FIX.4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
+ Assert.assertTrue(order.toString().contains("BE.CHM.001, 11: CHM0001-01, 22: 4, 48: BE0001245678, 54: 1, 58: this is a camel - bindy test"));
+ Assert.assertTrue(order.getTrailer().toString().contains("10: 220"));
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.tab.Order.class);
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(Order.class);
public void configure() {
from(URI_FILE_FIX_TAB).unmarshal(kvpBindyDataFormat).to(URI_MOCK_RESULT);
}
-
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
index fa08c65..357ae9d 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.dataformat.bindy.fix;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.bindy.CommonBindyTest;
+import org.apache.camel.dataformat.bindy.model.fix.simple.Order;
import org.apache.camel.model.dataformat.BindyType;
import org.junit.Assert;
import org.junit.Test;
@@ -33,17 +34,18 @@ public class BindySimpleKeyValuePairUnmarshallDslTest extends CommonBindyTest {
result.expectedMessageCount(1);
result.assertIsSatisfied();
- String body = result.getReceivedExchanges().get(0).getIn().getBody(String.class);
- Assert.assertTrue(body.contains("10: 220"));
- Assert.assertTrue(body.contains("FIX.4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
- Assert.assertTrue(body.contains("BE.CHM.001, 11: CHM0001-01, 22: 4, 48: BE0001245678, 54: 1, 58: this is a camel - bindy test"));
+ Order order = result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
+
+ Assert.assertTrue(order.getTrailer().toString().contains("10: 220"));
+ Assert.assertTrue(order.getHeader().toString().contains("FIX.4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
+ Assert.assertTrue(order.toString().contains("BE.CHM.001, 11: CHM0001-01, 22: 4, 48: BE0001245678, 54: 1, 58: this is a camel - bindy test"));
}
public static class ContextConfig extends RouteBuilder {
public void configure() {
from(URI_FILE_FIX).unmarshal()
- .bindy(BindyType.KeyValue, org.apache.camel.dataformat.bindy.model.fix.simple.Order.class)
+ .bindy(BindyType.KeyValue,Order.class)
.to(URI_MOCK_RESULT);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
index df063de..732515b 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.dataformat.bindy.fix;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.bindy.CommonBindyTest;
import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
+import org.apache.camel.dataformat.bindy.model.fix.simple.Order;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.test.annotation.DirtiesContext;
@@ -33,14 +34,14 @@ public class BindySimpleKeyValuePairUnmarshallTest extends CommonBindyTest {
result.expectedMessageCount(1);
result.assertIsSatisfied();
- String body = result.getReceivedExchanges().get(0).getIn().getBody(String.class);
- Assert.assertTrue(body.contains("10: 220"));
- Assert.assertTrue(body.contains("FIX.4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
- Assert.assertTrue(body.contains("BE.CHM.001, 11: CHM0001-01, 22: 4, 48: BE0001245678, 54: 1, 58: this is a camel - bindy test"));
+ Order order = result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
+ Assert.assertTrue(order.getTrailer().toString().contains("10: 220"));
+ Assert.assertTrue(order.getHeader().toString().contains("FIX.4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
+ Assert.assertTrue(order.toString().contains("BE.CHM.001, 11: CHM0001-01, 22: 4, 48: BE0001245678, 54: 1, 58: this is a camel - bindy test"));
}
public static class ContextConfig extends RouteBuilder {
- BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.simple.Order.class);
+ BindyKeyValuePairDataFormat kvpBindyDataFormat = new BindyKeyValuePairDataFormat(Order.class);
public void configure() {
from(URI_FILE_FIX).unmarshal(kvpBindyDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/Order.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/Order.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/Order.java
index 1f8e0e7..b4cbbcb 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/Order.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/Order.java
@@ -22,7 +22,7 @@ import java.util.Date;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-@FixedLengthRecord(hasHeader = true, hasFooter = true)
+@FixedLengthRecord(header = OrderHeader.class, footer = OrderFooter.class)
public class Order {
@DataField(pos = 1, length = 2)
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderFooter.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderFooter.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderFooter.java
index d025cb2..5b4b21f 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderFooter.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderFooter.java
@@ -19,7 +19,7 @@ package org.apache.camel.dataformat.bindy.fixed.headerfooter;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-@FixedLengthRecord(isFooter = true)
+@FixedLengthRecord
public class OrderFooter {
@DataField(pos = 1, length = 1)
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderHeader.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderHeader.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderHeader.java
index 0ca3a6c..f364ef8 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderHeader.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/OrderHeader.java
@@ -21,7 +21,7 @@ import java.util.Date;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-@FixedLengthRecord(isHeader = true)
+@FixedLengthRecord
public class OrderHeader {
@DataField(pos = 1, length = 1)
private int recordType = 1;
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java
index 0bc6fcc..323befd 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/link/BindySimpleFixedLengthWithLinkTest.java
@@ -16,10 +16,6 @@
*/
package org.apache.camel.dataformat.bindy.fixed.link;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
@@ -62,23 +58,11 @@ public class BindySimpleFixedLengthWithLinkTest extends CamelTestSupport {
// check the model
Exchange exchange = unmarshallResult.getReceivedExchanges().get(0);
- List<HashMap<String, Object>> results = (List) exchange.getIn().getBody();
- String orderKey = "org.apache.camel.dataformat.bindy.fixed.link.BindySimpleFixedLengthWithLinkTest$Order";
-
- for (int i = 0; i < results.size(); i++) {
- Map<String, Object> map = results.get(i);
- for (String key : map.keySet()) {
- if (key.equals(orderKey)) {
- Order order = (Order) map.get(orderKey);
- assertEquals("AAA", order.fieldA);
- assertEquals("CCC", order.fieldC);
- assertEquals("BBB", order.subRec.fieldB);
- }
- }
-
- }
-
-
+ Order order = exchange.getIn().getBody(Order.class);
+
+ assertEquals("AAA", order.fieldA);
+ assertEquals("CCC", order.fieldC);
+ assertEquals("BBB", order.subRec.fieldB);
}
// *************************************************************************
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/Order.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/Order.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/Order.java
index 476db12..c8c67b8 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/Order.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/Order.java
@@ -22,7 +22,7 @@ import java.util.Date;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-@FixedLengthRecord(hasHeader = true, hasFooter = true, skipHeader = true)
+@FixedLengthRecord(header = OrderHeader.class, footer = OrderFooter.class, skipHeader = true)
public class Order {
@DataField(pos = 1, length = 2)
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderFooter.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderFooter.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderFooter.java
index cb638ac..c652943 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderFooter.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderFooter.java
@@ -19,7 +19,7 @@ package org.apache.camel.dataformat.bindy.fixed.skipheader;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-@FixedLengthRecord(isFooter = true)
+@FixedLengthRecord
public class OrderFooter {
@DataField(pos = 1, length = 1)
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderHeader.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderHeader.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderHeader.java
index 82209b0..ec60156 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderHeader.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/OrderHeader.java
@@ -21,7 +21,7 @@ import java.util.Date;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-@FixedLengthRecord(isHeader = true)
+@FixedLengthRecord
public class OrderHeader {
@DataField(pos = 1, length = 1)
private int recordType = 1;
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
index b5f268b..d16b278 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
@@ -18,8 +18,6 @@ package org.apache.camel.dataformat.bindy.fixed.unmarshall.simple.trim;
import java.math.BigDecimal;
import java.util.Date;
-import java.util.List;
-import java.util.Map;
import org.apache.camel.EndpointInject;
import org.apache.camel.Produce;
@@ -61,8 +59,7 @@ public class BindySimpleFixedLengthUnmarshallTest extends AbstractJUnit4SpringCo
result.assertIsSatisfied();
// check the model
- Map<?, ?> map = (Map<?, ?>) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- BindySimpleFixedLengthUnmarshallTest.Order order = (BindySimpleFixedLengthUnmarshallTest.Order) map.values().iterator().next();
+ BindySimpleFixedLengthUnmarshallTest.Order order = result.getReceivedExchanges().get(0).getIn().getBody(BindySimpleFixedLengthUnmarshallTest.Order.class);
Assert.assertEquals(10, order.getOrderNr());
// the field is not trimmed
Assert.assertEquals(" Pauline", order.getFirstName());
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
index f121a7a..e26dcae 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
@@ -18,8 +18,6 @@ package org.apache.camel.dataformat.bindy.fixed.unmarshall.simple.trimfield;
import java.math.BigDecimal;
import java.util.Date;
-import java.util.List;
-import java.util.Map;
import org.apache.camel.EndpointInject;
import org.apache.camel.Produce;
@@ -61,8 +59,8 @@ public class BindySimpleFixedLengthUnmarshallTrimFieldTest extends AbstractJUnit
result.assertIsSatisfied();
// check the model
- Map<?, ?> map = (Map<?, ?>) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- BindySimpleFixedLengthUnmarshallTrimFieldTest.Order order = (BindySimpleFixedLengthUnmarshallTrimFieldTest.Order) map.values().iterator().next();
+
+ BindySimpleFixedLengthUnmarshallTrimFieldTest.Order order = result.getReceivedExchanges().get(0).getIn().getBody(BindySimpleFixedLengthUnmarshallTrimFieldTest.Order.class);
Assert.assertEquals(10, order.getOrderNr());
// the field is not trimmed
Assert.assertEquals("Pauline", order.getFirstName());
http://git-wip-us.apache.org/repos/asf/camel/blob/355becba/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest-context.xml b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest-context.xml
index 8ac0b90..77ba6ad 100644
--- a/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest-context.xml
+++ b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest-context.xml
@@ -32,7 +32,7 @@
</camelContext>
<bean id="csvBindyDataformat" class="org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat">
- <constructor-arg value="org.apache.camel.dataformat.bindy.model.simple.oneclass" />
+ <constructor-arg value="org.apache.camel.dataformat.bindy.model.simple.oneclass.Order" />
</bean>
</beans>
\ No newline at end of file
[11/12] camel git commit: Polished
Posted by da...@apache.org.
Polished
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3be04618
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3be04618
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3be04618
Branch: refs/heads/master
Commit: 3be04618eefb60499ef2a9b0f6bd2a28497b715c
Parents: d7be28f
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 7 11:13:52 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:13:52 2015 +0200
----------------------------------------------------------------------
.../bindy/csv/BindyCsvFieldEndingWithSeparatorIssueTest.java | 1 -
.../bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java | 1 +
.../bindy/fixed/delimited/BindyFixedLengthDelimitedFieldTest.java | 3 +--
.../bindy/fixed/dynamic/BindyFixedLengthDynamicFieldTest.java | 3 +--
.../headerfooter/BindySimpleFixedLengthHeaderFooterTest.java | 2 --
.../bindy/fixed/ordinal/BindySimpleFixedLengthOrdinalPosTest.java | 3 +--
.../bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java | 2 --
.../skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java | 2 --
8 files changed, 4 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3be04618/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvFieldEndingWithSeparatorIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvFieldEndingWithSeparatorIssueTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvFieldEndingWithSeparatorIssueTest.java
index fb4b33c..4e56f70 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvFieldEndingWithSeparatorIssueTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvFieldEndingWithSeparatorIssueTest.java
@@ -23,7 +23,6 @@ import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.model.csv.MyCsvRecord;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.model.dataformat.BindyType;
-
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Ignore;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/camel/blob/3be04618/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
index 6260d47..88c7ff2 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.dataformat.bindy.csv;
import java.util.List;
+
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.Produce;
http://git-wip-us.apache.org/repos/asf/camel/blob/3be04618/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/delimited/BindyFixedLengthDelimitedFieldTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/delimited/BindyFixedLengthDelimitedFieldTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/delimited/BindyFixedLengthDelimitedFieldTest.java
index 60fbb82..550b956 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/delimited/BindyFixedLengthDelimitedFieldTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/delimited/BindyFixedLengthDelimitedFieldTest.java
@@ -21,13 +21,12 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
-import org.apache.camel.EndpointInject;
+import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-
import org.apache.camel.model.dataformat.BindyDataFormat;
import org.apache.camel.model.dataformat.BindyType;
import org.apache.camel.test.junit4.CamelTestSupport;
http://git-wip-us.apache.org/repos/asf/camel/blob/3be04618/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/dynamic/BindyFixedLengthDynamicFieldTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/dynamic/BindyFixedLengthDynamicFieldTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/dynamic/BindyFixedLengthDynamicFieldTest.java
index 6fea020..6182905 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/dynamic/BindyFixedLengthDynamicFieldTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/dynamic/BindyFixedLengthDynamicFieldTest.java
@@ -21,13 +21,12 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
-import org.apache.camel.EndpointInject;
+import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-
import org.apache.camel.model.dataformat.BindyDataFormat;
import org.apache.camel.model.dataformat.BindyType;
import org.apache.camel.test.junit4.CamelTestSupport;
http://git-wip-us.apache.org/repos/asf/camel/blob/3be04618/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/BindySimpleFixedLengthHeaderFooterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/BindySimpleFixedLengthHeaderFooterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/BindySimpleFixedLengthHeaderFooterTest.java
index a268a37..a64a6dc 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/BindySimpleFixedLengthHeaderFooterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/BindySimpleFixedLengthHeaderFooterTest.java
@@ -27,11 +27,9 @@ import java.util.Map;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
-
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat;
-
import org.apache.camel.model.dataformat.BindyDataFormat;
import org.apache.camel.model.dataformat.BindyType;
import org.apache.camel.test.junit4.CamelTestSupport;
http://git-wip-us.apache.org/repos/asf/camel/blob/3be04618/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/ordinal/BindySimpleFixedLengthOrdinalPosTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/ordinal/BindySimpleFixedLengthOrdinalPosTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/ordinal/BindySimpleFixedLengthOrdinalPosTest.java
index bdff4c6..567df6d 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/ordinal/BindySimpleFixedLengthOrdinalPosTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/ordinal/BindySimpleFixedLengthOrdinalPosTest.java
@@ -21,13 +21,12 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
-import org.apache.camel.EndpointInject;
+import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-
import org.apache.camel.model.dataformat.BindyDataFormat;
import org.apache.camel.model.dataformat.BindyType;
import org.apache.camel.test.junit4.CamelTestSupport;
http://git-wip-us.apache.org/repos/asf/camel/blob/3be04618/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java
index c62e4e0..2621ca3 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipfields/BindySimpleSkipFieldsTest.java
@@ -20,12 +20,10 @@ import java.math.BigDecimal;
import java.util.Date;
import org.apache.camel.EndpointInject;
-
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-
import org.apache.camel.model.dataformat.BindyDataFormat;
import org.apache.camel.model.dataformat.BindyType;
import org.apache.camel.test.junit4.CamelTestSupport;
http://git-wip-us.apache.org/repos/asf/camel/blob/3be04618/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java
index 4feaa3a..8dea93f 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java
@@ -27,11 +27,9 @@ import java.util.Map;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
-
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat;
-
import org.apache.camel.model.dataformat.BindyDataFormat;
import org.apache.camel.model.dataformat.BindyType;
import org.apache.camel.test.junit4.CamelTestSupport;
[03/12] camel git commit: CAMEL-5958: Bindy ignores bean class type
(initial work)
Posted by da...@apache.org.
CAMEL-5958: Bindy ignores bean class type (initial work)
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ce6bf6e6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ce6bf6e6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ce6bf6e6
Branch: refs/heads/master
Commit: ce6bf6e6feb5f425cd544c4c1edfa2eb34641907
Parents: d780324
Author: lburgazzoli <lb...@gmail.com>
Authored: Sun Oct 27 16:04:33 2013 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:05:04 2015 +0200
----------------------------------------------------------------------
.../apache/camel/builder/DataFormatClause.java | 2 +
.../camel/model/dataformat/BindyDataFormat.java | 12 +-
.../bindy/BindyAbstractDataFormat.java | 25 +--
.../dataformat/bindy/BindyAbstractFactory.java | 108 +++-------
.../camel/dataformat/bindy/BindyCsvFactory.java | 187 ++++++++---------
.../bindy/BindyFixedLengthFactory.java | 208 ++++++++-----------
.../bindy/BindyKeyValuePairFactory.java | 128 +++++-------
.../bindy/csv/BindyCsvDataFormat.java | 17 +-
.../bindy/fixed/BindyFixedLengthDataFormat.java | 33 +--
.../bindy/kvp/BindyKeyValuePairDataFormat.java | 37 ++--
.../bindy/util/AnnotationModelLoader.java | 18 +-
.../csv/BindyCarQuoteAndCommaDelimiterTest.java | 15 +-
...ndyComplexCsvGenerateHeaderMarshallTest.java | 2 +-
.../bindy/csv/BindyComplexCsvMarshallTest.java | 2 +-
.../csv/BindyComplexCsvUnmarshallTest.java | 2 +-
.../csv/BindyCsvBigFileUnmarshallTest.java | 2 +-
.../csv/BindyDoubleQuotesCsvUnmarshallTest.java | 2 +-
.../BindyInlinedQuotesCsvUnmarshallTest.java | 2 +-
.../bindy/csv/BindyPipeDelimiterTest.java | 4 +-
.../csv/BindyPojoSimpleCsvMarshallTest.java | 2 +-
...indySimpleCsvGenerateHeaderMarshallTest.java | 2 +-
...ySimpleCsvMandatoryFieldsUnmarshallTest.java | 4 +-
.../csv/BindySimpleCsvMarshallDslTest.java | 2 +-
...dySimpleCsvMarshallPositionModifiedTest.java | 2 +-
.../bindy/csv/BindySimpleCsvMarshallTest.java | 2 +-
.../csv/BindySimpleCsvMarshallTrimClipTest.java | 2 +-
.../csv/BindySimpleCsvNullMarshallTest.java | 2 +-
.../BindySimpleCsvOneToManyMarshallTest.java | 2 +-
...SimpleCsvRemoveWhitespaceUnmarshallTest.java | 2 +-
...ndySimpleCsvSkipFirstLineUnmarshallTest.java | 2 +-
.../BindySimpleCsvUnmarshallBadIntegerTest.java | 2 +-
...SimpleCsvUnmarshallPositionModifiedTest.java | 2 +-
.../bindy/csv/BindySimpleCsvUnmarshallTest.java | 2 +-
...dySingleQuoteStartWordCsvUnmarshallTest.java | 2 +-
.../csv/BindySingleQuotesCsvUnmarshallTest.java | 2 +-
.../bindy/csv/BindyTabSeparatorTest.java | 8 +-
.../csv2/BindyMarshalUnmarshalssueTest.java | 4 +-
.../bindy/csv2/BindyMarshalWithQuoteTest.java | 2 +-
.../csv2/BindyUnmarshalCommaIssue2Test.java | 2 +-
.../csv2/BindyUnmarshalCommaIssueTest.java | 2 +-
.../BindyComplexKeyValuePairStandaloneTest.java | 3 +-
...plexOneToManyKeyValuePairUnMarshallTest.java | 2 +-
.../BindySimpleKeyValuePairMarshallDslTest.java | 2 +-
.../BindySimpleKeyValuePairMarshallTest.java | 2 +-
...BindySimpleKeyValuePairNullMarshallTest.java | 2 +-
...ndySimpleKeyValuePairSortedMarshallTest.java | 2 +-
...ySimpleKeyValuePairSortedUnmarshallTest.java | 2 +-
.../BindySimpleKeyValuePairTabMarshallTest.java | 2 +-
...indySimpleKeyValuePairTabUnmarshallTest.java | 2 +-
...indySimpleKeyValuePairUnmarshallDslTest.java | 2 +-
.../BindySimpleKeyValuePairUnmarshallTest.java | 2 +-
...yValuePairWithoutSectionMarshallDslTest.java | 2 +-
.../BindySimpleFixedLengthWithLinkTest.java | 2 +-
.../BindySimpleFixedLengthMarshallTest.java | 2 +-
...eFixedLengthMarshallWithClipAndTrimTest.java | 2 +-
...dySimpleFixedLengthMarshallWithClipTest.java | 2 +-
...SimpleFixedLengthMarshallWithNoClipTest.java | 2 +-
.../BindySimpleFixedLengthUnmarshallTest.java | 2 +-
...impleFixedLengthUnmarshallTrimFieldTest.java | 2 +-
.../date/BindyDatePatternCsvUnmarshallTest.java | 2 +-
60 files changed, 374 insertions(+), 525 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index 7887b14..6e915b6 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -156,12 +156,14 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
* @param type the type of bindy data format to use
* @param packages packages to scan for Bindy annotated POJO classes
*/
+ /*
public T bindy(BindyType type, String... packages) {
BindyDataFormat bindy = new BindyDataFormat();
bindy.setType(type);
bindy.setPackages(packages);
return dataFormat(bindy);
}
+ */
/**
* Uses the Bindy data format
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
index 09fb248..28d5cd2d 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
@@ -40,8 +40,8 @@ import org.apache.camel.util.ObjectHelper;
public class BindyDataFormat extends DataFormatDefinition {
@XmlAttribute(required = true)
private BindyType type;
- @XmlAttribute
- private String[] packages;
+ //@XmlAttribute
+ //private String[] packages;
@XmlAttribute
private String classType;
@XmlAttribute
@@ -64,6 +64,7 @@ public class BindyDataFormat extends DataFormatDefinition {
this.type = type;
}
+ /*
public String[] getPackages() {
return packages;
}
@@ -74,6 +75,7 @@ public class BindyDataFormat extends DataFormatDefinition {
public void setPackages(String[] packages) {
this.packages = packages;
}
+ */
public String getClassType() {
return classType;
@@ -104,12 +106,9 @@ public class BindyDataFormat extends DataFormatDefinition {
}
protected DataFormat createDataFormat(RouteContext routeContext) {
- if (packages == null && (classType == null && clazz == null)) {
+ if (classType == null && clazz == null) {
throw new IllegalArgumentException("Either packages or classType must be specified");
}
- if (packages != null && (classType != null || clazz != null)) {
- throw new IllegalArgumentException("Only one of packages and classType must be specified");
- }
if (type == BindyType.Csv) {
setDataFormatName("bindy-csv");
@@ -131,7 +130,6 @@ public class BindyDataFormat extends DataFormatDefinition {
@Override
protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
- setProperty(camelContext, dataFormat, "packages", packages);
setProperty(camelContext, dataFormat, "locale", locale);
setProperty(camelContext, dataFormat, "classType", clazz);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
index de9877d..af4609a 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
@@ -16,15 +16,13 @@
*/
package org.apache.camel.dataformat.bindy;
+import org.apache.camel.spi.DataFormat;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.PackageScanClassResolver;
-
public abstract class BindyAbstractDataFormat implements DataFormat {
- private String[] packages;
private String locale;
private BindyAbstractFactory modelFactory;
private Class<?> classType;
@@ -32,22 +30,10 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
public BindyAbstractDataFormat() {
}
- public BindyAbstractDataFormat(String... packages) {
- this.packages = packages;
- }
-
protected BindyAbstractDataFormat(Class<?> classType) {
this.classType = classType;
}
- public String[] getPackages() {
- return packages;
- }
-
- public void setPackages(String... packages) {
- this.packages = packages;
- }
-
public Class<?> getClassType() {
return classType;
}
@@ -64,9 +50,9 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
this.locale = locale;
}
- public BindyAbstractFactory getFactory(PackageScanClassResolver resolver) throws Exception {
+ public BindyAbstractFactory getFactory() throws Exception {
if (modelFactory == null) {
- modelFactory = createModelFactory(resolver);
+ modelFactory = createModelFactory();
modelFactory.setLocale(locale);
}
return modelFactory;
@@ -76,7 +62,6 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
this.modelFactory = modelFactory;
}
- protected abstract BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception;
protected Object extractUnmarshalResult(List<Map<String, Object>> models) {
if (getClassType() != null) {
@@ -98,4 +83,6 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
return models;
}
}
+
+ protected abstract BindyAbstractFactory createModelFactory() throws Exception;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
index f514702..1694847 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
@@ -16,22 +16,23 @@
*/
package org.apache.camel.dataformat.bindy;
+import org.apache.camel.dataformat.bindy.annotation.CsvRecord;
+import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
+import org.apache.camel.dataformat.bindy.annotation.Link;
+import org.apache.camel.dataformat.bindy.annotation.Message;
+import org.apache.camel.dataformat.bindy.annotation.Section;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.lang.reflect.Field;
import java.text.NumberFormat;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.camel.dataformat.bindy.util.AnnotationModelLoader;
-import org.apache.camel.spi.PackageScanClassResolver;
-import org.apache.camel.spi.PackageScanFilter;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* The {@link BindyAbstractFactory} implements what its common to all the formats
* supported by Camel Bindy
@@ -39,61 +40,29 @@ import org.slf4j.LoggerFactory;
public abstract class BindyAbstractFactory implements BindyFactory {
private static final Logger LOG = LoggerFactory.getLogger(BindyAbstractFactory.class);
protected final Map<String, List<Field>> annotatedLinkFields = new LinkedHashMap<String, List<Field>>();
- protected Set<Class<?>> models;
- protected Set<String> modelClassNames;
protected String crlf;
- private AnnotationModelLoader modelsLoader;
-
- private String[] packageNames;
private String locale;
private Class<?> type;
-
- public BindyAbstractFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
- this.modelsLoader = new AnnotationModelLoader(resolver);
- this.packageNames = packageNames;
-
- if (LOG.isDebugEnabled()) {
- for (String str : this.packageNames) {
- LOG.debug("Package name: {}", str);
- }
- }
-
- initModel();
- }
- public BindyAbstractFactory(PackageScanClassResolver resolver, Class<?> type) throws Exception {
- this.modelsLoader = new AnnotationModelLoader(resolver);
+ public BindyAbstractFactory(Class<?> type) throws Exception {
this.type = type;
if (LOG.isDebugEnabled()) {
LOG.debug("Class name: {}", type.getName());
}
-
- initModel();
- }
- public BindyAbstractFactory(PackageScanClassResolver resolver, Class<?> type, PackageScanFilter scanFilter) throws Exception {
- this.modelsLoader = new AnnotationModelLoader(resolver, scanFilter);
- this.type = type;
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class name: {}", type.getName());
+ if(!validateType(type)) {
+ throw new IllegalArgumentException("...");
}
-
+
initModel();
}
- public BindyAbstractFactory(PackageScanClassResolver resolver, String[] packageNames, PackageScanFilter scanFilter) throws Exception {
- this.modelsLoader = new AnnotationModelLoader(resolver, scanFilter);
- this.packageNames = packageNames;
-
- if (LOG.isDebugEnabled()) {
- for (String str : this.packageNames) {
- LOG.debug("Package name: {}", str);
- }
- }
-
- initModel();
+ protected boolean validateType(Class<?> type) {
+ return type.getAnnotation(CsvRecord.class) != null
+ || type.getAnnotation(Message.class) != null
+ || type.getAnnotation(Section.class) != null
+ || type.getAnnotation(FixedLengthRecord.class) != null;
}
/**
@@ -104,29 +73,6 @@ public abstract class BindyAbstractFactory implements BindyFactory {
* @throws Exception
*/
public void initModel() throws Exception {
- // Find classes defined as Model
- if (packageNames != null) {
- initModelClasses(this.packageNames);
- } else if (type != null) {
- // use the package name from the type as it may refer to types in the same package
- String pckName = type.getPackage().getName();
- initModelClasses(pckName);
-
- } else {
- throw new IllegalArgumentException("Either packagenames or type should be configured");
- }
-
- modelClassNames = new HashSet<String>();
- for (Class<?> clazz : models) {
- modelClassNames.add(clazz.getName());
- }
- }
-
- /**
- * Find all the classes defined as model
- */
- private void initModelClasses(String... packageNames) throws Exception {
- models = modelsLoader.loadModels(packageNames);
}
/**
@@ -164,6 +110,14 @@ public abstract class BindyAbstractFactory implements BindyFactory {
}
/**
+ *
+ * @return
+ */
+ protected Class<?> type() {
+ return type;
+ }
+
+ /**
* Factory method generating new instances of the model and adding them to a
* HashMap
*
@@ -174,12 +128,8 @@ public abstract class BindyAbstractFactory implements BindyFactory {
public Map<String, Object> factory() throws Exception {
Map<String, Object> mapModel = new HashMap<String, Object>();
- for (Class<?> cl : models) {
- Object obj = ObjectHelper.newInstance(cl);
-
- // Add instance of the class to the Map Model
- mapModel.put(obj.getClass().getName(), obj);
- }
+ Object obj = ObjectHelper.newInstance(type);
+ mapModel.put(obj.getClass().getName(), obj);
return mapModel;
}
@@ -190,7 +140,7 @@ public abstract class BindyAbstractFactory implements BindyFactory {
* @return true if the model supports the identified classes
*/
public boolean supportsModel(Set<String> classes) {
- return modelClassNames.containsAll(classes);
+ return classes.contains(type);
}
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
index 16a4263..389ede2 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
@@ -34,7 +34,6 @@ import org.apache.camel.dataformat.bindy.annotation.OneToMany;
import org.apache.camel.dataformat.bindy.annotation.Section;
import org.apache.camel.dataformat.bindy.format.FormatException;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
-import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,15 +67,8 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
private boolean quoting;
private boolean autospanLine;
- public BindyCsvFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
- super(resolver, packageNames);
-
- // initialize specific parameters of the csv model
- initCsvModel();
- }
-
- public BindyCsvFactory(PackageScanClassResolver resolver, Class<?> type) throws Exception {
- super(resolver, type);
+ public BindyCsvFactory(Class<?> type) throws Exception {
+ super(type);
// initialize specific parameters of the csv model
initCsvModel();
@@ -104,58 +96,57 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
public void initAnnotatedFields() {
maxpos = 0;
- for (Class<?> cl : models) {
- List<Field> linkFields = new ArrayList<Field>();
+ Class<?> cl = type();
+ List<Field> linkFields = new ArrayList<Field>();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class retrieved: {}", cl.getName());
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class retrieved: {}", cl.getName());
+ }
- for (Field field : cl.getDeclaredFields()) {
- DataField dataField = field.getAnnotation(DataField.class);
- if (dataField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Position defined in the class: {}, position: {}, Field: {}",
- new Object[]{cl.getName(), dataField.pos(), dataField});
- }
+ for (Field field : cl.getDeclaredFields()) {
+ DataField dataField = field.getAnnotation(DataField.class);
+ if (dataField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Position defined in the class: {}, position: {}, Field: {}",
+ new Object[]{cl.getName(), dataField.pos(), dataField});
+ }
- if (dataField.required()) {
- ++numberMandatoryFields;
- } else {
- ++numberOptionalFields;
- }
+ if (dataField.required()) {
+ ++numberMandatoryFields;
+ } else {
+ ++numberOptionalFields;
+ }
- int pos = dataField.pos();
- if (annotatedFields.containsKey(pos)) {
- Field f = annotatedFields.get(pos);
- LOG.warn("Potentially invalid model: existing @DataField '{}' replaced by '{}'", f.getName(), field.getName());
- }
- dataFields.put(pos, dataField);
- annotatedFields.put(pos, field);
- maxpos = Math.max(maxpos, pos);
+ int pos = dataField.pos();
+ if (annotatedFields.containsKey(pos)) {
+ Field f = annotatedFields.get(pos);
+ LOG.warn("Potentially invalid model: existing @DataField '{}' replaced by '{}'", f.getName(), field.getName());
}
+ dataFields.put(pos, dataField);
+ annotatedFields.put(pos, field);
+ maxpos = Math.max(maxpos, pos);
+ }
- Link linkField = field.getAnnotation(Link.class);
+ Link linkField = field.getAnnotation(Link.class);
- if (linkField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
- }
- linkFields.add(field);
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
}
+ linkFields.add(field);
}
+ }
- if (!linkFields.isEmpty()) {
- annotatedLinkFields.put(cl.getName(), linkFields);
- }
+ if (!linkFields.isEmpty()) {
+ annotatedLinkFields.put(cl.getName(), linkFields);
+ }
- totalFields = numberMandatoryFields + numberOptionalFields;
+ totalFields = numberMandatoryFields + numberOptionalFields;
- if (LOG.isDebugEnabled()) {
- LOG.debug("Number of optional fields: {}", numberOptionalFields);
- LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
- LOG.debug("Total: {}", totalFields);
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Number of optional fields: {}", numberOptionalFields);
+ LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
+ LOG.debug("Total: {}", totalFields);
}
if (annotatedFields.size() < maxpos) {
@@ -254,20 +245,18 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
LOG.debug("Separator converted: '0x{}', from: {}", Integer.toHexString(separator), this.getSeparator());
}
- for (Class<?> clazz : models) {
- if (model.containsKey(clazz.getName())) {
+ Class<?> clazz = type();
+ if (model.containsKey(clazz.getName())) {
- Object obj = model.get(clazz.getName());
-
- if (obj != null && LOG.isDebugEnabled()) {
- LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
- }
- if (obj != null) {
+ Object obj = model.get(clazz.getName());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
+ }
+ if (obj != null) {
- // Generate Csv table
- generateCsvPositionMap(clazz, obj, results);
+ // Generate Csv table
+ generateCsvPositionMap(clazz, obj, results);
- }
}
}
@@ -526,60 +515,60 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
*/
private void initCsvRecordParameters() {
if (separator == null) {
- for (Class<?> cl : models) {
+ Class<?> cl = type();
- // Get annotation @CsvRecord from the class
- CsvRecord record = cl.getAnnotation(CsvRecord.class);
+ // Get annotation @CsvRecord from the class
+ CsvRecord record = cl.getAnnotation(CsvRecord.class);
- // Get annotation @Section from the class
- Section section = cl.getAnnotation(Section.class);
+ // Get annotation @Section from the class
+ Section section = cl.getAnnotation(Section.class);
- if (record != null) {
- LOG.debug("Csv record: {}", record);
+ if (record != null) {
+ LOG.debug("Csv record: {}", record);
- // Get skipFirstLine parameter
- skipFirstLine = record.skipFirstLine();
- LOG.debug("Skip First Line parameter of the CSV: {}" + skipFirstLine);
+ // Get skipFirstLine parameter
+ skipFirstLine = record.skipFirstLine();
+ LOG.debug("Skip First Line parameter of the CSV: {}" + skipFirstLine);
- // Get generateHeaderColumnNames parameter
- generateHeaderColumnNames = record.generateHeaderColumns();
- LOG.debug("Generate header column names parameter of the CSV: {}", generateHeaderColumnNames);
+ // Get generateHeaderColumnNames parameter
+ generateHeaderColumnNames = record.generateHeaderColumns();
+ LOG.debug("Generate header column names parameter of the CSV: {}", generateHeaderColumnNames);
- // Get Separator parameter
- ObjectHelper.notNull(record.separator(), "No separator has been defined in the @Record annotation");
- separator = record.separator();
- LOG.debug("Separator defined for the CSV: {}", separator);
+ // Get Separator parameter
+ ObjectHelper.notNull(record.separator(), "No separator has been defined in the @Record annotation");
+ separator = record.separator();
+ LOG.debug("Separator defined for the CSV: {}", separator);
- // Get carriage return parameter
- crlf = record.crlf();
- LOG.debug("Carriage return defined for the CSV: {}", crlf);
+ // Get carriage return parameter
+ crlf = record.crlf();
+ LOG.debug("Carriage return defined for the CSV: {}", crlf);
- // Get isOrdered parameter
- messageOrdered = record.isOrdered();
- LOG.debug("Must CSV record be ordered: {}", messageOrdered);
+ // Get isOrdered parameter
+ messageOrdered = record.isOrdered();
+ LOG.debug("Must CSV record be ordered: {}", messageOrdered);
- if (ObjectHelper.isNotEmpty(record.quote())) {
- quote = record.quote();
- LOG.debug("Quoting columns with: {}", quote);
- }
+ if (ObjectHelper.isNotEmpty(record.quote())) {
+ quote = record.quote();
+ LOG.debug("Quoting columns with: {}", quote);
+ }
- quoting = record.quoting();
- LOG.debug("CSV will be quoted: {}", quoting);
+ quoting = record.quoting();
+ LOG.debug("CSV will be quoted: {}", quoting);
- autospanLine = record.autospanLine();
- LOG.debug("Autospan line in last record: {}", autospanLine);
- }
+ autospanLine = record.autospanLine();
+ LOG.debug("Autospan line in last record: {}", autospanLine);
+ }
- if (section != null) {
- // Test if section number is not null
- ObjectHelper.notNull(section.number(), "No number has been defined for the section");
+ if (section != null) {
+ // Test if section number is not null
+ ObjectHelper.notNull(section.number(), "No number has been defined for the section");
- // Get section number and add it to the sections
- sections.put(cl.getName(), section.number());
- }
+ // Get section number and add it to the sections
+ sections.put(cl.getName(), section.number());
}
}
}
+
/**
* Set the default values for the non defined fields.
* @param model the model which has its default fields set.
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/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 2220adc..e44432b 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
@@ -65,30 +65,13 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
private int recordLength;
private boolean ignoreTrailingChars;
- public BindyFixedLengthFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
- super(resolver, packageNames);
-
- // initialize specific parameters of the fixed length model
- initFixedLengthModel();
- }
-
- public BindyFixedLengthFactory(PackageScanClassResolver resolver, PackageScanFilter scanFilter, String... packageNames) throws Exception {
- super(resolver, packageNames, scanFilter);
- initFixedLengthModel();
- }
-
- public BindyFixedLengthFactory(PackageScanClassResolver resolver, Class<?> type) throws Exception {
- super(resolver, type);
+ public BindyFixedLengthFactory(Class<?> type) throws Exception {
+ super(type);
// initialize specific parameters of the fixed length model
initFixedLengthModel();
}
- public BindyFixedLengthFactory(PackageScanClassResolver resolver, PackageScanFilter scanFilter, Class<?> type) throws Exception {
- super(resolver, type, scanFilter);
- initFixedLengthModel();
- }
-
/**
* method uses to initialize the model representing the classes who will
* bind the data. This process will scan for classes according to the
@@ -105,56 +88,52 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
}
public void initAnnotatedFields() {
+ Class<?> cl = type();
+ List<Field> linkFields = new ArrayList<Field>();
- for (Class<?> cl : models) {
-
- List<Field> linkFields = new ArrayList<Field>();
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class retrieved: {}", cl.getName());
- }
-
- for (Field field : cl.getDeclaredFields()) {
- DataField dataField = field.getAnnotation(DataField.class);
- if (dataField != null) {
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Position defined in the class: {}, position: {}, Field: {}", new Object[]{cl.getName(), dataField.pos(), dataField});
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class retrieved: {}", cl.getName());
+ }
- if (dataField.required()) {
- ++numberMandatoryFields;
- } else {
- ++numberOptionalFields;
- }
+ for (Field field : cl.getDeclaredFields()) {
+ DataField dataField = field.getAnnotation(DataField.class);
+ if (dataField != null) {
- dataFields.put(dataField.pos(), dataField);
- annotatedFields.put(dataField.pos(), field);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Position defined in the class: {}, position: {}, Field: {}", new Object[]{cl.getName(), dataField.pos(), dataField});
}
- Link linkField = field.getAnnotation(Link.class);
-
- if (linkField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
- }
- linkFields.add(field);
+ if (dataField.required()) {
+ ++numberMandatoryFields;
+ } else {
+ ++numberOptionalFields;
}
+ dataFields.put(dataField.pos(), dataField);
+ annotatedFields.put(dataField.pos(), field);
}
- if (!linkFields.isEmpty()) {
- annotatedLinkFields.put(cl.getName(), linkFields);
+ Link linkField = field.getAnnotation(Link.class);
+
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
+ }
+ linkFields.add(field);
}
- totalFields = numberMandatoryFields + numberOptionalFields;
+ }
- if (LOG.isDebugEnabled()) {
- LOG.debug("Number of optional fields: {}", numberOptionalFields);
- LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
- LOG.debug("Total: {}", totalFields);
- }
+ if (!linkFields.isEmpty()) {
+ annotatedLinkFields.put(cl.getName(), linkFields);
+ }
+
+ totalFields = numberMandatoryFields + numberOptionalFields;
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Number of optional fields: {}", numberOptionalFields);
+ LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
+ LOG.debug("Total: {}", totalFields);
}
}
@@ -298,23 +277,21 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
StringBuilder buffer = new StringBuilder();
Map<Integer, List<String>> results = new HashMap<Integer, List<String>>();
- for (Class<?> clazz : models) {
+ Class<?> clazz = type();
+ if (model.containsKey(clazz.getName())) {
- if (model.containsKey(clazz.getName())) {
+ Object obj = model.get(clazz.getName());
- Object obj = model.get(clazz.getName());
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
+ }
- if (obj != null) {
+ if (obj != null) {
- // Generate Fixed Length table
- // containing the positions of the fields
- generateFixedLengthPositionMap(clazz, obj, results);
+ // Generate Fixed Length table
+ // containing the positions of the fields
+ generateFixedLengthPositionMap(clazz, obj, results);
- }
}
}
@@ -466,54 +443,53 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
*/
private void initFixedLengthRecordParameters() {
- for (Class<?> cl : models) {
-
- // Get annotation @FixedLengthRecord from the class
- FixedLengthRecord record = cl.getAnnotation(FixedLengthRecord.class);
-
- if (record != null) {
- LOG.debug("Fixed length record: {}", record);
-
- // Get carriage return parameter
- crlf = record.crlf();
- LOG.debug("Carriage return defined for the CSV: {}", crlf);
-
- // Get hasHeader parameter
- hasHeader = record.hasHeader();
- LOG.debug("Has Header: {}", hasHeader);
-
- // Get skipHeader parameter
- skipHeader = record.skipHeader();
- LOG.debug("Skip Header: {}", skipHeader);
-
- // Get hasFooter parameter
- hasFooter = record.hasFooter();
- LOG.debug("Has Footer: {}", hasFooter);
-
- // Get skipFooter parameter
- skipFooter = record.skipFooter();
- LOG.debug("Skip Footer: {}", skipFooter);
-
- // Get isHeader parameter
- isHeader = record.isHeader();
- LOG.debug("Is Header: {}", isHeader);
-
- // Get isFooter parameter
- isFooter = record.isFooter();
- LOG.debug("Is Footer: {}", isFooter);
-
- // Get padding character
- paddingChar = record.paddingChar();
- LOG.debug("Padding char: {}", paddingChar);
-
- // Get length of the record
- recordLength = record.length();
- LOG.debug("Length of the record: {}", recordLength);
-
- // Get flag for ignore trailing characters
- ignoreTrailingChars = record.ignoreTrailingChars();
- LOG.debug("Ignore trailing chars: {}", ignoreTrailingChars);
- }
+ Class<?> cl = type();
+
+ // Get annotation @FixedLengthRecord from the class
+ FixedLengthRecord record = cl.getAnnotation(FixedLengthRecord.class);
+
+ if (record != null) {
+ LOG.debug("Fixed length record: {}", record);
+
+ // Get carriage return parameter
+ crlf = record.crlf();
+ LOG.debug("Carriage return defined for the CSV: {}", crlf);
+
+ // Get hasHeader parameter
+ hasHeader = record.hasHeader();
+ LOG.debug("Has Header: {}", hasHeader);
+
+ // Get skipHeader parameter
+ skipHeader = record.skipHeader();
+ LOG.debug("Skip Header: {}", skipHeader);
+
+ // Get hasFooter parameter
+ hasFooter = record.hasFooter();
+ LOG.debug("Has Footer: {}", hasFooter);
+
+ // Get skipFooter parameter
+ skipFooter = record.skipFooter();
+ LOG.debug("Skip Footer: {}", skipFooter);
+
+ // Get isHeader parameter
+ isHeader = record.isHeader();
+ LOG.debug("Is Header: {}", isHeader);
+
+ // Get isFooter parameter
+ isFooter = record.isFooter();
+ LOG.debug("Is Footer: {}", isFooter);
+
+ // Get padding character
+ paddingChar = record.paddingChar();
+ LOG.debug("Padding char: {}", paddingChar);
+
+ // Get length of the record
+ recordLength = record.length();
+ LOG.debug("Length of the record: {}", recordLength);
+
+ // Get flag for ignore trailing characters
+ ignoreTrailingChars = record.ignoreTrailingChars();
+ LOG.debug("Ignore trailing chars: {}", ignoreTrailingChars);
}
if (hasHeader && isHeader) {
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
index 020820a..9418f40 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
@@ -55,15 +55,9 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
private String pairSeparator;
private boolean messageOrdered;
- public BindyKeyValuePairFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
- super(resolver, packageNames);
- // Initialize what is specific to Key Value Pair model
- initKeyValuePairModel();
- }
-
- public BindyKeyValuePairFactory(PackageScanClassResolver resolver, Class<?> type) throws Exception {
- super(resolver, type);
+ public BindyKeyValuePairFactory(Class<?> type) throws Exception {
+ super(type);
// Initialize what is specific to Key Value Pair model
initKeyValuePairModel();
@@ -89,34 +83,31 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
public void initAnnotatedFields() {
- for (Class<?> cl : models) {
+ Class<?> cl = type();
+ List<Field> linkFields = new ArrayList<Field>();
- List<Field> linkFields = new ArrayList<Field>();
-
- for (Field field : cl.getDeclaredFields()) {
- KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
- if (keyValuePairField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Key declared in the class : {}, key : {}, Field : {}", new Object[]{cl.getName(), keyValuePairField.tag(), keyValuePairField});
- }
- keyValuePairFields.put(keyValuePairField.tag(), keyValuePairField);
- annotatedFields.put(keyValuePairField.tag(), field);
+ for (Field field : cl.getDeclaredFields()) {
+ KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
+ if (keyValuePairField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Key declared in the class : {}, key : {}, Field : {}", new Object[]{cl.getName(), keyValuePairField.tag(), keyValuePairField});
}
+ keyValuePairFields.put(keyValuePairField.tag(), keyValuePairField);
+ annotatedFields.put(keyValuePairField.tag(), field);
+ }
- Link linkField = field.getAnnotation(Link.class);
+ Link linkField = field.getAnnotation(Link.class);
- if (linkField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class linked : {}, Field {}", cl.getName(), field);
- }
- linkFields.add(field);
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked : {}, Field {}", cl.getName(), field);
}
+ linkFields.add(field);
}
+ }
- if (!linkFields.isEmpty()) {
- annotatedLinkFields.put(cl.getName(), linkFields);
- }
-
+ if (!linkFields.isEmpty()) {
+ annotatedLinkFields.put(cl.getName(), linkFields);
}
}
@@ -170,19 +161,15 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
}
- // Iterate over the model
- for (Class<?> clazz : models) {
+ Class<?> clazz = type();
+ Object obj = model.get(clazz.getName());
- Object obj = model.get(clazz.getName());
+ if (obj != null) {
- if (obj != null) {
-
- // Generate model from key value map
- generateModelFromKeyValueMap(clazz, obj, results, line, lists);
+ // Generate model from key value map
+ generateModelFromKeyValueMap(clazz, obj, results, line, lists);
- }
}
-
}
private void generateModelFromKeyValueMap(Class<?> clazz, Object obj, Map<Integer, List<String>> results, int line, Map<String, List<Object>> lists) throws Exception {
@@ -594,43 +581,40 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
*/
private void initMessageParameters() {
if ((pairSeparator == null) || (keyValuePairSeparator == null)) {
- for (Class<?> cl : models) {
- // Get annotation @Message from the class
- Message message = cl.getAnnotation(Message.class);
-
- // Get annotation @Section from the class
- Section section = cl.getAnnotation(Section.class);
-
- if (message != null) {
- // Get Pair Separator parameter
- ObjectHelper.notNull(message.pairSeparator(), "No Pair Separator has been defined in the @Message annotation");
- pairSeparator = message.pairSeparator();
- LOG.debug("Pair Separator defined for the message: {}", pairSeparator);
-
- // Get KeyValuePair Separator parameter
- ObjectHelper.notNull(message.keyValuePairSeparator(), "No Key Value Pair Separator has been defined in the @Message annotation");
- keyValuePairSeparator = message.keyValuePairSeparator();
- LOG.debug("Key Value Pair Separator defined for the message: {}", keyValuePairSeparator);
-
- // Get carriage return parameter
- crlf = message.crlf();
- LOG.debug("Carriage return defined for the message: {}", crlf);
-
- // Get isOrdered parameter
- messageOrdered = message.isOrdered();
- LOG.debug("Is the message ordered in output: {}", messageOrdered);
- }
+ Class<?> cl = type();
+ // Get annotation @Message from the class
+ Message message = cl.getAnnotation(Message.class);
+
+ // Get annotation @Section from the class
+ Section section = cl.getAnnotation(Section.class);
+
+ if (message != null) {
+ // Get Pair Separator parameter
+ ObjectHelper.notNull(message.pairSeparator(), "No Pair Separator has been defined in the @Message annotation");
+ pairSeparator = message.pairSeparator();
+ LOG.debug("Pair Separator defined for the message: {}", pairSeparator);
+
+ // Get KeyValuePair Separator parameter
+ ObjectHelper.notNull(message.keyValuePairSeparator(), "No Key Value Pair Separator has been defined in the @Message annotation");
+ keyValuePairSeparator = message.keyValuePairSeparator();
+ LOG.debug("Key Value Pair Separator defined for the message: {}", keyValuePairSeparator);
+
+ // Get carriage return parameter
+ crlf = message.crlf();
+ LOG.debug("Carriage return defined for the message: {}", crlf);
+
+ // Get isOrdered parameter
+ messageOrdered = message.isOrdered();
+ LOG.debug("Is the message ordered in output: {}", messageOrdered);
+ }
- if (section != null) {
- // Test if section number is not null
- ObjectHelper.notNull(section.number(), "No number has been defined for the section");
+ if (section != null) {
+ // Test if section number is not null
+ ObjectHelper.notNull(section.number(), "No number has been defined for the section");
- // Get section number and add it to the sections
- sections.put(cl.getName(), section.number());
- }
+ // Get section number and add it to the sections
+ sections.put(cl.getName(), section.number());
}
}
}
-
-
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
index d8ef0c6..a85b5fa 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
@@ -35,7 +35,6 @@ import org.apache.camel.dataformat.bindy.BindyCsvFactory;
import org.apache.camel.dataformat.bindy.annotation.Link;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -51,10 +50,6 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
public BindyCsvDataFormat() {
}
- public BindyCsvDataFormat(String... packages) {
- super(packages);
- }
-
public BindyCsvDataFormat(Class<?> type) {
super(type);
}
@@ -62,7 +57,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
@SuppressWarnings("unchecked")
public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
- BindyCsvFactory factory = (BindyCsvFactory)getFactory(exchange.getContext().getPackageScanClassResolver());
+ BindyCsvFactory factory = (BindyCsvFactory)getFactory();
ObjectHelper.notNull(factory, "not instantiated");
// Get CRLF
@@ -117,7 +112,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
}
public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
- BindyCsvFactory factory = (BindyCsvFactory)getFactory(exchange.getContext().getPackageScanClassResolver());
+ BindyCsvFactory factory = (BindyCsvFactory)getFactory();
ObjectHelper.notNull(factory, "not instantiated");
// List of Pojos
@@ -313,11 +308,7 @@ public class BindyCsvDataFormat extends BindyAbstractDataFormat {
}
@Override
- protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
- if (getClassType() != null) {
- return new BindyCsvFactory(resolver, getClassType());
- } else {
- return new BindyCsvFactory(resolver, getPackages());
- }
+ protected BindyAbstractFactory createModelFactory() throws Exception {
+ return new BindyCsvFactory(getClassType());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/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 180b982..e65c715 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
@@ -60,10 +60,6 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
public BindyFixedLengthDataFormat() {
}
- public BindyFixedLengthDataFormat(String... packages) {
- super(packages);
- }
-
public BindyFixedLengthDataFormat(Class<?> type) {
super(type);
}
@@ -71,7 +67,7 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
@SuppressWarnings("unchecked")
public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
PackageScanClassResolver resolver = exchange.getContext().getPackageScanClassResolver();
- BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory(resolver);
+ BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory();
ObjectHelper.notNull(factory, "not instantiated");
// Get CRLF
@@ -153,7 +149,7 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
PackageScanClassResolver resolver = exchange.getContext().getPackageScanClassResolver();
- BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory(resolver);
+ BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory();
ObjectHelper.notNull(factory, "not instantiated");
// List of Pojos
@@ -269,7 +265,7 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
}
@Override
- protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
+ protected BindyAbstractFactory createModelFactory() throws Exception {
// Initialize the primary (body) model factory ignoring header and footer model classes
PackageScanFilter defaultRecordScanFilter = new PackageScanFilter() {
@@ -280,12 +276,7 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
}
};
- BindyFixedLengthFactory factory;
- if (getClassType() != null) {
- factory = new BindyFixedLengthFactory(resolver, defaultRecordScanFilter, getClassType());
- } else {
- factory = new BindyFixedLengthFactory(resolver, defaultRecordScanFilter, getPackages());
- }
+ BindyFixedLengthFactory factory = new BindyFixedLengthFactory(getClassType());
// Optionally initialize the header factory... using header model classes
if (factory.hasHeader()) {
@@ -296,12 +287,9 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
return record != null && record.isHeader();
}
};
-
- if (getClassType() != null) {
- this.headerFactory = new BindyFixedLengthFactory(resolver, headerScanFilter, getClassType());
- } else {
- this.headerFactory = new BindyFixedLengthFactory(resolver, headerScanFilter, getPackages());
- }
+
+ this.headerFactory = new BindyFixedLengthFactory(getClassType());
+
}
// Optionally initialize the footer factory... using footer model classes
@@ -315,11 +303,8 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
}
};
- if (getClassType() != null) {
- this.footerFactory = new BindyFixedLengthFactory(resolver, footerScanFilter, getClassType());
- } else {
- this.footerFactory = new BindyFixedLengthFactory(resolver, footerScanFilter, getPackages());
- }
+ this.footerFactory = new BindyFixedLengthFactory(getClassType());
+
}
return factory;
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
index f6cc146..f9fad09 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
@@ -16,28 +16,27 @@
*/
package org.apache.camel.dataformat.bindy.kvp;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-
import org.apache.camel.Exchange;
import org.apache.camel.dataformat.bindy.BindyAbstractDataFormat;
import org.apache.camel.dataformat.bindy.BindyAbstractFactory;
import org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+
/**
* A <a href="http://camel.apache.org/data-format.html">data format</a> (
* {@link DataFormat}) using Bindy to marshal to and from CSV files
@@ -49,17 +48,13 @@ public class BindyKeyValuePairDataFormat extends BindyAbstractDataFormat {
public BindyKeyValuePairDataFormat() {
}
- public BindyKeyValuePairDataFormat(String... packages) {
- super(packages);
- }
-
public BindyKeyValuePairDataFormat(Class<?> type) {
super(type);
}
@SuppressWarnings("unchecked")
public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
- BindyAbstractFactory factory = getFactory(exchange.getContext().getPackageScanClassResolver());
+ BindyAbstractFactory factory = getFactory();
List<Map<String, Object>> models = (ArrayList<Map<String, Object>>)body;
byte[] crlf;
@@ -77,7 +72,7 @@ public class BindyKeyValuePairDataFormat extends BindyAbstractDataFormat {
}
public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
- BindyKeyValuePairFactory factory = (BindyKeyValuePairFactory)getFactory(exchange.getContext().getPackageScanClassResolver());
+ BindyKeyValuePairFactory factory = (BindyKeyValuePairFactory)getFactory();
// List of Pojos
List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();
@@ -151,11 +146,7 @@ public class BindyKeyValuePairDataFormat extends BindyAbstractDataFormat {
}
}
- protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
- if (getClassType() != null) {
- return new BindyKeyValuePairFactory(resolver, getClassType());
- } else {
- return new BindyKeyValuePairFactory(resolver, getPackages());
- }
+ protected BindyAbstractFactory createModelFactory() throws Exception {
+ return new BindyKeyValuePairFactory(getClassType());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
index ae3e1f9..7c86d4e 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
@@ -35,7 +35,7 @@ import org.apache.camel.spi.PackageScanFilter;
public class AnnotationModelLoader {
private PackageScanClassResolver resolver;
- private PackageScanFilter filter;
+ //private PackageScanFilter filter;
private Set<Class<? extends Annotation>> annotations;
public AnnotationModelLoader(PackageScanClassResolver resolver) {
@@ -48,26 +48,18 @@ public class AnnotationModelLoader {
annotations.add(Section.class);
annotations.add(FixedLengthRecord.class);
}
-
+
+ /*
public AnnotationModelLoader(PackageScanClassResolver resolver, PackageScanFilter filter) {
this(resolver);
this.filter = filter;
}
+ */
public Set<Class<?>> loadModels(String... packageNames) throws Exception {
Set<Class<?>> results = resolver.findAnnotated(annotations, packageNames);
- //TODO; this logic could be moved into the PackageScanClassResolver by creating:
- // findAnnotated(annotations, packageNames, filter)
- Set<Class<?>> resultsToRemove = new HashSet<Class<?>>();
- if (filter != null) {
- for (Class<?> clazz : results) {
- if (!filter.matches(clazz)) {
- resultsToRemove.add(clazz);
- }
- }
- }
- results.removeAll(resultsToRemove);
+
return results;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
index 5a4d051..87b67e6 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
@@ -87,17 +87,16 @@ public class BindyCarQuoteAndCommaDelimiterTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
- BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.car");
- camelDataFormat.setLocale("en");
+ BindyCsvDataFormat dataFormat = new BindyCsvDataFormat();
+ dataFormat.setClassType(org.apache.camel.dataformat.bindy.model.car.Car.class);
+ dataFormat.setLocale("en");
from("direct:out")
- .unmarshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.model.car")
- .to("mock:out");
-
+ .unmarshal().bindy(BindyType.Csv,org.apache.camel.dataformat.bindy.model.car.Car.class)
+ .to("mock:out");
from("direct:in")
- .marshal(camelDataFormat)
- .to("mock:in");
+ .marshal(dataFormat)
+ .to("mock:in");
}
};
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java
index 9e1fca1..a17b459 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java
@@ -98,7 +98,7 @@ public class BindyComplexCsvGenerateHeaderMarshallTest extends AbstractJUnit4Spr
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.complex.generateheader");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.complex.generateheader.Order.class);
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java
index 9a1d3d4..94f93ba 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java
@@ -99,7 +99,7 @@ public class BindyComplexCsvMarshallTest extends AbstractJUnit4SpringContextTest
@Override
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Order.class);
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
index c6525e2..72ca66d 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
@@ -50,7 +50,7 @@ public class BindyComplexCsvUnmarshallTest extends AbstractJUnit4SpringContextTe
public static class ContextConfig extends RouteBuilder {
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Order.class);
from("direct:start").unmarshal(camelDataFormat).to("mock:result");
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
index 3a376eb..ee8f6a9 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
@@ -53,7 +53,7 @@ public class BindyCsvBigFileUnmarshallTest extends AbstractJUnit4SpringContextTe
public static class ContextConfig extends RouteBuilder {
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
from("file://src/test/data/big?noop=true").unmarshal(camelDataFormat).to("mock:result");
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java
index c855492..fc0aebe 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyDoubleQuotesCsvUnmarshallTest.java
@@ -58,7 +58,7 @@ public class BindyDoubleQuotesCsvUnmarshallTest extends AbstractJUnit4SpringCont
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.csv");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(Order.class);
public void configure() {
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
index ba5d63c..0356209 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
@@ -64,7 +64,7 @@ public class BindyInlinedQuotesCsvUnmarshallTest extends AbstractJUnit4SpringCon
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclasssinglequote");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclasssinglequote.Order.class);
public void configure() {
from(URI_DIRECT_START).unmarshal(camelDataFormat).to(URI_MOCK_RESULT);
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
index 552937b..6202404 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
@@ -76,11 +76,11 @@ public class BindyPipeDelimiterTest extends CamelTestSupport {
@Override
public void configure() throws Exception {
from("direct:unmarshal")
- .unmarshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.model.simple.pipeline")
+ .unmarshal().bindy(BindyType.Csv, org.apache.camel.dataformat.bindy.model.simple.pipeline.MyData.class)
.to("mock:result");
from("direct:marshal")
- .marshal().bindy(BindyType.Csv, "org.apache.camel.dataformat.bindy.model.simple.pipeline")
+ .marshal().bindy(BindyType.Csv, org.apache.camel.dataformat.bindy.model.simple.pipeline.MyData.class)
.to("mock:result");
}
};
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java
index 1469937..8e39b98 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPojoSimpleCsvMarshallTest.java
@@ -94,7 +94,7 @@ public class BindyPojoSimpleCsvMarshallTest extends AbstractJUnit4SpringContextT
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
camelDataFormat.setLocale("en");
Tracer tracer = new Tracer();
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java
index f5b9c29..5dbfdba 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java
@@ -86,7 +86,7 @@ public class BindySimpleCsvGenerateHeaderMarshallTest extends AbstractJUnit4Spri
public void configure() {
BindyCsvDataFormat camelDataFormat =
- new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassgenerateheader");
+ new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassgenerateheader.Order.class);
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
index d90a545..0799792 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
@@ -164,8 +164,8 @@ public class BindySimpleCsvMandatoryFieldsUnmarshallTest extends AbstractJUnit4S
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat formatOptional = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
- BindyCsvDataFormat formatMandatory = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassmandatory");
+ BindyCsvDataFormat formatOptional = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
+ BindyCsvDataFormat formatMandatory = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassmandatory.Order.class);
public void configure() {
from("direct:start1").unmarshal(formatOptional).to("mock:result1");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
index 902a4e6..25fa9cc 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
@@ -95,7 +95,7 @@ public class BindySimpleCsvMarshallDslTest extends AbstractJUnit4SpringContextTe
public void configure() {
BindyDataFormat bindy = new BindyDataFormat();
bindy.setLocale("en");
- bindy.setPackages(new String[] {"org.apache.camel.dataformat.bindy.model.simple.oneclass"});
+ bindy.setClassType(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
bindy.setType(BindyType.Csv);
from("direct:start").
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java
index c264511..aaf431f 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java
@@ -86,7 +86,7 @@ public class BindySimpleCsvMarshallPositionModifiedTest extends CommonBindyTest
getContext().addInterceptStrategy(tracer);
- BindyCsvDataFormat csvBindyDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassdifferentposition");
+ BindyCsvDataFormat csvBindyDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassdifferentposition.Order.class);
csvBindyDataFormat.setLocale("en");
// default should errors go to mock:error
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
index c40e084..b4f98ff 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
@@ -109,7 +109,7 @@ public class BindySimpleCsvMarshallTest extends AbstractJUnit4SpringContextTests
getContext().addInterceptStrategy(tracer);
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
camelDataFormat.setLocale("en");
// default should errors go to mock:error
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java
index 28d1ca8..171298b 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTrimClipTest.java
@@ -64,7 +64,7 @@ public class BindySimpleCsvMarshallTrimClipTest extends AbstractJUnit4SpringCont
public static class ContextConfig extends RouteBuilder {
public void configure() {
BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(
- "org.apache.camel.dataformat.bindy.model.simple.oneclassandtrimandclip");
+ org.apache.camel.dataformat.bindy.model.simple.oneclassandtrimandclip.Customer.class);
from(URI_DIRECT_START).marshal(camelDataFormat).to(URI_MOCK_RESULT);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
index e1b62bb..3b2de59 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvNullMarshallTest.java
@@ -84,7 +84,7 @@ public class BindySimpleCsvNullMarshallTest extends AbstractJUnit4SpringContextT
public static class ContextConfig extends RouteBuilder {
public void configure() {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java
index 08faa2d..eb562e0 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java
@@ -105,7 +105,7 @@ public class BindySimpleCsvOneToManyMarshallTest extends AbstractJUnit4SpringCon
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.onetomany");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.onetomany.Author.class);
public void configure() {
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
index c33b5d6..6260d47 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvRemoveWhitespaceUnmarshallTest.java
@@ -54,7 +54,7 @@ public class BindySimpleCsvRemoveWhitespaceUnmarshallTest extends AbstractJUnit4
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassandremovewhitespace");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassandremovewhitespace.Order.class);
public void configure() {
// from("file://src/test/data2")
http://git-wip-us.apache.org/repos/asf/camel/blob/ce6bf6e6/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
index 1662ec5..388074d 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
@@ -50,7 +50,7 @@ public class BindySimpleCsvSkipFirstLineUnmarshallTest extends AbstractJUnit4Spr
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassandskipfirstline");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclassandskipfirstline.Order.class);
public void configure() {
// from("file://src/test/data2")
[06/12] camel git commit: CAMEL-5958: Bindy ignores bean class type
Posted by da...@apache.org.
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 <lb...@gmail.com>
Authored: Wed Dec 18 16:57:51 2013 +0100
Committer: Claus Ibsen <da...@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
[10/12] camel git commit: Fixed parameter unusued in beanio java dsl
Posted by da...@apache.org.
Fixed parameter unusued in beanio java dsl
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d7be28f5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d7be28f5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d7be28f5
Branch: refs/heads/master
Commit: d7be28f5adf0feab8e21df89e8e66ae85422eca9
Parents: f5be7b9
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 7 11:09:57 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:09:57 2015 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/camel/builder/DataFormatClause.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d7be28f5/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index be35d9f..a82a6c9 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -144,7 +144,7 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
dataFormat.setMapping(mapping);
dataFormat.setStreamName(streamName);
dataFormat.setEncoding(encoding);
- dataFormat.setIgnoreInvalidRecords(ignoreInvalidRecords);
+ dataFormat.setIgnoreUnidentifiedRecords(ignoreUnidentifiedRecords);
dataFormat.setIgnoreUnexpectedRecords(ignoreUnexpectedRecords);
dataFormat.setIgnoreInvalidRecords(ignoreInvalidRecords);
return dataFormat(dataFormat);
[12/12] camel git commit: CAMEL-5958: Fixed test
Posted by da...@apache.org.
CAMEL-5958: Fixed test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3fc9de75
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3fc9de75
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3fc9de75
Branch: refs/heads/master
Commit: 3fc9de75401215f7a712091ec16d5df9dc06da90
Parents: 3be0461
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Aug 7 11:18:55 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:18:55 2015 +0200
----------------------------------------------------------------------
.../resources/org/apache/camel/model/routeWithBindyDataFormat.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3fc9de75/camel-core/src/test/resources/org/apache/camel/model/routeWithBindyDataFormat.xml
----------------------------------------------------------------------
diff --git a/camel-core/src/test/resources/org/apache/camel/model/routeWithBindyDataFormat.xml b/camel-core/src/test/resources/org/apache/camel/model/routeWithBindyDataFormat.xml
index 7b211b1..b76a831 100644
--- a/camel-core/src/test/resources/org/apache/camel/model/routeWithBindyDataFormat.xml
+++ b/camel-core/src/test/resources/org/apache/camel/model/routeWithBindyDataFormat.xml
@@ -20,7 +20,7 @@
<from uri="seda:a"/>
<pipeline>
<marshal>
- <bindy bindyTyp="Csv" packages="org.apache.camel"/>
+ <bindy type="Csv" classType="org.apache.camel.MyFoo"/>
</marshal>
<to uri="seda:b"/>
</pipeline>
[08/12] camel git commit: CAMEL-5958: Bindy ignores bean class type
Posted by da...@apache.org.
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/e1e5cac5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e1e5cac5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e1e5cac5
Branch: refs/heads/master
Commit: e1e5cac598a4a842995e5805da26c1a87ef1148a
Parents: b0e76ed
Author: lburgazzoli <lb...@gmail.com>
Authored: Sat Sep 20 19:29:48 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:05:48 2015 +0200
----------------------------------------------------------------------
.../apache/camel/builder/DataFormatClause.java | 17 +--------
.../csv/BindyCarQuoteAndCommaDelimiterTest.java | 2 +-
.../csv/BindySimpleCsvAutospanLineTest.java | 3 +-
.../BindySimpleCsvBooleanFalseMarshallTest.java | 4 ++-
.../BindySimpleCsvBooleanTrueMarshallTest.java | 4 ++-
.../BindySimpleCsvBooleanUnmarshallTest.java | 38 ++++++++++----------
.../BindySimpleCsvUnmarshallBadIntegerTest.java | 3 +-
.../bindy/csv/BindySimpleCsvUnmarshallTest.java | 8 ++---
...indySimpleKeyValuePairUnmarshallDslTest.java | 2 +-
9 files changed, 35 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e1e5cac5/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index 6e915b6..be35d9f 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -149,22 +149,7 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
dataFormat.setIgnoreInvalidRecords(ignoreInvalidRecords);
return dataFormat(dataFormat);
}
-
- /**
- * Uses the Bindy data format
- *
- * @param type the type of bindy data format to use
- * @param packages packages to scan for Bindy annotated POJO classes
- */
- /*
- public T bindy(BindyType type, String... packages) {
- BindyDataFormat bindy = new BindyDataFormat();
- bindy.setType(type);
- bindy.setPackages(packages);
- return dataFormat(bindy);
- }
- */
-
+
/**
* Uses the Bindy data format
*
http://git-wip-us.apache.org/repos/asf/camel/blob/e1e5cac5/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
index a51fad9..f06874e 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
@@ -88,7 +88,7 @@ public class BindyCarQuoteAndCommaDelimiterTest extends CamelTestSupport {
dataFormat.setLocale("en");
from("direct:out")
- .unmarshal().bindy(BindyType.Csv,type)
+ .unmarshal().bindy(BindyType.Csv, type)
.to("mock:out");
from("direct:in")
.marshal(dataFormat)
http://git-wip-us.apache.org/repos/asf/camel/blob/e1e5cac5/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java
index 1f6dc57..1ef984e 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java
@@ -64,8 +64,7 @@ public class BindySimpleCsvAutospanLineTest extends CamelTestSupport {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- final BindyCsvDataFormat bindy = new BindyCsvDataFormat(
- org.apache.camel.dataformat.bindy.model.simple.spanLastRecord.SpanLastRecord.class);
+ final BindyCsvDataFormat bindy = new BindyCsvDataFormat(SpanLastRecord.class);
from("direct:unmarshal")
.unmarshal(bindy)
http://git-wip-us.apache.org/repos/asf/camel/blob/e1e5cac5/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java
index 11121a5..59af0e5 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java
@@ -71,7 +71,9 @@ public class BindySimpleCsvBooleanFalseMarshallTest extends AbstractJUnit4Spring
public static class ContextConfig extends RouteBuilder {
public void configure() {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.bool");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(
+ org.apache.camel.dataformat.bindy.model.simple.bool.BooleanExample.class);
+
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/e1e5cac5/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java
index 8b0fd9e..6633b72 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java
@@ -71,7 +71,9 @@ public class BindySimpleCsvBooleanTrueMarshallTest extends AbstractJUnit4SpringC
public static class ContextConfig extends RouteBuilder {
public void configure() {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.bool");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(
+ org.apache.camel.dataformat.bindy.model.simple.bool.BooleanExample.class);
+
camelDataFormat.setLocale("en");
from("direct:start").marshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/e1e5cac5/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
index 57eea3b..9861e53 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanUnmarshallTest.java
@@ -17,7 +17,6 @@
package org.apache.camel.dataformat.bindy.csv;
import java.util.List;
-import java.util.Map;
import org.apache.camel.EndpointInject;
import org.apache.camel.LoggingLevel;
@@ -65,17 +64,17 @@ public class BindySimpleCsvBooleanUnmarshallTest extends AbstractJUnit4SpringCon
template.sendBody(expected);
- List<Map<String, BooleanExample>> examples = (List<Map<String, BooleanExample>>) result.getExchanges().get(0).getIn().getBody();
+ List<BooleanExample> examples = (List<BooleanExample>)result.getExchanges().get(0).getIn().getBody();
result.expectedMessageCount(1);
result.assertIsSatisfied();
- assertFalse(examples.get(0).get(BooleanExample.class.getName()).getName().isEmpty());
- assertEquals(examples.get(0).get(BooleanExample.class.getName()).getName(), "andrew");
- assertTrue(examples.get(0).get(BooleanExample.class.getName()).getExist());
- assertFalse(examples.get(1).get(BooleanExample.class.getName()).getName().isEmpty());
- assertEquals(examples.get(1).get(BooleanExample.class.getName()).getName(), "andrew");
- assertFalse(examples.get(1).get(BooleanExample.class.getName()).getExist());
+ assertFalse(examples.get(0).getName().isEmpty());
+ assertEquals(examples.get(0).getName(), "andrew");
+ assertTrue(examples.get(0).getExist());
+ assertFalse(examples.get(1).getName().isEmpty());
+ assertEquals(examples.get(1).getName(), "andrew");
+ assertFalse(examples.get(1).getExist());
assertNotNull(examples);
}
@@ -89,25 +88,26 @@ public class BindySimpleCsvBooleanUnmarshallTest extends AbstractJUnit4SpringCon
template.sendBody(expected);
- List<Map<String, BooleanExample>> examples = (List<Map<String, BooleanExample>>) result.getExchanges().get(0).getIn().getBody();
+ List<BooleanExample> examples = (List<BooleanExample>)result.getExchanges().get(0).getIn().getBody();
result.expectedMessageCount(1);
result.assertIsSatisfied();
- assertFalse(examples.get(0).get(BooleanExample.class.getName()).getName().isEmpty());
- assertEquals(examples.get(0).get(BooleanExample.class.getName()).getName(), "andrew");
- assertTrue(examples.get(0).get(BooleanExample.class.getName()).getExist());
- assertFalse(examples.get(1).get(BooleanExample.class.getName()).getName().isEmpty());
- assertEquals(examples.get(1).get(BooleanExample.class.getName()).getName(), "joseph");
- assertFalse(examples.get(1).get(BooleanExample.class.getName()).getExist());
- assertFalse(examples.get(2).get(BooleanExample.class.getName()).getName().isEmpty());
- assertEquals(examples.get(2).get(BooleanExample.class.getName()).getName(), "nicholas");
- assertTrue(examples.get(2).get(BooleanExample.class.getName()).getExist());
+ assertFalse(examples.get(0).getName().isEmpty());
+ assertEquals(examples.get(0).getName(), "andrew");
+ assertTrue(examples.get(0).getExist());
+ assertFalse(examples.get(1).getName().isEmpty());
+ assertEquals(examples.get(1).getName(), "joseph");
+ assertFalse(examples.get(1).getExist());
+ assertFalse(examples.get(2).getName().isEmpty());
+ assertEquals(examples.get(2).getName(), "nicholas");
+ assertTrue(examples.get(2).getExist());
assertNotNull(examples);
}
public static class ContextConfig extends RouteBuilder {
- BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.bool");
+ BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(
+ org.apache.camel.dataformat.bindy.model.simple.bool.BooleanExample.class);
public void configure() {
// from("file://src/test/data?move=./target/done").unmarshal(camelDataFormat).to("mock:result");
http://git-wip-us.apache.org/repos/asf/camel/blob/e1e5cac5/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
index 71993d4..b2e458c 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import static org.junit.Assert.assertEquals;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
@@ -34,6 +33,8 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import static org.junit.Assert.assertEquals;
+
@ContextConfiguration
public class BindySimpleCsvUnmarshallBadIntegerTest extends AbstractJUnit4SpringContextTests {
http://git-wip-us.apache.org/repos/asf/camel/blob/e1e5cac5/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
index 52abc59..277c26c 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
@@ -16,10 +16,6 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-
import java.util.List;
import org.apache.camel.EndpointInject;
@@ -38,6 +34,10 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
@ContextConfiguration
public class BindySimpleCsvUnmarshallTest extends AbstractJUnit4SpringContextTests {
http://git-wip-us.apache.org/repos/asf/camel/blob/e1e5cac5/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
index 357ae9d..adec426 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
@@ -45,7 +45,7 @@ public class BindySimpleKeyValuePairUnmarshallDslTest extends CommonBindyTest {
public void configure() {
from(URI_FILE_FIX).unmarshal()
- .bindy(BindyType.KeyValue,Order.class)
+ .bindy(BindyType.KeyValue, Order.class)
.to(URI_MOCK_RESULT);
}
[04/12] camel git commit: CAMEL-5958: Bindy ignores bean class type
(some more work)
Posted by da...@apache.org.
CAMEL-5958: Bindy ignores bean class type (some more work)
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a052c1cf
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a052c1cf
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a052c1cf
Branch: refs/heads/master
Commit: a052c1cf63e4cae94427d082ae47322328326827
Parents: cfb8f92
Author: lburgazzoli <lb...@gmail.com>
Authored: Tue Nov 26 18:01:28 2013 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:05:46 2015 +0200
----------------------------------------------------------------------
.../bindy/BindyAbstractDataFormat.java | 8 +-
.../dataformat/bindy/BindyAbstractFactory.java | 70 +++----
.../camel/dataformat/bindy/BindyCsvFactory.java | 174 ++++++++---------
.../bindy/BindyFixedLengthFactory.java | 191 ++++++++++---------
.../bindy/BindyKeyValuePairFactory.java | 121 ++++++------
.../bindy/fixed/BindyFixedLengthDataFormat.java | 34 ----
.../bindy/kvp/BindyKeyValuePairDataFormat.java | 21 +-
.../bindy/util/AnnotationModelLoader.java | 18 +-
8 files changed, 315 insertions(+), 322 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a052c1cf/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
index af4609a..b790424 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
@@ -16,12 +16,12 @@
*/
package org.apache.camel.dataformat.bindy;
-import org.apache.camel.spi.DataFormat;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.apache.camel.spi.DataFormat;
+
public abstract class BindyAbstractDataFormat implements DataFormat {
private String locale;
private BindyAbstractFactory modelFactory;
@@ -29,7 +29,6 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
public BindyAbstractDataFormat() {
}
-
protected BindyAbstractDataFormat(Class<?> classType) {
this.classType = classType;
}
@@ -62,6 +61,7 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
this.modelFactory = modelFactory;
}
+ protected abstract BindyAbstractFactory createModelFactory() throws Exception;
protected Object extractUnmarshalResult(List<Map<String, Object>> models) {
if (getClassType() != null) {
@@ -83,6 +83,4 @@ public abstract class BindyAbstractDataFormat implements DataFormat {
return models;
}
}
-
- protected abstract BindyAbstractFactory createModelFactory() throws Exception;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/a052c1cf/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
index 1694847..43bca89 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
@@ -16,23 +16,20 @@
*/
package org.apache.camel.dataformat.bindy;
-import org.apache.camel.dataformat.bindy.annotation.CsvRecord;
-import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
-import org.apache.camel.dataformat.bindy.annotation.Link;
-import org.apache.camel.dataformat.bindy.annotation.Message;
-import org.apache.camel.dataformat.bindy.annotation.Section;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.lang.reflect.Field;
import java.text.NumberFormat;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.camel.dataformat.bindy.annotation.Link;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* The {@link BindyAbstractFactory} implements what its common to all the formats
* supported by Camel Bindy
@@ -40,7 +37,11 @@ import java.util.Set;
public abstract class BindyAbstractFactory implements BindyFactory {
private static final Logger LOG = LoggerFactory.getLogger(BindyAbstractFactory.class);
protected final Map<String, List<Field>> annotatedLinkFields = new LinkedHashMap<String, List<Field>>();
+ protected Set<Class<?>> models;
+ protected Set<String> modelClassNames;
protected String crlf;
+
+ private String[] packageNames;
private String locale;
private Class<?> type;
@@ -50,21 +51,10 @@ public abstract class BindyAbstractFactory implements BindyFactory {
if (LOG.isDebugEnabled()) {
LOG.debug("Class name: {}", type.getName());
}
-
- if(!validateType(type)) {
- throw new IllegalArgumentException("...");
- }
-
+
initModel();
}
-
- protected boolean validateType(Class<?> type) {
- return type.getAnnotation(CsvRecord.class) != null
- || type.getAnnotation(Message.class) != null
- || type.getAnnotation(Section.class) != null
- || type.getAnnotation(FixedLengthRecord.class) != null;
- }
-
+
/**
* method uses to initialize the model representing the classes who will
* bind the data. This process will scan for classes according to the
@@ -73,6 +63,24 @@ public abstract class BindyAbstractFactory implements BindyFactory {
* @throws Exception
*/
public void initModel() throws Exception {
+ models = new HashSet<Class<?>>();
+ models.add(type);
+
+ for (Field field : type.getDeclaredFields()) {
+ Link linkField = field.getAnnotation(Link.class);
+
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked: {}, Field: {}", field.getType(), field);
+ }
+ models.add(field.getType());
+ }
+ }
+
+ modelClassNames = new HashSet<String>();
+ for (Class<?> clazz : models) {
+ modelClassNames.add(clazz.getName());
+ }
}
/**
@@ -110,14 +118,6 @@ public abstract class BindyAbstractFactory implements BindyFactory {
}
/**
- *
- * @return
- */
- protected Class<?> type() {
- return type;
- }
-
- /**
* Factory method generating new instances of the model and adding them to a
* HashMap
*
@@ -128,8 +128,12 @@ public abstract class BindyAbstractFactory implements BindyFactory {
public Map<String, Object> factory() throws Exception {
Map<String, Object> mapModel = new HashMap<String, Object>();
- Object obj = ObjectHelper.newInstance(type);
- mapModel.put(obj.getClass().getName(), obj);
+ for (Class<?> cl : models) {
+ Object obj = ObjectHelper.newInstance(cl);
+
+ // Add instance of the class to the Map Model
+ mapModel.put(obj.getClass().getName(), obj);
+ }
return mapModel;
}
@@ -140,7 +144,7 @@ public abstract class BindyAbstractFactory implements BindyFactory {
* @return true if the model supports the identified classes
*/
public boolean supportsModel(Set<String> classes) {
- return classes.contains(type);
+ return modelClassNames.containsAll(classes);
}
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/a052c1cf/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
index 389ede2..a699c04 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
@@ -96,57 +96,58 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
public void initAnnotatedFields() {
maxpos = 0;
- Class<?> cl = type();
- List<Field> linkFields = new ArrayList<Field>();
+ for (Class<?> cl : models) {
+ List<Field> linkFields = new ArrayList<Field>();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class retrieved: {}", cl.getName());
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class retrieved: {}", cl.getName());
+ }
- for (Field field : cl.getDeclaredFields()) {
- DataField dataField = field.getAnnotation(DataField.class);
- if (dataField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Position defined in the class: {}, position: {}, Field: {}",
- new Object[]{cl.getName(), dataField.pos(), dataField});
- }
+ for (Field field : cl.getDeclaredFields()) {
+ DataField dataField = field.getAnnotation(DataField.class);
+ if (dataField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Position defined in the class: {}, position: {}, Field: {}",
+ new Object[]{cl.getName(), dataField.pos(), dataField});
+ }
- if (dataField.required()) {
- ++numberMandatoryFields;
- } else {
- ++numberOptionalFields;
- }
+ if (dataField.required()) {
+ ++numberMandatoryFields;
+ } else {
+ ++numberOptionalFields;
+ }
- int pos = dataField.pos();
- if (annotatedFields.containsKey(pos)) {
- Field f = annotatedFields.get(pos);
- LOG.warn("Potentially invalid model: existing @DataField '{}' replaced by '{}'", f.getName(), field.getName());
+ int pos = dataField.pos();
+ if (annotatedFields.containsKey(pos)) {
+ Field f = annotatedFields.get(pos);
+ LOG.warn("Potentially invalid model: existing @DataField '{}' replaced by '{}'", f.getName(), field.getName());
+ }
+ dataFields.put(pos, dataField);
+ annotatedFields.put(pos, field);
+ maxpos = Math.max(maxpos, pos);
}
- dataFields.put(pos, dataField);
- annotatedFields.put(pos, field);
- maxpos = Math.max(maxpos, pos);
- }
- Link linkField = field.getAnnotation(Link.class);
+ Link linkField = field.getAnnotation(Link.class);
- if (linkField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
+ }
+ linkFields.add(field);
}
- linkFields.add(field);
}
- }
- if (!linkFields.isEmpty()) {
- annotatedLinkFields.put(cl.getName(), linkFields);
- }
+ if (!linkFields.isEmpty()) {
+ annotatedLinkFields.put(cl.getName(), linkFields);
+ }
- totalFields = numberMandatoryFields + numberOptionalFields;
+ totalFields = numberMandatoryFields + numberOptionalFields;
- if (LOG.isDebugEnabled()) {
- LOG.debug("Number of optional fields: {}", numberOptionalFields);
- LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
- LOG.debug("Total: {}", totalFields);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Number of optional fields: {}", numberOptionalFields);
+ LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
+ LOG.debug("Total: {}", totalFields);
+ }
}
if (annotatedFields.size() < maxpos) {
@@ -245,18 +246,19 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
LOG.debug("Separator converted: '0x{}', from: {}", Integer.toHexString(separator), this.getSeparator());
}
- Class<?> clazz = type();
- if (model.containsKey(clazz.getName())) {
+ for (Class<?> clazz : models) {
+ if (model.containsKey(clazz.getName())) {
- Object obj = model.get(clazz.getName());
- if (LOG.isDebugEnabled()) {
- LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
- }
- if (obj != null) {
+ Object obj = model.get(clazz.getName());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
+ }
+ if (obj != null) {
- // Generate Csv table
- generateCsvPositionMap(clazz, obj, results);
+ // Generate Csv table
+ generateCsvPositionMap(clazz, obj, results);
+ }
}
}
@@ -515,60 +517,60 @@ public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactor
*/
private void initCsvRecordParameters() {
if (separator == null) {
- Class<?> cl = type();
+ for (Class<?> cl : models) {
- // Get annotation @CsvRecord from the class
- CsvRecord record = cl.getAnnotation(CsvRecord.class);
+ // Get annotation @CsvRecord from the class
+ CsvRecord record = cl.getAnnotation(CsvRecord.class);
- // Get annotation @Section from the class
- Section section = cl.getAnnotation(Section.class);
+ // Get annotation @Section from the class
+ Section section = cl.getAnnotation(Section.class);
- if (record != null) {
- LOG.debug("Csv record: {}", record);
+ if (record != null) {
+ LOG.debug("Csv record: {}", record);
- // Get skipFirstLine parameter
- skipFirstLine = record.skipFirstLine();
- LOG.debug("Skip First Line parameter of the CSV: {}" + skipFirstLine);
+ // Get skipFirstLine parameter
+ skipFirstLine = record.skipFirstLine();
+ LOG.debug("Skip First Line parameter of the CSV: {}" + skipFirstLine);
- // Get generateHeaderColumnNames parameter
- generateHeaderColumnNames = record.generateHeaderColumns();
- LOG.debug("Generate header column names parameter of the CSV: {}", generateHeaderColumnNames);
+ // Get generateHeaderColumnNames parameter
+ generateHeaderColumnNames = record.generateHeaderColumns();
+ LOG.debug("Generate header column names parameter of the CSV: {}", generateHeaderColumnNames);
- // Get Separator parameter
- ObjectHelper.notNull(record.separator(), "No separator has been defined in the @Record annotation");
- separator = record.separator();
- LOG.debug("Separator defined for the CSV: {}", separator);
+ // Get Separator parameter
+ ObjectHelper.notNull(record.separator(), "No separator has been defined in the @Record annotation");
+ separator = record.separator();
+ LOG.debug("Separator defined for the CSV: {}", separator);
- // Get carriage return parameter
- crlf = record.crlf();
- LOG.debug("Carriage return defined for the CSV: {}", crlf);
+ // Get carriage return parameter
+ crlf = record.crlf();
+ LOG.debug("Carriage return defined for the CSV: {}", crlf);
- // Get isOrdered parameter
- messageOrdered = record.isOrdered();
- LOG.debug("Must CSV record be ordered: {}", messageOrdered);
+ // Get isOrdered parameter
+ messageOrdered = record.isOrdered();
+ LOG.debug("Must CSV record be ordered: {}", messageOrdered);
- if (ObjectHelper.isNotEmpty(record.quote())) {
- quote = record.quote();
- LOG.debug("Quoting columns with: {}", quote);
- }
+ if (ObjectHelper.isNotEmpty(record.quote())) {
+ quote = record.quote();
+ LOG.debug("Quoting columns with: {}", quote);
+ }
- quoting = record.quoting();
- LOG.debug("CSV will be quoted: {}", quoting);
+ quoting = record.quoting();
+ LOG.debug("CSV will be quoted: {}", quoting);
- autospanLine = record.autospanLine();
- LOG.debug("Autospan line in last record: {}", autospanLine);
- }
+ autospanLine = record.autospanLine();
+ LOG.debug("Autospan line in last record: {}", autospanLine);
+ }
- if (section != null) {
- // Test if section number is not null
- ObjectHelper.notNull(section.number(), "No number has been defined for the section");
+ if (section != null) {
+ // Test if section number is not null
+ ObjectHelper.notNull(section.number(), "No number has been defined for the section");
- // Get section number and add it to the sections
- sections.put(cl.getName(), section.number());
+ // Get section number and add it to the sections
+ sections.put(cl.getName(), section.number());
+ }
}
}
}
-
/**
* Set the default values for the non defined fields.
* @param model the model which has its default fields set.
http://git-wip-us.apache.org/repos/asf/camel/blob/a052c1cf/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 e44432b..ac3bfbc 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
@@ -31,8 +31,6 @@ import org.apache.camel.dataformat.bindy.annotation.DataField;
import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
import org.apache.camel.dataformat.bindy.annotation.Link;
import org.apache.camel.dataformat.bindy.format.FormatException;
-import org.apache.camel.spi.PackageScanClassResolver;
-import org.apache.camel.spi.PackageScanFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -71,7 +69,7 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
// initialize specific parameters of the fixed length model
initFixedLengthModel();
}
-
+
/**
* method uses to initialize the model representing the classes who will
* bind the data. This process will scan for classes according to the
@@ -88,52 +86,56 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
}
public void initAnnotatedFields() {
- Class<?> cl = type();
- List<Field> linkFields = new ArrayList<Field>();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class retrieved: {}", cl.getName());
- }
+ for (Class<?> cl : models) {
- for (Field field : cl.getDeclaredFields()) {
- DataField dataField = field.getAnnotation(DataField.class);
- if (dataField != null) {
+ List<Field> linkFields = new ArrayList<Field>();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Position defined in the class: {}, position: {}, Field: {}", new Object[]{cl.getName(), dataField.pos(), dataField});
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class retrieved: {}", cl.getName());
+ }
- if (dataField.required()) {
- ++numberMandatoryFields;
- } else {
- ++numberOptionalFields;
- }
+ for (Field field : cl.getDeclaredFields()) {
+ DataField dataField = field.getAnnotation(DataField.class);
+ if (dataField != null) {
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Position defined in the class: {}, position: {}, Field: {}", new Object[]{cl.getName(), dataField.pos(), dataField});
+ }
- dataFields.put(dataField.pos(), dataField);
- annotatedFields.put(dataField.pos(), field);
- }
+ if (dataField.required()) {
+ ++numberMandatoryFields;
+ } else {
+ ++numberOptionalFields;
+ }
- Link linkField = field.getAnnotation(Link.class);
+ dataFields.put(dataField.pos(), dataField);
+ annotatedFields.put(dataField.pos(), field);
+ }
- if (linkField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
+ Link linkField = field.getAnnotation(Link.class);
+
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked: {}, Field: {}", cl.getName(), field);
+ }
+ linkFields.add(field);
}
- linkFields.add(field);
+
}
- }
+ if (!linkFields.isEmpty()) {
+ annotatedLinkFields.put(cl.getName(), linkFields);
+ }
- if (!linkFields.isEmpty()) {
- annotatedLinkFields.put(cl.getName(), linkFields);
- }
+ totalFields = numberMandatoryFields + numberOptionalFields;
- totalFields = numberMandatoryFields + numberOptionalFields;
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Number of optional fields: {}", numberOptionalFields);
+ LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
+ LOG.debug("Total: {}", totalFields);
+ }
- if (LOG.isDebugEnabled()) {
- LOG.debug("Number of optional fields: {}", numberOptionalFields);
- LOG.debug("Number of mandatory fields: {}", numberMandatoryFields);
- LOG.debug("Total: {}", totalFields);
}
}
@@ -277,21 +279,23 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
StringBuilder buffer = new StringBuilder();
Map<Integer, List<String>> results = new HashMap<Integer, List<String>>();
- Class<?> clazz = type();
- if (model.containsKey(clazz.getName())) {
+ for (Class<?> clazz : models) {
- Object obj = model.get(clazz.getName());
+ if (model.containsKey(clazz.getName())) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
- }
+ Object obj = model.get(clazz.getName());
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Model object: {}, class: {}", obj, obj.getClass().getName());
+ }
- if (obj != null) {
+ if (obj != null) {
- // Generate Fixed Length table
- // containing the positions of the fields
- generateFixedLengthPositionMap(clazz, obj, results);
+ // Generate Fixed Length table
+ // containing the positions of the fields
+ generateFixedLengthPositionMap(clazz, obj, results);
+ }
}
}
@@ -443,53 +447,54 @@ public class BindyFixedLengthFactory extends BindyAbstractFactory implements Bin
*/
private void initFixedLengthRecordParameters() {
- Class<?> cl = type();
-
- // Get annotation @FixedLengthRecord from the class
- FixedLengthRecord record = cl.getAnnotation(FixedLengthRecord.class);
-
- if (record != null) {
- LOG.debug("Fixed length record: {}", record);
-
- // Get carriage return parameter
- crlf = record.crlf();
- LOG.debug("Carriage return defined for the CSV: {}", crlf);
-
- // Get hasHeader parameter
- hasHeader = record.hasHeader();
- LOG.debug("Has Header: {}", hasHeader);
-
- // Get skipHeader parameter
- skipHeader = record.skipHeader();
- LOG.debug("Skip Header: {}", skipHeader);
-
- // Get hasFooter parameter
- hasFooter = record.hasFooter();
- LOG.debug("Has Footer: {}", hasFooter);
-
- // Get skipFooter parameter
- skipFooter = record.skipFooter();
- LOG.debug("Skip Footer: {}", skipFooter);
-
- // Get isHeader parameter
- isHeader = record.isHeader();
- LOG.debug("Is Header: {}", isHeader);
-
- // Get isFooter parameter
- isFooter = record.isFooter();
- LOG.debug("Is Footer: {}", isFooter);
-
- // Get padding character
- paddingChar = record.paddingChar();
- LOG.debug("Padding char: {}", paddingChar);
-
- // Get length of the record
- recordLength = record.length();
- LOG.debug("Length of the record: {}", recordLength);
-
- // Get flag for ignore trailing characters
- ignoreTrailingChars = record.ignoreTrailingChars();
- LOG.debug("Ignore trailing chars: {}", ignoreTrailingChars);
+ for (Class<?> cl : models) {
+
+ // Get annotation @FixedLengthRecord from the class
+ FixedLengthRecord record = cl.getAnnotation(FixedLengthRecord.class);
+
+ if (record != null) {
+ LOG.debug("Fixed length record: {}", record);
+
+ // Get carriage return parameter
+ crlf = record.crlf();
+ LOG.debug("Carriage return defined for the CSV: {}", crlf);
+
+ // Get hasHeader parameter
+ hasHeader = record.hasHeader();
+ LOG.debug("Has Header: {}", hasHeader);
+
+ // Get skipHeader parameter
+ skipHeader = record.skipHeader();
+ LOG.debug("Skip Header: {}", skipHeader);
+
+ // Get hasFooter parameter
+ hasFooter = record.hasFooter();
+ LOG.debug("Has Footer: {}", hasFooter);
+
+ // Get skipFooter parameter
+ skipFooter = record.skipFooter();
+ LOG.debug("Skip Footer: {}", skipFooter);
+
+ // Get isHeader parameter
+ isHeader = record.isHeader();
+ LOG.debug("Is Header: {}", isHeader);
+
+ // Get isFooter parameter
+ isFooter = record.isFooter();
+ LOG.debug("Is Footer: {}", isFooter);
+
+ // Get padding character
+ paddingChar = record.paddingChar();
+ LOG.debug("Padding char: {}", paddingChar);
+
+ // Get length of the record
+ recordLength = record.length();
+ LOG.debug("Length of the record: {}", recordLength);
+
+ // Get flag for ignore trailing characters
+ ignoreTrailingChars = record.ignoreTrailingChars();
+ LOG.debug("Ignore trailing chars: {}", ignoreTrailingChars);
+ }
}
if (hasHeader && isHeader) {
http://git-wip-us.apache.org/repos/asf/camel/blob/a052c1cf/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
index 9418f40..625a415 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
@@ -32,7 +32,6 @@ import org.apache.camel.dataformat.bindy.annotation.Message;
import org.apache.camel.dataformat.bindy.annotation.OneToMany;
import org.apache.camel.dataformat.bindy.annotation.Section;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
-import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,7 +54,7 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
private String pairSeparator;
private boolean messageOrdered;
-
+
public BindyKeyValuePairFactory(Class<?> type) throws Exception {
super(type);
@@ -83,31 +82,34 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
public void initAnnotatedFields() {
- Class<?> cl = type();
- List<Field> linkFields = new ArrayList<Field>();
+ for (Class<?> cl : models) {
- for (Field field : cl.getDeclaredFields()) {
- KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
- if (keyValuePairField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Key declared in the class : {}, key : {}, Field : {}", new Object[]{cl.getName(), keyValuePairField.tag(), keyValuePairField});
+ List<Field> linkFields = new ArrayList<Field>();
+
+ for (Field field : cl.getDeclaredFields()) {
+ KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
+ if (keyValuePairField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Key declared in the class : {}, key : {}, Field : {}", new Object[]{cl.getName(), keyValuePairField.tag(), keyValuePairField});
+ }
+ keyValuePairFields.put(keyValuePairField.tag(), keyValuePairField);
+ annotatedFields.put(keyValuePairField.tag(), field);
}
- keyValuePairFields.put(keyValuePairField.tag(), keyValuePairField);
- annotatedFields.put(keyValuePairField.tag(), field);
- }
- Link linkField = field.getAnnotation(Link.class);
+ Link linkField = field.getAnnotation(Link.class);
- if (linkField != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Class linked : {}, Field {}", cl.getName(), field);
+ if (linkField != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Class linked : {}, Field {}", cl.getName(), field);
+ }
+ linkFields.add(field);
}
- linkFields.add(field);
}
- }
- if (!linkFields.isEmpty()) {
- annotatedLinkFields.put(cl.getName(), linkFields);
+ if (!linkFields.isEmpty()) {
+ annotatedLinkFields.put(cl.getName(), linkFields);
+ }
+
}
}
@@ -161,15 +163,19 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
}
- Class<?> clazz = type();
- Object obj = model.get(clazz.getName());
+ // Iterate over the model
+ for (Class<?> clazz : models) {
+
+ Object obj = model.get(clazz.getName());
- if (obj != null) {
+ if (obj != null) {
- // Generate model from key value map
- generateModelFromKeyValueMap(clazz, obj, results, line, lists);
+ // Generate model from key value map
+ generateModelFromKeyValueMap(clazz, obj, results, line, lists);
+ }
}
+
}
private void generateModelFromKeyValueMap(Class<?> clazz, Object obj, Map<Integer, List<String>> results, int line, Map<String, List<Object>> lists) throws Exception {
@@ -581,40 +587,43 @@ public class BindyKeyValuePairFactory extends BindyAbstractFactory implements Bi
*/
private void initMessageParameters() {
if ((pairSeparator == null) || (keyValuePairSeparator == null)) {
- Class<?> cl = type();
- // Get annotation @Message from the class
- Message message = cl.getAnnotation(Message.class);
-
- // Get annotation @Section from the class
- Section section = cl.getAnnotation(Section.class);
-
- if (message != null) {
- // Get Pair Separator parameter
- ObjectHelper.notNull(message.pairSeparator(), "No Pair Separator has been defined in the @Message annotation");
- pairSeparator = message.pairSeparator();
- LOG.debug("Pair Separator defined for the message: {}", pairSeparator);
-
- // Get KeyValuePair Separator parameter
- ObjectHelper.notNull(message.keyValuePairSeparator(), "No Key Value Pair Separator has been defined in the @Message annotation");
- keyValuePairSeparator = message.keyValuePairSeparator();
- LOG.debug("Key Value Pair Separator defined for the message: {}", keyValuePairSeparator);
-
- // Get carriage return parameter
- crlf = message.crlf();
- LOG.debug("Carriage return defined for the message: {}", crlf);
-
- // Get isOrdered parameter
- messageOrdered = message.isOrdered();
- LOG.debug("Is the message ordered in output: {}", messageOrdered);
- }
+ for (Class<?> cl : models) {
+ // Get annotation @Message from the class
+ Message message = cl.getAnnotation(Message.class);
+
+ // Get annotation @Section from the class
+ Section section = cl.getAnnotation(Section.class);
+
+ if (message != null) {
+ // Get Pair Separator parameter
+ ObjectHelper.notNull(message.pairSeparator(), "No Pair Separator has been defined in the @Message annotation");
+ pairSeparator = message.pairSeparator();
+ LOG.debug("Pair Separator defined for the message: {}", pairSeparator);
+
+ // Get KeyValuePair Separator parameter
+ ObjectHelper.notNull(message.keyValuePairSeparator(), "No Key Value Pair Separator has been defined in the @Message annotation");
+ keyValuePairSeparator = message.keyValuePairSeparator();
+ LOG.debug("Key Value Pair Separator defined for the message: {}", keyValuePairSeparator);
+
+ // Get carriage return parameter
+ crlf = message.crlf();
+ LOG.debug("Carriage return defined for the message: {}", crlf);
+
+ // Get isOrdered parameter
+ messageOrdered = message.isOrdered();
+ LOG.debug("Is the message ordered in output: {}", messageOrdered);
+ }
- if (section != null) {
- // Test if section number is not null
- ObjectHelper.notNull(section.number(), "No number has been defined for the section");
+ if (section != null) {
+ // Test if section number is not null
+ ObjectHelper.notNull(section.number(), "No number has been defined for the section");
- // Get section number and add it to the sections
- sections.put(cl.getName(), section.number());
+ // Get section number and add it to the sections
+ sections.put(cl.getName(), section.number());
+ }
}
}
}
+
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/a052c1cf/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 e65c715..9d19874 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
@@ -32,14 +32,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.dataformat.bindy.BindyAbstractDataFormat;
import org.apache.camel.dataformat.bindy.BindyAbstractFactory;
import org.apache.camel.dataformat.bindy.BindyFixedLengthFactory;
-import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.PackageScanClassResolver;
-import org.apache.camel.spi.PackageScanFilter;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,7 +62,6 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
@SuppressWarnings("unchecked")
public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
- PackageScanClassResolver resolver = exchange.getContext().getPackageScanClassResolver();
BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory();
ObjectHelper.notNull(factory, "not instantiated");
@@ -148,7 +143,6 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
}
public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
- PackageScanClassResolver resolver = exchange.getContext().getPackageScanClassResolver();
BindyFixedLengthFactory factory = (BindyFixedLengthFactory) getFactory();
ObjectHelper.notNull(factory, "not instantiated");
@@ -266,45 +260,17 @@ public class BindyFixedLengthDataFormat extends BindyAbstractDataFormat {
@Override
protected BindyAbstractFactory createModelFactory() throws Exception {
-
- // Initialize the primary (body) model factory ignoring header and footer model classes
- PackageScanFilter defaultRecordScanFilter = new PackageScanFilter() {
- @Override
- public boolean matches(Class<?> type) {
- FixedLengthRecord record = type.getAnnotation(FixedLengthRecord.class);
- return record != null && !record.isFooter() && !record.isHeader();
- }
- };
BindyFixedLengthFactory factory = new BindyFixedLengthFactory(getClassType());
// Optionally initialize the header factory... using header model classes
if (factory.hasHeader()) {
- PackageScanFilter headerScanFilter = new PackageScanFilter() {
- @Override
- public boolean matches(Class<?> type) {
- FixedLengthRecord record = type.getAnnotation(FixedLengthRecord.class);
- return record != null && record.isHeader();
- }
- };
-
this.headerFactory = new BindyFixedLengthFactory(getClassType());
-
}
// Optionally initialize the footer factory... using footer model classes
if (factory.hasFooter()) {
-
- PackageScanFilter footerScanFilter = new PackageScanFilter() {
- @Override
- public boolean matches(Class<?> type) {
- FixedLengthRecord record = type.getAnnotation(FixedLengthRecord.class);
- return record != null && record.isFooter();
- }
- };
-
this.footerFactory = new BindyFixedLengthFactory(getClassType());
-
}
return factory;
http://git-wip-us.apache.org/repos/asf/camel/blob/a052c1cf/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
index f9fad09..7c4a028 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
@@ -16,27 +16,28 @@
*/
package org.apache.camel.dataformat.bindy.kvp;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+
import org.apache.camel.Exchange;
import org.apache.camel.dataformat.bindy.BindyAbstractDataFormat;
import org.apache.camel.dataformat.bindy.BindyAbstractFactory;
import org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory;
import org.apache.camel.dataformat.bindy.util.ConverterUtils;
import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-
/**
* A <a href="http://camel.apache.org/data-format.html">data format</a> (
* {@link DataFormat}) using Bindy to marshal to and from CSV files
http://git-wip-us.apache.org/repos/asf/camel/blob/a052c1cf/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
index 7c86d4e..ae3e1f9 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/AnnotationModelLoader.java
@@ -35,7 +35,7 @@ import org.apache.camel.spi.PackageScanFilter;
public class AnnotationModelLoader {
private PackageScanClassResolver resolver;
- //private PackageScanFilter filter;
+ private PackageScanFilter filter;
private Set<Class<? extends Annotation>> annotations;
public AnnotationModelLoader(PackageScanClassResolver resolver) {
@@ -48,18 +48,26 @@ public class AnnotationModelLoader {
annotations.add(Section.class);
annotations.add(FixedLengthRecord.class);
}
-
- /*
+
public AnnotationModelLoader(PackageScanClassResolver resolver, PackageScanFilter filter) {
this(resolver);
this.filter = filter;
}
- */
public Set<Class<?>> loadModels(String... packageNames) throws Exception {
Set<Class<?>> results = resolver.findAnnotated(annotations, packageNames);
-
+ //TODO; this logic could be moved into the PackageScanClassResolver by creating:
+ // findAnnotated(annotations, packageNames, filter)
+ Set<Class<?>> resultsToRemove = new HashSet<Class<?>>();
+ if (filter != null) {
+ for (Class<?> clazz : results) {
+ if (!filter.matches(clazz)) {
+ resultsToRemove.add(clazz);
+ }
+ }
+ }
+ results.removeAll(resultsToRemove);
return results;
}
[09/12] camel git commit: merge main codebase
Posted by da...@apache.org.
merge main codebase
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f5be7b92
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f5be7b92
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f5be7b92
Branch: refs/heads/master
Commit: f5be7b92672598a3346dcdba70f5a49a39007473
Parents: e1e5cac
Author: lburgazzoli <lb...@gmail.com>
Authored: Tue Jul 21 22:45:59 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:07:02 2015 +0200
----------------------------------------------------------------------
.../camel/model/dataformat/BindyDataFormat.java | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f5be7b92/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
index 28d5cd2d..76def26 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
@@ -40,8 +40,6 @@ import org.apache.camel.util.ObjectHelper;
public class BindyDataFormat extends DataFormatDefinition {
@XmlAttribute(required = true)
private BindyType type;
- //@XmlAttribute
- //private String[] packages;
@XmlAttribute
private String classType;
@XmlAttribute
@@ -64,19 +62,6 @@ public class BindyDataFormat extends DataFormatDefinition {
this.type = type;
}
- /*
- public String[] getPackages() {
- return packages;
- }
-
- /**
- * The java package names to scan for model classes.
- */
- public void setPackages(String[] packages) {
- this.packages = packages;
- }
- */
-
public String getClassType() {
return classType;
}
@@ -88,6 +73,9 @@ public class BindyDataFormat extends DataFormatDefinition {
this.classType = classType;
}
+ /**
+ * Type of model class to use.
+ */
public void setClassType(Class<?> classType) {
this.clazz = classType;
}
[07/12] camel git commit: CAMEL-5958: Bindy ignores bean class type:
load models recursively
Posted by da...@apache.org.
CAMEL-5958: Bindy ignores bean class type: load models recursively
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/222f5fda
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/222f5fda
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/222f5fda
Branch: refs/heads/master
Commit: 222f5fdaea783002161333502aadf1b7a38ea8f4
Parents: a052c1c
Author: lburgazzoli <lb...@gmail.com>
Authored: Fri Nov 29 22:46:27 2013 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Aug 7 11:05:47 2015 +0200
----------------------------------------------------------------------
.../dataformat/bindy/BindyAbstractFactory.java | 25 ++++++++++++++------
1 file changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/222f5fda/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
index 43bca89..a23383a 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
@@ -64,23 +64,34 @@ public abstract class BindyAbstractFactory implements BindyFactory {
*/
public void initModel() throws Exception {
models = new HashSet<Class<?>>();
- models.add(type);
+ modelClassNames = new HashSet<String>();
- for (Field field : type.getDeclaredFields()) {
+ loadModels(type);
+ }
+
+ /**
+ * Recursively load model.
+ *
+ * @param root
+ */
+ private void loadModels(Class<?> root) {
+ models.add(root);
+ modelClassNames.add(root.getName());
+
+ for (Field field : root.getDeclaredFields()) {
Link linkField = field.getAnnotation(Link.class);
if (linkField != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Class linked: {}, Field: {}", field.getType(), field);
}
+
models.add(field.getType());
+ modelClassNames.add(field.getType().getName());
+
+ loadModels(field.getType());
}
}
-
- modelClassNames = new HashSet<String>();
- for (Class<?> clazz : models) {
- modelClassNames.add(clazz.getName());
- }
}
/**