This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-19408/restore-component in repository https://gitbox.apache.org/repos/asf/camel.git
commit c9a67c4789330ca5d3259eda24a417b6003fae61 Author: Nicolas Filotto <nfilo...@talend.com> AuthorDate: Fri Jun 2 11:51:34 2023 +0200 CAMEL-19408: camel-swift - Restore the component --- bom/camel-bom/pom.xml | 5 + camel-dependencies/pom.xml | 2 +- catalog/camel-allcomponents/pom.xml | 5 + .../apache/camel/catalog/dataformats.properties | 2 + .../apache/camel/catalog/dataformats/swiftMt.json | 22 +++ .../apache/camel/catalog/dataformats/swiftMx.json | 25 +++ components/camel-swift/pom.xml | 97 +++++++++++ .../swift/mt/SwiftMtDataFormatConfigurer.java | 28 +++ .../swift/mx/SwiftMxDataFormatConfigurer.java | 30 ++++ .../swift/mx/SwiftMxTypeConvertersLoader.java | 54 ++++++ .../services/org/apache/camel/TypeConverterLoader | 2 + .../org/apache/camel/configurer/swiftMt-dataformat | 2 + .../org/apache/camel/configurer/swiftMx-dataformat | 2 + .../org/apache/camel/dataformat.properties | 7 + .../services/org/apache/camel/dataformat/swiftMt | 2 + .../services/org/apache/camel/dataformat/swiftMx | 2 + .../apache/camel/dataformat/swift/mt/swiftMt.json | 22 +++ .../apache/camel/dataformat/swift/mx/swiftMx.json | 25 +++ .../src/main/docs/swiftMt-dataformat.adoc | 124 +++++++++++++ .../src/main/docs/swiftMx-dataformat.adoc | 124 +++++++++++++ .../dataformat/swift/mt/SwiftMtDataFormat.java | 89 ++++++++++ .../dataformat/swift/mx/ReadConfiguration.java | 35 ++++ .../dataformat/swift/mx/SwiftMxDataFormat.java | 192 +++++++++++++++++++++ .../dataformat/swift/mx/SwiftMxTypeConverters.java | 44 +++++ .../dataformat/swift/mx/WriteConfiguration.java | 76 ++++++++ .../swift/mt/SpringSwiftMtDataFormatTest.java | 89 ++++++++++ .../dataformat/swift/mt/SwiftMtDataFormatTest.java | 106 ++++++++++++ .../swift/mx/SpringSwiftMxDataFormatTest.java | 126 ++++++++++++++ .../dataformat/swift/mx/SwiftMxDataFormatTest.java | 155 +++++++++++++++++ .../src/test/resources/log4j2.properties | 28 +++ .../camel-swift/src/test/resources/mt/message1.txt | 55 ++++++ .../src/test/resources/mt/message2.json | 128 ++++++++++++++ .../camel-swift/src/test/resources/mt/message2.txt | 20 +++ .../camel-swift/src/test/resources/mx/message1.xml | 38 ++++ .../src/test/resources/mx/message2.json | 184 ++++++++++++++++++++ .../camel-swift/src/test/resources/mx/message2.xml | 129 ++++++++++++++ .../camel-swift/src/test/resources/mx/message3.xml | 43 +++++ .../routes/SpringSwiftMtDataFormatTest.xml | 53 ++++++ .../routes/SpringSwiftMxDataFormatTest.xml | 74 ++++++++ components/pom.xml | 1 + .../org/apache/camel/main/dataformats.properties | 2 + .../modules/dataformats/examples/json/swiftMt.json | 1 + .../modules/dataformats/examples/json/swiftMx.json | 1 + docs/components/modules/dataformats/nav.adoc | 2 + .../dataformats/pages/swiftMt-dataformat.adoc | 1 + .../dataformats/pages/swiftMx-dataformat.adoc | 1 + parent/pom.xml | 7 +- 47 files changed, 2260 insertions(+), 2 deletions(-) diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index 6ce47b2b196..950d79d83ed 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -1827,6 +1827,11 @@ <artifactId>camel-support</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-swift</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-syslog</artifactId> diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml index a11dbaa523b..b6c909981e2 100644 --- a/camel-dependencies/pom.xml +++ b/camel-dependencies/pom.xml @@ -422,7 +422,7 @@ <protobuf-maven-plugin-version>0.6.1</protobuf-maven-plugin-version> <protonpack-version>1.8</protonpack-version> <protostream-version>4.6.2.Final</protostream-version> - <prowide-version>SRU2022-9.3.2</prowide-version> + <prowide-version>SRU2022-10.0.0</prowide-version> <pubnub-version>6.3.5</pubnub-version> <pulsar-version>2.11.1</pulsar-version> <qpid-broker-version>9.0.0</qpid-broker-version> diff --git a/catalog/camel-allcomponents/pom.xml b/catalog/camel-allcomponents/pom.xml index 956196188ca..2aeb061ce2b 100644 --- a/catalog/camel-allcomponents/pom.xml +++ b/catalog/camel-allcomponents/pom.xml @@ -1603,6 +1603,11 @@ <artifactId>camel-stub</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-swift</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-syslog</artifactId> diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats.properties index 9d7b2dc0cdc..e7c684944b4 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats.properties @@ -32,6 +32,8 @@ protobufJackson rss snakeYaml soap +swiftMt +swiftMx syslog tarFile thrift diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/swiftMt.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/swiftMt.json new file mode 100644 index 00000000000..57e6025066b --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/swiftMt.json @@ -0,0 +1,22 @@ +{ + "dataformat": { + "kind": "dataformat", + "name": "swiftMt", + "title": "SWIFT MT", + "description": "Encode and decode SWIFT MT messages.", + "deprecated": false, + "firstVersion": "3.20.0", + "label": "dataformat,transformation,swift", + "javaType": "org.apache.camel.dataformat.swift.mt.SwiftMtDataFormat", + "supportLevel": "Stable", + "groupId": "org.apache.camel", + "artifactId": "camel-swift", + "version": "4.0.0-SNAPSHOT", + "modelName": "swiftMt", + "modelJavaType": "org.apache.camel.model.dataformat.SwiftMtDataFormat" + }, + "properties": { + "writeInJson": { "kind": "attribute", "displayName": "Write In Json", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "The flag indicating that messages must be marshalled in a JSON format." }, + "id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" } + } +} diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/swiftMx.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/swiftMx.json new file mode 100644 index 00000000000..9a3be83d40c --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/swiftMx.json @@ -0,0 +1,25 @@ +{ + "dataformat": { + "kind": "dataformat", + "name": "swiftMx", + "title": "SWIFT MX", + "description": "Encode and decode SWIFT MX messages.", + "deprecated": false, + "firstVersion": "3.20.0", + "label": "dataformat,transformation,swift", + "javaType": "org.apache.camel.dataformat.swift.mx.SwiftMxDataFormat", + "supportLevel": "Stable", + "groupId": "org.apache.camel", + "artifactId": "camel-swift", + "version": "4.0.0-SNAPSHOT", + "modelName": "swiftMx", + "modelJavaType": "org.apache.camel.model.dataformat.SwiftMxDataFormat" + }, + "properties": { + "writeConfigRef": { "kind": "attribute", "displayName": "Write Config Ref", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a specific configuration to use when marshalling a message to lookup from the registry." }, + "writeInJson": { "kind": "attribute", "displayName": "Write In Json", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "The flag indicating that messages must be marshalled in a JSON format." }, + "readMessageId": { "kind": "attribute", "displayName": "Read Message Id", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The type of MX message to produce when unmarshalling an input stream. If not set, it will be automatically detected from the namespace used." }, + "readConfigRef": { "kind": "attribute", "displayName": "Read Config Ref", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a specific configuration to use when unmarshalling an input stream to lookup from the registry." }, + "id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" } + } +} diff --git a/components/camel-swift/pom.xml b/components/camel-swift/pom.xml new file mode 100644 index 00000000000..71e28203a1b --- /dev/null +++ b/components/camel-swift/pom.xml @@ -0,0 +1,97 @@ +<?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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>4.0.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-swift</artifactId> + <packaging>jar</packaging> + <name>Camel :: SWIFT</name> + <description>Camel SWIFT data format support</description> + + <properties> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-support</artifactId> + </dependency> + + <dependency> + <groupId>com.prowidesoftware</groupId> + <artifactId>pw-iso20022</artifactId> + <version>${prowide-version}</version> + </dependency> + + <!-- testing --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-spring-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${jackson2-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson2-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <version>${log4j2-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commons-io-version}</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <argLine>--add-opens java.base/java.time=ALL-UNNAMED + </argLine> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/components/camel-swift/src/generated/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormatConfigurer.java b/components/camel-swift/src/generated/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormatConfigurer.java new file mode 100644 index 00000000000..37c5f7c02be --- /dev/null +++ b/components/camel-swift/src/generated/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormatConfigurer.java @@ -0,0 +1,28 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.dataformat.swift.mt; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.spi.GeneratedPropertyConfigurer; +import org.apache.camel.support.component.PropertyConfigurerSupport; + +/** + * Generated by camel build tools - do NOT edit this file! + */ +@SuppressWarnings("unchecked") +public class SwiftMtDataFormatConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { + + @Override + public boolean configure(CamelContext camelContext, Object target, String name, Object value, boolean ignoreCase) { + SwiftMtDataFormat dataformat = (SwiftMtDataFormat) target; + switch (ignoreCase ? name.toLowerCase() : name) { + case "writeinjson": + case "writeInJson": dataformat.setWriteInJson(property(camelContext, boolean.class, value)); return true; + default: return false; + } + } + +} + diff --git a/components/camel-swift/src/generated/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormatConfigurer.java b/components/camel-swift/src/generated/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormatConfigurer.java new file mode 100644 index 00000000000..e412b7632fb --- /dev/null +++ b/components/camel-swift/src/generated/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormatConfigurer.java @@ -0,0 +1,30 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.dataformat.swift.mx; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.spi.GeneratedPropertyConfigurer; +import org.apache.camel.support.component.PropertyConfigurerSupport; + +/** + * Generated by camel build tools - do NOT edit this file! + */ +@SuppressWarnings("unchecked") +public class SwiftMxDataFormatConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { + + @Override + public boolean configure(CamelContext camelContext, Object target, String name, Object value, boolean ignoreCase) { + SwiftMxDataFormat dataformat = (SwiftMxDataFormat) target; + switch (ignoreCase ? name.toLowerCase() : name) { + case "writeinjson": + case "writeInJson": dataformat.setWriteInJson(property(camelContext, boolean.class, value)); return true; + case "readmessageid": + case "readMessageId": dataformat.setReadMessageId(property(camelContext, com.prowidesoftware.swift.model.MxId.class, value)); return true; + default: return false; + } + } + +} + diff --git a/components/camel-swift/src/generated/java/org/apache/camel/dataformat/swift/mx/SwiftMxTypeConvertersLoader.java b/components/camel-swift/src/generated/java/org/apache/camel/dataformat/swift/mx/SwiftMxTypeConvertersLoader.java new file mode 100644 index 00000000000..6dd0bbc1a7b --- /dev/null +++ b/components/camel-swift/src/generated/java/org/apache/camel/dataformat/swift/mx/SwiftMxTypeConvertersLoader.java @@ -0,0 +1,54 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.dataformat.swift.mx; + +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; +import org.apache.camel.DeferredContextBinding; +import org.apache.camel.Exchange; +import org.apache.camel.TypeConversionException; +import org.apache.camel.TypeConverterLoaderException; +import org.apache.camel.spi.TypeConverterLoader; +import org.apache.camel.spi.TypeConverterRegistry; +import org.apache.camel.support.SimpleTypeConverter; +import org.apache.camel.support.TypeConverterSupport; +import org.apache.camel.util.DoubleMap; + +/** + * Generated by camel build tools - do NOT edit this file! + */ +@SuppressWarnings("unchecked") +@DeferredContextBinding +public final class SwiftMxTypeConvertersLoader implements TypeConverterLoader, CamelContextAware { + + private CamelContext camelContext; + + public SwiftMxTypeConvertersLoader() { + } + + @Override + public void setCamelContext(CamelContext camelContext) { + this.camelContext = camelContext; + } + + @Override + public CamelContext getCamelContext() { + return camelContext; + } + + @Override + public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException { + registerConverters(registry); + } + + private void registerConverters(TypeConverterRegistry registry) { + addTypeConverter(registry, com.prowidesoftware.swift.model.MxId.class, byte[].class, false, + (type, exchange, value) -> org.apache.camel.dataformat.swift.mx.SwiftMxTypeConverters.toMxId((byte[]) value)); + addTypeConverter(registry, com.prowidesoftware.swift.model.MxId.class, java.lang.String.class, false, + (type, exchange, value) -> org.apache.camel.dataformat.swift.mx.SwiftMxTypeConverters.toMxId((java.lang.String) value)); + } + + private static void addTypeConverter(TypeConverterRegistry registry, Class<?> toType, Class<?> fromType, boolean allowNull, SimpleTypeConverter.ConversionMethod method) { + registry.addTypeConverter(toType, fromType, new SimpleTypeConverter(allowNull, method)); + } + +} diff --git a/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/TypeConverterLoader b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/TypeConverterLoader new file mode 100644 index 00000000000..475946539e2 --- /dev/null +++ b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/TypeConverterLoader @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +org.apache.camel.dataformat.swift.mx.SwiftMxTypeConvertersLoader diff --git a/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/configurer/swiftMt-dataformat b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/configurer/swiftMt-dataformat new file mode 100644 index 00000000000..0e6e889546a --- /dev/null +++ b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/configurer/swiftMt-dataformat @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.dataformat.swift.mt.SwiftMtDataFormatConfigurer diff --git a/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/configurer/swiftMx-dataformat b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/configurer/swiftMx-dataformat new file mode 100644 index 00000000000..4f18fc5da79 --- /dev/null +++ b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/configurer/swiftMx-dataformat @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.dataformat.swift.mx.SwiftMxDataFormatConfigurer diff --git a/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/dataformat.properties b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/dataformat.properties new file mode 100644 index 00000000000..3665e27feb1 --- /dev/null +++ b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/dataformat.properties @@ -0,0 +1,7 @@ +# Generated by camel build tools - do NOT edit this file! +dataFormats=swiftMt swiftMx +groupId=org.apache.camel +artifactId=camel-swift +version=4.0.0-SNAPSHOT +projectName=Camel :: SWIFT +projectDescription=Camel SWIFT data format support diff --git a/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/dataformat/swiftMt b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/dataformat/swiftMt new file mode 100644 index 00000000000..4c5a87b4c5e --- /dev/null +++ b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/dataformat/swiftMt @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.dataformat.swift.mt.SwiftMtDataFormat diff --git a/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/dataformat/swiftMx b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/dataformat/swiftMx new file mode 100644 index 00000000000..22dd4acfe1b --- /dev/null +++ b/components/camel-swift/src/generated/resources/META-INF/services/org/apache/camel/dataformat/swiftMx @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.dataformat.swift.mx.SwiftMxDataFormat diff --git a/components/camel-swift/src/generated/resources/org/apache/camel/dataformat/swift/mt/swiftMt.json b/components/camel-swift/src/generated/resources/org/apache/camel/dataformat/swift/mt/swiftMt.json new file mode 100644 index 00000000000..804067af997 --- /dev/null +++ b/components/camel-swift/src/generated/resources/org/apache/camel/dataformat/swift/mt/swiftMt.json @@ -0,0 +1,22 @@ +{ + "dataformat": { + "kind": "dataformat", + "name": "swiftMt", + "title": "SWIFT MT", + "description": "Encode and decode SWIFT MT messages.", + "deprecated": false, + "firstVersion": "3.20.0", + "label": "dataformat,transformation,swift", + "javaType": "org.apache.camel.dataformat.swift.mt.SwiftMtDataFormat", + "supportLevel": "Stable", + "groupId": "org.apache.camel", + "artifactId": "camel-swift", + "version": "4.0.0-SNAPSHOT", + "modelName": "swiftMt", + "modelJavaType": "org.apache.camel.model.dataformat.SwiftMtDataFormat" + }, + "properties": { + "writeInJson": { "index": 0, "kind": "attribute", "displayName": "Write In Json", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "The flag indicating that messages must be marshalled in a JSON format." }, + "id": { "index": 1, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" } + } +} diff --git a/components/camel-swift/src/generated/resources/org/apache/camel/dataformat/swift/mx/swiftMx.json b/components/camel-swift/src/generated/resources/org/apache/camel/dataformat/swift/mx/swiftMx.json new file mode 100644 index 00000000000..0eabbbc4110 --- /dev/null +++ b/components/camel-swift/src/generated/resources/org/apache/camel/dataformat/swift/mx/swiftMx.json @@ -0,0 +1,25 @@ +{ + "dataformat": { + "kind": "dataformat", + "name": "swiftMx", + "title": "SWIFT MX", + "description": "Encode and decode SWIFT MX messages.", + "deprecated": false, + "firstVersion": "3.20.0", + "label": "dataformat,transformation,swift", + "javaType": "org.apache.camel.dataformat.swift.mx.SwiftMxDataFormat", + "supportLevel": "Stable", + "groupId": "org.apache.camel", + "artifactId": "camel-swift", + "version": "4.0.0-SNAPSHOT", + "modelName": "swiftMx", + "modelJavaType": "org.apache.camel.model.dataformat.SwiftMxDataFormat" + }, + "properties": { + "writeConfigRef": { "index": 0, "kind": "attribute", "displayName": "Write Config Ref", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a specific configuration to use when marshalling a message to lookup from the registry." }, + "writeInJson": { "index": 1, "kind": "attribute", "displayName": "Write In Json", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "The flag indicating that messages must be marshalled in a JSON format." }, + "readMessageId": { "index": 2, "kind": "attribute", "displayName": "Read Message Id", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The type of MX message to produce when unmarshalling an input stream. If not set, it will be automatically detected from the namespace used." }, + "readConfigRef": { "index": 3, "kind": "attribute", "displayName": "Read Config Ref", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a specific configuration to use when unmarshalling an input stream to lookup from the registry." }, + "id": { "index": 4, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" } + } +} diff --git a/components/camel-swift/src/main/docs/swiftMt-dataformat.adoc b/components/camel-swift/src/main/docs/swiftMt-dataformat.adoc new file mode 100644 index 00000000000..924c9fcd6bf --- /dev/null +++ b/components/camel-swift/src/main/docs/swiftMt-dataformat.adoc @@ -0,0 +1,124 @@ += SWIFT MT DataFormat +:doctitle: SWIFT MT +:shortname: swiftMt +:artifactid: camel-swift +:description: Encode and decode SWIFT MT messages. +:since: 3.20 +:supportlevel: Stable +:tabs-sync-option: +//Manually maintained attributes +:camel-spring-boot-name: swift + +*Since Camel {since}* + +The SWIFT MT data format is used to encode and decode SWIFT MT messages. The data format leverages the library https://github.com/prowide/prowide-core[Prowide Core] to encode and decode SWIFT MT messages. + +== Options + +// dataformat options: START +include::partial$dataformat-options.adoc[] +// dataformat options: END + +In Spring DSL, you configure the data format using this tag: + +[source,xml] +---- +<camelContext> + <dataFormats> + <swiftMt id="swiftInJson" writeInJson="true"/> + </dataFormats> + ... +</camelContext> +---- + +Then you can use it later by its reference: + +[source,xml] +---- +<route> + <from uri="direct:startEncode" /> + <marshal ref="swiftInJson" /> + <to uri="mock:result" /> +</route> +---- + +Most of the time, you won't need to declare the data format if you use +the default options. In that case, you can declare the data format +inline as shown below: + +[source,xml] +---- +<route> + <from uri="direct:startEncode" /> + <marshal> + <swiftMt /> + </marshal> + <to uri="mock:result" /> +</route> +---- + +== Marshal + +In this example, we marshal the messages read from a JMS queue in SWIFT format before storing the result into a file. + +[source,java] +---- +from("jms://myqueue") + .marshal().swiftMt() + .to("file://data.bin"); +---- + +In Spring DSL: + +[source,xml] +---- + <from uri="jms://myqueue"> + <marshal> + <swiftMt/> + </marshal> + <to uri="file://data.bin"/> +---- + +== Unmarshal + +The unmarshaller converts the input data into the concrete class of type `com.prowidesoftware.swift.model.mt.AbstractMT` that best matches with the content of the message. + +In this example, we unmarshal the content of a file to get SWIFT MT +objects before processing them with the `newOrder` processor. + +[source,java] +---- +from("file://data.bin") + .unmarshal().swiftMt() + .process("newOrder"); +---- + +In Spring DSL: + +[source,xml] +---- + <from uri="file://data.bin"> + <unmarshal> + <swiftMt/> + </unmarshal> + <to uri="bean:newOrder"/> +---- + +== Dependencies + +To use SWIFT MT in your Camel routes you need to add a dependency on +*camel-swift* which implements this data format. + +If you use Maven you can just add the following to your pom.xml: + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-swift</artifactId> + <version>x.x.x</version> <!-- use the same version as your Camel core version --> +</dependency> +---- + + +include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-swift/src/main/docs/swiftMx-dataformat.adoc b/components/camel-swift/src/main/docs/swiftMx-dataformat.adoc new file mode 100644 index 00000000000..79d9dbb6886 --- /dev/null +++ b/components/camel-swift/src/main/docs/swiftMx-dataformat.adoc @@ -0,0 +1,124 @@ += SWIFT MX DataFormat +:doctitle: SWIFT MX +:shortname: swiftMx +:artifactid: camel-swift +:description: Encode and decode SWIFT MX messages. +:since: 3.20 +:supportlevel: Stable +:tabs-sync-option: +//Manually maintained attributes +:camel-spring-boot-name: swift + +*Since Camel {since}* + +The SWIFT MX data format is used to encode and decode SWIFT MX messages. The data format leverages the library https://github.com/prowide/prowide-iso20022[Prowide ISO 20022] to encode and decode SWIFT MX messages. + +== Options + +// dataformat options: START +include::partial$dataformat-options.adoc[] +// dataformat options: END + +In Spring DSL, you configure the data format using this tag: + +[source,xml] +---- +<camelContext> + <dataFormats> + <swiftMx id="swiftInJson" writeInJson="true"/> + </dataFormats> + ... +</camelContext> +---- + +Then you can use it later by its reference: + +[source,xml] +---- +<route> + <from uri="direct:startEncode" /> + <marshal ref="swiftInJson" /> + <to uri="mock:result" /> +</route> +---- + +Most of the time, you won't need to declare the data format if you use +the default options. In that case, you can declare the data format +inline as shown below: + +[source,xml] +---- +<route> + <from uri="direct:startEncode" /> + <marshal> + <swiftMx /> + </marshal> + <to uri="mock:result" /> +</route> +---- + +== Marshal + +In this example, we marshal the messages read from a JMS queue in SWIFT format before storing the result into a file. + +[source,java] +---- +from("jms://myqueue") + .marshal().swiftMx() + .to("file://data.bin"); +---- + +In Spring DSL: + +[source,xml] +---- + <from uri="jms://myqueue"> + <marshal> + <swiftMx/> + </marshal> + <to uri="file://data.bin"/> +---- + +== Unmarshal + +The unmarshaller converts the input data into the concrete class of type `com.prowidesoftware.swift.model.mx.AbstractMX` that best matches with the content of the message. + +In this example, we unmarshal the content of a file to get SWIFT MX +objects before processing them with the `newOrder` processor. + +[source,java] +---- +from("file://data.bin") + .unmarshal().swiftMx() + .process("newOrder"); +---- + +In Spring DSL: + +[source,xml] +---- + <from uri="file://data.bin"> + <unmarshal> + <swiftMx/> + </unmarshal> + <to uri="bean:newOrder"/> +---- + +== Dependencies + +To use SWIFT MX in your Camel routes you need to add a dependency on +*camel-swift* which implements this data format. + +If you use Maven you can just add the following to your pom.xml: + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-swift</artifactId> + <version>x.x.x</version> <!-- use the same version as your Camel core version --> +</dependency> +---- + + +include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormat.java b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormat.java new file mode 100644 index 00000000000..cca11349775 --- /dev/null +++ b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormat.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.swift.mt; + +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; + +import com.prowidesoftware.JsonSerializable; +import com.prowidesoftware.swift.model.mt.AbstractMT; +import org.apache.camel.Exchange; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.DataFormatName; +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.annotations.Dataformat; +import org.apache.camel.support.service.ServiceSupport; + +/** + * {@code SwiftMtDataFormat} is a specific {@link DataFormat} leveraging + * <a href="https://github.com/prowide/prowide-core">Prowide Core</a> to encode and decode SWIFT MT messages. + */ +@Dataformat("swiftMt") +@Metadata(firstVersion = "3.20.0", title = "SWIFT MT") +public class SwiftMtDataFormat extends ServiceSupport implements DataFormat, DataFormatName { + + /** + * The flag indicating that messages must be marshalled in a JSON format. + */ + private boolean writeInJson; + + /** + * Constructs a {@code SwiftMtDataFormat} with the default configuration. + */ + public SwiftMtDataFormat() { + } + + /** + * Constructs a {@code SwiftMtDataFormat} with the given parameter. + * + * @param writeInJson the flag indicating that messages must be marshalled in a JSON format. + */ + public SwiftMtDataFormat(boolean writeInJson) { + this.writeInJson = writeInJson; + } + + @Override + public String getDataFormatName() { + return "swiftMt"; + } + + @Override + public void marshal(Exchange exchange, Object object, OutputStream stream) throws Exception { + if (writeInJson) { + stream.write(((JsonSerializable) object).toJson().getBytes(StandardCharsets.UTF_8)); + } else { + ((AbstractMT) object).write(stream); + } + } + + @Override + public Object unmarshal(Exchange exchange, InputStream stream) throws Exception { + return AbstractMT.parse(stream); + } + + /** + * @return {@code true} if messages must be marshalled in a JSON format, {@code false} otherwise. + */ + public boolean isWriteInJson() { + return writeInJson; + } + + public void setWriteInJson(boolean writeInJson) { + this.writeInJson = writeInJson; + } +} diff --git a/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/ReadConfiguration.java b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/ReadConfiguration.java new file mode 100644 index 00000000000..676572182e8 --- /dev/null +++ b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/ReadConfiguration.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.swift.mx; + +import com.prowidesoftware.swift.model.mx.MxReadConfiguration; +import com.prowidesoftware.swift.model.mx.adapters.TypeAdaptersConfiguration; + +/** + * {@code ReadConfiguration} is a class for easy setup of a {@link MxReadConfiguration} in a Spring application + * configured in XML, because it provides the setters. + */ +public class ReadConfiguration extends MxReadConfiguration { + + public TypeAdaptersConfiguration getAdapters() { + return adapters; + } + + public void setAdapters(TypeAdaptersConfiguration adapters) { + this.adapters = adapters; + } +} diff --git a/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormat.java b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormat.java new file mode 100644 index 00000000000..76add7dd7ff --- /dev/null +++ b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormat.java @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.swift.mx; + +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; + +import com.prowidesoftware.JsonSerializable; +import com.prowidesoftware.swift.model.MxId; +import com.prowidesoftware.swift.model.mx.AbstractMX; +import com.prowidesoftware.swift.model.mx.MxReadConfiguration; +import com.prowidesoftware.swift.model.mx.MxWriteConfiguration; +import org.apache.camel.Exchange; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.DataFormatName; +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.annotations.Dataformat; +import org.apache.camel.support.ExchangeHelper; +import org.apache.camel.support.service.ServiceSupport; + +/** + * {@code SwiftMxDataFormat} is a specific {@link DataFormat} leveraging + * <a href="https://github.com/prowide/prowide-iso20022">Prowide ISO 20022</a> to encode and decode SWIFT MX messages. + */ +@Dataformat("swiftMx") +@Metadata(firstVersion = "3.20.0", title = "SWIFT MX") +public class SwiftMxDataFormat extends ServiceSupport implements DataFormat, DataFormatName { + /** + * The specific configuration to use when marshalling a message. Ignored if {@code writeInJson} is set to + * {@code true}. + */ + private MxWriteConfiguration writeConfig; + /** + * The flag indicating that messages must be marshalled in a JSON format. If {@code true}, the value of + * {@code writeConfig} is ignored. + */ + private boolean writeInJson; + /** + * The type of MX message to produce when unmarshalling an input stream. If not set, it will be automatically + * detected from the namespace used. + */ + private MxId readMessageId; + /** + * The specific configuration to use when unmarshalling an input stream. + */ + private MxReadConfiguration readConfig; + + /** + * Constructs a {@code SwiftMxDataFormat} with the default configuration. + */ + public SwiftMxDataFormat() { + } + + /** + * Constructs a {@code SwiftMxDataFormat} with the given parameters. + * + * @param writeInJson the flag indicating that messages must be marshalled in a JSON format. + * @param readMessageId the type of MX message to produce when unmarshalling an input stream. If not set, it will be + * automatically detected from the namespace used. + * @param readConfig the specific configuration to use when unmarshalling an input stream. + */ + public SwiftMxDataFormat(boolean writeInJson, MxId readMessageId, MxReadConfiguration readConfig) { + this.writeInJson = writeInJson; + this.readMessageId = readMessageId; + this.readConfig = readConfig; + } + + /** + * Constructs a {@code SwiftMxDataFormat} with the given parameters. + * + * @param writeConfig the specific configuration to use when marshalling a message. + * @param readMessageId the type of MX message to produce when unmarshalling an input stream. If not set, it will be + * automatically detected from the namespace used. + * @param readConfig the specific configuration to use when unmarshalling an input stream. + */ + public SwiftMxDataFormat(MxWriteConfiguration writeConfig, MxId readMessageId, MxReadConfiguration readConfig) { + this.writeConfig = writeConfig; + this.readMessageId = readMessageId; + this.readConfig = readConfig; + } + + @Override + public String getDataFormatName() { + return "swiftMx"; + } + + @Override + public void marshal(Exchange exchange, Object object, OutputStream stream) throws Exception { + final String output; + if (writeInJson) { + output = ((JsonSerializable) object).toJson(); + } else { + output = ((AbstractMX) object).message(writeConfig); + } + stream.write(output.getBytes(StandardCharsets.UTF_8)); + } + + @Override + public Object unmarshal(Exchange exchange, InputStream stream) throws Exception { + return AbstractMX.parse( + new String(ExchangeHelper.convertToMandatoryType(exchange, byte[].class, stream), StandardCharsets.UTF_8), + readMessageId, readConfig); + } + + @Override + public void init() { + super.init(); + if (writeConfig == null) { + writeConfig = new MxWriteConfiguration(); + } + if (readConfig == null) { + readConfig = new MxReadConfiguration(); + } + } + + /** + * @return the specific configuration to use when marshalling a message. Ignored if {@code writeInJson} is set to + * {@code true}. + */ + public MxWriteConfiguration getWriteConfig() { + return writeConfig; + } + + public void setWriteConfig(Object writeConfig) { + if (writeConfig != null) { + if (writeConfig instanceof MxWriteConfiguration) { + this.writeConfig = (MxWriteConfiguration) writeConfig; + } else { + throw new IllegalArgumentException( + String.format("The argument for setWriteConfig should be subClass of %s", + MxWriteConfiguration.class.getName())); + } + } + } + + /** + * @return the type of MX message to produce when unmarshalling an input stream. If not set, it will be + * automatically detected from the namespace used. + */ + public MxId getReadMessageId() { + return readMessageId; + } + + public void setReadMessageId(MxId readMessageId) { + this.readMessageId = readMessageId; + } + + /** + * @return the specific configuration to use when unmarshalling an input stream. + */ + public MxReadConfiguration getReadConfig() { + return readConfig; + } + + public void setReadConfig(Object readConfig) { + if (readConfig != null) { + if (readConfig instanceof MxReadConfiguration) { + this.readConfig = (MxReadConfiguration) readConfig; + } else { + throw new IllegalArgumentException( + String.format("The argument for setReadConfig should be subClass of %s", + MxReadConfiguration.class.getName())); + } + } + } + + /** + * @return {@code true} if messages must be marshalled in a JSON format, {@code false} otherwise. + */ + public boolean isWriteInJson() { + return writeInJson; + } + + public void setWriteInJson(boolean writeInJson) { + this.writeInJson = writeInJson; + } +} diff --git a/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/SwiftMxTypeConverters.java b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/SwiftMxTypeConverters.java new file mode 100644 index 00000000000..4ac584570cc --- /dev/null +++ b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/SwiftMxTypeConverters.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.swift.mx; + +import java.nio.charset.StandardCharsets; + +import com.prowidesoftware.swift.model.MxId; +import org.apache.camel.Converter; + +/** + * {@code SwiftMxTypeConverters} provide some basic {@link org.apache.camel.TypeConverter}s that could be needed when + * marshalling/unmarshalling SWIFT MX messages. + */ +@Converter(generateLoader = true) +public final class SwiftMxTypeConverters { + + private SwiftMxTypeConverters() { + // Helper class + } + + @Converter + public static MxId toMxId(String namespace) { + return new MxId(namespace); + } + + @Converter + public static MxId toMxId(byte[] namespace) { + return new MxId(new String(namespace, StandardCharsets.UTF_8)); + } +} diff --git a/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/WriteConfiguration.java b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/WriteConfiguration.java new file mode 100644 index 00000000000..779ba8da4d1 --- /dev/null +++ b/components/camel-swift/src/main/java/org/apache/camel/dataformat/swift/mx/WriteConfiguration.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.dataformat.swift.mx; + +import com.prowidesoftware.swift.model.mx.EscapeHandler; +import com.prowidesoftware.swift.model.mx.MxWriteConfiguration; +import com.prowidesoftware.swift.model.mx.adapters.TypeAdaptersConfiguration; + +/** + * {@code WriteConfiguration} is a class for easy setup of a {@link MxWriteConfiguration} in a Spring application + * configured in XML, because it provides the setters. + */ +public class WriteConfiguration extends MxWriteConfiguration { + + public String getRootElement() { + return rootElement; + } + + public void setRootElement(String rootElement) { + this.rootElement = rootElement; + } + + public boolean isIncludeXMLDeclaration() { + return includeXMLDeclaration; + } + + public void setIncludeXMLDeclaration(boolean includeXMLDeclaration) { + this.includeXMLDeclaration = includeXMLDeclaration; + } + + public EscapeHandler getEscapeHandler() { + return escapeHandler; + } + + public void setEscapeHandler(EscapeHandler escapeHandler) { + this.escapeHandler = escapeHandler; + } + + public String getHeaderPrefix() { + return headerPrefix; + } + + public void setHeaderPrefix(String headerPrefix) { + this.headerPrefix = headerPrefix; + } + + public String getDocumentPrefix() { + return documentPrefix; + } + + public void setDocumentPrefix(String documentPrefix) { + this.documentPrefix = documentPrefix; + } + + public TypeAdaptersConfiguration getAdapters() { + return adapters; + } + + public void setAdapters(TypeAdaptersConfiguration adapters) { + this.adapters = adapters; + } +} diff --git a/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mt/SpringSwiftMtDataFormatTest.java b/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mt/SpringSwiftMtDataFormatTest.java new file mode 100644 index 00000000000..a81ba483ce1 --- /dev/null +++ b/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mt/SpringSwiftMtDataFormatTest.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.swift.mt; + +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.prowidesoftware.swift.model.mt.mt1xx.MT103; +import com.prowidesoftware.swift.model.mt.mt5xx.MT515; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.junit.jupiter.api.Test; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * The unit test for {@link SwiftMtDataFormat} testing the XML DSL. + */ +class SpringSwiftMtDataFormatTest extends CamelSpringTestSupport { + + @Test + void testUnmarshal() throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint("mock:unmarshal"); + mockEndpoint.expectedMessageCount(1); + + Object result + = template.requestBody("direct:unmarshal", Files.readAllBytes(Paths.get("src/test/resources/mt/message1.txt"))); + assertNotNull(result); + assertInstanceOf(MT515.class, result); + mockEndpoint.assertIsSatisfied(); + } + + @Test + void testMarshal() throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint("mock:marshal"); + mockEndpoint.expectedMessageCount(1); + + MT103 message = MT103.parse(Files.readString(Paths.get("src/test/resources/mt/message2.txt"))); + + Object result = template.requestBody("direct:marshal", message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + MT103 actual = MT103.parse((InputStream) result); + assertEquals(message.message(), actual.message()); + mockEndpoint.assertIsSatisfied(); + } + + @Test + void testMarshalJson() throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint("mock:marshalJson"); + mockEndpoint.expectedMessageCount(1); + + MT103 message = MT103.parse(Files.readString(Paths.get("src/test/resources/mt/message2.txt"))); + + Object result = template.requestBody("direct:marshalJson", message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + + ObjectMapper mapper = new ObjectMapper(); + assertEquals(mapper.readTree(Files.readString(Paths.get("src/test/resources/mt/message2.json"))), + mapper.readTree((InputStream) result)); + mockEndpoint.assertIsSatisfied(); + } + + @Override + protected AbstractApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("routes/SpringSwiftMtDataFormatTest.xml"); + } +} diff --git a/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormatTest.java b/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormatTest.java new file mode 100644 index 00000000000..f86dd5b85f7 --- /dev/null +++ b/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormatTest.java @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.swift.mt; + +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.prowidesoftware.swift.model.mt.mt1xx.MT103; +import com.prowidesoftware.swift.model.mt.mt5xx.MT515; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.model.dataformat.SwiftMtDataFormat; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * The unit test for {@link org.apache.camel.dataformat.swift.mt.SwiftMtDataFormat} testing the Java DSL. + */ +class SwiftMtDataFormatTest extends CamelTestSupport { + + @ParameterizedTest + @ValueSource(strings = { "", "dsl" }) + void testUnmarshal(String mode) throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint(String.format("mock:unmarshal%s", mode)); + mockEndpoint.expectedMessageCount(1); + + Object result + = template.requestBody(String.format("direct:unmarshal%s", mode), + Files.readAllBytes(Paths.get("src/test/resources/mt/message1.txt"))); + assertNotNull(result); + assertInstanceOf(MT515.class, result); + mockEndpoint.assertIsSatisfied(); + } + + @ParameterizedTest + @ValueSource(strings = { "", "dsl" }) + void testMarshal(String mode) throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint(String.format("mock:marshal%s", mode)); + mockEndpoint.expectedMessageCount(1); + + MT103 message = MT103.parse(Files.readString(Paths.get("src/test/resources/mt/message2.txt"))); + + Object result + = template.requestBody(String.format("direct:marshal%s", mode), message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + MT103 actual = MT103.parse((InputStream) result); + assertEquals(message.message(), actual.message()); + mockEndpoint.assertIsSatisfied(); + } + + @ParameterizedTest + @ValueSource(strings = { "", "dsl" }) + void testMarshalJson(String mode) throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint(String.format("mock:marshalJson%s", mode)); + mockEndpoint.expectedMessageCount(1); + + MT103 message = MT103.parse(Files.readString(Paths.get("src/test/resources/mt/message2.txt"))); + + Object result + = template.requestBody(String.format("direct:marshalJson%s", mode), message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + + ObjectMapper mapper = new ObjectMapper(); + assertEquals(mapper.readTree(Files.readString(Paths.get("src/test/resources/mt/message2.json"))), + mapper.readTree((InputStream) result)); + mockEndpoint.assertIsSatisfied(); + } + + @Override + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + @Override + public void configure() { + from("direct:unmarshal").unmarshal(new SwiftMtDataFormat()).to("mock:unmarshal"); + from("direct:unmarshaldsl").unmarshal().swiftMt().to("mock:unmarshaldsl"); + from("direct:marshal").marshal(new SwiftMtDataFormat()).to("mock:marshal"); + from("direct:marshaldsl").marshal().swiftMt().to("mock:marshaldsl"); + from("direct:marshalJson").marshal(new SwiftMtDataFormat("true")).to("mock:marshalJson"); + from("direct:marshalJsondsl").marshal().swiftMt(true).to("mock:marshalJsondsl"); + } + }; + } +} diff --git a/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mx/SpringSwiftMxDataFormatTest.java b/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mx/SpringSwiftMxDataFormatTest.java new file mode 100644 index 00000000000..f7466bc8827 --- /dev/null +++ b/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mx/SpringSwiftMxDataFormatTest.java @@ -0,0 +1,126 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.swift.mx; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.prowidesoftware.swift.model.mx.MxCamt04800103; +import com.prowidesoftware.swift.model.mx.MxPacs00800107; +import com.prowidesoftware.swift.model.mx.sys.MxXsys01100102; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * The unit test for {@link SwiftMxDataFormat} testing the XML DSL. + */ +class SpringSwiftMxDataFormatTest extends CamelSpringTestSupport { + + @Test + void testUnmarshal() throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint("mock:unmarshal"); + mockEndpoint.expectedMessageCount(1); + + Object result + = template.requestBody("direct:unmarshal", + Files.readAllBytes(Paths.get("src/test/resources/mx/message1.xml"))); + assertNotNull(result); + assertInstanceOf(MxCamt04800103.class, result); + mockEndpoint.assertIsSatisfied(); + } + + @Test + void testUnmarshalFull() throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint("mock:unmarshalFull"); + mockEndpoint.expectedMessageCount(1); + + Object result + = template.requestBody("direct:unmarshalFull", + Files.readAllBytes(Paths.get("src/test/resources/mx/message3.xml"))); + assertNotNull(result); + assertInstanceOf(MxXsys01100102.class, result); + mockEndpoint.assertIsSatisfied(); + } + + @Test + void testMarshal() throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint("mock:marshal"); + mockEndpoint.expectedMessageCount(1); + + MxPacs00800107 message = MxPacs00800107.parse(Files.readString(Paths.get("src/test/resources/mx/message2.xml"))); + Object result + = template.requestBody("direct:marshal", message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + MxPacs00800107 actual = MxPacs00800107.parse(IOUtils.toString((InputStream) result, StandardCharsets.UTF_8)); + assertEquals(message.message(), actual.message()); + mockEndpoint.assertIsSatisfied(); + } + + @Test + void testMarshalJson() throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint("mock:marshalJson"); + mockEndpoint.expectedMessageCount(1); + + MxPacs00800107 message = MxPacs00800107.parse(Files.readString(Paths.get("src/test/resources/mx/message2.xml"))); + Object result + = template.requestBody("direct:marshalJson", message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + + ObjectMapper mapper = new ObjectMapper(); + assertEquals(mapper.readTree(Files.readString(Paths.get("src/test/resources/mx/message2.json"))), + mapper.readTree((InputStream) result)); + mockEndpoint.assertIsSatisfied(); + } + + @Test + void testMarshalFull() throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint("mock:marshalFull"); + mockEndpoint.expectedMessageCount(1); + + MxPacs00800107 message = MxPacs00800107.parse(Files.readString(Paths.get("src/test/resources/mx/message2.xml"))); + Object result + = template.requestBody("direct:marshalFull", message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + + BufferedReader reader = new BufferedReader(new InputStreamReader((InputStream) result, StandardCharsets.UTF_8)); + String line = reader.readLine(); + assertFalse(line.contains("<?xml"), String.format("Should not start with the xml header, the first line was %s", line)); + mockEndpoint.assertIsSatisfied(); + } + + @Override + protected AbstractApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("routes/SpringSwiftMxDataFormatTest.xml"); + } +} diff --git a/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormatTest.java b/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormatTest.java new file mode 100644 index 00000000000..1846fb3b02b --- /dev/null +++ b/components/camel-swift/src/test/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormatTest.java @@ -0,0 +1,155 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.swift.mx; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.prowidesoftware.swift.model.mx.MxCamt04800103; +import com.prowidesoftware.swift.model.mx.MxPacs00800107; +import com.prowidesoftware.swift.model.mx.MxReadConfiguration; +import com.prowidesoftware.swift.model.mx.MxWriteConfiguration; +import com.prowidesoftware.swift.model.mx.sys.MxXsys01100102; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.model.dataformat.SwiftMxDataFormat; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * The unit test for {@link org.apache.camel.dataformat.swift.mx.SwiftMxDataFormat} testing the Java DSL. + */ +class SwiftMxDataFormatTest extends CamelTestSupport { + + @ParameterizedTest + @ValueSource(strings = { "", "dsl" }) + void testUnmarshal(String mode) throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint(String.format("mock:unmarshal%s", mode)); + mockEndpoint.expectedMessageCount(1); + + Object result + = template.requestBody(String.format("direct:unmarshal%s", mode), + Files.readAllBytes(Paths.get("src/test/resources/mx/message1.xml"))); + assertNotNull(result); + assertInstanceOf(MxCamt04800103.class, result); + mockEndpoint.assertIsSatisfied(); + } + + @ParameterizedTest + @ValueSource(strings = { "", "dsl" }) + void testUnmarshalFull(String mode) throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint(String.format("mock:unmarshalFull%s", mode)); + mockEndpoint.expectedMessageCount(1); + + Object result + = template.requestBody(String.format("direct:unmarshalFull%s", mode), + Files.readAllBytes(Paths.get("src/test/resources/mx/message3.xml"))); + assertNotNull(result); + assertInstanceOf(MxXsys01100102.class, result); + mockEndpoint.assertIsSatisfied(); + } + + @ParameterizedTest + @ValueSource(strings = { "", "dsl" }) + void testMarshal(String mode) throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint(String.format("mock:marshal%s", mode)); + mockEndpoint.expectedMessageCount(1); + + MxPacs00800107 message = MxPacs00800107.parse(Files.readString(Paths.get("src/test/resources/mx/message2.xml"))); + Object result + = template.requestBody(String.format("direct:marshal%s", mode), message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + MxPacs00800107 actual = MxPacs00800107.parse(IOUtils.toString((InputStream) result, StandardCharsets.UTF_8)); + assertEquals(message.message(), actual.message()); + mockEndpoint.assertIsSatisfied(); + } + + @ParameterizedTest + @ValueSource(strings = { "", "dsl" }) + void testMarshalJson(String mode) throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint(String.format("mock:marshalJson%s", mode)); + mockEndpoint.expectedMessageCount(1); + + MxPacs00800107 message = MxPacs00800107.parse(Files.readString(Paths.get("src/test/resources/mx/message2.xml"))); + Object result + = template.requestBody(String.format("direct:marshalJson%s", mode), message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + + ObjectMapper mapper = new ObjectMapper(); + assertEquals(mapper.readTree(Files.readString(Paths.get("src/test/resources/mx/message2.json"))), + mapper.readTree((InputStream) result)); + mockEndpoint.assertIsSatisfied(); + } + + @ParameterizedTest + @ValueSource(strings = { "", "dsl" }) + void testMarshalFull(String mode) throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint(String.format("mock:marshalFull%s", mode)); + mockEndpoint.expectedMessageCount(1); + + MxPacs00800107 message = MxPacs00800107.parse(Files.readString(Paths.get("src/test/resources/mx/message2.xml"))); + Object result + = template.requestBody(String.format("direct:marshalFull%s", mode), message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + + BufferedReader reader = new BufferedReader(new InputStreamReader((InputStream) result, StandardCharsets.UTF_8)); + String line = reader.readLine(); + assertFalse(line.contains("<?xml"), String.format("Should not start with the xml header, the first line was %s", line)); + mockEndpoint.assertIsSatisfied(); + } + + @Override + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + @Override + public void configure() { + from("direct:unmarshal").unmarshal(new SwiftMxDataFormat()).to("mock:unmarshal"); + from("direct:unmarshaldsl").unmarshal().swiftMx().to("mock:unmarshaldsl"); + MxReadConfiguration readConfig = new MxReadConfiguration(); + from("direct:unmarshalFull") + .unmarshal(new SwiftMxDataFormat(false, "urn:swift:xsd:xsys.011.001.02", readConfig)) + .to("mock:unmarshalFull"); + from("direct:unmarshalFulldsl").unmarshal() + .swiftMx(false, "urn:swift:xsd:xsys.011.001.02", readConfig).to("mock:unmarshalFulldsl"); + from("direct:marshal").marshal(new SwiftMxDataFormat()).to("mock:marshal"); + from("direct:marshaldsl").marshal().swiftMx().to("mock:marshaldsl"); + MxWriteConfiguration writeConfiguration = new MxWriteConfiguration(); + writeConfiguration.includeXMLDeclaration = false; + from("direct:marshalFull").marshal(new SwiftMxDataFormat(writeConfiguration, null, null)) + .to("mock:marshalFull"); + from("direct:marshalFulldsl").marshal().swiftMx(writeConfiguration, null, null).to("mock:marshalFulldsl"); + from("direct:marshalJson").marshal(new SwiftMxDataFormat(true)).to("mock:marshalJson"); + from("direct:marshalJsondsl").marshal().swiftMx(true).to("mock:marshalJsondsl"); + } + }; + } +} diff --git a/components/camel-swift/src/test/resources/log4j2.properties b/components/camel-swift/src/test/resources/log4j2.properties new file mode 100644 index 00000000000..452a0d1dbee --- /dev/null +++ b/components/camel-swift/src/test/resources/log4j2.properties @@ -0,0 +1,28 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +appender.console.type = Console +appender.console.name = console +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d %-5p %c{1} - %m %n +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-swift-test.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d %-5p %c{1} - %m %n +rootLogger.level = info +rootLogger.appenderRef.file.ref = file diff --git a/components/camel-swift/src/test/resources/mt/message1.txt b/components/camel-swift/src/test/resources/mt/message1.txt new file mode 100644 index 00000000000..a474f5c31b6 --- /dev/null +++ b/components/camel-swift/src/test/resources/mt/message1.txt @@ -0,0 +1,55 @@ +{1:F01AAAAIT2TAXXX8236800622}{2:O5151648131111BBBBLULLCFND22278474801311111648N}{4: +:16R:GENL +:20C::SEME//FRTJ123456789 +:23G:NEWM +:22F::TRTR//TRAD +:16R:LINK +:13A::LINK//514 +:20C::RELA//0405D012AA +:16S:LINK +:16S:GENL +:16R:CONFDET +:98A::TRAD//20210112 +:98A::SETT//20210117 +:90A::DEAL//PRCT/101,001283 +:22F::PRIC//AVER +:22H::PAYM//APMT +:22H::BUSE//BUYI +:16R:CONFPRTY +:95P::INVE//FUNANIC1 +:16S:CONFPRTY +:16R:CONFPRTY +:95P::BUYR//MGTCDE55 +:16S:CONFPRTY +:16R:CONFPRTY +:95P::SELL//CFPIDEFF +:16S:CONFPRTY +:36B::CONF//FAMT/4000000, +:35B:ISIN GB0123412345 +:16S:CONFDET +:16R:SETDET +:22F::SETR//TRAD +:16R:SETPRTY +:95R::DEAG/CRST/111 +:16S:SETPRTY +:16R:SETPRTY +:95P::SELL//CFPIDEFF +:97A::SAFE//1234567 +:16S:SETPRTY +:16R:SETPRTY +:95P::PSET//CRSTGB22 +:16S:SETPRTY +:16R:AMT +:19A::DEAL//GBP4040051,32 +:16S:AMT +:16R:AMT +:19A::ACRU//GBP7000, +:16S:AMT +:16R:AMT +:19A::EXEC//GBP100, +:16S:AMT +:16R:AMT +:19A::SETT//GBP4047151,32 +:16S:AMT +:16S:SETDET +-} diff --git a/components/camel-swift/src/test/resources/mt/message2.json b/components/camel-swift/src/test/resources/mt/message2.json new file mode 100644 index 00000000000..b29edb88fbb --- /dev/null +++ b/components/camel-swift/src/test/resources/mt/message2.json @@ -0,0 +1,128 @@ +{ + "type": "MT", + "basicHeaderBlock": { + "applicationId": "F", + "serviceId": "01", + "logicalTerminal": "BICFOOYYAXXX", + "sessionNumber": "8683", + "sequenceNumber": "497519" + }, + "applicationHeaderBlock": { + "senderInputTime": "1535", + "MIRDate": "051028", + "MIRLogicalTerminal": "ESPBESMMAXXX", + "MIRSessionNumber": "5423", + "MIRSequenceNumber": "752247", + "receiverOutputDate": "051028", + "receiverOutputTime": "1535", + "messagePriority": "N", + "messageType": "103", + "blockType": "O", + "direction": "O" + }, + "userHeaderBlock": { + "fields": [ + { + "name": "113", + "bankingPriority": "ROMF" + }, + { + "name": "108", + "mUR": "0510280182794665" + }, + { + "name": "119", + "validationFlag": "STP" + } + ] + }, + "textBlock": { + "fields": [ + { + "name": "20", + "reference": "0061350113089908" + }, + { + "name": "13C", + "code": "RNCTIME", + "timeIndication": "1534", + "sign": "+", + "timeOffset": "0000" + }, + { + "name": "23B", + "type": "CRED" + }, + { + "name": "23E", + "instructionCode": "SDVA" + }, + { + "name": "32A", + "date": "061028", + "currency": "EUR", + "amount": "100000," + }, + { + "name": "33B", + "currency": "EUR", + "amount": "100000," + }, + { + "name": "50K", + "account": "12345678", + "nameAndAddress": "AGENTES DE BOLSA FOO AGENCIA", + "nameAndAddress2": "AV XXXXX 123 BIS 9 PL", + "nameAndAddress3": "12345 BARCELONA" + }, + { + "name": "52A", + "account": "2337", + "identifierCode": "FOOAESMMXXX" + }, + { + "name": "53A", + "identifierCode": "FOOAESMMXXX" + }, + { + "name": "57A", + "identifierCode": "BICFOOYYXXX" + }, + { + "name": "59", + "account": "ES0123456789012345671234", + "nameAndAddress": "FOO AGENTES DE BOLSA ASOC" + }, + { + "name": "71A", + "code": "OUR" + }, + { + "name": "72", + "narrative": "/BNF/TRANSF. BCO. FOO", + "structured": [ + { + "narrativeFragments": [ + "TRANSF. BCO. FOO" + ], + "narrativeSupplementFragments": [], + "codeword": "BNF" + } + ], + "unstructuredFragments": [] + } + ] + }, + "trailerBlock": { + "fields": [ + { + "name": "MAC", + "value": "88B4F929" + }, + { + "name": "CHK", + "value": "22EF370A4073" + } + ] + } +} diff --git a/components/camel-swift/src/test/resources/mt/message2.txt b/components/camel-swift/src/test/resources/mt/message2.txt new file mode 100644 index 00000000000..df5efc8303d --- /dev/null +++ b/components/camel-swift/src/test/resources/mt/message2.txt @@ -0,0 +1,20 @@ +{1:F01BICFOOYYAXXX8683497519}{2:O1031535051028ESPBESMMAXXX54237522470510281535N}{3:{113:ROMF}{108:0510280182794665}{119:STP}}{4: +:20:0061350113089908 +:13C:/RNCTIME/1534+0000 +:23B:CRED +:23E:SDVA +:32A:061028EUR100000, +:33B:EUR100000, +:50K:/12345678 +AGENTES DE BOLSA FOO AGENCIA +AV XXXXX 123 BIS 9 PL +12345 BARCELONA +:52A:/2337 +FOOAESMMXXX +:53A:FOOAESMMXXX +:57A:BICFOOYYXXX +:59:/ES0123456789012345671234 +FOO AGENTES DE BOLSA ASOC +:71A:OUR +:72:/BNF/TRANSF. BCO. FOO +-}{5:{MAC:88B4F929}{CHK:22EF370A4073}} diff --git a/components/camel-swift/src/test/resources/mx/message1.xml b/components/camel-swift/src/test/resources/mx/message1.xml new file mode 100644 index 00000000000..919760d442e --- /dev/null +++ b/components/camel-swift/src/test/resources/mx/message1.xml @@ -0,0 +1,38 @@ +<?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. + +--> +<Doc:Document xmlns:Doc="urn:swift:xsd:camt.048.001.03" xmlns:xsi="httDoc://www.w3.org/2001/XMLSchema-instance"> + <Doc:ModfyRsvatn> + <Doc:MsgHdr> + <Doc:MsgId>001</Doc:MsgId> + </Doc:MsgHdr> + <Doc:RsvatnId> + <Doc:Cur> + <Doc:Tp> + <Doc:Cd>CARE</Doc:Cd> + </Doc:Tp> + </Doc:Cur> + </Doc:RsvatnId> + <Doc:NewRsvatnValSet> + <Doc:Amt> + <Doc:AmtWthtCcy>1234.0</Doc:AmtWthtCcy> + </Doc:Amt> + </Doc:NewRsvatnValSet> + </Doc:ModfyRsvatn> +</Doc:Document> diff --git a/components/camel-swift/src/test/resources/mx/message2.json b/components/camel-swift/src/test/resources/mx/message2.json new file mode 100644 index 00000000000..dc6cedb3e69 --- /dev/null +++ b/components/camel-swift/src/test/resources/mx/message2.json @@ -0,0 +1,184 @@ +{ + "fiToFICstmrCdtTrf": { + "grpHdr": { + "msgId": "823823423", + "creDtTm": { + "dateTime": { + "date": { + "year": 2019, + "month": 10, + "day": 19 + }, + "time": { + "hour": 21, + "minute": 0, + "second": 45, + "nano": 0 + } + }, + "offset": { + "totalSeconds": 7200 + } + }, + "btchBookg": false, + "nbOfTxs": "1", + "ctrlSum": 10000, + "ttlIntrBkSttlmAmt": { + "value": 10000, + "ccy": "USD" + }, + "intrBkSttlmDt": { + "year": 2019, + "month": 10, + "day": 28 + }, + "sttlmInf": { + "sttlmMtd": "INDA" + }, + "instgAgt": { + "finInstnId": { + "bicfi": "CITTGB2LPBG", + "nm": "Lionel Messi", + "othr": { + "id": "2342342342", + "issr": "FOOISSUER" + } + } + }, + "instdAgt": { + "finInstnId": { + "bicfi": "ICBCUS4CXXX", + "nm": "Manu Ginobili", + "pstlAdr": { + "adrTp": "PBOX", + "dept": "1", + "subDept": "DFGH", + "strtNm": "My Street", + "bldgNb": "1122", + "pstCd": "10002", + "twnNm": "Los Angeles", + "ctrySubDvsn": "ABCD" + } + } + } + }, + "cdtTrfTxInf": [ + { + "pmtId": { + "instrId": "2233445566", + "endToEndId": "987654321987654321", + "txId": "123456789", + "clrSysRef": "SDSDS333" + }, + "intrBkSttlmAmt": { + "value": 5000, + "ccy": "USD" + }, + "intrBkSttlmDt": { + "year": 2019, + "month": 7, + "day": 31 + }, + "sttlmPrty": "URGT", + "accptncDtTm": { + "dateTime": { + "date": { + "year": 2019, + "month": 4, + "day": 28 + }, + "time": { + "hour": 20, + "minute": 54, + "second": 39, + "nano": 0 + } + }, + "offset": { + "totalSeconds": 7200 + } + }, + "poolgAdjstmntDt": { + "year": 2019, + "month": 4, + "day": 29 + }, + "instdAmt": { + "value": 5000, + "ccy": "USD" + }, + "chrgBr": "SHAR", + "dbtr": { + "nm": "Jhon Doe", + "pstlAdr": { + "adrTp": "HOME", + "dept": "ABCD", + "subDept": "1", + "strtNm": "Foo Street", + "bldgNb": "1", + "pstCd": "1234", + "twnNm": "Buenos Aires", + "ctrySubDvsn": "CABA", + "ctry": "AR" + }, + "ctryOfRes": "AR" + }, + "dbtrAgt": { + "finInstnId": { + "bicfi": "ITUSUSP1XXX", + "nm": "Foo Corp" + } + }, + "cdtrAgt": { + "finInstnId": { + "bicfi": "USTBUS31XXX" + } + }, + "cdtr": { + "nm": "Mike Smith" + } + } + ] + }, + "appHdr": { + "fr": { + "fiId": { + "finInstnId": { + "bicfi": "ABCDUS33XXX" + } + } + }, + "to": { + "fiId": { + "finInstnId": { + "bicfi": "EFGHUS33XXX" + } + } + }, + "bizMsgIdr": "12312312312", + "msgDefIdr": "pacs.008.001.07", + "creDt": { + "dateTime": { + "date": { + "year": 2019, + "month": 10, + "day": 19 + }, + "time": { + "hour": 20, + "minute": 53, + "second": 13, + "nano": 0 + } + }, + "offset": { + "totalSeconds": 0 + } + }, + "pssblDplct": false, + "namespace": "urn:iso:std:iso:20022:tech:xsd:head.001.001.01" + }, + "type": "MX", + "@xmlns": "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.07", + "identifier": "pacs.008.001.07" +} diff --git a/components/camel-swift/src/test/resources/mx/message2.xml b/components/camel-swift/src/test/resources/mx/message2.xml new file mode 100644 index 00000000000..9989c5209c3 --- /dev/null +++ b/components/camel-swift/src/test/resources/mx/message2.xml @@ -0,0 +1,129 @@ +<?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. + +--> +<message> + <AppHdr xmlns='urn:iso:std:iso:20022:tech:xsd:head.001.001.01' + xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> + <Fr> + <FIId> + <FinInstnId> + <BICFI>ABCDUS33XXX</BICFI> + </FinInstnId> + </FIId> + </Fr> + <To> + <FIId> + <FinInstnId> + <BICFI>EFGHUS33XXX</BICFI> + </FinInstnId> + </FIId> + </To> + <BizMsgIdr>12312312312</BizMsgIdr> + <MsgDefIdr>pacs.008.001.07</MsgDefIdr> + <CreDt>2019-10-19T20:53:13Z</CreDt> + <PssblDplct>false</PssblDplct> + </AppHdr> + <Document xmlns='urn:iso:std:iso:20022:tech:xsd:pacs.008.001.07' + xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> + <FIToFICstmrCdtTrf> + <GrpHdr> + <MsgId>823823423</MsgId> + <CreDtTm>2019-10-19T21:00:45</CreDtTm> + <BtchBookg>false</BtchBookg> + <NbOfTxs>1</NbOfTxs> + <CtrlSum>10000</CtrlSum> + <TtlIntrBkSttlmAmt Ccy='USD'>10000</TtlIntrBkSttlmAmt> + <IntrBkSttlmDt>2019-10-28</IntrBkSttlmDt> + <SttlmInf> + <SttlmMtd>INDA</SttlmMtd> + </SttlmInf> + <InstgAgt> + <FinInstnId> + <BICFI>CITTGB2LPBG</BICFI> + <Nm>Lionel Messi</Nm> + <Othr> + <Id>2342342342</Id> + <Issr>FOOISSUER</Issr> + </Othr> + </FinInstnId> + </InstgAgt> + <InstdAgt> + <FinInstnId> + <BICFI>ICBCUS4CXXX</BICFI> + <Nm>Manu Ginobili</Nm> + <PstlAdr> + <AdrTp>PBOX</AdrTp> + <Dept>1</Dept> + <SubDept>DFGH</SubDept> + <StrtNm>My Street</StrtNm> + <BldgNb>1122</BldgNb> + <PstCd>10002</PstCd> + <TwnNm>Los Angeles</TwnNm> + <CtrySubDvsn>ABCD</CtrySubDvsn> + </PstlAdr> + </FinInstnId> + </InstdAgt> + </GrpHdr> + <CdtTrfTxInf> + <PmtId> + <InstrId>2233445566</InstrId> + <EndToEndId>987654321987654321</EndToEndId> + <TxId>123456789</TxId> + <ClrSysRef>SDSDS333</ClrSysRef> + </PmtId> + <IntrBkSttlmAmt Ccy='USD'>5000</IntrBkSttlmAmt> + <IntrBkSttlmDt>2019-07-31</IntrBkSttlmDt> + <SttlmPrty>URGT</SttlmPrty> + <AccptncDtTm>2019-04-28T20:54:39</AccptncDtTm> + <PoolgAdjstmntDt>2019-04-29</PoolgAdjstmntDt> + <InstdAmt Ccy='USD'>5000</InstdAmt> + <ChrgBr>SHAR</ChrgBr> + <Dbtr> + <Nm>Jhon Doe</Nm> + <PstlAdr> + <AdrTp>HOME</AdrTp> + <Dept>ABCD</Dept> + <SubDept>1</SubDept> + <StrtNm>Foo Street</StrtNm> + <BldgNb>1</BldgNb> + <PstCd>1234</PstCd> + <TwnNm>Buenos Aires</TwnNm> + <CtrySubDvsn>CABA</CtrySubDvsn> + <Ctry>AR</Ctry> + </PstlAdr> + <CtryOfRes>AR</CtryOfRes> + </Dbtr> + <DbtrAgt> + <FinInstnId> + <BICFI>ITUSUSP1XXX</BICFI> + <Nm>Foo Corp</Nm> + </FinInstnId> + </DbtrAgt> + <CdtrAgt> + <FinInstnId> + <BICFI>USTBUS31XXX</BICFI> + </FinInstnId> + </CdtrAgt> + <Cdtr> + <Nm>Mike Smith</Nm> + </Cdtr> + </CdtTrfTxInf> + </FIToFICstmrCdtTrf> + </Document> +</message> diff --git a/components/camel-swift/src/test/resources/mx/message3.xml b/components/camel-swift/src/test/resources/mx/message3.xml new file mode 100644 index 00000000000..e0caa4cf699 --- /dev/null +++ b/components/camel-swift/src/test/resources/mx/message3.xml @@ -0,0 +1,43 @@ +<?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. + +--> +<Doc:Document xmlns:Doc="urn:swift:xsd:xsys.011.001.02" xmlns:Sw="urn:swift:snl:ns.Sw" + xmlns:SwInt="urn:swift:snl:ns.SwInt" xmlns:SwGbl="urn:swift:snl:ns.SwGbl"> + <Doc:xsys.011.001.02> + <Doc:DlvryNtfctn> + <Sw:SnFRef>swf00000-2020-07-28T15:11:11.123456Z</Sw:SnFRef> + <Sw:SnFRefType>InterAct</Sw:SnFRefType> + <Sw:AcceptStatus>Accepted</Sw:AcceptStatus> + <Sw:DeliveryTime>2020-07-28T15:11:08Z</Sw:DeliveryTime> + <Sw:AckSwiftTime>2020-07-28T15:11:08Z</Sw:AckSwiftTime> + <Sw:FileRequestHeader> + <SwInt:Requestor>cn=gtxdev,o=rtbsgb2l,o=swift</SwInt:Requestor> + <SwInt:Responder>cn=gtxdev,o=rtbsgb2l,o=swift</SwInt:Responder> + <SwInt:Service>swift.finplus!pc</SwInt:Service> + <SwInt:RequestType>seev.047.001.01</SwInt:RequestType> + <SwInt:Priority>Normal</SwInt:Priority> + <SwInt:RequestRef>FOO123456</SwInt:RequestRef> + </Sw:FileRequestHeader> + <Doc:Xtnsn> + <Doc:PlcAndNm>PlaceAndName</Doc:PlcAndNm> + <Doc:XtnsnEnvlp>XtnsnEnvlp</Doc:XtnsnEnvlp> + </Doc:Xtnsn> + </Doc:DlvryNtfctn> + </Doc:xsys.011.001.02> +</Doc:Document> diff --git a/components/camel-swift/src/test/resources/routes/SpringSwiftMtDataFormatTest.xml b/components/camel-swift/src/test/resources/routes/SpringSwiftMtDataFormatTest.xml new file mode 100644 index 00000000000..def669206fd --- /dev/null +++ b/components/camel-swift/src/test/resources/routes/SpringSwiftMtDataFormatTest.xml @@ -0,0 +1,53 @@ +<?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. + +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + "> + + <!-- START SNIPPET: e1 --> + <camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:unmarshal"/> + <unmarshal> + <swiftMt /> + </unmarshal> + <to uri="mock:unmarshal"/> + </route> + <route> + <from uri="direct:marshal"/> + <marshal> + <swiftMt /> + </marshal> + <to uri="mock:marshal"/> + </route> + <route> + <from uri="direct:marshalJson"/> + <marshal> + <swiftMt writeInJson="true"/> + </marshal> + <to uri="mock:marshalJson"/> + </route> + </camelContext> + <!-- END SNIPPET: e1 --> + +</beans> diff --git a/components/camel-swift/src/test/resources/routes/SpringSwiftMxDataFormatTest.xml b/components/camel-swift/src/test/resources/routes/SpringSwiftMxDataFormatTest.xml new file mode 100644 index 00000000000..76f1bfd87f6 --- /dev/null +++ b/components/camel-swift/src/test/resources/routes/SpringSwiftMxDataFormatTest.xml @@ -0,0 +1,74 @@ +<?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. + +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + "> + + <bean id="readConfig" class="org.apache.camel.dataformat.swift.mx.ReadConfiguration"> + </bean> + + <bean id="writeConfig" class="org.apache.camel.dataformat.swift.mx.WriteConfiguration"> + <property name="includeXMLDeclaration" value="false"/> + </bean> + + <!-- START SNIPPET: e1 --> + <camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:unmarshal"/> + <unmarshal> + <swiftMx /> + </unmarshal> + <to uri="mock:unmarshal"/> + </route> + <route> + <from uri="direct:unmarshalFull"/> + <unmarshal> + <swiftMx writeInJson="false" readMessageId="urn:swift:xsd:xsys.011.001.02" readConfigRef="readConfig" /> + </unmarshal> + <to uri="mock:unmarshalFull"/> + </route> + <route> + <from uri="direct:marshal"/> + <marshal> + <swiftMx /> + </marshal> + <to uri="mock:marshal"/> + </route> + <route> + <from uri="direct:marshalFull"/> + <marshal> + <swiftMx writeConfigRef="writeConfig"/> + </marshal> + <to uri="mock:marshalFull"/> + </route> + <route> + <from uri="direct:marshalJson"/> + <marshal> + <swiftMx writeInJson="true"/> + </marshal> + <to uri="mock:marshalJson"/> + </route> + </camelContext> + <!-- END SNIPPET: e1 --> + +</beans> diff --git a/components/pom.xml b/components/pom.xml index 7ab55270ae1..47f2883f5d5 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -286,6 +286,7 @@ <module>camel-stream</module> <module>camel-stringtemplate</module> <module>camel-stitch</module> + <module>camel-swift</module> <module>camel-openapi-java</module> <module>camel-optaplanner</module> <module>camel-syslog</module> diff --git a/core/camel-main/src/generated/resources/org/apache/camel/main/dataformats.properties b/core/camel-main/src/generated/resources/org/apache/camel/main/dataformats.properties index 9d7b2dc0cdc..e7c684944b4 100644 --- a/core/camel-main/src/generated/resources/org/apache/camel/main/dataformats.properties +++ b/core/camel-main/src/generated/resources/org/apache/camel/main/dataformats.properties @@ -32,6 +32,8 @@ protobufJackson rss snakeYaml soap +swiftMt +swiftMx syslog tarFile thrift diff --git a/docs/components/modules/dataformats/examples/json/swiftMt.json b/docs/components/modules/dataformats/examples/json/swiftMt.json new file mode 120000 index 00000000000..df7df418763 --- /dev/null +++ b/docs/components/modules/dataformats/examples/json/swiftMt.json @@ -0,0 +1 @@ +../../../../../../components/camel-swift/src/generated/resources/org/apache/camel/dataformat/swift/mt/swiftMt.json \ No newline at end of file diff --git a/docs/components/modules/dataformats/examples/json/swiftMx.json b/docs/components/modules/dataformats/examples/json/swiftMx.json new file mode 120000 index 00000000000..15aee664fa6 --- /dev/null +++ b/docs/components/modules/dataformats/examples/json/swiftMx.json @@ -0,0 +1 @@ +../../../../../../components/camel-swift/src/generated/resources/org/apache/camel/dataformat/swift/mx/swiftMx.json \ No newline at end of file diff --git a/docs/components/modules/dataformats/nav.adoc b/docs/components/modules/dataformats/nav.adoc index 0d8ae1b3eaf..de8415029ca 100644 --- a/docs/components/modules/dataformats/nav.adoc +++ b/docs/components/modules/dataformats/nav.adoc @@ -33,6 +33,8 @@ ** xref:protobufJackson-dataformat.adoc[Protobuf Jackson] ** xref:rss-dataformat.adoc[RSS] ** xref:soap-dataformat.adoc[SOAP] +** xref:swiftMt-dataformat.adoc[SWIFT MT] +** xref:swiftMx-dataformat.adoc[SWIFT MX] ** xref:syslog-dataformat.adoc[Syslog] ** xref:tarFile-dataformat.adoc[Tar File] ** xref:thrift-dataformat.adoc[Thrift] diff --git a/docs/components/modules/dataformats/pages/swiftMt-dataformat.adoc b/docs/components/modules/dataformats/pages/swiftMt-dataformat.adoc new file mode 120000 index 00000000000..6f4183fdd30 --- /dev/null +++ b/docs/components/modules/dataformats/pages/swiftMt-dataformat.adoc @@ -0,0 +1 @@ +../../../../../components/camel-swift/src/main/docs/swiftMt-dataformat.adoc \ No newline at end of file diff --git a/docs/components/modules/dataformats/pages/swiftMx-dataformat.adoc b/docs/components/modules/dataformats/pages/swiftMx-dataformat.adoc new file mode 120000 index 00000000000..5e1b760ad83 --- /dev/null +++ b/docs/components/modules/dataformats/pages/swiftMx-dataformat.adoc @@ -0,0 +1 @@ +../../../../../components/camel-swift/src/main/docs/swiftMx-dataformat.adoc \ No newline at end of file diff --git a/parent/pom.xml b/parent/pom.xml index 63201c3817d..52a41e7f710 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -417,7 +417,7 @@ <protobuf-maven-plugin-version>0.6.1</protobuf-maven-plugin-version> <protonpack-version>1.8</protonpack-version> <protostream-version>4.6.2.Final</protostream-version> - <prowide-version>SRU2022-9.3.2</prowide-version> + <prowide-version>SRU2022-10.0.0</prowide-version> <pubnub-version>6.3.5</pubnub-version> <pulsar-version>2.11.1</pulsar-version> <qpid-broker-version>9.0.0</qpid-broker-version> @@ -2234,6 +2234,11 @@ <artifactId>camel-stub</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-swift</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-syslog</artifactId>