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-spring-boot.git
commit 7f90ac5c2fb5997a2acca2a1e21a6f4f896220c8 Author: Nicolas Filotto <nfilo...@talend.com> AuthorDate: Fri Jun 2 12:15:49 2023 +0200 CAMEL-19408: camel-swift - Restore the component This reverts commit a8414ead6c78a4effd07d04747338836d11bf350. --- .../springboot/catalog/dataformats.properties | 2 + .../springboot/catalog/dataformats/swiftMt.json | 22 +++ .../springboot/catalog/dataformats/swiftMx.json | 25 +++ components-starter/camel-swift-starter/pom.xml | 71 +++++++ .../camel-swift-starter/src/main/docs/swift.json | 83 +++++++++ .../SwiftMtDataFormatAutoConfiguration.java | 78 ++++++++ .../springboot/SwiftMtDataFormatConfiguration.java | 49 +++++ .../SwiftMxDataFormatAutoConfiguration.java | 78 ++++++++ .../springboot/SwiftMxDataFormatConfiguration.java | 88 +++++++++ .../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 ++ .../src/main/resources/META-INF/spring.factories | 21 +++ .../src/main/resources/META-INF/spring.provides | 17 ++ .../dataformat/swift/mt/SwiftMtDataFormatTest.java | 109 +++++++++++ .../dataformat/swift/mx/SwiftMxDataFormatTest.java | 167 +++++++++++++++++ .../src/test/resources/mt/message1.txt | 55 ++++++ .../src/test/resources/mt/message2.json | 118 ++++++++++++ .../src/test/resources/mt/message2.txt | 20 ++ .../src/test/resources/mx/message1.xml | 38 ++++ .../src/test/resources/mx/message2.json | 169 +++++++++++++++++ .../src/test/resources/mx/message2.xml | 129 +++++++++++++ .../src/test/resources/mx/message3.xml | 43 +++++ .../resources/routes/SwiftMtDataFormatTest.xml | 38 ++++ .../resources/routes/SwiftMxDataFormatTest.xml | 52 ++++++ components-starter/pom.xml | 1 + tooling/camel-spring-boot-bom/pom.xml | 5 + tooling/camel-spring-boot-dependencies/pom.xml | 10 + 27 files changed, 1702 insertions(+) diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats.properties b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats.properties index c90d14cafd3..a555766580a 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats.properties +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats.properties @@ -32,6 +32,8 @@ protobufJackson rss snakeYaml soap +swiftMt +swiftMx syslog tarFile thrift diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/swiftMt.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/swiftMt.json new file mode 100644 index 00000000000..be8c1a96fe4 --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/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.springboot", + "artifactId": "camel-swift-starter", + "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-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/swiftMx.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/swiftMx.json new file mode 100644 index 00000000000..0272fd5b1be --- /dev/null +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/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.springboot", + "artifactId": "camel-swift-starter", + "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-starter/camel-swift-starter/pom.xml b/components-starter/camel-swift-starter/pom.xml new file mode 100644 index 00000000000..ee7a5c7cbdb --- /dev/null +++ b/components-starter/camel-swift-starter/pom.xml @@ -0,0 +1,71 @@ +<?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.springboot</groupId> + <artifactId>components-starter</artifactId> + <version>4.0.0-SNAPSHOT</version> + </parent> + <artifactId>camel-swift-starter</artifactId> + <packaging>jar</packaging> + <name>Camel SB Starters :: SWIFT</name> + <description>Spring-Boot Starter for Camel SWIFT data format support</description> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <version>${spring-boot-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-swift</artifactId> + <version>${camel-version}</version> + </dependency> + <!-- testing --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-junit5</artifactId> + <version>${camel-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <scope>test</scope> + </dependency> + <!--START OF GENERATED CODE--> + <dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-core-starter</artifactId> + </dependency> + <!--END OF GENERATED CODE--> + </dependencies> +</project> diff --git a/components-starter/camel-swift-starter/src/main/docs/swift.json b/components-starter/camel-swift-starter/src/main/docs/swift.json new file mode 100644 index 00000000000..ad0c94a7d98 --- /dev/null +++ b/components-starter/camel-swift-starter/src/main/docs/swift.json @@ -0,0 +1,83 @@ +{ + "groups": [ + { + "name": "camel.dataformat.swift-mt", + "type": "org.apache.camel.dataformat.swift.mt.springboot.SwiftMtDataFormatConfiguration", + "sourceType": "org.apache.camel.dataformat.swift.mt.springboot.SwiftMtDataFormatConfiguration" + }, + { + "name": "camel.dataformat.swift-mt.customizer", + "type": "org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.dataformat.swift.mt.springboot.SwiftMtDataFormatConfiguration", + "sourceMethod": "getCustomizer()" + }, + { + "name": "camel.dataformat.swift-mx", + "type": "org.apache.camel.dataformat.swift.mx.springboot.SwiftMxDataFormatConfiguration", + "sourceType": "org.apache.camel.dataformat.swift.mx.springboot.SwiftMxDataFormatConfiguration" + }, + { + "name": "camel.dataformat.swift-mx.customizer", + "type": "org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon$CustomizerProperties", + "sourceType": "org.apache.camel.dataformat.swift.mx.springboot.SwiftMxDataFormatConfiguration", + "sourceMethod": "getCustomizer()" + } + ], + "properties": [ + { + "name": "camel.dataformat.swift-mt.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.dataformat.swift-mt.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the swiftMt data format. This is enabled by default.", + "sourceType": "org.apache.camel.dataformat.swift.mt.springboot.SwiftMtDataFormatConfiguration" + }, + { + "name": "camel.dataformat.swift-mt.write-in-json", + "type": "java.lang.Boolean", + "description": "The flag indicating that messages must be marshalled in a JSON format.", + "sourceType": "org.apache.camel.dataformat.swift.mt.springboot.SwiftMtDataFormatConfiguration", + "defaultValue": false + }, + { + "name": "camel.dataformat.swift-mx.customizer.enabled", + "type": "java.lang.Boolean", + "sourceType": "org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon$CustomizerProperties" + }, + { + "name": "camel.dataformat.swift-mx.enabled", + "type": "java.lang.Boolean", + "description": "Whether to enable auto configuration of the swiftMx data format. This is enabled by default.", + "sourceType": "org.apache.camel.dataformat.swift.mx.springboot.SwiftMxDataFormatConfiguration" + }, + { + "name": "camel.dataformat.swift-mx.read-config-ref", + "type": "java.lang.String", + "description": "Refers to a specific configuration to use when unmarshalling an input stream to lookup from the registry.", + "sourceType": "org.apache.camel.dataformat.swift.mx.springboot.SwiftMxDataFormatConfiguration" + }, + { + "name": "camel.dataformat.swift-mx.read-message-id", + "type": "java.lang.String", + "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.", + "sourceType": "org.apache.camel.dataformat.swift.mx.springboot.SwiftMxDataFormatConfiguration" + }, + { + "name": "camel.dataformat.swift-mx.write-config-ref", + "type": "java.lang.String", + "description": "Refers to a specific configuration to use when marshalling a message to lookup from the registry.", + "sourceType": "org.apache.camel.dataformat.swift.mx.springboot.SwiftMxDataFormatConfiguration" + }, + { + "name": "camel.dataformat.swift-mx.write-in-json", + "type": "java.lang.Boolean", + "description": "The flag indicating that messages must be marshalled in a JSON format.", + "sourceType": "org.apache.camel.dataformat.swift.mx.springboot.SwiftMxDataFormatConfiguration", + "defaultValue": false + } + ], + "hints": [] +} \ No newline at end of file diff --git a/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mt/springboot/SwiftMtDataFormatAutoConfiguration.java b/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mt/springboot/SwiftMtDataFormatAutoConfiguration.java new file mode 100644 index 00000000000..b56f419d0fe --- /dev/null +++ b/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mt/springboot/SwiftMtDataFormatAutoConfiguration.java @@ -0,0 +1,78 @@ +/* + * 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.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.dataformat.swift.mt.SwiftMtDataFormat; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.DataFormatCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.DataFormatConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.convert.ApplicationConversionService; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration(proxyBeanMethods = false) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({DataFormatConfigurationProperties.class,SwiftMtDataFormatConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.dataformat", "camel.dataformat.swift-mt"}) +public class SwiftMtDataFormatAutoConfiguration { + + @Autowired + private ApplicationContext applicationContext; + private final CamelContext camelContext; + @Autowired + private SwiftMtDataFormatConfiguration configuration; + + public SwiftMtDataFormatAutoConfiguration( + org.apache.camel.CamelContext camelContext) { + this.camelContext = camelContext; + } + + @Lazy + @Bean + public DataFormatCustomizer configureSwiftMtDataFormatFactory() { + return new DataFormatCustomizer() { + @Override + public void configure(String name, DataFormat target) { + CamelPropertiesHelper.copyProperties(camelContext, configuration, target); + } + @Override + public boolean isEnabled(String name, DataFormat target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.dataformat.customizer", + "camel.dataformat.swift-mt.customizer") + && target instanceof SwiftMtDataFormat; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mt/springboot/SwiftMtDataFormatConfiguration.java b/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mt/springboot/SwiftMtDataFormatConfiguration.java new file mode 100644 index 00000000000..9ff5251e355 --- /dev/null +++ b/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mt/springboot/SwiftMtDataFormatConfiguration.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.swift.mt.springboot; + +import org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Encode and decode SWIFT MT messages. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.dataformat.swift-mt") +public class SwiftMtDataFormatConfiguration + extends + DataFormatConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the swiftMt data format. This is + * enabled by default. + */ + private Boolean enabled; + /** + * The flag indicating that messages must be marshalled in a JSON format. + */ + private Boolean writeInJson = false; + + public Boolean getWriteInJson() { + return writeInJson; + } + + public void setWriteInJson(Boolean writeInJson) { + this.writeInJson = writeInJson; + } +} \ No newline at end of file diff --git a/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mx/springboot/SwiftMxDataFormatAutoConfiguration.java b/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mx/springboot/SwiftMxDataFormatAutoConfiguration.java new file mode 100644 index 00000000000..8b1fac55791 --- /dev/null +++ b/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mx/springboot/SwiftMxDataFormatAutoConfiguration.java @@ -0,0 +1,78 @@ +/* + * 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.springboot; + +import org.apache.camel.CamelContext; +import org.apache.camel.dataformat.swift.mx.SwiftMxDataFormat; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.DataFormatCustomizer; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.DataFormatConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.ConditionalOnHierarchicalProperties; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.convert.ApplicationConversionService; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration(proxyBeanMethods = false) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) +@EnableConfigurationProperties({DataFormatConfigurationProperties.class,SwiftMxDataFormatConfiguration.class}) +@ConditionalOnHierarchicalProperties({"camel.dataformat", "camel.dataformat.swift-mx"}) +public class SwiftMxDataFormatAutoConfiguration { + + @Autowired + private ApplicationContext applicationContext; + private final CamelContext camelContext; + @Autowired + private SwiftMxDataFormatConfiguration configuration; + + public SwiftMxDataFormatAutoConfiguration( + org.apache.camel.CamelContext camelContext) { + this.camelContext = camelContext; + } + + @Lazy + @Bean + public DataFormatCustomizer configureSwiftMxDataFormatFactory() { + return new DataFormatCustomizer() { + @Override + public void configure(String name, DataFormat target) { + CamelPropertiesHelper.copyProperties(camelContext, configuration, target); + } + @Override + public boolean isEnabled(String name, DataFormat target) { + return HierarchicalPropertiesEvaluator.evaluate( + applicationContext, + "camel.dataformat.customizer", + "camel.dataformat.swift-mx.customizer") + && target instanceof SwiftMxDataFormat; + } + }; + } +} \ No newline at end of file diff --git a/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mx/springboot/SwiftMxDataFormatConfiguration.java b/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mx/springboot/SwiftMxDataFormatConfiguration.java new file mode 100644 index 00000000000..dc7c1a7429e --- /dev/null +++ b/components-starter/camel-swift-starter/src/main/java/org/apache/camel/dataformat/swift/mx/springboot/SwiftMxDataFormatConfiguration.java @@ -0,0 +1,88 @@ +/* + * 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.springboot; + +import org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Encode and decode SWIFT MX messages. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.dataformat.swift-mx") +public class SwiftMxDataFormatConfiguration + extends + DataFormatConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the swiftMx data format. This is + * enabled by default. + */ + private Boolean enabled; + /** + * Refers to a specific configuration to use when marshalling a message to + * lookup from the registry. + */ + private String writeConfigRef; + /** + * The flag indicating that messages must be marshalled in a JSON format. + */ + private Boolean writeInJson = false; + /** + * 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 String readMessageId; + /** + * Refers to a specific configuration to use when unmarshalling an input + * stream to lookup from the registry. + */ + private String readConfigRef; + + public String getWriteConfigRef() { + return writeConfigRef; + } + + public void setWriteConfigRef(String writeConfigRef) { + this.writeConfigRef = writeConfigRef; + } + + public Boolean getWriteInJson() { + return writeInJson; + } + + public void setWriteInJson(Boolean writeInJson) { + this.writeInJson = writeInJson; + } + + public String getReadMessageId() { + return readMessageId; + } + + public void setReadMessageId(String readMessageId) { + this.readMessageId = readMessageId; + } + + public String getReadConfigRef() { + return readConfigRef; + } + + public void setReadConfigRef(String readConfigRef) { + this.readConfigRef = readConfigRef; + } +} \ No newline at end of file diff --git a/components-starter/camel-swift-starter/src/main/resources/META-INF/LICENSE.txt b/components-starter/camel-swift-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 00000000000..6b0b1270ff0 --- /dev/null +++ b/components-starter/camel-swift-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/components-starter/camel-swift-starter/src/main/resources/META-INF/NOTICE.txt b/components-starter/camel-swift-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 00000000000..2e215bf2e6b --- /dev/null +++ b/components-starter/camel-swift-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/components-starter/camel-swift-starter/src/main/resources/META-INF/spring.factories b/components-starter/camel-swift-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000000..a0a35a8d9c1 --- /dev/null +++ b/components-starter/camel-swift-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,21 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.dataformat.swift.mt.springboot.SwiftMtDataFormatAutoConfiguration,\ +org.apache.camel.dataformat.swift.mx.springboot.SwiftMxDataFormatAutoConfiguration + diff --git a/components-starter/camel-swift-starter/src/main/resources/META-INF/spring.provides b/components-starter/camel-swift-starter/src/main/resources/META-INF/spring.provides new file mode 100644 index 00000000000..9b65986b13f --- /dev/null +++ b/components-starter/camel-swift-starter/src/main/resources/META-INF/spring.provides @@ -0,0 +1,17 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +provides: camel-swift diff --git a/components-starter/camel-swift-starter/src/test/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormatTest.java b/components-starter/camel-swift-starter/src/test/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormatTest.java new file mode 100644 index 00000000000..2761557b461 --- /dev/null +++ b/components-starter/camel-swift-starter/src/test/java/org/apache/camel/dataformat/swift/mt/SwiftMtDataFormatTest.java @@ -0,0 +1,109 @@ +/* + * 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.EndpointInject; +import org.apache.camel.Produce; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit5.CamelSpringBootTest; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest( + classes = { + CamelAutoConfiguration.class, + SwiftMtDataFormatTest.class + }, + properties = { + "camel.springboot.routes-include-pattern=file:src/test/resources/routes/SwiftMtDataFormatTest.xml" + } +) +class SwiftMtDataFormatTest { + + @EndpointInject("mock:unmarshal") + MockEndpoint mockEndpointUnmarshal; + @Autowired + @Produce("direct:unmarshal") + ProducerTemplate templateUnmarshal; + @EndpointInject("mock:marshal") + MockEndpoint mockEndpointMarshal; + @Autowired + @Produce("direct:marshal") + ProducerTemplate templateMarshal; + @EndpointInject("mock:marshalJson") + MockEndpoint mockEndpointMarshalJson; + @Autowired + @Produce("direct:marshalJson") + ProducerTemplate templateMarshalJson; + + @Test + void testUnmarshal() throws Exception { + mockEndpointUnmarshal.expectedMessageCount(1); + + Object result = templateUnmarshal.requestBody(Files.readAllBytes(Paths.get("src/test/resources/mt/message1.txt"))); + assertNotNull(result); + assertInstanceOf(MT515.class, result); + mockEndpointUnmarshal.assertIsSatisfied(); + } + + @Test + void testMarshal() throws Exception { + mockEndpointMarshal.expectedMessageCount(1); + + MT103 message = MT103.parse(Files.readString(Paths.get("src/test/resources/mt/message2.txt"))); + + Object result = templateMarshal.requestBody(message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + MT103 actual = MT103.parse((InputStream) result); + assertEquals(message.message(), actual.message()); + mockEndpointMarshal.assertIsSatisfied(); + } + + @Test + void testMarshalJson() throws Exception { + mockEndpointMarshalJson.expectedMessageCount(1); + + MT103 message = MT103.parse(Files.readString(Paths.get("src/test/resources/mt/message2.txt"))); + + Object result = templateMarshalJson.requestBody(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)); + mockEndpointMarshalJson.assertIsSatisfied(); + } +} diff --git a/components-starter/camel-swift-starter/src/test/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormatTest.java b/components-starter/camel-swift-starter/src/test/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormatTest.java new file mode 100644 index 00000000000..ebe47c33ace --- /dev/null +++ b/components-starter/camel-swift-starter/src/test/java/org/apache/camel/dataformat/swift/mx/SwiftMxDataFormatTest.java @@ -0,0 +1,167 @@ +/* + * 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.EndpointInject; +import org.apache.camel.Produce; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.test.spring.junit5.CamelSpringBootTest; +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.test.annotation.DirtiesContext; + +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; + +@DirtiesContext +@CamelSpringBootTest +@SpringBootTest( + classes = { + CamelAutoConfiguration.class, + SwiftMxDataFormatTest.class, + SwiftMxDataFormatTest.Config.class + }, + properties = { + "camel.springboot.routes-include-pattern=file:src/test/resources/routes/SwiftMxDataFormatTest.xml" + } +) +class SwiftMxDataFormatTest { + + @EndpointInject("mock:unmarshal") + MockEndpoint mockEndpointUnmarshal; + @Autowired + @Produce("direct:unmarshal") + ProducerTemplate templateUnmarshal; + @EndpointInject("mock:unmarshalFull") + MockEndpoint mockEndpointUnmarshalFull; + @Autowired + @Produce("direct:unmarshalFull") + ProducerTemplate templateUnmarshalFull; + @EndpointInject("mock:marshal") + MockEndpoint mockEndpointMarshal; + @Autowired + @Produce("direct:marshal") + ProducerTemplate templateMarshal; + @EndpointInject("mock:marshalJson") + MockEndpoint mockEndpointMarshalJson; + @Autowired + @Produce("direct:marshalJson") + ProducerTemplate templateMarshalJson; + @EndpointInject("mock:marshalFull") + MockEndpoint mockEndpointMarshalFull; + @Autowired + @Produce("direct:marshalFull") + ProducerTemplate templateMarshalFull; + + @Test + void testUnmarshal() throws Exception { + mockEndpointUnmarshal.expectedMessageCount(1); + + Object result = templateUnmarshal.requestBody(Files.readAllBytes(Paths.get("src/test/resources/mx/message1.xml"))); + assertNotNull(result); + assertInstanceOf(MxCamt04800103.class, result); + mockEndpointUnmarshal.assertIsSatisfied(); + } + + @Test + void testUnmarshalFull() throws Exception { + mockEndpointUnmarshalFull.expectedMessageCount(1); + + Object result = templateUnmarshalFull.requestBody(Files.readAllBytes(Paths.get("src/test/resources/mx/message3.xml"))); + assertNotNull(result); + assertInstanceOf(MxXsys01100102.class, result); + mockEndpointUnmarshalFull.assertIsSatisfied(); + } + + @Test + void testMarshal() throws Exception { + mockEndpointMarshal.expectedMessageCount(1); + + MxPacs00800107 message = MxPacs00800107.parse(Files.readString(Paths.get("src/test/resources/mx/message2.xml"))); + Object result = templateMarshal.requestBody(message); + assertNotNull(result); + assertInstanceOf(InputStream.class, result); + MxPacs00800107 actual = MxPacs00800107.parse(IOUtils.toString((InputStream) result, StandardCharsets.UTF_8)); + assertEquals(message.message(), actual.message()); + mockEndpointMarshal.assertIsSatisfied(); + } + + @Test + void testMarshalJson() throws Exception { + mockEndpointMarshalJson.expectedMessageCount(1); + + MxPacs00800107 message = MxPacs00800107.parse(Files.readString(Paths.get("src/test/resources/mx/message2.xml"))); + Object result = templateMarshalJson.requestBody(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)); + mockEndpointMarshalJson.assertIsSatisfied(); + } + + @Test + void testMarshalFull() throws Exception { + mockEndpointMarshalFull.expectedMessageCount(1); + + MxPacs00800107 message = MxPacs00800107.parse(Files.readString(Paths.get("src/test/resources/mx/message2.xml"))); + Object result = templateMarshalFull.requestBody(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)); + mockEndpointMarshalFull.assertIsSatisfied(); + } + + @Configuration + public static class Config { + + @Bean + public ReadConfiguration readConfig(){ + return new ReadConfiguration(); + } + + @Bean + public WriteConfiguration writeConfig(){ + WriteConfiguration configuration = new WriteConfiguration(); + configuration.setIncludeXMLDeclaration(false); + return configuration; + } + } +} diff --git a/components-starter/camel-swift-starter/src/test/resources/mt/message1.txt b/components-starter/camel-swift-starter/src/test/resources/mt/message1.txt new file mode 100644 index 00000000000..a474f5c31b6 --- /dev/null +++ b/components-starter/camel-swift-starter/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-starter/camel-swift-starter/src/test/resources/mt/message2.json b/components-starter/camel-swift-starter/src/test/resources/mt/message2.json new file mode 100644 index 00000000000..f89ae62860f --- /dev/null +++ b/components-starter/camel-swift-starter/src/test/resources/mt/message2.json @@ -0,0 +1,118 @@ +{ + "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" + } + ] + }, + "trailerBlock": { + "fields": [ + { + "name": "MAC", + "value": "88B4F929" + }, + { + "name": "CHK", + "value": "22EF370A4073" + } + ] + } +} diff --git a/components-starter/camel-swift-starter/src/test/resources/mt/message2.txt b/components-starter/camel-swift-starter/src/test/resources/mt/message2.txt new file mode 100644 index 00000000000..df5efc8303d --- /dev/null +++ b/components-starter/camel-swift-starter/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-starter/camel-swift-starter/src/test/resources/mx/message1.xml b/components-starter/camel-swift-starter/src/test/resources/mx/message1.xml new file mode 100644 index 00000000000..919760d442e --- /dev/null +++ b/components-starter/camel-swift-starter/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-starter/camel-swift-starter/src/test/resources/mx/message2.json b/components-starter/camel-swift-starter/src/test/resources/mx/message2.json new file mode 100644 index 00000000000..7daaa4b792d --- /dev/null +++ b/components-starter/camel-swift-starter/src/test/resources/mx/message2.json @@ -0,0 +1,169 @@ +{ + "fiToFICstmrCdtTrf": { + "grpHdr": { + "msgId": "823823423", + "creDtTm": { + "year": 2019, + "month": 10, + "day": 19, + "timezone": -2147483648, + "hour": 21, + "minute": 0, + "second": 45 + }, + "btchBookg": false, + "nbOfTxs": "1", + "ctrlSum": 10000, + "ttlIntrBkSttlmAmt": { + "value": 10000, + "ccy": "USD" + }, + "intrBkSttlmDt": { + "year": 2019, + "month": 10, + "day": 28, + "timezone": -2147483648, + "hour": -2147483648, + "minute": -2147483648, + "second": -2147483648 + }, + "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, + "timezone": -2147483648, + "hour": -2147483648, + "minute": -2147483648, + "second": -2147483648 + }, + "sttlmPrty": "URGT", + "accptncDtTm": { + "year": 2019, + "month": 4, + "day": 28, + "timezone": -2147483648, + "hour": 20, + "minute": 54, + "second": 39 + }, + "poolgAdjstmntDt": { + "year": 2019, + "month": 4, + "day": 29, + "timezone": -2147483648, + "hour": -2147483648, + "minute": -2147483648, + "second": -2147483648 + }, + "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": { + "year": 2019, + "month": 10, + "day": 19, + "timezone": 0, + "hour": 20, + "minute": 53, + "second": 13 + }, + "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-starter/camel-swift-starter/src/test/resources/mx/message2.xml b/components-starter/camel-swift-starter/src/test/resources/mx/message2.xml new file mode 100644 index 00000000000..9989c5209c3 --- /dev/null +++ b/components-starter/camel-swift-starter/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-starter/camel-swift-starter/src/test/resources/mx/message3.xml b/components-starter/camel-swift-starter/src/test/resources/mx/message3.xml new file mode 100644 index 00000000000..e0caa4cf699 --- /dev/null +++ b/components-starter/camel-swift-starter/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-starter/camel-swift-starter/src/test/resources/routes/SwiftMtDataFormatTest.xml b/components-starter/camel-swift-starter/src/test/resources/routes/SwiftMtDataFormatTest.xml new file mode 100644 index 00000000000..d2072b958b7 --- /dev/null +++ b/components-starter/camel-swift-starter/src/test/resources/routes/SwiftMtDataFormatTest.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. +--> +<routes id="camel" 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> +</routes> diff --git a/components-starter/camel-swift-starter/src/test/resources/routes/SwiftMxDataFormatTest.xml b/components-starter/camel-swift-starter/src/test/resources/routes/SwiftMxDataFormatTest.xml new file mode 100644 index 00000000000..cfd1f5ed766 --- /dev/null +++ b/components-starter/camel-swift-starter/src/test/resources/routes/SwiftMxDataFormatTest.xml @@ -0,0 +1,52 @@ +<?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. +--> +<routes id="camel" 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> +</routes> diff --git a/components-starter/pom.xml b/components-starter/pom.xml index c575d56bbd5..a09ce8228c7 100644 --- a/components-starter/pom.xml +++ b/components-starter/pom.xml @@ -392,6 +392,7 @@ <module>camel-stream-starter</module> <module>camel-stringtemplate-starter</module> <module>camel-stub-starter</module> + <module>camel-swift-starter</module> <module>camel-syslog-starter</module> <module>camel-tarfile-starter</module> <module>camel-telegram-starter</module> diff --git a/tooling/camel-spring-boot-bom/pom.xml b/tooling/camel-spring-boot-bom/pom.xml index 5e9e9981bf0..52f2546ae27 100644 --- a/tooling/camel-spring-boot-bom/pom.xml +++ b/tooling/camel-spring-boot-bom/pom.xml @@ -1518,6 +1518,11 @@ <artifactId>camel-stub-starter</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-swift-starter</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-syslog-starter</artifactId> diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index a34381d05d4..c275867c853 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -1540,6 +1540,11 @@ <artifactId>camel-stub-starter</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.springboot</groupId> + <artifactId>camel-swift-starter</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-syslog-starter</artifactId> @@ -3527,6 +3532,11 @@ <artifactId>camel-support</artifactId> <version>4.0.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-swift</artifactId> + <version>4.0.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-syslog</artifactId>