You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/07/23 11:15:59 UTC

[camel] 01/01: camel-flatpack - Fix flaky tests due to lack of toString coverter that would walk the DataSet and therefore advance the position.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch fp
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9c605f4485d02c25cd41d1a72718ae88deede59e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Jul 23 13:15:46 2023 +0200

    camel-flatpack - Fix flaky tests due to lack of toString coverter that would walk the DataSet and therefore advance the position.
---
 .../apache/camel/component/flatpack/FlatpackConverterLoader.java    | 2 ++
 .../java/org/apache/camel/component/flatpack/FlatpackConverter.java | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/components/camel-flatpack/src/generated/java/org/apache/camel/component/flatpack/FlatpackConverterLoader.java b/components/camel-flatpack/src/generated/java/org/apache/camel/component/flatpack/FlatpackConverterLoader.java
index 833af57e50b..292c83bd137 100644
--- a/components/camel-flatpack/src/generated/java/org/apache/camel/component/flatpack/FlatpackConverterLoader.java
+++ b/components/camel-flatpack/src/generated/java/org/apache/camel/component/flatpack/FlatpackConverterLoader.java
@@ -41,6 +41,8 @@ public final class FlatpackConverterLoader implements TypeConverterLoader, Camel
     }
 
     private void registerConverters(TypeConverterRegistry registry) {
+        addTypeConverter(registry, java.lang.String.class, net.sf.flatpack.DataSet.class, false,
+            (type, exchange, value) -> org.apache.camel.component.flatpack.FlatpackConverter.toString((net.sf.flatpack.DataSet) value));
         addTypeConverter(registry, java.util.List.class, net.sf.flatpack.DataSet.class, false,
             (type, exchange, value) -> org.apache.camel.component.flatpack.FlatpackConverter.toList((net.sf.flatpack.DataSet) value));
         addTypeConverter(registry, java.util.Map.class, net.sf.flatpack.DataSet.class, false,
diff --git a/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackConverter.java b/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackConverter.java
index 1cc1fe22622..d42b4bb90a2 100644
--- a/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackConverter.java
+++ b/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackConverter.java
@@ -59,6 +59,12 @@ public final class FlatpackConverter {
         return answer;
     }
 
+    @Converter
+    public static String toString(DataSet dataSet) {
+        // force using toString from DataSet as we do not want conversion of each element
+        return dataSet.toString();
+    }
+
     @Converter
     public static Document toDocument(DataSet dataSet) throws ParserConfigurationException {
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();