This is an automated email from the ASF dual-hosted git repository.
jiriondrusek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-upgrade-recipes.git
The following commit(s) were added to refs/heads/main by this push:
new 25e2a32 Fixes #71, dataformats migration covers marshal and unmarshal
25e2a32 is described below
commit 25e2a32bd8ea1a32e09cde6ff8f6b02fda14bbd1
Author: Jiri Ondrusek <[email protected]>
AuthorDate: Tue Dec 2 12:54:19 2025 +0100
Fixes #71, dataformats migration covers marshal and unmarshal
---
.../ReplacePropertyInDataFormatYaml.java | 8 +-
.../apache/camel/upgrade/CamelUpdate415Test.java | 125 +++++++++++++++++++++
2 files changed, 132 insertions(+), 1 deletion(-)
diff --git
a/camel-upgrade-recipes/src/main/java/org/apache/camel/upgrade/customRecipes/ReplacePropertyInDataFormatYaml.java
b/camel-upgrade-recipes/src/main/java/org/apache/camel/upgrade/customRecipes/ReplacePropertyInDataFormatYaml.java
index 556b69b..35129b9 100644
---
a/camel-upgrade-recipes/src/main/java/org/apache/camel/upgrade/customRecipes/ReplacePropertyInDataFormatYaml.java
+++
b/camel-upgrade-recipes/src/main/java/org/apache/camel/upgrade/customRecipes/ReplacePropertyInDataFormatYaml.java
@@ -73,9 +73,15 @@ public class ReplacePropertyInDataFormatYaml extends Recipe {
String path = RecipesUtil.getProperty(getCursor());
- //yaml fury marshal
+ //yaml marshal
if(path.endsWith("dataFormats." + component + "." +
oldPropertyKey)) {
return e.withKey(((Yaml.Scalar)
e.getKey().copyPaste()).withValue(newPropertyKey));
+ } //yaml marshal
+ if(path.endsWith("marshal." + component + "." +
oldPropertyKey)) {
+ return e.withKey(((Yaml.Scalar)
e.getKey().copyPaste()).withValue(newPropertyKey));
+ } //yaml marshal
+ if(path.endsWith("unmarshal." + component + "." +
oldPropertyKey)) {
+ return e.withKey(((Yaml.Scalar)
e.getKey().copyPaste()).withValue(newPropertyKey));
}
return e;
diff --git
a/camel-upgrade-recipes/src/test/java/org/apache/camel/upgrade/CamelUpdate415Test.java
b/camel-upgrade-recipes/src/test/java/org/apache/camel/upgrade/CamelUpdate415Test.java
index ef7859d..f182c31 100644
---
a/camel-upgrade-recipes/src/test/java/org/apache/camel/upgrade/CamelUpdate415Test.java
+++
b/camel-upgrade-recipes/src/test/java/org/apache/camel/upgrade/CamelUpdate415Test.java
@@ -91,6 +91,131 @@ public class CamelUpdate415Test implements RewriteTest {
keyOrTrustStoreParameters: "1333"
"""));
}
+ /**
+ * <a
href="https://camel.apache.org/manual/camel-4x-upgrade-guide-4_15.html#_data_formats">Data
Formats</a> in Yaml
+ */
+ @Test
+ void dataFormatUnmarshalYamlDsl() {
+ //language=yaml
+ rewriteRun(yaml(
+ """
+ - route:
+ id: csv-processing-route
+ from:
+ uri: "direct://input"
+ steps:
+ - unmarshal:
+ crypto:
+ algorithmParameterRef: "111"
+ initVectorRef: "222"
+ keyRef: "333"
+ csv:
+ formatRef: "444"
+ formatName: "555"
+ flatpack:
+ parserFactoryRef: "666"
+ jaxb:
+ namespacePrefixRef: "777"
+ soap:
+ namespacePrefixRef: "888"
+ elementNameStrategyRef: "999"
+ swiftMx:
+ readConfigRef: "1111"
+ writeConfigRef: "1222"
+ xmlSecurity:
+ keyOrTrustStoreParametersRef: "1333"
+ """,
+ """
+ - route:
+ id: csv-processing-route
+ from:
+ uri: "direct://input"
+ steps:
+ - unmarshal:
+ crypto:
+ algorithmParameterSpec: "111"
+ initVector: "222"
+ key: "333"
+ csv:
+ format: "444"
+ format: "555"
+ flatpack:
+ parserFactory: "666"
+ jaxb:
+ namespacePrefix: "777"
+ soap:
+ namespacePrefix: "888"
+ elementNameStrategy: "999"
+ swiftMx:
+ readConfig: "1111"
+ writeConfig: "1222"
+ xmlSecurity:
+ keyOrTrustStoreParameters: "1333"
+ """));
+ }
+
+ /**
+ * <a
href="https://camel.apache.org/manual/camel-4x-upgrade-guide-4_15.html#_data_formats">Data
Formats</a> in Yaml
+ */
+ @Test
+ void dataFormatMarshalYamlDsl() {
+ //language=yaml
+ rewriteRun(yaml(
+ """
+ - route:
+ id: csv-processing-route
+ from:
+ uri: "direct://input"
+ steps:
+ - marshal:
+ crypto:
+ algorithmParameterRef: "111"
+ initVectorRef: "222"
+ keyRef: "333"
+ csv:
+ formatRef: "444"
+ formatName: "555"
+ flatpack:
+ parserFactoryRef: "666"
+ jaxb:
+ namespacePrefixRef: "777"
+ soap:
+ namespacePrefixRef: "888"
+ elementNameStrategyRef: "999"
+ swiftMx:
+ readConfigRef: "1111"
+ writeConfigRef: "1222"
+ xmlSecurity:
+ keyOrTrustStoreParametersRef: "1333"
+ """,
+ """
+ - route:
+ id: csv-processing-route
+ from:
+ uri: "direct://input"
+ steps:
+ - marshal:
+ crypto:
+ algorithmParameterSpec: "111"
+ initVector: "222"
+ key: "333"
+ csv:
+ format: "444"
+ format: "555"
+ flatpack:
+ parserFactory: "666"
+ jaxb:
+ namespacePrefix: "777"
+ soap:
+ namespacePrefix: "888"
+ elementNameStrategy: "999"
+ swiftMx:
+ readConfig: "1111"
+ writeConfig: "1222"
+ xmlSecurity:
+ keyOrTrustStoreParameters: "1333"
+ """));
+ }
/**
* <a
href="https://camel.apache.org/manual/camel-4x-upgrade-guide-4_15.html#_camel_ai_nested_headers_classes">Camel
AI Nested Headers classes</a>