This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch Croway-expose-smb-unc-path in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2fb300dd031812248297eb9d792dd14833426e61 Author: Claus Ibsen <[email protected]> AuthorDate: Fri Apr 25 09:32:08 2025 +0200 camel-smb: Expose UncPath for backwardcompatibility. --- .../resources/org/apache/camel/catalog/components/smb.json | 3 ++- .../META-INF/org/apache/camel/component/smb/smb.json | 3 ++- .../java/org/apache/camel/component/smb/SmbConstants.java | 1 + .../java/org/apache/camel/component/smb/SmbComponentIT.java | 4 ++-- .../builder/endpoint/dsl/SmbEndpointBuilderFactory.java | 12 ++++++++++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smb.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smb.json index aad41b0e5bb..3f242e27660 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smb.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smb.json @@ -46,7 +46,8 @@ "CamelFileHost": { "index": 12, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The remote hostname.", "constantName": "org.apache.camel.component.smb.SmbConstants#FILE_HOST" }, "CamelSmbFileInputStream": { "index": 13, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "java.io.InputStream", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The remote file input stream.", "constantName": "org.apache.camel.component.smb.SmbConstants#SMB_FILE_INPUT_STREAM" }, "CamelFileLocalWorkPath": { "index": 14, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Path to the local work file, if local work directory is used.", "constantName": "org.apache.camel.component.smb.SmbConstants#FILE_LOCAL_WORK_PATH" }, - "CamelSmbFileExists": { "index": 15, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.file.GenericFileExist", "enum": [ "Override", "Append", "Fail", "Ignore", "Move", "TryRename" ], "deprecated": true, "deprecationNote": "", "autowired": false, "secret": false, "description": "The expected behavior if the file already exists.", "constantName": "org.apache.camel.component.smb.SmbConstants#SMB_FIL [...] + "CamelSmbFileExists": { "index": 15, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.file.GenericFileExist", "enum": [ "Override", "Append", "Fail", "Ignore", "Move", "TryRename" ], "deprecated": true, "deprecationNote": "", "autowired": false, "secret": false, "description": "The expected behavior if the file already exists.", "constantName": "org.apache.camel.component.smb.SmbConstants#SMB_FIL [...] + "CamelSmbUncPath": { "index": 16, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "UNC path to the retrieved file", "constantName": "org.apache.camel.component.smb.SmbConstants#SMB_UNC_PATH" } }, "properties": { "hostname": { "index": 0, "kind": "path", "displayName": "Hostname", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.smb.SmbConfiguration", "configurationField": "configuration", "description": "The share hostname or IP address" }, diff --git a/components/camel-smb/src/generated/resources/META-INF/org/apache/camel/component/smb/smb.json b/components/camel-smb/src/generated/resources/META-INF/org/apache/camel/component/smb/smb.json index aad41b0e5bb..3f242e27660 100644 --- a/components/camel-smb/src/generated/resources/META-INF/org/apache/camel/component/smb/smb.json +++ b/components/camel-smb/src/generated/resources/META-INF/org/apache/camel/component/smb/smb.json @@ -46,7 +46,8 @@ "CamelFileHost": { "index": 12, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The remote hostname.", "constantName": "org.apache.camel.component.smb.SmbConstants#FILE_HOST" }, "CamelSmbFileInputStream": { "index": 13, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "java.io.InputStream", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The remote file input stream.", "constantName": "org.apache.camel.component.smb.SmbConstants#SMB_FILE_INPUT_STREAM" }, "CamelFileLocalWorkPath": { "index": 14, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Path to the local work file, if local work directory is used.", "constantName": "org.apache.camel.component.smb.SmbConstants#FILE_LOCAL_WORK_PATH" }, - "CamelSmbFileExists": { "index": 15, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.file.GenericFileExist", "enum": [ "Override", "Append", "Fail", "Ignore", "Move", "TryRename" ], "deprecated": true, "deprecationNote": "", "autowired": false, "secret": false, "description": "The expected behavior if the file already exists.", "constantName": "org.apache.camel.component.smb.SmbConstants#SMB_FIL [...] + "CamelSmbFileExists": { "index": 15, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.apache.camel.component.file.GenericFileExist", "enum": [ "Override", "Append", "Fail", "Ignore", "Move", "TryRename" ], "deprecated": true, "deprecationNote": "", "autowired": false, "secret": false, "description": "The expected behavior if the file already exists.", "constantName": "org.apache.camel.component.smb.SmbConstants#SMB_FIL [...] + "CamelSmbUncPath": { "index": 16, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "UNC path to the retrieved file", "constantName": "org.apache.camel.component.smb.SmbConstants#SMB_UNC_PATH" } }, "properties": { "hostname": { "index": 0, "kind": "path", "displayName": "Hostname", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.smb.SmbConfiguration", "configurationField": "configuration", "description": "The share hostname or IP address" }, diff --git a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConstants.java b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConstants.java index 929da35d3d3..6a6abc590eb 100644 --- a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConstants.java +++ b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConstants.java @@ -81,5 +81,6 @@ public class SmbConstants { javaType = "org.apache.camel.component.file.GenericFileExist") @Deprecated public static final String SMB_FILE_EXISTS = "CamelSmbFileExists"; + @Metadata(label = "consumer", description = "UNC path to the retrieved file", javaType = "String") public static final String SMB_UNC_PATH = "CamelSmbUncPath"; } diff --git a/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbComponentIT.java b/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbComponentIT.java index 86e371a7d44..c2d4b34c8da 100644 --- a/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbComponentIT.java +++ b/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbComponentIT.java @@ -48,7 +48,7 @@ public class SmbComponentIT extends CamelTestSupport { public void testSmbRead() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedMessageCount(100); - mock.expectedHeaderValuesReceivedInAnyOrder("CamelSmbUncPath", "\\\\localhost\\data-rw\\1.txt"); + mock.allMessages().header(SmbConstants.SMB_UNC_PATH).startsWith("\\\\localhost\\data-rw\\"); mock.assertIsSatisfied(); } @@ -56,7 +56,7 @@ public class SmbComponentIT extends CamelTestSupport { @Test public void testSmbSendFile() throws Exception { mockResultEndpoint.expectedMinimumMessageCount(1); - Exchange exchange = template.request("direct:smbSendFile", null); + template.request("direct:smbSendFile", null); MockEndpoint.assertIsSatisfied(context); } diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmbEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmbEndpointBuilderFactory.java index 3718d0077a4..04d92079573 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmbEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmbEndpointBuilderFactory.java @@ -3909,6 +3909,18 @@ public interface SmbEndpointBuilderFactory { public String smbFileExists() { return "CamelSmbFileExists"; } + /** + * UNC path to the retrieved file. + * + * The option is a: {@code String} type. + * + * Group: consumer + * + * @return the name of the header {@code SmbUncPath}. + */ + public String smbUncPath() { + return "CamelSmbUncPath"; + } } static SmbEndpointBuilder endpointBuilder(String componentName, String path) { class SmbEndpointBuilderImpl extends AbstractEndpointBuilder implements SmbEndpointBuilder, AdvancedSmbEndpointBuilder {
