You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2020/09/21 15:27:27 UTC
[camel-quarkus] branch master updated: Added UniVocity data formats
native support #1756
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new a10279e Added UniVocity data formats native support #1756
a10279e is described below
commit a10279ef045e1775ba61e9cca54ab50d546b3359
Author: aldettinger <al...@gmail.com>
AuthorDate: Thu Sep 17 21:26:25 2020 +0200
Added UniVocity data formats native support #1756
---
.../reference/dataformats/univocity-parsers.adoc | 6 +-
.../reference/extensions/univocity-parsers.adoc | 8 +-
extensions-jvm/pom.xml | 1 -
.../parsers/it/UnivocityParsersResource.java | 77 --------------------
.../univocity/parsers/it/UnivocityParsersTest.java | 50 -------------
extensions/pom.xml | 1 +
.../univocity-parsers/deployment/pom.xml | 0
.../deployment/UnivocityParsersProcessor.java | 14 ----
.../univocity-parsers/pom.xml | 1 -
.../univocity-parsers/runtime/pom.xml | 1 +
.../main/resources/META-INF/quarkus-extension.yaml | 0
integration-tests/pom.xml | 1 +
.../univocity-parsers}/pom.xml | 45 +++++++++++-
.../it/UniVocityCsvDataFormatMarshalRoute.java | 53 ++++++++++++++
.../it/UniVocityCsvDataFormatUnmarshalRoute.java | 63 ++++++++++++++++
.../UniVocityFixedWidthDataFormatMarshalRoute.java | 53 ++++++++++++++
...niVocityFixedWidthDataFormatUnmarshalRoute.java | 66 +++++++++++++++++
.../parsers/it/UniVocityParsersResource.java | 66 +++++++++++++++++
.../it/UniVocityTsvDataFormatMarshalRoute.java | 49 +++++++++++++
.../it/UniVocityTsvDataFormatUnmarshalRoute.java | 62 ++++++++++++++++
.../it/UniVocityCsvDataFormatMarshalIT.java | 24 ++++++
.../it/UniVocityCsvDataFormatMarshalTest.java | 82 +++++++++++++++++++++
.../it/UniVocityCsvDataFormatUnmarshalIT.java | 24 ++++++
.../it/UniVocityCsvDataFormatUnmarshalTest.java | 85 ++++++++++++++++++++++
.../it/UniVocityFixedWidthDataFormatMarshalIT.java | 24 ++++++
.../UniVocityFixedWidthDataFormatMarshalTest.java | 83 +++++++++++++++++++++
.../UniVocityFixedWidthDataFormatUnmarshalIT.java | 24 ++++++
...UniVocityFixedWidthDataFormatUnmarshalTest.java | 85 ++++++++++++++++++++++
.../univocity/parsers/it/UniVocityTestHelper.java | 68 +++++++++++++++++
.../it/UniVocityTsvDataFormatMarshalIT.java | 24 ++++++
.../it/UniVocityTsvDataFormatMarshalTest.java | 82 +++++++++++++++++++++
.../it/UniVocityTsvDataFormatUnmarshalIT.java | 24 ++++++
.../it/UniVocityTsvDataFormatUnmarshalTest.java | 84 +++++++++++++++++++++
tooling/scripts/test-categories.yaml | 1 +
34 files changed, 1177 insertions(+), 154 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/dataformats/univocity-parsers.adoc b/docs/modules/ROOT/pages/reference/dataformats/univocity-parsers.adoc
index 2428e86..7d55c68 100644
--- a/docs/modules/ROOT/pages/reference/dataformats/univocity-parsers.adoc
+++ b/docs/modules/ROOT/pages/reference/dataformats/univocity-parsers.adoc
@@ -4,11 +4,11 @@
= uniVocity TSV
:cq-artifact-id: camel-quarkus-univocity-parsers
:cq-artifact-id-base: univocity-parsers
-:cq-native-supported: false
-:cq-status: Preview
+:cq-native-supported: true
+:cq-status: Stable
:cq-deprecated: false
:cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 1.2.0
:cq-camel-part-name: univocity-tsv
:cq-camel-part-title: uniVocity TSV
:cq-camel-part-description: Marshal and unmarshal Java objects from and to TSV (Tab-Separated Values) records using UniVocity Parsers.
diff --git a/docs/modules/ROOT/pages/reference/extensions/univocity-parsers.adoc b/docs/modules/ROOT/pages/reference/extensions/univocity-parsers.adoc
index 018dc96..4186b06 100644
--- a/docs/modules/ROOT/pages/reference/extensions/univocity-parsers.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/univocity-parsers.adoc
@@ -3,15 +3,15 @@
= uniVocity CSV
:cq-artifact-id: camel-quarkus-univocity-parsers
-:cq-native-supported: false
-:cq-status: Preview
+:cq-native-supported: true
+:cq-status: Stable
:cq-description: Marshal and unmarshal Java objects from and to CSV (Comma Separated Values) using UniVocity Parsers.
:cq-deprecated: false
:cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 1.2.0
[.badges]
-[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
+[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native since##[.badge-supported]##1.2.0##
Marshal and unmarshal Java objects from and to CSV (Comma Separated Values) using UniVocity Parsers.
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index 5d75745..290485f 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -139,7 +139,6 @@
<module>syslog</module>
<module>thrift</module>
<module>twilio</module>
- <module>univocity-parsers</module>
<module>velocity</module>
<module>web3j</module>
<module>weka</module>
diff --git a/extensions-jvm/univocity-parsers/integration-test/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UnivocityParsersResource.java b/extensions-jvm/univocity-parsers/integration-test/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UnivocityParsersResource.java
deleted file mode 100644
index 427fba4..0000000
--- a/extensions-jvm/univocity-parsers/integration-test/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UnivocityParsersResource.java
+++ /dev/null
@@ -1,77 +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.quarkus.component.univocity.parsers.it;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.camel.CamelContext;
-import org.jboss.logging.Logger;
-
-@Path("/univocity-parsers")
-@ApplicationScoped
-public class UnivocityParsersResource {
-
- private static final Logger LOG = Logger.getLogger(UnivocityParsersResource.class);
-
- private static final String DATAFORMAT_UNIVOCITY_CSV = "univocity-csv";
- private static final String DATAFORMAT_UNIVOCITY_FIXED = "univocity-fixed";
- private static final String DATAFORMAT_UNIVOCITY_TSV = "univocity-tsv";
- @Inject
- CamelContext context;
-
- @Path("/load/dataformat/univocity-csv")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response loadDataformatUnivocityCsv() throws Exception {
- /* This is an autogenerated test */
- if (context.resolveDataFormat(DATAFORMAT_UNIVOCITY_CSV) != null) {
- return Response.ok().build();
- }
- LOG.warnf("Could not load [%s] from the Camel context", DATAFORMAT_UNIVOCITY_CSV);
- return Response.status(500, DATAFORMAT_UNIVOCITY_CSV + " could not be loaded from the Camel context").build();
- }
-
- @Path("/load/dataformat/univocity-fixed")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response loadDataformatUnivocityFixed() throws Exception {
- /* This is an autogenerated test */
- if (context.resolveDataFormat(DATAFORMAT_UNIVOCITY_FIXED) != null) {
- return Response.ok().build();
- }
- LOG.warnf("Could not load [%s] from the Camel context", DATAFORMAT_UNIVOCITY_FIXED);
- return Response.status(500, DATAFORMAT_UNIVOCITY_FIXED + " could not be loaded from the Camel context").build();
- }
-
- @Path("/load/dataformat/univocity-tsv")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response loadDataformatUnivocityTsv() throws Exception {
- /* This is an autogenerated test */
- if (context.resolveDataFormat(DATAFORMAT_UNIVOCITY_TSV) != null) {
- return Response.ok().build();
- }
- LOG.warnf("Could not load [%s] from the Camel context", DATAFORMAT_UNIVOCITY_TSV);
- return Response.status(500, DATAFORMAT_UNIVOCITY_TSV + " could not be loaded from the Camel context").build();
- }
-}
diff --git a/extensions-jvm/univocity-parsers/integration-test/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UnivocityParsersTest.java b/extensions-jvm/univocity-parsers/integration-test/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UnivocityParsersTest.java
deleted file mode 100644
index 40f28ea..0000000
--- a/extensions-jvm/univocity-parsers/integration-test/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UnivocityParsersTest.java
+++ /dev/null
@@ -1,50 +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.quarkus.component.univocity.parsers.it;
-
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
-
-@QuarkusTest
-class UnivocityParsersTest {
-
- @Test
- public void loadDataformatUnivocityCsv() {
- /* A simple autogenerated test */
- RestAssured.get("/univocity-parsers/load/dataformat/univocity-csv")
- .then()
- .statusCode(200);
- }
-
- @Test
- public void loadDataformatUnivocityFixed() {
- /* A simple autogenerated test */
- RestAssured.get("/univocity-parsers/load/dataformat/univocity-fixed")
- .then()
- .statusCode(200);
- }
-
- @Test
- public void loadDataformatUnivocityTsv() {
- /* A simple autogenerated test */
- RestAssured.get("/univocity-parsers/load/dataformat/univocity-tsv")
- .then()
- .statusCode(200);
- }
-
-}
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 29c5334..574988d 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -183,6 +183,7 @@
<module>tika</module>
<module>timer</module>
<module>twitter</module>
+ <module>univocity-parsers</module>
<module>validator</module>
<module>vertx</module>
<module>vertx-http</module>
diff --git a/extensions-jvm/univocity-parsers/deployment/pom.xml b/extensions/univocity-parsers/deployment/pom.xml
similarity index 100%
rename from extensions-jvm/univocity-parsers/deployment/pom.xml
rename to extensions/univocity-parsers/deployment/pom.xml
diff --git a/extensions-jvm/univocity-parsers/deployment/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/deployment/UnivocityParsersProcessor.java b/extensions/univocity-parsers/deployment/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/deployment/UnivocityParsersProcessor.java
similarity index 69%
rename from extensions-jvm/univocity-parsers/deployment/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/deployment/UnivocityParsersProcessor.java
rename to extensions/univocity-parsers/deployment/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/deployment/UnivocityParsersProcessor.java
index a725f29..2a3c3a5 100644
--- a/extensions-jvm/univocity-parsers/deployment/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/deployment/UnivocityParsersProcessor.java
+++ b/extensions/univocity-parsers/deployment/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/deployment/UnivocityParsersProcessor.java
@@ -17,11 +17,7 @@
package org.apache.camel.quarkus.component.univocity.parsers.deployment;
import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.ExecutionTime;
-import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.pkg.steps.NativeBuild;
-import org.apache.camel.quarkus.core.JvmOnlyRecorder;
import org.jboss.logging.Logger;
class UnivocityParsersProcessor {
@@ -33,14 +29,4 @@ class UnivocityParsersProcessor {
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
-
- /**
- * Remove this once this extension starts supporting the native mode.
- */
- @BuildStep(onlyIf = NativeBuild.class)
- @Record(value = ExecutionTime.RUNTIME_INIT)
- void warnJvmInNative(JvmOnlyRecorder recorder) {
- JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
- recorder.warnJvmInNative(FEATURE); // warn at runtime
- }
}
diff --git a/extensions-jvm/univocity-parsers/pom.xml b/extensions/univocity-parsers/pom.xml
similarity index 97%
rename from extensions-jvm/univocity-parsers/pom.xml
rename to extensions/univocity-parsers/pom.xml
index 2cf8ef0..4de3fb4 100644
--- a/extensions-jvm/univocity-parsers/pom.xml
+++ b/extensions/univocity-parsers/pom.xml
@@ -35,6 +35,5 @@
<modules>
<module>deployment</module>
<module>runtime</module>
- <module>integration-test</module>
</modules>
</project>
diff --git a/extensions-jvm/univocity-parsers/runtime/pom.xml b/extensions/univocity-parsers/runtime/pom.xml
similarity index 98%
rename from extensions-jvm/univocity-parsers/runtime/pom.xml
rename to extensions/univocity-parsers/runtime/pom.xml
index 3d430f3..9d05333 100644
--- a/extensions-jvm/univocity-parsers/runtime/pom.xml
+++ b/extensions/univocity-parsers/runtime/pom.xml
@@ -34,6 +34,7 @@
<properties>
<camel.quarkus.jvmSince>1.1.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>1.2.0</camel.quarkus.nativeSince>
</properties>
<dependencyManagement>
diff --git a/extensions-jvm/univocity-parsers/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/univocity-parsers/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 100%
rename from extensions-jvm/univocity-parsers/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to extensions/univocity-parsers/runtime/src/main/resources/META-INF/quarkus-extension.yaml
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 4066598..101f625 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -149,6 +149,7 @@
<module>telegram</module>
<module>tika</module>
<module>twitter</module>
+ <module>univocity-parsers</module>
<module>validator</module>
<module>vertx</module>
<module>vertx-websocket</module>
diff --git a/extensions-jvm/univocity-parsers/integration-test/pom.xml b/integration-tests/univocity-parsers/pom.xml
similarity index 70%
rename from extensions-jvm/univocity-parsers/integration-test/pom.xml
rename to integration-tests/univocity-parsers/pom.xml
index 65f97bf..25cccf7 100644
--- a/extensions-jvm/univocity-parsers/integration-test/pom.xml
+++ b/integration-tests/univocity-parsers/pom.xml
@@ -23,13 +23,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-build-parent-it</artifactId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
<version>1.2.0-SNAPSHOT</version>
- <relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
</parent>
- <artifactId>camel-quarkus-univocity-parsers-integration-test</artifactId>
- <name>Camel Quarkus :: uniVocity CSV :: Integration Test</name>
+ <artifactId>camel-quarkus-integration-test-univocity-parsers</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: uniVocity CSV</name>
<description>Integration tests for Camel Quarkus uniVocity CSV extension</description>
<dependencyManagement>
@@ -47,12 +46,20 @@
<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-univocity-parsers</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jackson</artifactId>
+ </dependency>
<!-- test dependencies -->
<dependency>
@@ -97,4 +104,34 @@
</plugin>
</plugins>
</build>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatMarshalRoute.java b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatMarshalRoute.java
new file mode 100644
index 0000000..4c828cd
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatMarshalRoute.java
@@ -0,0 +1,53 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.dataformat.univocity.UniVocityCsvDataFormat;
+import org.apache.camel.spi.DataFormat;
+
+public class UniVocityCsvDataFormatMarshalRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ final Map<String, DataFormat> testsDataformat = new HashMap<>();
+
+ // Default writing of CSV
+ testsDataformat.put("default", new UniVocityCsvDataFormat());
+
+ // Write a CSV with specific headers
+ testsDataformat.put("header", new UniVocityCsvDataFormat()
+ .setHeaders(new String[] { "A", "C" }));
+
+ // Write a CSV with an advanced configuration
+ testsDataformat.put("advanced", new UniVocityCsvDataFormat()
+ .setNullValue("N/A")
+ .setEmptyValue("empty")
+ .setQuote('_')
+ .setQuoteAllFields(true)
+ .setQuoteEscape('-')
+ .setDelimiter(';'));
+
+ for (Map.Entry<String, DataFormat> testDataformat : testsDataformat.entrySet()) {
+ from("direct:csv-marshal-" + testDataformat.getKey()).marshal(testDataformat.getValue());
+ }
+ }
+
+}
diff --git a/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatUnmarshalRoute.java b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatUnmarshalRoute.java
new file mode 100644
index 0000000..ddd68a5
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatUnmarshalRoute.java
@@ -0,0 +1,63 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.dataformat.univocity.UniVocityCsvDataFormat;
+import org.apache.camel.spi.DataFormat;
+
+public class UniVocityCsvDataFormatUnmarshalRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ final Map<String, DataFormat> testsDataformat = new HashMap<>();
+
+ // Default reading of CSV
+ testsDataformat.put("default", new UniVocityCsvDataFormat());
+
+ // Reading CSV as Map
+ testsDataformat.put("map", new UniVocityCsvDataFormat()
+ .setAsMap(true)
+ .setHeaderExtractionEnabled(true));
+
+ // Reading CSV as Map with specific headers
+ testsDataformat.put("mapWithHeaders", new UniVocityCsvDataFormat()
+ .setAsMap(true)
+ .setHeaders(new String[] { "A", "B", "C" }));
+
+ // Reading CSV using an iterator
+ testsDataformat.put("lazy", new UniVocityCsvDataFormat()
+ .setLazyLoad(true));
+
+ // Reading CSV using advanced configuration
+ testsDataformat.put("advanced", new UniVocityCsvDataFormat()
+ .setNullValue("N/A")
+ .setDelimiter(';')
+ .setIgnoreLeadingWhitespaces(true)
+ .setIgnoreTrailingWhitespaces(false)
+ .setComment('!')
+ .setSkipEmptyLines(true));
+
+ for (Map.Entry<String, DataFormat> testDataformat : testsDataformat.entrySet()) {
+ from("direct:csv-unmarshal-" + testDataformat.getKey()).unmarshal(testDataformat.getValue());
+ }
+ }
+
+}
diff --git a/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatMarshalRoute.java b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatMarshalRoute.java
new file mode 100644
index 0000000..585e420
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatMarshalRoute.java
@@ -0,0 +1,53 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.dataformat.univocity.UniVocityFixedWidthDataFormat;
+import org.apache.camel.spi.DataFormat;
+
+public class UniVocityFixedWidthDataFormatMarshalRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ final Map<String, DataFormat> testsDataformat = new HashMap<>();
+
+ // Default writing of fixed-width
+ testsDataformat.put("default", new UniVocityFixedWidthDataFormat()
+ .setFieldLengths(new int[] { 3, 3, 5 }));
+
+ // Write a fixed-width with specific headers
+ testsDataformat.put("header", new UniVocityFixedWidthDataFormat()
+ .setFieldLengths(new int[] { 3, 5 })
+ .setHeaders(new String[] { "A", "C" }));
+
+ // Write a fixed-width with an advanced configuration
+ testsDataformat.put("advanced", new UniVocityFixedWidthDataFormat()
+ .setFieldLengths(new int[] { 5, 5 })
+ .setNullValue("N/A")
+ .setEmptyValue("empty")
+ .setPadding('_'));
+
+ for (Map.Entry<String, DataFormat> testDataformat : testsDataformat.entrySet()) {
+ from("direct:fixed-width-marshal-" + testDataformat.getKey()).marshal(testDataformat.getValue());
+ }
+ }
+
+}
diff --git a/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatUnmarshalRoute.java b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatUnmarshalRoute.java
new file mode 100644
index 0000000..d83e94a
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatUnmarshalRoute.java
@@ -0,0 +1,66 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.dataformat.univocity.UniVocityFixedWidthDataFormat;
+import org.apache.camel.spi.DataFormat;
+
+public class UniVocityFixedWidthDataFormatUnmarshalRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ final Map<String, DataFormat> testsDataformat = new HashMap<>();
+
+ // Default reading of fixed-width
+ testsDataformat.put("default", new UniVocityFixedWidthDataFormat()
+ .setFieldLengths(new int[] { 3, 3, 5 }));
+
+ // Reading fixed-width as Map
+ testsDataformat.put("map", new UniVocityFixedWidthDataFormat()
+ .setFieldLengths(new int[] { 3, 3, 5 })
+ .setAsMap(true)
+ .setHeaderExtractionEnabled(true));
+
+ // Reading fixed-width as Map with specific headers
+ testsDataformat.put("mapWithHeaders", new UniVocityFixedWidthDataFormat()
+ .setFieldLengths(new int[] { 3, 3, 5 })
+ .setAsMap(true)
+ .setHeaders(new String[] { "A", "B", "C" }));
+
+ // Reading fixed-width using an iterator
+ testsDataformat.put("lazy", new UniVocityFixedWidthDataFormat()
+ .setFieldLengths(new int[] { 3, 3, 5 })
+ .setLazyLoad(true));
+
+ // Reading fixed-width using advanced configuration
+ testsDataformat.put("advanced", new UniVocityFixedWidthDataFormat()
+ .setFieldLengths(new int[] { 3, 3 })
+ .setNullValue("N/A")
+ .setPadding('_')
+ .setComment('!')
+ .setSkipEmptyLines(true));
+
+ for (Map.Entry<String, DataFormat> testDataformat : testsDataformat.entrySet()) {
+ from("direct:fixed-width-unmarshal-" + testDataformat.getKey()).unmarshal(testDataformat.getValue());
+ }
+ }
+
+}
diff --git a/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityParsersResource.java b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityParsersResource.java
new file mode 100644
index 0000000..1246865
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityParsersResource.java
@@ -0,0 +1,66 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.ProducerTemplate;
+import org.jboss.logging.Logger;
+
+@Path("/univocity-parsers")
+@ApplicationScoped
+public class UniVocityParsersResource {
+
+ private static final Logger LOG = Logger.getLogger(UniVocityParsersResource.class);
+
+ @Inject
+ ProducerTemplate template;
+
+ @Path("/marshal/{dataformat : (csv|fixed-width|tsv)}/{test}")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String marshal(@PathParam("dataformat") String df, @PathParam("test") String testName,
+ List<Map<String, String>> objectsToMarshal) {
+ LOG.debugf("Calling marshal with (dataformat = %s, test = %s and content =\n%s", df, testName, objectsToMarshal);
+ if (objectsToMarshal.size() == 1) {
+ // Force single line marshal to complete test coverage
+ return template.requestBody("direct:" + df + "-marshal-" + testName, objectsToMarshal.get(0), String.class);
+ }
+ return template.requestBody("direct:" + df + "-marshal-" + testName, objectsToMarshal, String.class);
+ }
+
+ @Path("/unmarshal/{dataformat : (csv|fixed-width|tsv)}/{test}")
+ @GET
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.APPLICATION_JSON)
+ public List<?> unmarshal(@PathParam("dataformat") String df, @PathParam("test") String testName, String content) {
+ LOG.debugf("Calling unmarshal with (dataformat = %s, test = %s and content =\n%s", df, testName, content);
+ return template.requestBody("direct:" + df + "-unmarshal-" + testName, content, List.class);
+ }
+
+}
diff --git a/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatMarshalRoute.java b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatMarshalRoute.java
new file mode 100644
index 0000000..4cf6078
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatMarshalRoute.java
@@ -0,0 +1,49 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.dataformat.univocity.UniVocityTsvDataFormat;
+import org.apache.camel.spi.DataFormat;
+
+public class UniVocityTsvDataFormatMarshalRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ final Map<String, DataFormat> testsDataformat = new HashMap<>();
+
+ // Default writing of TSV
+ testsDataformat.put("default", new UniVocityTsvDataFormat());
+
+ // Write a TSV with specific headers
+ testsDataformat.put("header", new UniVocityTsvDataFormat()
+ .setHeaders(new String[] { "A", "C" }));
+
+ // Write a TSV with an advanced configuration
+ testsDataformat.put("advanced", new UniVocityTsvDataFormat()
+ .setNullValue("N/A")
+ .setEmptyValue("empty"));
+
+ for (Map.Entry<String, DataFormat> testDataformat : testsDataformat.entrySet()) {
+ from("direct:tsv-marshal-" + testDataformat.getKey()).marshal(testDataformat.getValue());
+ }
+ }
+
+}
diff --git a/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatUnmarshalRoute.java b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatUnmarshalRoute.java
new file mode 100644
index 0000000..501e7a1
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/main/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatUnmarshalRoute.java
@@ -0,0 +1,62 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.dataformat.univocity.UniVocityTsvDataFormat;
+import org.apache.camel.spi.DataFormat;
+
+public class UniVocityTsvDataFormatUnmarshalRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ final Map<String, DataFormat> testsDataformat = new HashMap<>();
+
+ // Default reading of TSV
+ testsDataformat.put("default", new UniVocityTsvDataFormat());
+
+ // Reading TSV as Map
+ testsDataformat.put("map", new UniVocityTsvDataFormat()
+ .setAsMap(true)
+ .setHeaderExtractionEnabled(true));
+
+ // Reading TSV as Map with specific headers
+ testsDataformat.put("mapWithHeaders", new UniVocityTsvDataFormat()
+ .setAsMap(true)
+ .setHeaders(new String[] { "A", "B", "C" }));
+
+ // Reading TSV using an iterator
+ testsDataformat.put("lazy", new UniVocityTsvDataFormat()
+ .setLazyLoad(true));
+
+ // Reading TSV using advanced configuration
+ testsDataformat.put("advanced", new UniVocityTsvDataFormat()
+ .setNullValue("N/A")
+ .setIgnoreLeadingWhitespaces(true)
+ .setIgnoreTrailingWhitespaces(false)
+ .setComment('!')
+ .setSkipEmptyLines(true));
+
+ for (Map.Entry<String, DataFormat> testDataformat : testsDataformat.entrySet()) {
+ from("direct:tsv-unmarshal-" + testDataformat.getKey()).unmarshal(testDataformat.getValue());
+ }
+ }
+
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatMarshalIT.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatMarshalIT.java
new file mode 100644
index 0000000..f6d3a40
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatMarshalIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class UniVocityCsvDataFormatMarshalIT extends UniVocityCsvDataFormatMarshalTest {
+
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatMarshalTest.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatMarshalTest.java
new file mode 100644
index 0000000..a4ba9a9
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatMarshalTest.java
@@ -0,0 +1,82 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.asMap;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.join;
+import static org.hamcrest.Matchers.is;
+
+@QuarkusTest
+public class UniVocityCsvDataFormatMarshalTest {
+
+ @Test
+ void shouldMarshalWithDefaultConfiguration() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2", "C", "3"),
+ asMap("A", "one", "B", "two", "C", "three"));
+ String expected = join("1,2,3", "one,two,three");
+ String url = "/univocity-parsers/marshal/csv/default";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalSingleLine() {
+ List<Map<String, String>> object = Arrays.asList(asMap("A", "1", "B", "2", "C", "3"));
+ String expected = join("1,2,3");
+ String url = "/univocity-parsers/marshal/csv/default";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalAndAddNewColumns() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2"),
+ asMap("C", "three", "A", "one", "B", "two"));
+ String expected = join("1,2", "one,two,three");
+ String url = "/univocity-parsers/marshal/csv/default";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalWithSpecificHeaders() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2", "C", "3"),
+ asMap("A", "one", "B", "two", "C", "three"));
+ String expected = join("1,3", "one,three");
+ String url = "/univocity-parsers/marshal/csv/header";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalUsingAdvancedConfiguration() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", null, "B", "", "C", "_"),
+ asMap("A", "one", "B", "two", "C", "three"));
+ String expected = join("_N/A_;_empty_;_-__", "_one_;_two_;_three_");
+ String url = "/univocity-parsers/marshal/csv/advanced";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatUnmarshalIT.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatUnmarshalIT.java
new file mode 100644
index 0000000..92c8210
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatUnmarshalIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class UniVocityCsvDataFormatUnmarshalIT extends UniVocityCsvDataFormatUnmarshalTest {
+
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatUnmarshalTest.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatUnmarshalTest.java
new file mode 100644
index 0000000..bbf4d2c
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityCsvDataFormatUnmarshalTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.Arrays;
+import java.util.List;
+
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.asMap;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.join;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@QuarkusTest
+public class UniVocityCsvDataFormatUnmarshalTest {
+
+ @Test
+ void shouldUnmarshalWithDefaultConfiguration() {
+ String content = join("A,B,C", "1,2,3", "one,two,three");
+ String url = "/univocity-parsers/unmarshal/csv/default";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(3, unmarshalleds.size());
+ assertEquals(Arrays.asList("A", "B", "C"), unmarshalleds.get(0));
+ assertEquals(Arrays.asList("1", "2", "3"), unmarshalleds.get(1));
+ assertEquals(Arrays.asList("one", "two", "three"), unmarshalleds.get(2));
+ }
+
+ @Test
+ void shouldUnmarshalAsMap() {
+ String content = join("A,B,C", "1,2,3", "one,two,three");
+ String url = "/univocity-parsers/unmarshal/csv/map";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(2, unmarshalleds.size());
+ assertEquals(asMap("A", "1", "B", "2", "C", "3"), unmarshalleds.get(0));
+ assertEquals(asMap("A", "one", "B", "two", "C", "three"), unmarshalleds.get(1));
+ }
+
+ @Test
+ void shouldUnmarshalAsMapWithHeaders() {
+ String content = join("1,2,3", "one,two,three");
+ String url = "/univocity-parsers/unmarshal/csv/mapWithHeaders";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(2, unmarshalleds.size());
+ assertEquals(asMap("A", "1", "B", "2", "C", "3"), unmarshalleds.get(0));
+ assertEquals(asMap("A", "one", "B", "two", "C", "three"), unmarshalleds.get(1));
+ }
+
+ @Test
+ void shouldUnmarshalUsingIterator() {
+ String content = join("A,B,C", "1,2,3", "one,two,three");
+ String url = "/univocity-parsers/unmarshal/csv/lazy";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(3, unmarshalleds.size());
+ assertEquals(Arrays.asList("A", "B", "C"), unmarshalleds.get(0));
+ assertEquals(Arrays.asList("1", "2", "3"), unmarshalleds.get(1));
+ assertEquals(Arrays.asList("one", "two", "three"), unmarshalleds.get(2));
+ }
+
+ @Test
+ void shouldUnmarshalUsingAdvancedConfiguration() {
+ String content = join("!This is comment", "!This is comment too", "A;B", "", " ;D ");
+ String url = "/univocity-parsers/unmarshal/csv/advanced";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(2, unmarshalleds.size());
+ assertEquals(Arrays.asList("A", "B"), unmarshalleds.get(0));
+ assertEquals(Arrays.asList("N/A", "D "), unmarshalleds.get(1));
+ }
+
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatMarshalIT.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatMarshalIT.java
new file mode 100644
index 0000000..18fc06b
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatMarshalIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class UniVocityFixedWidthDataFormatMarshalIT extends UniVocityFixedWidthDataFormatMarshalTest {
+
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatMarshalTest.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatMarshalTest.java
new file mode 100644
index 0000000..2405052
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatMarshalTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.asMap;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.join;
+import static org.hamcrest.Matchers.is;
+
+@QuarkusTest
+public class UniVocityFixedWidthDataFormatMarshalTest {
+
+ @Test
+ void shouldMarshalWithDefaultConfiguration() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2", "C", "3"),
+ asMap("A", "one", "B", "two", "C", "three"));
+ String expected = join("1 2 3 ", "onetwothree");
+ String url = "/univocity-parsers/marshal/fixed-width/default";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalSingleLine() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2", "C", "3"));
+ String expected = join("1 2 3 ");
+ String url = "/univocity-parsers/marshal/fixed-width/default";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalAndAddNewColumns() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2"),
+ asMap("C", "three", "A", "one", "B", "two"));
+ String expected = join("1 2 ", "onetwothree");
+ String url = "/univocity-parsers/marshal/fixed-width/default";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalWithSpecificHeaders() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2", "C", "3"),
+ asMap("A", "one", "B", "two", "C", "three"));
+ String expected = join("1 3 ", "onethree");
+ String url = "/univocity-parsers/marshal/fixed-width/header";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalUsingAdvancedConfiguration() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", null, "B", ""),
+ asMap("A", "one", "B", "two"));
+ String expected = join("N/A__empty", "one__two__");
+ String url = "/univocity-parsers/marshal/fixed-width/advanced";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatUnmarshalIT.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatUnmarshalIT.java
new file mode 100644
index 0000000..5aa7938
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatUnmarshalIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class UniVocityFixedWidthDataFormatUnmarshalIT extends UniVocityFixedWidthDataFormatUnmarshalTest {
+
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatUnmarshalTest.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatUnmarshalTest.java
new file mode 100644
index 0000000..98e1b7d
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityFixedWidthDataFormatUnmarshalTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.Arrays;
+import java.util.List;
+
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.asMap;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.join;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@QuarkusTest
+public class UniVocityFixedWidthDataFormatUnmarshalTest {
+
+ @Test
+ void shouldUnmarshalWithDefaultConfiguration() {
+ String content = join("A B C ", "1 2 3 ", "onetwothree");
+ String url = "/univocity-parsers/unmarshal/fixed-width/default";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(3, unmarshalleds.size());
+ assertEquals(Arrays.asList("A", "B", "C"), unmarshalleds.get(0));
+ assertEquals(Arrays.asList("1", "2", "3"), unmarshalleds.get(1));
+ assertEquals(Arrays.asList("one", "two", "three"), unmarshalleds.get(2));
+ }
+
+ @Test
+ void shouldUnmarshalAsMap() {
+ String content = join("A B C ", "1 2 3 ", "onetwothree");
+ String url = "/univocity-parsers/unmarshal/fixed-width/map";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(2, unmarshalleds.size());
+ assertEquals(asMap("A", "1", "B", "2", "C", "3"), unmarshalleds.get(0));
+ assertEquals(asMap("A", "one", "B", "two", "C", "three"), unmarshalleds.get(1));
+ }
+
+ @Test
+ void shouldUnmarshalAsMapWithHeaders() {
+ String content = join("1 2 3 ", "onetwothree");
+ String url = "/univocity-parsers/unmarshal/fixed-width/mapWithHeaders";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(2, unmarshalleds.size());
+ assertEquals(asMap("A", "1", "B", "2", "C", "3"), unmarshalleds.get(0));
+ assertEquals(asMap("A", "one", "B", "two", "C", "three"), unmarshalleds.get(1));
+ }
+
+ @Test
+ void shouldUnmarshalUsingIterator() {
+ String content = join("A B C ", "1 2 3 ", "onetwothree");
+ String url = "/univocity-parsers/unmarshal/fixed-width/lazy";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(3, unmarshalleds.size());
+ assertEquals(Arrays.asList("A", "B", "C"), unmarshalleds.get(0));
+ assertEquals(Arrays.asList("1", "2", "3"), unmarshalleds.get(1));
+ assertEquals(Arrays.asList("one", "two", "three"), unmarshalleds.get(2));
+ }
+
+ @Test
+ void shouldUnmarshalUsingAdvancedConfiguration() {
+ String content = join("!This is comment", "!This is comment too", "A__B__", "", "___D__");
+ String url = "/univocity-parsers/unmarshal/fixed-width/advanced";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(2, unmarshalleds.size());
+ assertEquals(Arrays.asList("A", "B"), unmarshalleds.get(0));
+ assertEquals(Arrays.asList("N/A", "D"), unmarshalleds.get(1));
+ }
+
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTestHelper.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTestHelper.java
new file mode 100644
index 0000000..4a46924
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTestHelper.java
@@ -0,0 +1,68 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import static java.lang.System.lineSeparator;
+
+/**
+ * This class provides utility methods for the unit tests
+ */
+final class UniVocityTestHelper {
+
+ private UniVocityTestHelper() {
+ // Helper class
+ }
+
+ /**
+ * Creates a Map with the given key values
+ *
+ * @param keyValues the key values
+ * @return Map with the given key values
+ */
+ public static Map<String, String> asMap(String... keyValues) {
+ if (keyValues == null || keyValues.length % 2 == 1) {
+ throw new IllegalArgumentException("You must specify key values with an even number.");
+ }
+
+ Map<String, String> result = new LinkedHashMap<>(keyValues.length / 2);
+ for (int i = 0; i < keyValues.length; i += 2) {
+ result.put(keyValues[i], keyValues[i + 1]);
+ }
+ return result;
+ }
+
+ /**
+ * Joins the given lines with the platform new line.
+ *
+ * @param lines lines to join
+ * @return joined lines with the platform new line
+ */
+ public static String join(String... lines) {
+ if (lines == null || lines.length == 0) {
+ return "";
+ }
+
+ StringBuilder sb = new StringBuilder();
+ for (String line : lines) {
+ sb.append(line).append(lineSeparator());
+ }
+ return sb.toString();
+ }
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatMarshalIT.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatMarshalIT.java
new file mode 100644
index 0000000..e78b951
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatMarshalIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class UniVocityTsvDataFormatMarshalIT extends UniVocityTsvDataFormatMarshalTest {
+
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatMarshalTest.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatMarshalTest.java
new file mode 100644
index 0000000..a37e000
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatMarshalTest.java
@@ -0,0 +1,82 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.asMap;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.join;
+import static org.hamcrest.Matchers.is;
+
+@QuarkusTest
+public class UniVocityTsvDataFormatMarshalTest {
+
+ @Test
+ void shouldMarshalWithDefaultConfiguration() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2", "C", "3"),
+ asMap("A", "one", "B", "two", "C", "three"));
+ String expected = join("1\t2\t3", "one\ttwo\tthree");
+ String url = "/univocity-parsers/marshal/tsv/default";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalSingleLine() {
+ List<Map<String, String>> object = Arrays.asList(asMap("A", "1", "B", "2", "C", "3"));
+ String expected = join("1\t2\t3");
+ String url = "/univocity-parsers/marshal/tsv/default";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalAndAddNewColumns() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2"),
+ asMap("C", "three", "A", "one", "B", "two"));
+ String expected = join("1\t2", "one\ttwo\tthree");
+ String url = "/univocity-parsers/marshal/tsv/default";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalWithSpecificHeaders() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", "1", "B", "2", "C", "3"),
+ asMap("A", "one", "B", "two", "C", "three"));
+ String expected = join("1\t3", "one\tthree");
+ String url = "/univocity-parsers/marshal/tsv/header";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+
+ @Test
+ void shouldMarshalUsingAdvancedConfiguration() {
+ List<Map<String, String>> object = Arrays.asList(
+ asMap("A", null, "B", "", "C", "_"),
+ asMap("A", "one", "B", "two", "C", "three"));
+ String expected = join("N/A\tempty\t_", "one\ttwo\tthree");
+ String url = "/univocity-parsers/marshal/tsv/advanced";
+ given().when().contentType(ContentType.JSON).body(object).get(url).then().statusCode(200).body(is(expected));
+ }
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatUnmarshalIT.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatUnmarshalIT.java
new file mode 100644
index 0000000..e7b9abd
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatUnmarshalIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class UniVocityTsvDataFormatUnmarshalIT extends UniVocityTsvDataFormatUnmarshalTest {
+
+}
diff --git a/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatUnmarshalTest.java b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatUnmarshalTest.java
new file mode 100644
index 0000000..1efb094
--- /dev/null
+++ b/integration-tests/univocity-parsers/src/test/java/org/apache/camel/quarkus/component/univocity/parsers/it/UniVocityTsvDataFormatUnmarshalTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.quarkus.component.univocity.parsers.it;
+
+import java.util.Arrays;
+import java.util.List;
+
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.asMap;
+import static org.apache.camel.quarkus.component.univocity.parsers.it.UniVocityTestHelper.join;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@QuarkusTest
+public class UniVocityTsvDataFormatUnmarshalTest {
+
+ @Test
+ void shouldUnmarshalWithDefaultConfiguration() {
+ String content = join("A\tB\tC", "1\t2\t3", "one\ttwo\tthree");
+ String url = "/univocity-parsers/unmarshal/tsv/default";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(3, unmarshalleds.size());
+ assertEquals(Arrays.asList("A", "B", "C"), unmarshalleds.get(0));
+ assertEquals(Arrays.asList("1", "2", "3"), unmarshalleds.get(1));
+ assertEquals(Arrays.asList("one", "two", "three"), unmarshalleds.get(2));
+ }
+
+ @Test
+ void shouldUnmarshalAsMap() {
+ String content = join("A\tB\tC", "1\t2\t3", "one\ttwo\tthree");
+ String url = "/univocity-parsers/unmarshal/tsv/map";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(2, unmarshalleds.size());
+ assertEquals(asMap("A", "1", "B", "2", "C", "3"), unmarshalleds.get(0));
+ assertEquals(asMap("A", "one", "B", "two", "C", "three"), unmarshalleds.get(1));
+ }
+
+ @Test
+ void shouldUnmarshalAsMapWithHeaders() {
+ String content = join("1\t2\t3", "one\ttwo\tthree");
+ String url = "/univocity-parsers/unmarshal/tsv/mapWithHeaders";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(2, unmarshalleds.size());
+ assertEquals(asMap("A", "1", "B", "2", "C", "3"), unmarshalleds.get(0));
+ assertEquals(asMap("A", "one", "B", "two", "C", "three"), unmarshalleds.get(1));
+ }
+
+ @Test
+ void shouldUnmarshalUsingIterator() {
+ String content = join("A\tB\tC", "1\t2\t3", "one\ttwo\tthree");
+ String url = "/univocity-parsers/unmarshal/tsv/lazy";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(3, unmarshalleds.size());
+ assertEquals(Arrays.asList("A", "B", "C"), unmarshalleds.get(0));
+ assertEquals(Arrays.asList("1", "2", "3"), unmarshalleds.get(1));
+ assertEquals(Arrays.asList("one", "two", "three"), unmarshalleds.get(2));
+ }
+
+ @Test
+ void shouldUnmarshalUsingAdvancedConfiguration() {
+ String content = join("!This is comment", "!This is comment too", "A\tB", "", " \tD ");
+ String url = "/univocity-parsers/unmarshal/tsv/advanced";
+ List<?> unmarshalleds = given().when().body(content).get(url).then().statusCode(200).extract().as(List.class);
+ assertEquals(2, unmarshalleds.size());
+ assertEquals(Arrays.asList("A", "B"), unmarshalleds.get(0));
+ assertEquals(Arrays.asList("N/A", "D "), unmarshalleds.get(1));
+ }
+}
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 7e1ec77..ab581c4 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -108,6 +108,7 @@ networking2-dataformats:
- netty
- send-dynamic-http
- servlet
+ - univocity-parsers
- websocket-jsr356
- vertx
- compression