moved a bindy test into the right directory so that this test is executed
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f68954cd Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f68954cd Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f68954cd Branch: refs/heads/camel-gora Commit: f68954cde6ecae2e5b991fa2556120343c5e7b84 Parents: 8f32615 Author: cmueller <cmuel...@apache.org> Authored: Sat Dec 7 21:38:43 2013 +0100 Committer: cmueller <cmuel...@apache.org> Committed: Sat Dec 7 21:38:43 2013 +0100 ---------------------------------------------------------------------- .../csv/BindySimpleCsvAutospanLineTest.java | 78 -------------------- .../simple/spanLastRecord/SpanLastRecord.java | 45 ----------- .../csv/BindySimpleCsvAutospanLineTest.java | 78 ++++++++++++++++++++ .../simple/spanLastRecord/SpanLastRecord.java | 61 +++++++++++++++ 4 files changed, 139 insertions(+), 123 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/f68954cd/components/camel-bindy/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java b/components/camel-bindy/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java deleted file mode 100644 index 0df3f6d..0000000 --- a/components/camel-bindy/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dataformat.bindy.csv; - -import 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 { - - @Test - public void testUnmarshalNoNeedToSpanLine() throws Exception { - final MockEndpoint mock = getMockEndpoint("mock:unmarshal"); - mock.expectedMessageCount(1); - - template.sendBody("direct:unmarshal", "1,hei,kommentar"); - - 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()); - - assertEquals(1, order.getRecordId()); - assertEquals("hei", order.getName()); - assertEquals("kommentar", order.getComment()); - } - - @Test - public void testUnmarshalSpanningLine() throws Exception { - final MockEndpoint mock = getMockEndpoint("mock:unmarshal"); - mock.expectedMessageCount(1); - - template.sendBody("direct:unmarshal", "1,hei,kommentar,test,noe,hei"); - - 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()); - - assertEquals(1, order.getRecordId()); - assertEquals("hei", order.getName()); - assertEquals("kommentar,test,noe,hei", order.getComment()); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - final BindyCsvDataFormat bindy = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.spanLastRecord"); - - from("direct:unmarshal") - .unmarshal(bindy) - .to("mock:unmarshal"); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/f68954cd/components/camel-bindy/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/spanLastRecord/SpanLastRecord.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/spanLastRecord/SpanLastRecord.java b/components/camel-bindy/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/spanLastRecord/SpanLastRecord.java deleted file mode 100644 index bcb01ee..0000000 --- a/components/camel-bindy/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/spanLastRecord/SpanLastRecord.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.camel.dataformat.bindy.model.simple.spanLastRecord; - -import org.apache.camel.dataformat.bindy.annotation.CsvRecord; -import org.apache.camel.dataformat.bindy.annotation.DataField; - -@CsvRecord(separator = ",", autospanLine = true) -public class SpanLastRecord { - - @DataField(pos = 1) - private int recordId; - @DataField(pos = 2) - private String name; - @DataField(pos = 3) - private String comment; - - public int getRecordId() { - return recordId; - } - - public void setRecordId(final int recordId) { - this.recordId = recordId; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public String getComment() { - return comment; - } - - public void setComment(final String comment) { - this.comment = comment; - } - - @Override - public String toString() { - return "SpanLastRecord [recordId=" + recordId + ", name=" + name + ", comment=" + comment + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/f68954cd/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 new file mode 100644 index 0000000..0df3f6d --- /dev/null +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvAutospanLineTest.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.bindy.csv; + +import 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 { + + @Test + public void testUnmarshalNoNeedToSpanLine() throws Exception { + final MockEndpoint mock = getMockEndpoint("mock:unmarshal"); + mock.expectedMessageCount(1); + + template.sendBody("direct:unmarshal", "1,hei,kommentar"); + + 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()); + + assertEquals(1, order.getRecordId()); + assertEquals("hei", order.getName()); + assertEquals("kommentar", order.getComment()); + } + + @Test + public void testUnmarshalSpanningLine() throws Exception { + final MockEndpoint mock = getMockEndpoint("mock:unmarshal"); + mock.expectedMessageCount(1); + + template.sendBody("direct:unmarshal", "1,hei,kommentar,test,noe,hei"); + + 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()); + + assertEquals(1, order.getRecordId()); + assertEquals("hei", order.getName()); + assertEquals("kommentar,test,noe,hei", order.getComment()); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + final BindyCsvDataFormat bindy = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.spanLastRecord"); + + from("direct:unmarshal") + .unmarshal(bindy) + .to("mock:unmarshal"); + } + }; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/f68954cd/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/spanLastRecord/SpanLastRecord.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/spanLastRecord/SpanLastRecord.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/spanLastRecord/SpanLastRecord.java new file mode 100644 index 0000000..64ce3c5 --- /dev/null +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/spanLastRecord/SpanLastRecord.java @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.bindy.model.simple.spanLastRecord; + +import org.apache.camel.dataformat.bindy.annotation.CsvRecord; +import org.apache.camel.dataformat.bindy.annotation.DataField; + +@CsvRecord(separator = ",", autospanLine = true) +public class SpanLastRecord { + + @DataField(pos = 1) + private int recordId; + @DataField(pos = 2) + private String name; + @DataField(pos = 3) + private String comment; + + public int getRecordId() { + return recordId; + } + + public void setRecordId(final int recordId) { + this.recordId = recordId; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public String getComment() { + return comment; + } + + public void setComment(final String comment) { + this.comment = comment; + } + + @Override + public String toString() { + return "SpanLastRecord [recordId=" + recordId + ", name=" + name + ", comment=" + comment + "]"; + } + +}