You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2020/01/30 08:48:49 UTC
[camel-quarkus] branch master updated: Added a camel-bindy
extension #653
This is an automated email from the ASF dual-hosted git repository.
aldettinger 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 f7d07bc Added a camel-bindy extension #653
f7d07bc is described below
commit f7d07bc787e79706c78f731374484418af13329e
Author: aldettinger <al...@gmail.com>
AuthorDate: Fri Jan 24 19:39:07 2020 +0100
Added a camel-bindy extension #653
---
.github/workflows/pr-build.yaml | 1 +
.../pages/list-of-camel-quarkus-extensions.adoc | 8 +-
extensions/bindy/deployment/pom.xml | 75 ++++++++++++
.../component/bindy/deployment/BindyProcessor.java | 31 +++++
extensions/bindy/pom.xml | 39 ++++++
extensions/bindy/runtime/pom.xml | 83 +++++++++++++
.../main/resources/META-INF/quarkus-extension.yaml | 27 ++++
extensions/pom.xml | 1 +
extensions/readme.adoc | 8 +-
integration-tests/bindy/pom.xml | 136 +++++++++++++++++++++
.../quarkus/component/bindy/it/BindyResource.java | 107 ++++++++++++++++
.../quarkus/component/bindy/it/BindyTestRoute.java | 47 +++++++
.../quarkus/component/bindy/it/model/CsvOrder.java | 50 ++++++++
.../component/bindy/it/model/FixedLengthOrder.java | 47 +++++++
.../quarkus/component/bindy/it/model/Header.java | 52 ++++++++
.../component/bindy/it/model/MessageOrder.java | 107 ++++++++++++++++
.../bindy/it/model/NameWithLengthSuffix.java | 51 ++++++++
.../model/NameWithLengthSuffixFormatFactory.java | 45 +++++++
.../quarkus/component/bindy/it/model/Security.java | 39 ++++++
.../component/bindy/it/model/TestConverter.java | 33 +++++
.../quarkus/component/bindy/it/model/Trailer.java | 41 +++++++
.../quarkus/component/bindy/it/CsvRecordIT.java | 24 ++++
.../quarkus/component/bindy/it/CsvRecordTest.java | 58 +++++++++
.../component/bindy/it/FixedLengthRecordIT.java | 24 ++++
.../component/bindy/it/FixedLengthRecordTest.java | 57 +++++++++
.../component/bindy/it/MessageRecordIT.java | 24 ++++
.../component/bindy/it/MessageRecordTest.java | 76 ++++++++++++
integration-tests/pom.xml | 1 +
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 10 ++
30 files changed, 1305 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml
index f03713e..fa071d7 100644
--- a/.github/workflows/pr-build.yaml
+++ b/.github/workflows/pr-build.yaml
@@ -204,6 +204,7 @@ jobs:
-Ddocker \
-DskipTests \
-pl :camel-quarkus-integration-test-base64 \
+ -pl :camel-quarkus-integration-test-bindy \
-pl :camel-quarkus-integration-test-snakeyaml \
-pl :camel-quarkus-integration-test-tagsoup \
-pl :camel-quarkus-integration-test-xslt \
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index f682720..f8673ee 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -213,7 +213,7 @@ Number of Camel components: 61 in 52 JAR artifacts (0 deprecated)
== Camel Data Formats
// dataformats: START
-Number of Camel data formats: 10 in 9 JAR artifacts (0 deprecated)
+Number of Camel data formats: 13 in 10 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -221,6 +221,12 @@ Number of Camel data formats: 10 in 9 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/base64-dataformat.html[Base64] (camel-quarkus-base64) | 1.0.0-M1 | The Base64 data format is used for base64 encoding and decoding.
+| link:https://camel.apache.org/components/latest/bindy-dataformat.html[Bindy CSV] (camel-quarkus-bindy) | 1.0.0 | The Bindy data format is used for working with flat payloads (such as CSV, delimited, fixed length formats, or FIX messages).
+
+| link:https://camel.apache.org/components/latest/bindy-dataformat.html[Bindy Fixed Length] (camel-quarkus-bindy) | 1.0.0 | The Bindy data format is used for working with flat payloads (such as CSV, delimited, fixed length formats, or FIX messages).
+
+| link:https://camel.apache.org/components/latest/bindy-dataformat.html[Bindy Key Value Pair] (camel-quarkus-bindy) | 1.0.0 | The Bindy data format is used for working with flat payloads (such as CSV, delimited, fixed length formats, or FIX messages).
+
| link:https://camel.apache.org/components/latest/csv-dataformat.html[CSV] (camel-quarkus-csv) | 0.2.0 | The CSV data format is used for handling CSV payloads.
| xref:extensions/fhir.adoc[FHIR JSon] (camel-quarkus-fhir) | 0.3.0 | The FHIR JSon data format is used to marshall/unmarshall to/from FHIR objects to/from JSON.
diff --git a/extensions/bindy/deployment/pom.xml b/extensions/bindy/deployment/pom.xml
new file mode 100644
index 0000000..2f4259d
--- /dev/null
+++ b/extensions/bindy/deployment/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bindy-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-bindy-deployment</artifactId>
+ <name>Camel Quarkus :: Bindy :: Deployment</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bindy</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/extensions/bindy/deployment/src/main/java/org/apache/camel/quarkus/component/bindy/deployment/BindyProcessor.java b/extensions/bindy/deployment/src/main/java/org/apache/camel/quarkus/component/bindy/deployment/BindyProcessor.java
new file mode 100644
index 0000000..74bd071
--- /dev/null
+++ b/extensions/bindy/deployment/src/main/java/org/apache/camel/quarkus/component/bindy/deployment/BindyProcessor.java
@@ -0,0 +1,31 @@
+/*
+ * 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.bindy.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+class BindyProcessor {
+
+ private static final String FEATURE = "camel-bindy";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+}
diff --git a/extensions/bindy/pom.xml b/extensions/bindy/pom.xml
new file mode 100644
index 0000000..f7e3dc6
--- /dev/null
+++ b/extensions/bindy/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-build-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-bindy-parent</artifactId>
+ <name>Camel Quarkus :: Bindy</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/bindy/runtime/pom.xml b/extensions/bindy/runtime/pom.xml
new file mode 100644
index 0000000..d5d44ec
--- /dev/null
+++ b/extensions/bindy/runtime/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bindy-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-bindy</artifactId>
+ <name>Camel Quarkus :: Bindy :: Runtime</name>
+ <description>Camel Bindy Data Format</description>
+
+ <properties>
+ <firstVersion>1.0.0</firstVersion>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-bindy</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/extensions/bindy/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/bindy/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..7adeed4
--- /dev/null
+++ b/extensions/bindy/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+---
+name: "Camel Quarkus Bindy"
+description: "Camel Bindy Data Format"
+metadata:
+ keywords:
+ - "camel"
+ - "bindy"
+ guide: "https://quarkus.io/guides/camel"
+ categories:
+ - "integration"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 181534c..2b43456 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -60,6 +60,7 @@
<module>base64</module>
<module>bean</module>
<module>bean-validator</module>
+ <module>bindy</module>
<module>consul</module>
<module>controlbus</module>
<module>csv</module>
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index 078f32d..be0d62b 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -201,7 +201,7 @@ Number of Camel components: 61 in 52 JAR artifacts (0 deprecated)
== Camel Data Formats
// dataformats: START
-Number of Camel data formats: 10 in 9 JAR artifacts (0 deprecated)
+Number of Camel data formats: 13 in 10 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -209,6 +209,12 @@ Number of Camel data formats: 10 in 9 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/base64-dataformat.html[Base64] (camel-quarkus-base64) | 1.0.0-M1 | The Base64 data format is used for base64 encoding and decoding.
+| link:https://camel.apache.org/components/latest/bindy-dataformat.html[Bindy CSV] (camel-quarkus-bindy) | 1.0.0 | The Bindy data format is used for working with flat payloads (such as CSV, delimited, fixed length formats, or FIX messages).
+
+| link:https://camel.apache.org/components/latest/bindy-dataformat.html[Bindy Fixed Length] (camel-quarkus-bindy) | 1.0.0 | The Bindy data format is used for working with flat payloads (such as CSV, delimited, fixed length formats, or FIX messages).
+
+| link:https://camel.apache.org/components/latest/bindy-dataformat.html[Bindy Key Value Pair] (camel-quarkus-bindy) | 1.0.0 | The Bindy data format is used for working with flat payloads (such as CSV, delimited, fixed length formats, or FIX messages).
+
| link:https://camel.apache.org/components/latest/csv-dataformat.html[CSV] (camel-quarkus-csv) | 0.2.0 | The CSV data format is used for handling CSV payloads.
| xref:extensions/fhir.adoc[FHIR JSon] (camel-quarkus-fhir) | 0.3.0 | The FHIR JSon data format is used to marshall/unmarshall to/from FHIR objects to/from JSON.
diff --git a/integration-tests/bindy/pom.xml b/integration-tests/bindy/pom.xml
new file mode 100644
index 0000000..fc7d8ed
--- /dev/null
+++ b/integration-tests/bindy/pom.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-bindy</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Bindy</name>
+ <description>Integration tests for Camel Quarkus Bindy extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bindy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</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>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <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>
+ <configuration>
+ <systemProperties>
+ <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>native-image</id>
+ <goals>
+ <goal>native-image</goal>
+ </goals>
+ <configuration>
+ <reportErrorsAtRuntime>false</reportErrorsAtRuntime>
+ <cleanupServer>true</cleanupServer>
+ <enableHttpsUrlHandler>true</enableHttpsUrlHandler>
+ <enableServer>false</enableServer>
+ <dumpProxies>false</dumpProxies>
+ <graalvmHome>${graalvmHome}</graalvmHome>
+ <enableJni>true</enableJni>
+ <enableAllSecurityServices>true</enableAllSecurityServices>
+ <disableReports>true</disableReports>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyResource.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyResource.java
new file mode 100644
index 0000000..778ffb3
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyResource.java
@@ -0,0 +1,107 @@
+/*
+ * 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.bindy.it;
+
+import java.util.Arrays;
+import java.util.HashMap;
+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.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.quarkus.component.bindy.it.model.CsvOrder;
+import org.apache.camel.quarkus.component.bindy.it.model.FixedLengthOrder;
+import org.apache.camel.quarkus.component.bindy.it.model.Header;
+import org.apache.camel.quarkus.component.bindy.it.model.MessageOrder;
+import org.apache.camel.quarkus.component.bindy.it.model.Security;
+import org.apache.camel.quarkus.component.bindy.it.model.Trailer;
+import org.jboss.logging.Logger;
+
+@Path("/bindy")
+@ApplicationScoped
+public class BindyResource {
+
+ private static final Logger LOG = Logger.getLogger(BindyResource.class);
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/jsonToCsv")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String jsonToCsv(final CsvOrder order) {
+ LOG.infof("Invoking jsonToCsv: %s", order);
+ return producerTemplate.requestBody("direct:jsonToCsv", order, String.class);
+ }
+
+ @Path("/csvToJson")
+ @GET
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.APPLICATION_JSON)
+ public CsvOrder csvToJson(final String csvOrder) {
+ LOG.infof("Invoking csvToJson: %s", csvOrder);
+ return producerTemplate.requestBody("direct:csvToJson", csvOrder, CsvOrder.class);
+ }
+
+ @Path("/jsonToFixedLength")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String jsonToFixedLength(final FixedLengthOrder order) {
+ LOG.infof("Invoking jsonToFixedLength: %s", order);
+ return producerTemplate.requestBody("direct:jsonToFixedLength", order, String.class);
+ }
+
+ @Path("/fixedLengthToJson")
+ @GET
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.APPLICATION_JSON)
+ public FixedLengthOrder fixedLengthToJson(final String fixedLengthOrder) {
+ LOG.infof("Invoking fixedLengthToJson: %s", fixedLengthOrder);
+ return producerTemplate.requestBody("direct:fixedLengthToJson", fixedLengthOrder, FixedLengthOrder.class);
+ }
+
+ @Path("/jsonToMessage")
+ @GET
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String jsonToMessage(final MessageOrder order) {
+ LOG.infof("Invoking jsonToMessage: %s", order);
+ Map<String, Object> model = new HashMap<>();
+ model.put(MessageOrder.class.getName(), order);
+ model.put(Header.class.getName(), order.getHeader());
+ model.put(Trailer.class.getName(), order.getTrailer());
+ model.put(Security.class.getName(), order.getSecurities().get(0));
+ return producerTemplate.requestBody("direct:jsonToMessage", Arrays.asList(model), String.class);
+ }
+
+ @Path("/messageToJson")
+ @GET
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.APPLICATION_JSON)
+ public MessageOrder messageToJson(final String messageOrder) {
+ LOG.infof("Invoking messageToJson: %s", messageOrder);
+ return producerTemplate.requestBody("direct:messageToJson", messageOrder, MessageOrder.class);
+ }
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyTestRoute.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyTestRoute.java
new file mode 100644
index 0000000..f98c016
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyTestRoute.java
@@ -0,0 +1,47 @@
+/*
+ * 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.bindy.it;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
+import org.apache.camel.model.dataformat.BindyDataFormat;
+import org.apache.camel.model.dataformat.BindyType;
+import org.apache.camel.quarkus.component.bindy.it.model.CsvOrder;
+import org.apache.camel.quarkus.component.bindy.it.model.FixedLengthOrder;
+import org.apache.camel.quarkus.component.bindy.it.model.MessageOrder;
+
+public class BindyTestRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ BindyDataFormat bindyCsvDataFormat = new BindyDataFormat();
+ bindyCsvDataFormat.setClassType(CsvOrder.class);
+ bindyCsvDataFormat.setType(BindyType.Csv);
+ from("direct:jsonToCsv").marshal(bindyCsvDataFormat);
+ from("direct:csvToJson").unmarshal(bindyCsvDataFormat);
+
+ BindyDataFormat bindyFixedLengthDataFormat = new BindyDataFormat();
+ bindyFixedLengthDataFormat.setClassType(FixedLengthOrder.class);
+ bindyFixedLengthDataFormat.setType(BindyType.Fixed);
+ from("direct:jsonToFixedLength").marshal(bindyFixedLengthDataFormat);
+ from("direct:fixedLengthToJson").unmarshal(bindyFixedLengthDataFormat);
+
+ BindyKeyValuePairDataFormat bindyMessageDataFormat = new BindyKeyValuePairDataFormat(MessageOrder.class);
+ from("direct:jsonToMessage").marshal(bindyMessageDataFormat);
+ from("direct:messageToJson").unmarshal(bindyMessageDataFormat);
+ }
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/CsvOrder.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/CsvOrder.java
new file mode 100644
index 0000000..5cce291
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/CsvOrder.java
@@ -0,0 +1,50 @@
+/*
+ * 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.bindy.it.model;
+
+import org.apache.camel.dataformat.bindy.annotation.BindyConverter;
+import org.apache.camel.dataformat.bindy.annotation.CsvRecord;
+import org.apache.camel.dataformat.bindy.annotation.DataField;
+import org.apache.camel.dataformat.bindy.annotation.FormatFactories;
+
+@CsvRecord(separator = ",", endWithLineBreak = false)
+@FormatFactories({ NameWithLengthSuffixFormatFactory.class })
+public class CsvOrder {
+
+ @DataField(pos = 1)
+ private NameWithLengthSuffix nameWithLengthSuffix;
+
+ @DataField(pos = 2)
+ @BindyConverter(TestConverter.class)
+ private String country;
+
+ public NameWithLengthSuffix getNameWithLengthSuffix() {
+ return nameWithLengthSuffix;
+ }
+
+ public void setNameWithLengthSuffix(NameWithLengthSuffix nameWithLengthSuffix) {
+ this.nameWithLengthSuffix = nameWithLengthSuffix;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/FixedLengthOrder.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/FixedLengthOrder.java
new file mode 100644
index 0000000..289078e
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/FixedLengthOrder.java
@@ -0,0 +1,47 @@
+/*
+ * 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.bindy.it.model;
+
+import org.apache.camel.dataformat.bindy.annotation.DataField;
+import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
+
+@FixedLengthRecord(length = 6)
+public class FixedLengthOrder {
+
+ @DataField(pos = 1, length = 3)
+ private String name;
+
+ @DataField(pos = 4, length = 3)
+ private String country;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/Header.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/Header.java
new file mode 100644
index 0000000..191b08e
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/Header.java
@@ -0,0 +1,52 @@
+/*
+ * 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.bindy.it.model;
+
+import org.apache.camel.dataformat.bindy.annotation.KeyValuePairField;
+import org.apache.camel.dataformat.bindy.annotation.Link;
+
+@Link
+public class Header {
+
+ @KeyValuePairField(tag = 8)
+ private String beginString;
+
+ @KeyValuePairField(tag = 9)
+ private int bodyLength;
+
+ public String getBeginString() {
+ return beginString;
+ }
+
+ public void setBeginString(String beginString) {
+ this.beginString = beginString;
+ }
+
+ public int getBodyLength() {
+ return bodyLength;
+ }
+
+ public void setBodyLength(int bodyLength) {
+ this.bodyLength = bodyLength;
+ }
+
+ @Override
+ public String toString() {
+ return Header.class.getName() + " --> 8: " + this.beginString + ", 9: " + this.bodyLength;
+ }
+
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/MessageOrder.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/MessageOrder.java
new file mode 100644
index 0000000..38b7a5e
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/MessageOrder.java
@@ -0,0 +1,107 @@
+/*
+ * 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.bindy.it.model;
+
+import java.util.List;
+
+import org.apache.camel.dataformat.bindy.annotation.KeyValuePairField;
+import org.apache.camel.dataformat.bindy.annotation.Link;
+import org.apache.camel.dataformat.bindy.annotation.Message;
+import org.apache.camel.dataformat.bindy.annotation.OneToMany;
+
+@Message(keyValuePairSeparator = "=", pairSeparator = "\\u0001")
+public class MessageOrder {
+
+ @Link
+ Header header;
+
+ @Link
+ Trailer trailer;
+
+ @KeyValuePairField(tag = 1)
+ private String account;
+
+ @KeyValuePairField(tag = 58)
+ private String text;
+
+ @OneToMany(mappedTo = "org.apache.camel.quarkus.component.bindy.it.model.Security")
+ private List<Security> securities;
+
+ public List<Security> getSecurities() {
+ return securities;
+ }
+
+ public void setSecurities(List<Security> securities) {
+ this.securities = securities;
+ }
+
+ public Header getHeader() {
+ return header;
+ }
+
+ public void setHeader(Header header) {
+ this.header = header;
+ }
+
+ public Trailer getTrailer() {
+ return trailer;
+ }
+
+ public void setTrailer(Trailer trailer) {
+ this.trailer = trailer;
+ }
+
+ public String getAccount() {
+ return account;
+ }
+
+ public void setAccount(String account) {
+ this.account = account;
+ }
+
+ public String getText() {
+ return this.text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(MessageOrder.class.getName() + " --> 1: " + this.account + ", 58: " + this.text + System.lineSeparator());
+
+ if (this.header != null) {
+ sb.append(" " + this.header.toString() + System.lineSeparator());
+ }
+
+ if (this.securities != null) {
+ for (Security sec : this.securities) {
+ sb.append(" " + sec.toString() + System.lineSeparator());
+ }
+ }
+
+ if (this.trailer != null) {
+ sb.append(" " + this.trailer.toString() + System.lineSeparator());
+ }
+
+ return sb.toString();
+ }
+
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/NameWithLengthSuffix.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/NameWithLengthSuffix.java
new file mode 100644
index 0000000..76bd1d0
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/NameWithLengthSuffix.java
@@ -0,0 +1,51 @@
+/*
+ * 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.bindy.it.model;
+
+public class NameWithLengthSuffix {
+ private String name;
+ private int length;
+
+ public static NameWithLengthSuffix ofString(String name) {
+ NameWithLengthSuffix result = new NameWithLengthSuffix();
+ result.name = name;
+ result.length = name.length();
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return name + "-" + length;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/NameWithLengthSuffixFormatFactory.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/NameWithLengthSuffixFormatFactory.java
new file mode 100644
index 0000000..4171a2c
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/NameWithLengthSuffixFormatFactory.java
@@ -0,0 +1,45 @@
+/*
+ * 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.bindy.it.model;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+import org.apache.camel.dataformat.bindy.Format;
+import org.apache.camel.dataformat.bindy.FormattingOptions;
+import org.apache.camel.dataformat.bindy.format.factories.AbstractFormatFactory;
+
+@RegisterForReflection
+public class NameWithLengthSuffixFormatFactory extends AbstractFormatFactory {
+
+ {
+ supportedClasses.add(NameWithLengthSuffix.class);
+ }
+
+ @Override
+ public Format<?> build(FormattingOptions formattingOptions) {
+ return new Format<NameWithLengthSuffix>() {
+ @Override
+ public String format(NameWithLengthSuffix object) {
+ return object.toString();
+ }
+
+ @Override
+ public NameWithLengthSuffix parse(String string) {
+ return NameWithLengthSuffix.ofString(string);
+ }
+ };
+ }
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/Security.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/Security.java
new file mode 100644
index 0000000..2821ccc
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/Security.java
@@ -0,0 +1,39 @@
+/*
+ * 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.bindy.it.model;
+
+import org.apache.camel.dataformat.bindy.annotation.KeyValuePairField;
+
+public class Security {
+
+ @KeyValuePairField(tag = 22)
+ private String idSource;
+
+ public String getIdSource() {
+ return idSource;
+ }
+
+ public void setIdSource(String source) {
+ this.idSource = source;
+ }
+
+ @Override
+ public String toString() {
+ return Security.class.getName() + " --> 22: " + this.getIdSource();
+ }
+
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/TestConverter.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/TestConverter.java
new file mode 100644
index 0000000..816a653
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/TestConverter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.bindy.it.model;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+import org.apache.camel.dataformat.bindy.Format;
+
+@RegisterForReflection(fields = false)
+public class TestConverter implements Format<String> {
+ @Override
+ public String format(String object) {
+ return object.toUpperCase();
+ }
+
+ @Override
+ public String parse(String string) {
+ return string.replaceAll("[aeiouyAEIOUY]", "_");
+ }
+}
diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/Trailer.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/Trailer.java
new file mode 100644
index 0000000..21e799c
--- /dev/null
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/model/Trailer.java
@@ -0,0 +1,41 @@
+/*
+ * 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.bindy.it.model;
+
+import org.apache.camel.dataformat.bindy.annotation.KeyValuePairField;
+import org.apache.camel.dataformat.bindy.annotation.Link;
+
+@Link
+public class Trailer {
+
+ @KeyValuePairField(tag = 10)
+ private int checkSum;
+
+ public int getCheckSum() {
+ return checkSum;
+ }
+
+ public void setCheckSum(int checkSum) {
+ this.checkSum = checkSum;
+ }
+
+ @Override
+ public String toString() {
+ return Trailer.class.getName() + " --> 10: " + this.checkSum;
+ }
+
+}
diff --git a/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/CsvRecordIT.java b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/CsvRecordIT.java
new file mode 100644
index 0000000..444ae04
--- /dev/null
+++ b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/CsvRecordIT.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.bindy.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class CsvRecordIT extends CsvRecordTest {
+
+}
diff --git a/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/CsvRecordTest.java b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/CsvRecordTest.java
new file mode 100644
index 0000000..1230bce
--- /dev/null
+++ b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/CsvRecordTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.bindy.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.apache.camel.quarkus.component.bindy.it.model.CsvOrder;
+import org.apache.camel.quarkus.component.bindy.it.model.NameWithLengthSuffix;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@QuarkusTest
+class CsvRecordTest {
+
+ private static final String CSV = "bindy-order-name-16,BINDY-COUNTRY";
+
+ @Test
+ public void jsonToCsvShouldSucceed() {
+ CsvOrder order = new CsvOrder();
+ order.setNameWithLengthSuffix(NameWithLengthSuffix.ofString("bindy-order-name"));
+ order.setCountry("bindy-country");
+
+ String csvOrder = RestAssured.given() //
+ .contentType(ContentType.JSON).body(order).get("/bindy/jsonToCsv").then().statusCode(200).extract().asString();
+
+ assertEquals(CSV, csvOrder);
+ }
+
+ @Test
+ public void csvToJsonShouldSucceed() {
+ CsvOrder order = RestAssured.given() //
+ .contentType(ContentType.TEXT).body(CSV).get("/bindy/csvToJson").then().statusCode(200).extract()
+ .as(CsvOrder.class);
+
+ assertNotNull(order);
+ assertNotNull(order.getNameWithLengthSuffix());
+ assertEquals("bindy-order-name-16-19", order.getNameWithLengthSuffix().toString());
+ assertEquals("B_ND_-C__NTR_", order.getCountry());
+ }
+
+}
diff --git a/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/FixedLengthRecordIT.java b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/FixedLengthRecordIT.java
new file mode 100644
index 0000000..a465a86
--- /dev/null
+++ b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/FixedLengthRecordIT.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.bindy.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class FixedLengthRecordIT extends FixedLengthRecordTest {
+
+}
diff --git a/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/FixedLengthRecordTest.java b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/FixedLengthRecordTest.java
new file mode 100644
index 0000000..62d6619
--- /dev/null
+++ b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/FixedLengthRecordTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.bindy.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.apache.camel.quarkus.component.bindy.it.model.FixedLengthOrder;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@QuarkusTest
+class FixedLengthRecordTest {
+
+ private static final String FIXED_LENGTH_ORDER = "BobSpa\r\n";
+
+ @Test
+ public void jsonToFixedLengthShouldSucceed() {
+ FixedLengthOrder order = new FixedLengthOrder();
+ order.setName("Bob");
+ order.setCountry("Spa");
+
+ String fixedLengthOrder = RestAssured.given() //
+ .contentType(ContentType.JSON).body(order).get("/bindy/jsonToFixedLength").then().statusCode(200).extract()
+ .asString();
+
+ assertEquals(FIXED_LENGTH_ORDER, fixedLengthOrder);
+ }
+
+ @Test
+ public void fixedLengthToJsonShouldSucceed() {
+ FixedLengthOrder order = RestAssured.given() //
+ .contentType(ContentType.TEXT).body(FIXED_LENGTH_ORDER).get("/bindy/fixedLengthToJson").then().statusCode(200)
+ .extract().as(FixedLengthOrder.class);
+
+ assertNotNull(order);
+ assertEquals("Bob", order.getName());
+ assertEquals("Spa", order.getCountry());
+ }
+
+}
diff --git a/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/MessageRecordIT.java b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/MessageRecordIT.java
new file mode 100644
index 0000000..66fb64c
--- /dev/null
+++ b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/MessageRecordIT.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.bindy.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class MessageRecordIT extends MessageRecordTest {
+
+}
diff --git a/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/MessageRecordTest.java b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/MessageRecordTest.java
new file mode 100644
index 0000000..66c9fc3
--- /dev/null
+++ b/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/MessageRecordTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.bindy.it;
+
+import java.util.ArrayList;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.apache.camel.quarkus.component.bindy.it.model.Header;
+import org.apache.camel.quarkus.component.bindy.it.model.MessageOrder;
+import org.apache.camel.quarkus.component.bindy.it.model.Security;
+import org.apache.camel.quarkus.component.bindy.it.model.Trailer;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@QuarkusTest
+class MessageRecordTest {
+
+ private static final String MESSAGE_ORDER = "1=BE.CHM.0018=BEGIN9=2010=22022=458=camel - quarkus - bindy test\r\n";
+
+ @Test
+ public void jsonToMessageShouldSucceed() {
+ MessageOrder order = new MessageOrder();
+ order.setAccount("BE.CHM.001");
+ order.setHeader(new Header());
+ order.getHeader().setBeginString("BEGIN");
+ order.getHeader().setBodyLength(20);
+ order.setSecurities(new ArrayList<>());
+ order.getSecurities().add(new Security());
+ order.getSecurities().get(0).setIdSource("4");
+ order.setText("camel - quarkus - bindy test");
+ order.setTrailer(new Trailer());
+ order.getTrailer().setCheckSum(220);
+
+ String messageOrder = RestAssured.given() //
+ .contentType(ContentType.JSON).body(order).get("/bindy/jsonToMessage").then().statusCode(200).extract()
+ .asString();
+ assertEquals(MESSAGE_ORDER, messageOrder);
+ }
+
+ @Test
+ public void messageToJsonShouldSucceed() {
+ MessageOrder order = RestAssured.given() //
+ .contentType(ContentType.TEXT).body(MESSAGE_ORDER).get("/bindy/messageToJson").then().statusCode(200).extract()
+ .as(MessageOrder.class);
+
+ assertNotNull(order);
+ assertEquals("BE.CHM.001", order.getAccount());
+ assertNotNull(order.getHeader());
+ assertEquals("BEGIN", order.getHeader().getBeginString());
+ assertEquals(20, order.getHeader().getBodyLength());
+ assertNotNull(order.getSecurities());
+ assertEquals(1, order.getSecurities().size());
+ assertEquals("4", order.getSecurities().get(0).getIdSource());
+ assertEquals("camel - quarkus - bindy test", order.getText());
+ assertNotNull(order.getTrailer());
+ assertEquals(220, order.getTrailer().getCheckSum());
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 9eb386b..9f310be 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -168,6 +168,7 @@
<module>base64</module>
<module>bean</module>
<module>bean-validator</module>
+ <module>bindy</module>
<module>consul</module>
<module>controlbus</module>
<module>csv</module>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index db8ea1f..2c54e6f 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -146,6 +146,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bindy-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-consul-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index d7c0dc0..02f9fb0 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -158,6 +158,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-bindy</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-caffeine-lrucache</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -596,6 +601,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bindy</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-consul</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>