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

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


The following commit(s) were added to refs/heads/main by this push:
     new be1a40aee Fix #3332: new smb-source and smb-sink Kamelets for Windows 
and Samba file shares (#3339)
be1a40aee is described below

commit be1a40aeec508a1f300a9f34b13cde46345562bd
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 04:53:52 2026 +0100

    Fix #3332: new smb-source and smb-sink Kamelets for Windows and Samba file 
shares (#3339)
    
    * Fix #3332: new smb-source and smb-sink Kamelets for Windows and Samba 
file shares
    
    smb-source reads the files of a directory on an SMB share, one message per
    file (bytes, or a stream with streamDownload), with the file, ce-file,
    CamelFileName, CamelFileLength, CamelFileLastModified and CamelSmbUncPath
    headers, and the idempotent, delete, move, moveFailed, preMove, include,
    exclude, antInclude, readLock, sortBy and streamDownload options of
    sftp-source.
    
    smb-sink writes each message as a file, named by the file or ce-file header
    without its directory, or by CamelFileName as it is. It removes the
    CamelFile*, CamelOverruleFile* and CamelSmb* headers of the message first
    (CamelSmbFileExists would otherwise override fileExist), and the component
    jails CamelFileName to directoryName.
    
    Citrus tests (SmbIT) against a Samba container (dockurr/samba:4.23.10).
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
    
    * chore: regenerate the catalog files after merging main
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
    
    ---------
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 .../camel-kamelets-catalog-sbom.json               |  32 ++-
 docs/modules/ROOT/nav.adoc                         |   2 +
 kamelets/smb-sink.kamelet.yaml                     | 188 +++++++++++++++
 kamelets/smb-source.kamelet.yaml                   | 260 +++++++++++++++++++++
 .../main/resources/META-INF/kamelets-index.json    |  20 ++
 .../main/resources/kamelets/smb-sink.kamelet.yaml  | 188 +++++++++++++++
 .../resources/kamelets/smb-source.kamelet.yaml     | 260 +++++++++++++++++++++
 .../camel-kamelets-itest/src/test/java/SmbIT.java  |  71 ++++++
 .../resources/smb/smb-sink-route.citrus.it.yaml    | 112 +++++++++
 .../src/test/resources/smb/smb-sink-route.yaml     |  91 ++++++++
 .../resources/smb/smb-source-route.citrus.it.yaml  | 100 ++++++++
 .../src/test/resources/smb/smb-source-route.yaml   |  57 +++++
 .../src/test/resources/smb/smbServer.groovy        |  31 +++
 .../src/test/resources/smb/verifyMoved.groovy      |  27 +++
 .../src/test/resources/smb/verifyUpload.groovy     |  36 +++
 15 files changed, 1474 insertions(+), 1 deletion(-)

diff --git a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json 
b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
index 70b58c47a..94e12d96e 100644
--- a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
+++ b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
@@ -986,6 +986,16 @@
     "type" : "library",
     "name" : "slack-source",
     "version" : "4.24.0-SNAPSHOT"
+  }, {
+    "bom-ref" : "kamelet:smb-sink",
+    "type" : "library",
+    "name" : "smb-sink",
+    "version" : "4.24.0-SNAPSHOT"
+  }, {
+    "bom-ref" : "kamelet:smb-source",
+    "type" : "library",
+    "name" : "smb-source",
+    "version" : "4.24.0-SNAPSHOT"
   }, {
     "bom-ref" : "kamelet:smpp-sink",
     "type" : "library",
@@ -2127,6 +2137,17 @@
       "name" : "camel.apache.org/versioned-by",
       "value" : "runtime"
     } ]
+  }, {
+    "bom-ref" : "pkg:maven/org.apache.camel/[email protected]",
+    "type" : "library",
+    "group" : "org.apache.camel",
+    "name" : "camel-smb",
+    "version" : "4.24.0-SNAPSHOT",
+    "purl" : "pkg:maven/org.apache.camel/[email protected]",
+    "properties" : [ {
+      "name" : "camel.apache.org/versioned-by",
+      "value" : "runtime"
+    } ]
   }, {
     "bom-ref" : "pkg:maven/org.apache.camel/[email protected]",
     "type" : "library",
@@ -2345,7 +2366,7 @@
   } ],
   "dependencies" : [ {
     "ref" : "camel-kamelets-catalog",
-    "dependsOn" : [ "kamelet:avro-deserialize-action", 
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink", 
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink", 
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink", 
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink", 
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink", 
"kamelet:aws-eventbridge-sink", "kamelet:aws-eventbridge-source", 
"kamelet:aws-kinesis-firehose-sink", "kamelet:aws-ki [...]
+    "dependsOn" : [ "kamelet:avro-deserialize-action", 
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink", 
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink", 
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink", 
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink", 
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink", 
"kamelet:aws-eventbridge-sink", "kamelet:aws-eventbridge-source", 
"kamelet:aws-kinesis-firehose-sink", "kamelet:aws-ki [...]
   }, {
     "ref" : "kamelet:avro-deserialize-action",
     "dependsOn" : [ 
"pkg:maven/org.apache.camel/[email protected]", 
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -2931,6 +2952,12 @@
   }, {
     "ref" : "kamelet:slack-source",
     "dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]", 
"pkg:maven/org.apache.camel/[email protected]", 
"pkg:maven/org.apache.camel/[email protected]" ]
+  }, {
+    "ref" : "kamelet:smb-sink",
+    "dependsOn" : [ 
"pkg:maven/org.apache.camel/[email protected]", 
"pkg:maven/org.apache.camel/[email protected]" ]
+  }, {
+    "ref" : "kamelet:smb-source",
+    "dependsOn" : [ 
"pkg:maven/org.apache.camel/[email protected]", 
"pkg:maven/org.apache.camel/[email protected]" ]
   }, {
     "ref" : "kamelet:smpp-sink",
     "dependsOn" : [ 
"pkg:maven/org.apache.camel/[email protected]", 
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -3294,6 +3321,9 @@
   }, {
     "ref" : "pkg:maven/org.apache.camel/[email protected]",
     "dependsOn" : [ ]
+  }, {
+    "ref" : "pkg:maven/org.apache.camel/[email protected]",
+    "dependsOn" : [ ]
   }, {
     "ref" : "pkg:maven/org.apache.camel/[email protected]",
     "dependsOn" : [ ]
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 1d4ce7158..7256c82c8 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -194,6 +194,8 @@
 * xref:simple-filter-action.adoc[]
 * xref:slack-sink.adoc[]
 * xref:slack-source.adoc[]
+* xref:smb-sink.adoc[]
+* xref:smb-source.adoc[]
 * xref:smpp-sink.adoc[]
 * xref:smpp-source.adoc[]
 * xref:snmp-source.adoc[]
diff --git a/kamelets/smb-sink.kamelet.yaml b/kamelets/smb-sink.kamelet.yaml
new file mode 100644
index 000000000..6af926d89
--- /dev/null
+++ b/kamelets/smb-sink.kamelet.yaml
@@ -0,0 +1,188 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+  name: smb-sink
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+    camel.apache.org/kamelet.icon: 
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzY4LjU1MyAzNjguNTUzIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bm
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "SMB"
+    camel.apache.org/kamelet.namespace: "File"
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+    camel.apache.org/kamelet.verified: "true"
+spec:
+  definition:
+    title: "SMB Sink"
+    description: |-
+      Writes each message as a file to a directory of a Windows or Samba file 
share (SMB).
+
+      Use it to deliver exports, reports or data files to a Windows file 
server or a NAS, on a share such as `\\fileserver\imports`. To read files from 
a share use `smb-source`. For an FTP or SFTP server use `ftp-sink` or 
`sftp-sink`.
+
+      Input: the body is the content of the file, as text, bytes or a stream. 
The name of the file comes from the `file` header, or from `ce-file` when 
`file` is not set; any directory in it is dropped, so `reports/data.csv` and 
`reports\data.csv` are written as `data.csv`. Without these headers, 
`CamelFileName` is used as it is, subdirectories included, and without any of 
them a unique name is generated.
+
+      Output: the message is unchanged. The `CamelFileNameProduced` header is 
set to the path of the file within the share.
+
+      Good to know: a file with the same name is replaced, unless `fileExist` 
says otherwise. A file is written under its real name from the start, so a 
reader that polls the directory can pick it up half-written. To prevent that, 
set `tempPrefix` to write it under a temporary name and rename it once it is 
complete, or `doneFileName` to write an empty done file next to it once it is 
complete. Log in with `username` and `password`. A message fails when the 
server cannot be reached or the  [...]
+    required:
+      - connectionHost
+      - shareName
+      - directoryName
+      - username
+      - password
+    type: object
+    properties:
+      connectionHost:
+        title: Connection Host
+        description: The host name or IP address of the SMB server, without 
`smb://`, without `\\` and without a port.
+        type: string
+        example: fileserver.example.com
+      connectionPort:
+        title: Connection Port
+        description: The port of the SMB server, usually 445.
+        type: integer
+        default: 445
+      shareName:
+        title: Share Name
+        description: The name of the share, as the server shares it, such as 
`imports` for `\\fileserver\imports`.
+        type: string
+        example: imports
+      directoryName:
+        title: Directory Name
+        description: The directory within the share to write the files to, 
with `/` between its parts, such as `incoming/orders`. Use `/` to write the 
files at the top of the share. It is created when it does not exist, unless 
`autoCreate` is false.
+        type: string
+        example: incoming/orders
+      username:
+        title: Username
+        description: The user to log in to the SMB server as, without the 
domain, such as `jdoe`.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      password:
+        title: Password
+        description: The password of `username`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      domain:
+        title: Domain
+        description: The Windows domain of `username`, such as `CORP` for the 
account `CORP\jdoe`. Leave it unset for a user of the server itself.
+        type: string
+        example: CORP
+      fileExist:
+        title: If File Exists
+        description: What to do when a file with the same name is already in 
the directory. `Override` replaces it, `Append` adds the new content at its 
end, `Fail` fails the message, and `Ignore` keeps the old file and drops the 
new content without an error.
+        type: string
+        default: Override
+        enum: ["Override", "Append", "Fail", "Ignore"]
+      autoCreate:
+        title: Autocreate Missing Directories
+        description: If true, `directoryName`, and any subdirectory in the 
`CamelFileName` header, is created on the share when it does not exist. If 
false, a message for a directory that does not exist fails.
+        type: boolean
+        default: true
+      tempPrefix:
+        title: Temporary Name Prefix
+        description: A prefix for the name a file is written under. Once the 
file is complete, it is renamed to its real name, so a reader that skips the 
names with this prefix never picks up a half-written file. `smb-source`, like 
other readers built with Camel, skips the names that start with a dot, so a 
prefix such as `.tmp-`, which writes `orders.csv` as `.tmp-orders.csv`, works 
with it as it is. A prefix that ends with `/`, such as `.inprogress/`, writes 
the file into that subdirect [...]
+        type: string
+        example: ".tmp-"
+      doneFileName:
+        title: Done File Name
+        description: The name of an empty file to write next to each file once 
the file is complete, so that a reader knows the file can be read. 
`$\{file:name}` stands for the name of the file and `$\{file:name.noext}` for 
the name without its extension, so `$\{file:name}.done` writes 
`orders.csv.done`, and `$\{file:name.noext}.ready` writes `orders.ready`. A 
fixed name, such as `ready`, is written again after each file. No other 
`$\{...}` is allowed, and with one the file is written bu [...]
+        type: string
+        example: "${file:name}.done"
+  dataTypes:
+    # No 'default: binary' here on purpose, as in sftp-sink: with stream 
caching turned off, it would read a
+    # stream into memory (a byte[]) before the file is written, such as a 
large file from smb-source with
+    # streamDownload (#3117).
+    in:
+      headers:
+        file:
+          title: File Name
+          description: The name of the file to write, such as `orders.csv`. 
Any directory in it is dropped.
+          type: string
+        ce-file:
+          title: File Name (CloudEvents)
+          description: The name of the file to write, used when `file` is not 
set. Any directory in it is dropped.
+          type: string
+        CamelFileName:
+          title: Camel File Name
+          description: The name of the file to write, used as it is, 
subdirectories included, when neither `file` nor `ce-file` is set.
+          type: string
+    out:
+      headers:
+        CamelFileNameProduced:
+          title: File Written
+          description: The path of the file that was written, within the 
share, such as `incoming/orders/orders.csv`.
+          type: string
+  dependencies:
+    - "camel:smb"
+    - "camel:kamelet"
+  template:
+    from:
+      uri: kamelet:source
+      steps:
+        - removeHeaders:
+            pattern: "Camel(File|OverruleFile|Smb).*"
+            excludePattern: CamelFileName
+        - choice:
+            when:
+              - expression:
+                  simple:
+                    expression: "${header[file]}"
+                steps:
+                  - setHeader:
+                      name: CamelFileName
+                      expression:
+                        simple:
+                          expression: "${header[file]}"
+                  - setHeader:
+                      name: CamelFileName
+                      expression:
+                        simple:
+                          expression: "${file:onlyname}"
+              - expression:
+                  simple:
+                    expression: "${header[ce-file]}"
+                steps:
+                  - setHeader:
+                      name: CamelFileName
+                      expression:
+                        simple:
+                          expression: "${header[ce-file]}"
+                  - setHeader:
+                      name: CamelFileName
+                      expression:
+                        simple:
+                          expression: "${file:onlyname}"
+        - to:
+            uri: smb
+            parameters:
+              hostname: "{{connectionHost}}"
+              port: "{{connectionPort}}"
+              shareName: "{{shareName}}"
+              path: "{{directoryName}}"
+              autoCreate: "{{autoCreate}}"
+              doneFileName: "RAW({{?doneFileName}})"
+              domain: "RAW({{?domain}})"
+              fileExist: "{{fileExist}}"
+              password: "RAW({{?password}})"
+              tempPrefix: "RAW({{?tempPrefix}})"
+              username: "RAW({{?username}})"
diff --git a/kamelets/smb-source.kamelet.yaml b/kamelets/smb-source.kamelet.yaml
new file mode 100644
index 000000000..dd1d294e2
--- /dev/null
+++ b/kamelets/smb-source.kamelet.yaml
@@ -0,0 +1,260 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+  name: smb-source
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+    camel.apache.org/kamelet.icon: 
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzY4LjU1MyAzNjguNTUzIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bm
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "SMB"
+    camel.apache.org/kamelet.namespace: "File"
+  labels:
+    camel.apache.org/kamelet.type: "source"
+    camel.apache.org/kamelet.verified: "true"
+spec:
+  definition:
+    title: "SMB Source"
+    description: |-
+      Reads the files in a directory of a Windows or Samba file share (SMB), 
one message per file, and by default leaves them on the share.
+
+      Use it to collect the files that another system drops on a Windows file 
server or a NAS, such as orders, invoices or exports, from a share such as 
`\\fileserver\exports`. To write files to a share use `smb-sink`. For an FTP or 
SFTP server use `ftp-source` or `sftp-source`.
+
+      Output: the body is the content of the file, as bytes, or as a stream 
when `streamDownload` is true. `Content-Type` is `application/octet-stream`. 
The `file` and `ce-file` headers hold the name of the file, with its path below 
`directoryName` when `recursive` is true, such as `2026/orders.csv`. 
`CamelFileName` holds the same name, `CamelFileLength` the size of the file in 
bytes, `CamelFileLastModified` the time the file was last changed, in 
milliseconds since 1970, and `CamelSmbUnc [...]
+
+      Good to know: files are not deleted or moved after they are read, unless 
`delete` is true or `move` is set. A file is read only once while the 
integration runs (`idempotent`), but the files left on the share are all read 
again after a restart; to read each file only once, also across restarts, set 
`move` to a directory such as `.done`, set `delete` to true, or keep the list 
of the files read in a file with `idempotentRepository`. To read only some of 
the files, set `include`, `excl [...]
+    required:
+      - connectionHost
+      - shareName
+      - directoryName
+      - username
+      - password
+    type: object
+    properties:
+      connectionHost:
+        title: Connection Host
+        description: The host name or IP address of the SMB server, without 
`smb://`, without `\\` and without a port.
+        type: string
+        example: fileserver.example.com
+      connectionPort:
+        title: Connection Port
+        description: The port of the SMB server, usually 445.
+        type: integer
+        default: 445
+      shareName:
+        title: Share Name
+        description: The name of the share, as the server shares it, such as 
`exports` for `\\fileserver\exports`.
+        type: string
+        example: exports
+      directoryName:
+        title: Directory Name
+        description: The directory within the share to read the files from, 
with `/` between its parts, such as `outgoing/orders`. Use `/` to read the 
files at the top of the share; the names in the file headers then start with 
`/`, such as `/orders.csv`.
+        type: string
+        example: outgoing/orders
+      username:
+        title: Username
+        description: The user to log in to the SMB server as, without the 
domain, such as `jdoe`.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      password:
+        title: Password
+        description: The password of `username`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      domain:
+        title: Domain
+        description: The Windows domain of `username`, such as `CORP` for the 
account `CORP\jdoe`. Leave it unset for a user of the server itself.
+        type: string
+        example: CORP
+      recursive:
+        title: Recursive
+        description: If true, the files in the subdirectories of 
`directoryName` are read too.
+        type: boolean
+        default: false
+      idempotent:
+        title: Skip Files Already Read
+        description: If true, a file is read only once while the integration 
runs, even when it stays on the share. The list of the files read is kept in 
memory, so after a restart the files still on the share are read again, unless 
`move` or `delete` takes them away, or `idempotentRepository` keeps the list 
elsewhere. If false, and neither `delete` nor `move` is set, the same files are 
read again on every poll.
+        type: boolean
+        default: true
+      idempotentRepository:
+        title: Files Read Store
+        description: The name of a bean that keeps the list of the files read, 
so that the files left on the share are not read again after a restart, such as 
a `FileIdempotentRepository` that keeps the list in a file. Declare the bean in 
the integration, for example under `beans` in YAML. Only used when `idempotent` 
is true. When it is not set, the list is kept in memory.
+        type: string
+        example: readFiles
+      autoCreate:
+        title: Autocreate Missing Directories
+        description: If true, `directoryName` is created on the share when it 
does not exist.
+        type: boolean
+        default: true
+      delete:
+        title: Delete
+        description: If true, each file is deleted from the share once it has 
been read and handed on successfully. Use it to read each file only once, also 
across restarts. To keep the files, set `move` instead.
+        type: boolean
+        default: false
+      move:
+        title: Move After Read
+        description: Where to move each file on the share once it has been 
read and handed on successfully, so that it is not read again, also after a 
restart. A directory name, such as `.done`, is relative to the directory of the 
file. A path that ends with the name of the file, such as 
`done/$\{date:now:yyyyMMdd}/$\{file:name}`, is relative to `directoryName`, 
where `$\{file:name}` is the name of the file, with its path below 
`directoryName`, and `$\{date:now:yyyyMMdd}` today's date. A [...]
+        type: string
+        example: ".done"
+      moveFailed:
+        title: Move Failed Files To
+        description: Where to move a file on the share when it could not be 
handed on, for example because the next step failed, so that it is not read 
over and over. The same format as `move`, such as `.error`. When it is not set, 
a file that fails stays where it is and is read again at every poll. It can be 
set together with `delete` or `move`.
+        type: string
+        example: ".error"
+      preMove:
+        title: Move Before Read
+        description: Where to move each file on the share before it is read, 
so that another reader of the same directory does not take it too. The same 
format as `move`, such as `.inprogress`, a directory next to the file. `move`, 
`moveFailed` and `delete` then act on the file in its new place, so with `move` 
set to `.done` the file ends up in `.inprogress/.done`. When it is not set, a 
file is read where it is.
+        type: string
+        example: ".inprogress"
+      include:
+        title: Include Files
+        description: A regular expression that the name of a file must match 
to be read, such as `.*\.csv` for the CSV files. The whole name must match, 
upper and lower case count as the same, and only the name is matched, not its 
directory. The other files stay on the share. When it is not set, all the files 
are read.
+        type: string
+        example: '.*\.csv'
+      exclude:
+        title: Exclude Files
+        description: A regular expression for the names of the files not to 
read, such as `.*\.(tmp|part)`. The whole name must match, upper and lower case 
count as the same, and only the name is matched, not its directory. A file it 
matches is not read, even when `include` or `antInclude` matches it too.
+        type: string
+        example: '.*\.(tmp|part)'
+      antInclude:
+        title: Include Files (Wildcards)
+        description: Wildcard patterns, separated by commas, that the path of 
a file must match to be read, such as `*.csv,*.xml`. The path is relative to 
`directoryName`, such as `2026/orders.csv` when `recursive` is true. `*` 
matches any part of a name and `**` any number of directories, so `**/*.csv` 
matches the CSV files in `directoryName` and in its subdirectories. Upper and 
lower case differ. When it is not set, all the files are read.
+        type: string
+        example: '**/*.csv'
+      readLock:
+        title: Wait Until Written
+        description: How to make sure that another program has finished 
writing a file before it is read. `changed` reads a file once its size and 
modification time have not changed between two checks 1 second apart, or, with 
`readLockMinAge`, once the file is that old. A file still changing after 10 
seconds is skipped until the next poll, and while a file is checked the other 
files wait. `changed` never reads an empty file. `rename` reads a file once it 
can be renamed. `none` reads the  [...]
+        type: string
+        enum: ["none", "changed", "rename"]
+        example: changed
+      readLockMinAge:
+        title: Minimum File Age
+        description: 'Only used when `readLock` is `changed`: how old a file 
must be, in milliseconds, before it is read, counted from its modification time 
on the share. For example, 60000 leaves a file alone until it has not been 
changed for one minute. A file that is not old enough is skipped until the next 
poll, after 10 seconds of checks. The clocks of the server and of the 
integration must agree.'
+        type: integer
+        example: 60000
+      delay:
+        title: Poll Interval
+        description: How long to wait between two polls of the directory, in 
milliseconds. For example, 60000 polls once a minute. When it is not set, 500.
+        type: integer
+        example: 60000
+      maxMessagesPerPoll:
+        title: Max Files Per Poll
+        description: The largest number of files to read in one poll, such as 
100. The other files are read at the next polls. The poll takes the first files 
the server lists, and `sortBy` sorts only these. When it is not set, or 0, all 
the files found are read.
+        type: integer
+        example: 100
+      sortBy:
+        title: Sort By
+        description: The order in which the files of a poll are read. 
`file:name` sorts them by name, `file:modified` by modification time and 
`file:length` by size, from the smallest. When it is not set, the files are 
read in the order the server lists them.
+        type: string
+        enum: ["file:name", "file:modified", "file:length"]
+        example: file:modified
+      streamDownload:
+        title: Stream Download
+        description: 'If true, each file is read from the share while it is 
handed on, instead of being read into memory first, and the body is a stream. 
Use it for files too large for memory. It saves memory only when the 
integration does not keep the stream in memory either: set 
`camel.main.streamCachingSpoolEnabled=true`, which writes large bodies to a 
temporary file, or turn stream caching off. When it is not set, false.'
+        type: boolean
+  dataTypes:
+    out:
+      default: binary
+      headers:
+        file:
+          title: File Name
+          description: The name of the file, with its path below 
`directoryName` when `recursive` is true, such as `2026/orders.csv`.
+          type: string
+        ce-file:
+          title: File Name (CloudEvents)
+          description: The same value as `file`.
+          type: string
+        CamelFileName:
+          title: Camel File Name
+          description: The same value as `file`.
+          type: string
+        CamelFileLength:
+          title: File Size
+          description: The size of the file, in bytes.
+          type: integer
+        CamelFileLastModified:
+          title: Last Modified
+          description: The time the file was last changed, in milliseconds 
since 1970-01-01 UTC.
+          type: integer
+        CamelSmbUncPath:
+          title: UNC Path
+          description: The full Windows path of the file, with the server and 
the share, such as `\\fileserver\exports\orders\orders.csv`.
+          type: string
+      types:
+        binary:
+          format: "application-octet-stream"
+          description: The content of the file as it is, with `Content-Type` 
set to `application/octet-stream`. A stream stays a stream, so `streamDownload` 
still reads a large file without holding it in memory.
+          mediaType: application/octet-stream
+  dependencies:
+    - "camel:smb"
+    - "camel:kamelet"
+  template:
+    from:
+      uri: smb
+      parameters:
+        hostname: "{{connectionHost}}"
+        port: "{{connectionPort}}"
+        shareName: "{{shareName}}"
+        path: "{{directoryName}}"
+        antInclude: "RAW({{?antInclude}})"
+        autoCreate: "{{autoCreate}}"
+        delay: "{{?delay}}"
+        delete: "{{delete}}"
+        domain: "RAW({{?domain}})"
+        exclude: "RAW({{?exclude}})"
+        idempotent: "{{idempotent}}"
+        idempotentRepository: "#bean:{{?idempotentRepository}}"
+        include: "RAW({{?include}})"
+        maxMessagesPerPoll: "{{?maxMessagesPerPoll}}"
+        move: "{{?move}}"
+        moveFailed: "{{?moveFailed}}"
+        password: "RAW({{?password}})"
+        preMove: "{{?preMove}}"
+        readLock: "{{?readLock}}"
+        readLockMinAge: "{{?readLockMinAge}}"
+        recursive: "{{recursive}}"
+        sortBy: "RAW({{?sortBy}})"
+        streamDownload: "{{?streamDownload}}"
+        username: "RAW({{?username}})"
+      steps:
+        - choice:
+            when:
+              - expression:
+                  simple:
+                    expression: "${body} is 
'org.apache.camel.component.file.GenericFile'"
+                steps:
+                  - setBody:
+                      expression:
+                        simple:
+                          expression: "${body.getBody()}"
+        - setHeader:
+            name: file
+            expression:
+              simple:
+                expression: "${header[CamelFileName]}"
+        - setHeader:
+            name: ce-file
+            expression:
+              simple:
+                expression: "${header[CamelFileName]}"
+        - to:
+            uri: kamelet:sink
diff --git 
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json 
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index c40432e1c..4ecbda8e2 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -1949,6 +1949,26 @@
     "group" : "Slack",
     "namespace" : "Social",
     "provider" : "Apache Software Foundation"
+  }, {
+    "name" : "smb-sink",
+    "type" : "sink",
+    "supportLevel" : "Stable",
+    "title" : "SMB Sink",
+    "summary" : "Writes each message as a file to a directory of a Windows or 
Samba file share (SMB).",
+    "description" : "Writes each message as a file to a directory of a Windows 
or Samba file share (SMB).\n\nUse it to deliver exports, reports or data files 
to a Windows file server or a NAS, on a share such as 
`\\\\fileserver\\imports`. To read files from a share use `smb-source`. For an 
FTP or SFTP server use `ftp-sink` or `sftp-sink`.\n\nInput: the body is the 
content of the file, as text, bytes or a stream. The name of the file comes 
from the `file` header, or from `ce-file` when `f [...]
+    "group" : "SMB",
+    "namespace" : "File",
+    "provider" : "Apache Software Foundation"
+  }, {
+    "name" : "smb-source",
+    "type" : "source",
+    "supportLevel" : "Stable",
+    "title" : "SMB Source",
+    "summary" : "Reads the files in a directory of a Windows or Samba file 
share (SMB), one message per file, and by default leaves them on the share.",
+    "description" : "Reads the files in a directory of a Windows or Samba file 
share (SMB), one message per file, and by default leaves them on the 
share.\n\nUse it to collect the files that another system drops on a Windows 
file server or a NAS, such as orders, invoices or exports, from a share such as 
`\\\\fileserver\\exports`. To write files to a share use `smb-sink`. For an FTP 
or SFTP server use `ftp-source` or `sftp-source`.\n\nOutput: the body is the 
content of the file, as bytes, [...]
+    "group" : "SMB",
+    "namespace" : "File",
+    "provider" : "Apache Software Foundation"
   }, {
     "name" : "smpp-sink",
     "type" : "sink",
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/smb-sink.kamelet.yaml 
b/library/camel-kamelets/src/main/resources/kamelets/smb-sink.kamelet.yaml
new file mode 100644
index 000000000..6af926d89
--- /dev/null
+++ b/library/camel-kamelets/src/main/resources/kamelets/smb-sink.kamelet.yaml
@@ -0,0 +1,188 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+  name: smb-sink
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+    camel.apache.org/kamelet.icon: 
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzY4LjU1MyAzNjguNTUzIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bm
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "SMB"
+    camel.apache.org/kamelet.namespace: "File"
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+    camel.apache.org/kamelet.verified: "true"
+spec:
+  definition:
+    title: "SMB Sink"
+    description: |-
+      Writes each message as a file to a directory of a Windows or Samba file 
share (SMB).
+
+      Use it to deliver exports, reports or data files to a Windows file 
server or a NAS, on a share such as `\\fileserver\imports`. To read files from 
a share use `smb-source`. For an FTP or SFTP server use `ftp-sink` or 
`sftp-sink`.
+
+      Input: the body is the content of the file, as text, bytes or a stream. 
The name of the file comes from the `file` header, or from `ce-file` when 
`file` is not set; any directory in it is dropped, so `reports/data.csv` and 
`reports\data.csv` are written as `data.csv`. Without these headers, 
`CamelFileName` is used as it is, subdirectories included, and without any of 
them a unique name is generated.
+
+      Output: the message is unchanged. The `CamelFileNameProduced` header is 
set to the path of the file within the share.
+
+      Good to know: a file with the same name is replaced, unless `fileExist` 
says otherwise. A file is written under its real name from the start, so a 
reader that polls the directory can pick it up half-written. To prevent that, 
set `tempPrefix` to write it under a temporary name and rename it once it is 
complete, or `doneFileName` to write an empty done file next to it once it is 
complete. Log in with `username` and `password`. A message fails when the 
server cannot be reached or the  [...]
+    required:
+      - connectionHost
+      - shareName
+      - directoryName
+      - username
+      - password
+    type: object
+    properties:
+      connectionHost:
+        title: Connection Host
+        description: The host name or IP address of the SMB server, without 
`smb://`, without `\\` and without a port.
+        type: string
+        example: fileserver.example.com
+      connectionPort:
+        title: Connection Port
+        description: The port of the SMB server, usually 445.
+        type: integer
+        default: 445
+      shareName:
+        title: Share Name
+        description: The name of the share, as the server shares it, such as 
`imports` for `\\fileserver\imports`.
+        type: string
+        example: imports
+      directoryName:
+        title: Directory Name
+        description: The directory within the share to write the files to, 
with `/` between its parts, such as `incoming/orders`. Use `/` to write the 
files at the top of the share. It is created when it does not exist, unless 
`autoCreate` is false.
+        type: string
+        example: incoming/orders
+      username:
+        title: Username
+        description: The user to log in to the SMB server as, without the 
domain, such as `jdoe`.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      password:
+        title: Password
+        description: The password of `username`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      domain:
+        title: Domain
+        description: The Windows domain of `username`, such as `CORP` for the 
account `CORP\jdoe`. Leave it unset for a user of the server itself.
+        type: string
+        example: CORP
+      fileExist:
+        title: If File Exists
+        description: What to do when a file with the same name is already in 
the directory. `Override` replaces it, `Append` adds the new content at its 
end, `Fail` fails the message, and `Ignore` keeps the old file and drops the 
new content without an error.
+        type: string
+        default: Override
+        enum: ["Override", "Append", "Fail", "Ignore"]
+      autoCreate:
+        title: Autocreate Missing Directories
+        description: If true, `directoryName`, and any subdirectory in the 
`CamelFileName` header, is created on the share when it does not exist. If 
false, a message for a directory that does not exist fails.
+        type: boolean
+        default: true
+      tempPrefix:
+        title: Temporary Name Prefix
+        description: A prefix for the name a file is written under. Once the 
file is complete, it is renamed to its real name, so a reader that skips the 
names with this prefix never picks up a half-written file. `smb-source`, like 
other readers built with Camel, skips the names that start with a dot, so a 
prefix such as `.tmp-`, which writes `orders.csv` as `.tmp-orders.csv`, works 
with it as it is. A prefix that ends with `/`, such as `.inprogress/`, writes 
the file into that subdirect [...]
+        type: string
+        example: ".tmp-"
+      doneFileName:
+        title: Done File Name
+        description: The name of an empty file to write next to each file once 
the file is complete, so that a reader knows the file can be read. 
`$\{file:name}` stands for the name of the file and `$\{file:name.noext}` for 
the name without its extension, so `$\{file:name}.done` writes 
`orders.csv.done`, and `$\{file:name.noext}.ready` writes `orders.ready`. A 
fixed name, such as `ready`, is written again after each file. No other 
`$\{...}` is allowed, and with one the file is written bu [...]
+        type: string
+        example: "${file:name}.done"
+  dataTypes:
+    # No 'default: binary' here on purpose, as in sftp-sink: with stream 
caching turned off, it would read a
+    # stream into memory (a byte[]) before the file is written, such as a 
large file from smb-source with
+    # streamDownload (#3117).
+    in:
+      headers:
+        file:
+          title: File Name
+          description: The name of the file to write, such as `orders.csv`. 
Any directory in it is dropped.
+          type: string
+        ce-file:
+          title: File Name (CloudEvents)
+          description: The name of the file to write, used when `file` is not 
set. Any directory in it is dropped.
+          type: string
+        CamelFileName:
+          title: Camel File Name
+          description: The name of the file to write, used as it is, 
subdirectories included, when neither `file` nor `ce-file` is set.
+          type: string
+    out:
+      headers:
+        CamelFileNameProduced:
+          title: File Written
+          description: The path of the file that was written, within the 
share, such as `incoming/orders/orders.csv`.
+          type: string
+  dependencies:
+    - "camel:smb"
+    - "camel:kamelet"
+  template:
+    from:
+      uri: kamelet:source
+      steps:
+        - removeHeaders:
+            pattern: "Camel(File|OverruleFile|Smb).*"
+            excludePattern: CamelFileName
+        - choice:
+            when:
+              - expression:
+                  simple:
+                    expression: "${header[file]}"
+                steps:
+                  - setHeader:
+                      name: CamelFileName
+                      expression:
+                        simple:
+                          expression: "${header[file]}"
+                  - setHeader:
+                      name: CamelFileName
+                      expression:
+                        simple:
+                          expression: "${file:onlyname}"
+              - expression:
+                  simple:
+                    expression: "${header[ce-file]}"
+                steps:
+                  - setHeader:
+                      name: CamelFileName
+                      expression:
+                        simple:
+                          expression: "${header[ce-file]}"
+                  - setHeader:
+                      name: CamelFileName
+                      expression:
+                        simple:
+                          expression: "${file:onlyname}"
+        - to:
+            uri: smb
+            parameters:
+              hostname: "{{connectionHost}}"
+              port: "{{connectionPort}}"
+              shareName: "{{shareName}}"
+              path: "{{directoryName}}"
+              autoCreate: "{{autoCreate}}"
+              doneFileName: "RAW({{?doneFileName}})"
+              domain: "RAW({{?domain}})"
+              fileExist: "{{fileExist}}"
+              password: "RAW({{?password}})"
+              tempPrefix: "RAW({{?tempPrefix}})"
+              username: "RAW({{?username}})"
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/smb-source.kamelet.yaml 
b/library/camel-kamelets/src/main/resources/kamelets/smb-source.kamelet.yaml
new file mode 100644
index 000000000..dd1d294e2
--- /dev/null
+++ b/library/camel-kamelets/src/main/resources/kamelets/smb-source.kamelet.yaml
@@ -0,0 +1,260 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+  name: smb-source
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+    camel.apache.org/kamelet.icon: 
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzY4LjU1MyAzNjguNTUzIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bm
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "SMB"
+    camel.apache.org/kamelet.namespace: "File"
+  labels:
+    camel.apache.org/kamelet.type: "source"
+    camel.apache.org/kamelet.verified: "true"
+spec:
+  definition:
+    title: "SMB Source"
+    description: |-
+      Reads the files in a directory of a Windows or Samba file share (SMB), 
one message per file, and by default leaves them on the share.
+
+      Use it to collect the files that another system drops on a Windows file 
server or a NAS, such as orders, invoices or exports, from a share such as 
`\\fileserver\exports`. To write files to a share use `smb-sink`. For an FTP or 
SFTP server use `ftp-source` or `sftp-source`.
+
+      Output: the body is the content of the file, as bytes, or as a stream 
when `streamDownload` is true. `Content-Type` is `application/octet-stream`. 
The `file` and `ce-file` headers hold the name of the file, with its path below 
`directoryName` when `recursive` is true, such as `2026/orders.csv`. 
`CamelFileName` holds the same name, `CamelFileLength` the size of the file in 
bytes, `CamelFileLastModified` the time the file was last changed, in 
milliseconds since 1970, and `CamelSmbUnc [...]
+
+      Good to know: files are not deleted or moved after they are read, unless 
`delete` is true or `move` is set. A file is read only once while the 
integration runs (`idempotent`), but the files left on the share are all read 
again after a restart; to read each file only once, also across restarts, set 
`move` to a directory such as `.done`, set `delete` to true, or keep the list 
of the files read in a file with `idempotentRepository`. To read only some of 
the files, set `include`, `excl [...]
+    required:
+      - connectionHost
+      - shareName
+      - directoryName
+      - username
+      - password
+    type: object
+    properties:
+      connectionHost:
+        title: Connection Host
+        description: The host name or IP address of the SMB server, without 
`smb://`, without `\\` and without a port.
+        type: string
+        example: fileserver.example.com
+      connectionPort:
+        title: Connection Port
+        description: The port of the SMB server, usually 445.
+        type: integer
+        default: 445
+      shareName:
+        title: Share Name
+        description: The name of the share, as the server shares it, such as 
`exports` for `\\fileserver\exports`.
+        type: string
+        example: exports
+      directoryName:
+        title: Directory Name
+        description: The directory within the share to read the files from, 
with `/` between its parts, such as `outgoing/orders`. Use `/` to read the 
files at the top of the share; the names in the file headers then start with 
`/`, such as `/orders.csv`.
+        type: string
+        example: outgoing/orders
+      username:
+        title: Username
+        description: The user to log in to the SMB server as, without the 
domain, such as `jdoe`.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      password:
+        title: Password
+        description: The password of `username`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      domain:
+        title: Domain
+        description: The Windows domain of `username`, such as `CORP` for the 
account `CORP\jdoe`. Leave it unset for a user of the server itself.
+        type: string
+        example: CORP
+      recursive:
+        title: Recursive
+        description: If true, the files in the subdirectories of 
`directoryName` are read too.
+        type: boolean
+        default: false
+      idempotent:
+        title: Skip Files Already Read
+        description: If true, a file is read only once while the integration 
runs, even when it stays on the share. The list of the files read is kept in 
memory, so after a restart the files still on the share are read again, unless 
`move` or `delete` takes them away, or `idempotentRepository` keeps the list 
elsewhere. If false, and neither `delete` nor `move` is set, the same files are 
read again on every poll.
+        type: boolean
+        default: true
+      idempotentRepository:
+        title: Files Read Store
+        description: The name of a bean that keeps the list of the files read, 
so that the files left on the share are not read again after a restart, such as 
a `FileIdempotentRepository` that keeps the list in a file. Declare the bean in 
the integration, for example under `beans` in YAML. Only used when `idempotent` 
is true. When it is not set, the list is kept in memory.
+        type: string
+        example: readFiles
+      autoCreate:
+        title: Autocreate Missing Directories
+        description: If true, `directoryName` is created on the share when it 
does not exist.
+        type: boolean
+        default: true
+      delete:
+        title: Delete
+        description: If true, each file is deleted from the share once it has 
been read and handed on successfully. Use it to read each file only once, also 
across restarts. To keep the files, set `move` instead.
+        type: boolean
+        default: false
+      move:
+        title: Move After Read
+        description: Where to move each file on the share once it has been 
read and handed on successfully, so that it is not read again, also after a 
restart. A directory name, such as `.done`, is relative to the directory of the 
file. A path that ends with the name of the file, such as 
`done/$\{date:now:yyyyMMdd}/$\{file:name}`, is relative to `directoryName`, 
where `$\{file:name}` is the name of the file, with its path below 
`directoryName`, and `$\{date:now:yyyyMMdd}` today's date. A [...]
+        type: string
+        example: ".done"
+      moveFailed:
+        title: Move Failed Files To
+        description: Where to move a file on the share when it could not be 
handed on, for example because the next step failed, so that it is not read 
over and over. The same format as `move`, such as `.error`. When it is not set, 
a file that fails stays where it is and is read again at every poll. It can be 
set together with `delete` or `move`.
+        type: string
+        example: ".error"
+      preMove:
+        title: Move Before Read
+        description: Where to move each file on the share before it is read, 
so that another reader of the same directory does not take it too. The same 
format as `move`, such as `.inprogress`, a directory next to the file. `move`, 
`moveFailed` and `delete` then act on the file in its new place, so with `move` 
set to `.done` the file ends up in `.inprogress/.done`. When it is not set, a 
file is read where it is.
+        type: string
+        example: ".inprogress"
+      include:
+        title: Include Files
+        description: A regular expression that the name of a file must match 
to be read, such as `.*\.csv` for the CSV files. The whole name must match, 
upper and lower case count as the same, and only the name is matched, not its 
directory. The other files stay on the share. When it is not set, all the files 
are read.
+        type: string
+        example: '.*\.csv'
+      exclude:
+        title: Exclude Files
+        description: A regular expression for the names of the files not to 
read, such as `.*\.(tmp|part)`. The whole name must match, upper and lower case 
count as the same, and only the name is matched, not its directory. A file it 
matches is not read, even when `include` or `antInclude` matches it too.
+        type: string
+        example: '.*\.(tmp|part)'
+      antInclude:
+        title: Include Files (Wildcards)
+        description: Wildcard patterns, separated by commas, that the path of 
a file must match to be read, such as `*.csv,*.xml`. The path is relative to 
`directoryName`, such as `2026/orders.csv` when `recursive` is true. `*` 
matches any part of a name and `**` any number of directories, so `**/*.csv` 
matches the CSV files in `directoryName` and in its subdirectories. Upper and 
lower case differ. When it is not set, all the files are read.
+        type: string
+        example: '**/*.csv'
+      readLock:
+        title: Wait Until Written
+        description: How to make sure that another program has finished 
writing a file before it is read. `changed` reads a file once its size and 
modification time have not changed between two checks 1 second apart, or, with 
`readLockMinAge`, once the file is that old. A file still changing after 10 
seconds is skipped until the next poll, and while a file is checked the other 
files wait. `changed` never reads an empty file. `rename` reads a file once it 
can be renamed. `none` reads the  [...]
+        type: string
+        enum: ["none", "changed", "rename"]
+        example: changed
+      readLockMinAge:
+        title: Minimum File Age
+        description: 'Only used when `readLock` is `changed`: how old a file 
must be, in milliseconds, before it is read, counted from its modification time 
on the share. For example, 60000 leaves a file alone until it has not been 
changed for one minute. A file that is not old enough is skipped until the next 
poll, after 10 seconds of checks. The clocks of the server and of the 
integration must agree.'
+        type: integer
+        example: 60000
+      delay:
+        title: Poll Interval
+        description: How long to wait between two polls of the directory, in 
milliseconds. For example, 60000 polls once a minute. When it is not set, 500.
+        type: integer
+        example: 60000
+      maxMessagesPerPoll:
+        title: Max Files Per Poll
+        description: The largest number of files to read in one poll, such as 
100. The other files are read at the next polls. The poll takes the first files 
the server lists, and `sortBy` sorts only these. When it is not set, or 0, all 
the files found are read.
+        type: integer
+        example: 100
+      sortBy:
+        title: Sort By
+        description: The order in which the files of a poll are read. 
`file:name` sorts them by name, `file:modified` by modification time and 
`file:length` by size, from the smallest. When it is not set, the files are 
read in the order the server lists them.
+        type: string
+        enum: ["file:name", "file:modified", "file:length"]
+        example: file:modified
+      streamDownload:
+        title: Stream Download
+        description: 'If true, each file is read from the share while it is 
handed on, instead of being read into memory first, and the body is a stream. 
Use it for files too large for memory. It saves memory only when the 
integration does not keep the stream in memory either: set 
`camel.main.streamCachingSpoolEnabled=true`, which writes large bodies to a 
temporary file, or turn stream caching off. When it is not set, false.'
+        type: boolean
+  dataTypes:
+    out:
+      default: binary
+      headers:
+        file:
+          title: File Name
+          description: The name of the file, with its path below 
`directoryName` when `recursive` is true, such as `2026/orders.csv`.
+          type: string
+        ce-file:
+          title: File Name (CloudEvents)
+          description: The same value as `file`.
+          type: string
+        CamelFileName:
+          title: Camel File Name
+          description: The same value as `file`.
+          type: string
+        CamelFileLength:
+          title: File Size
+          description: The size of the file, in bytes.
+          type: integer
+        CamelFileLastModified:
+          title: Last Modified
+          description: The time the file was last changed, in milliseconds 
since 1970-01-01 UTC.
+          type: integer
+        CamelSmbUncPath:
+          title: UNC Path
+          description: The full Windows path of the file, with the server and 
the share, such as `\\fileserver\exports\orders\orders.csv`.
+          type: string
+      types:
+        binary:
+          format: "application-octet-stream"
+          description: The content of the file as it is, with `Content-Type` 
set to `application/octet-stream`. A stream stays a stream, so `streamDownload` 
still reads a large file without holding it in memory.
+          mediaType: application/octet-stream
+  dependencies:
+    - "camel:smb"
+    - "camel:kamelet"
+  template:
+    from:
+      uri: smb
+      parameters:
+        hostname: "{{connectionHost}}"
+        port: "{{connectionPort}}"
+        shareName: "{{shareName}}"
+        path: "{{directoryName}}"
+        antInclude: "RAW({{?antInclude}})"
+        autoCreate: "{{autoCreate}}"
+        delay: "{{?delay}}"
+        delete: "{{delete}}"
+        domain: "RAW({{?domain}})"
+        exclude: "RAW({{?exclude}})"
+        idempotent: "{{idempotent}}"
+        idempotentRepository: "#bean:{{?idempotentRepository}}"
+        include: "RAW({{?include}})"
+        maxMessagesPerPoll: "{{?maxMessagesPerPoll}}"
+        move: "{{?move}}"
+        moveFailed: "{{?moveFailed}}"
+        password: "RAW({{?password}})"
+        preMove: "{{?preMove}}"
+        readLock: "{{?readLock}}"
+        readLockMinAge: "{{?readLockMinAge}}"
+        recursive: "{{recursive}}"
+        sortBy: "RAW({{?sortBy}})"
+        streamDownload: "{{?streamDownload}}"
+        username: "RAW({{?username}})"
+      steps:
+        - choice:
+            when:
+              - expression:
+                  simple:
+                    expression: "${body} is 
'org.apache.camel.component.file.GenericFile'"
+                steps:
+                  - setBody:
+                      expression:
+                        simple:
+                          expression: "${body.getBody()}"
+        - setHeader:
+            name: file
+            expression:
+              simple:
+                expression: "${header[CamelFileName]}"
+        - setHeader:
+            name: ce-file
+            expression:
+              simple:
+                expression: "${header[CamelFileName]}"
+        - to:
+            uri: kamelet:sink
diff --git a/tests/camel-kamelets-itest/src/test/java/SmbIT.java 
b/tests/camel-kamelets-itest/src/test/java/SmbIT.java
new file mode 100644
index 000000000..49a580dd8
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/java/SmbIT.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+import java.util.stream.Stream;
+
+import org.citrusframework.api.common.TestLoader;
+import org.citrusframework.container.SequenceAfterTest;
+import org.citrusframework.container.SequenceBeforeTest;
+import org.citrusframework.http.server.HttpServer;
+import org.citrusframework.junit.jupiter.CitrusSupport;
+import org.citrusframework.junit.jupiter.CitrusTestFactory;
+import org.citrusframework.junit.jupiter.CitrusTestFactorySupport;
+import org.citrusframework.spi.BindToRegistry;
+import org.junit.jupiter.api.DynamicTest;
+
+import static 
org.citrusframework.actions.CreateVariablesAction.Builder.createVariables;
+import static 
org.citrusframework.actions.PurgeEndpointAction.Builder.purgeEndpoints;
+import static org.citrusframework.http.endpoint.builder.HttpEndpoints.http;
+
+/**
+ * Tests of the SMB Kamelets against a Samba server in a container.
+ */
+@CitrusSupport
+public class SmbIT {
+
+    private static final String TESTS = "smb-.*";
+
+    private final int smbHttpServerPort = ServerPorts.next();
+
+    // a container and a first Camel JBang run that downloads the libraries 
take a while
+    @BindToRegistry
+    HttpServer smbHttpServer = http()
+                .server()
+                .port(smbHttpServerPort)
+                .timeout(120000L)
+                .autoStart(true)
+                .build();
+
+    @BindToRegistry
+    public SequenceBeforeTest beforeSmb() {
+        return new SequenceBeforeTest.Builder().onTests(TESTS).actions(
+                createVariables().variable("smb.http.server.port", 
String.valueOf(smbHttpServerPort))
+        ).build();
+    }
+
+    @BindToRegistry
+    public SequenceAfterTest afterSmb() {
+        return new SequenceAfterTest.Builder().onTests(TESTS).actions(
+                purgeEndpoints().endpoint(smbHttpServer)
+        ).build();
+    }
+
+    @CitrusTestFactory
+    public Stream<DynamicTest> smb() {
+        return 
CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("smb");
+    }
+}
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/smb/smb-sink-route.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/smb/smb-sink-route.citrus.it.yaml
new file mode 100644
index 000000000..38e01959b
--- /dev/null
+++ 
b/tests/camel-kamelets-itest/src/test/resources/smb/smb-sink-route.citrus.it.yaml
@@ -0,0 +1,112 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: smb-sink-route-test
+description: 'smb-sink writes the body as a file to the directory on the 
share, under the name in the file header without its directory, ignores the 
CamelSmbFileExists and CamelOverruleFileName headers of the message, and fails 
a message whose CamelFileName points outside the directory'
+actions:
+  # Start the Samba server (port 445) with the share files and the user 
citrus, whose password has characters
+  # that have a meaning in an endpoint address
+  - testcontainers:
+      start:
+        container:
+          name: "smb"
+          image: "dockurr/samba:4.23.10"
+          autoRemove: true
+          startUpTimeout: 120
+          env:
+            - name: "NAME"
+              value: "files"
+            - name: "USER"
+              value: "citrus"
+            - name: "PASS"
+              value: "s3cr&t+pw"
+          exposedPorts:
+            - 445
+  - groovy:
+      script:
+        file: "smb/smbServer.groovy"
+
+  # Create Camel JBang integration
+  - camel:
+      cli:
+        run:
+          waitForRunningState: false
+          integration:
+            file: "smb/smb-sink-route.yaml"
+            systemProperties:
+              properties:
+                - name: "http.sink.url"
+                  value: "http://localhost:${smb.http.server.port}";
+                - name: "smb.host"
+                  value: "${CITRUS_TESTCONTAINERS_SMB_HOST}"
+                - name: "smb.port"
+                  value: "${CITRUS_TESTCONTAINERS_SMB_PORT}"
+
+  # The message goes on unchanged, with the path of the file within the share
+  - http:
+      server: "smbHttpServer"
+      receiveRequest:
+        POST:
+          path: "/result"
+          type: "plaintext"
+          headers:
+            - name: "X-Body-Type"
+              value: 'java.lang.String'
+            - name: "X-Content-Type"
+              value: 'ct='
+            - name: "X-File-Name-Produced"
+              value: 'upload/day 1.csv'
+          body:
+            data: |-
+              id,item
+              1,book
+  - http:
+      server: "smbHttpServer"
+      sendResponse:
+        response:
+          status: 200
+          reasonPhrase: "OK"
+          version: "HTTP/1.1"
+
+  # A CamelFileName that points outside the directory fails the message
+  - http:
+      server: "smbHttpServer"
+      receiveRequest:
+        POST:
+          path: "/rejected"
+          type: "plaintext"
+          headers:
+            - name: "X-Error"
+              value: 'java.lang.IllegalArgumentException'
+          body:
+            data: '@contains(''jailed to the starting directory'')@'
+  - http:
+      server: "smbHttpServer"
+      sendResponse:
+        response:
+          status: 200
+          reasonPhrase: "OK"
+          version: "HTTP/1.1"
+
+  # The share has the file, with the body as its content, and nothing outside 
the directory
+  - repeatOnError:
+      until: "i = 10"
+      autoSleep: 1000
+      actions:
+        - groovy:
+            script:
+              file: "smb/verifyUpload.groovy"
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/smb/smb-sink-route.yaml 
b/tests/camel-kamelets-itest/src/test/resources/smb/smb-sink-route.yaml
new file mode 100644
index 000000000..87d4dd220
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/smb/smb-sink-route.yaml
@@ -0,0 +1,91 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+- route:
+    from:
+      uri: "timer:send"
+      parameters:
+        repeatCount: 1
+      steps:
+        - setBody:
+            constant: "id,item\n1,book"
+        # the directory in the file header is dropped
+        - setHeader:
+            name: file
+            constant: 'reports/day 1.csv'
+        # the file exists already: these headers would fail the message, or 
write it elsewhere, if they were used
+        - setHeader:
+            name: CamelSmbFileExists
+            constant: 'Fail'
+        - setHeader:
+            name: CamelOverruleFileName
+            constant: '../overruled.csv'
+        - to:
+            uri: "kamelet:smb-sink"
+            parameters:
+              connectionHost: '{{smb.host}}'
+              connectionPort: '{{smb.port}}'
+              shareName: 'files'
+              directoryName: 'upload'
+              username: 'citrus'
+              # a password with characters that have a meaning in an endpoint 
address
+              password: 's3cr&t+pw'
+        # what the Kamelet gives: the Java type of the body and the 
Content-Type
+        - setHeader:
+            name: X-Body-Type
+            simple: "${body.getClass().getName()}"
+        - setHeader:
+            name: X-Content-Type
+            simple: "ct=${header.Content-Type}"
+        # Camel headers are not sent over HTTP: copy them
+        - setHeader:
+            name: X-File-Name-Produced
+            simple: "${header.CamelFileNameProduced}"
+        - to:
+            uri: "{{http.sink.url}}/result"
+        # then a file name that points outside the directory
+        - removeHeaders:
+            pattern: "*"
+        - setHeader:
+            name: CamelFileName
+            constant: '../outside.csv'
+        - doTry:
+            steps:
+              - to:
+                  uri: "kamelet:smb-sink"
+                  parameters:
+                    connectionHost: '{{smb.host}}'
+                    connectionPort: '{{smb.port}}'
+                    shareName: 'files'
+                    directoryName: 'upload'
+                    username: 'citrus'
+                    password: 's3cr&t+pw'
+              - setBody:
+                  constant: "written"
+            doCatch:
+              - exception:
+                  - "java.lang.Exception"
+                steps:
+                  - setHeader:
+                      name: X-Error
+                      simple: "${exception.class.name}"
+                  - setBody:
+                      simple: "${exception.message}"
+        - removeHeader:
+            name: CamelFileName
+        - to:
+            uri: "{{http.sink.url}}/rejected"
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/smb/smb-source-route.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/smb/smb-source-route.citrus.it.yaml
new file mode 100644
index 000000000..414781da9
--- /dev/null
+++ 
b/tests/camel-kamelets-itest/src/test/resources/smb/smb-source-route.citrus.it.yaml
@@ -0,0 +1,100 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: smb-source-route-test
+description: 'smb-source reads the file in the directory on the share, with 
its name in the file, ce-file and CamelFileName headers, its size and its UNC 
path, and moves it to the directory of move'
+actions:
+  # Start the Samba server (port 445) with the share files and the user 
citrus, whose password has characters
+  # that have a meaning in an endpoint address
+  - testcontainers:
+      start:
+        container:
+          name: "smb"
+          image: "dockurr/samba:4.23.10"
+          autoRemove: true
+          startUpTimeout: 120
+          env:
+            - name: "NAME"
+              value: "files"
+            - name: "USER"
+              value: "citrus"
+            - name: "PASS"
+              value: "s3cr&t+pw"
+          exposedPorts:
+            - 445
+  - groovy:
+      script:
+        file: "smb/smbServer.groovy"
+
+  # Create Camel JBang integration
+  - camel:
+      cli:
+        run:
+          waitForRunningState: false
+          integration:
+            file: "smb/smb-source-route.yaml"
+            systemProperties:
+              properties:
+                - name: "http.sink.url"
+                  value: "http://localhost:${smb.http.server.port}";
+                - name: "smb.host"
+                  value: "${CITRUS_TESTCONTAINERS_SMB_HOST}"
+                - name: "smb.port"
+                  value: "${CITRUS_TESTCONTAINERS_SMB_PORT}"
+
+  # The source gives the content of the file, with its name, which has a 
space, its size and its UNC path
+  - http:
+      server: "smbHttpServer"
+      receiveRequest:
+        POST:
+          path: "/result"
+          type: "plaintext"
+          headers:
+            - name: "X-Body-Type"
+              value: '[B'
+            - name: "X-Content-Type"
+              value: 'ct=application/octet-stream'
+            - name: "file"
+              value: 'order 1.csv'
+            - name: "ce-file"
+              value: 'order 1.csv'
+            - name: "X-File-Name"
+              value: 'order 1.csv'
+            - name: "X-File-Length"
+              value: '15'
+            - name: "X-Unc-Path"
+              value: '\\${CITRUS_TESTCONTAINERS_SMB_HOST}\files\orders\order 
1.csv'
+          body:
+            data: |
+              id,item
+              1,book
+  - http:
+      server: "smbHttpServer"
+      sendResponse:
+        response:
+          status: 200
+          reasonPhrase: "OK"
+          version: "HTTP/1.1"
+
+  # Once read, the file is moved to orders/.done
+  - repeatOnError:
+      until: "i = 10"
+      autoSleep: 1000
+      actions:
+        - groovy:
+            script:
+              file: "smb/verifyMoved.groovy"
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/smb/smb-source-route.yaml 
b/tests/camel-kamelets-itest/src/test/resources/smb/smb-source-route.yaml
new file mode 100644
index 000000000..875fe08a3
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/smb/smb-source-route.yaml
@@ -0,0 +1,57 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+- route:
+    from:
+      uri: "kamelet:smb-source"
+      parameters:
+        connectionHost: '{{smb.host}}'
+        connectionPort: '{{smb.port}}'
+        shareName: 'files'
+        directoryName: 'orders'
+        username: 'citrus'
+        # a password with characters that have a meaning in an endpoint address
+        password: 's3cr&t+pw'
+        move: '.done'
+        # one poll is enough: no poll runs while the test stops the server
+        delay: 60000
+      steps:
+        # what the Kamelet gives: the Java type of the body and the 
Content-Type
+        - setHeader:
+            name: X-Body-Type
+            simple: "${body.getClass().getName()}"
+        - setHeader:
+            name: X-Content-Type
+            simple: "ct=${header.Content-Type}"
+        # Camel headers are not sent over HTTP: copy them
+        - setHeader:
+            name: X-File-Name
+            simple: "${header.CamelFileName}"
+        - setHeader:
+            name: X-File-Length
+            simple: "${header.CamelFileLength}"
+        - setHeader:
+            name: X-Unc-Path
+            simple: "${header.CamelSmbUncPath}"
+        # Citrus reads an application/octet-stream body as bytes: send text
+        - removeHeader:
+            name: Content-Type
+        # give the HTTP server text
+        - convertBodyTo:
+            type: "java.lang.String"
+        - to:
+            uri: "{{http.sink.url}}/result"
diff --git a/tests/camel-kamelets-itest/src/test/resources/smb/smbServer.groovy 
b/tests/camel-kamelets-itest/src/test/resources/smb/smbServer.groovy
new file mode 100644
index 000000000..b40f2142a
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/smb/smbServer.groovy
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+// Prepares the share files of the Samba server in the container smb for a 
test: the directories orders and
+// upload, with the file orders/order 1.csv, whose name has a space, and the 
file upload/day 1.csv, which the
+// sink test replaces.
+
+import org.testcontainers.containers.GenericContainer
+
+def smb = context.getReferenceResolver().resolve('smb', GenericContainer.class)
+
+def command = "mkdir -p /shared/orders /shared/upload && printf 
'id,item\\n1,book\\n' > '/shared/orders/order 1.csv'" +
+        " && printf 'old' > '/shared/upload/day 1.csv' && chown -R citrus 
/shared && chgrp -R smb /shared"
+def result = smb.execInContainer('sh', '-c', command)
+if (result.getExitCode() != 0) {
+    throw new IllegalStateException('Failed to prepare the share: ' + 
result.getStderr())
+}
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/smb/verifyMoved.groovy 
b/tests/camel-kamelets-itest/src/test/resources/smb/verifyMoved.groovy
new file mode 100644
index 000000000..4e79af68d
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/smb/verifyMoved.groovy
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+// Checks that the file orders/order 1.csv was moved to orders/.done once it 
was read.
+
+import org.testcontainers.containers.GenericContainer
+
+def smb = context.getReferenceResolver().resolve('smb', GenericContainer.class)
+
+def files = smb.execInContainer('find', '/shared/orders', '-type', 
'f').getStdout().readLines()
+if (files != ['/shared/orders/.done/order 1.csv']) {
+    throw new IllegalStateException('Expected only /shared/orders/.done/order 
1.csv but got: ' + files)
+}
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/smb/verifyUpload.groovy 
b/tests/camel-kamelets-itest/src/test/resources/smb/verifyUpload.groovy
new file mode 100644
index 000000000..cec5b77d8
--- /dev/null
+++ b/tests/camel-kamelets-itest/src/test/resources/smb/verifyUpload.groovy
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+// Checks that the share has the file upload/day 1.csv, with the body of the 
message as its content, and no file
+// written outside the directory upload.
+
+import org.testcontainers.containers.GenericContainer
+
+def smb = context.getReferenceResolver().resolve('smb', GenericContainer.class)
+def file = '/shared/upload/day 1.csv'
+
+def content = smb.execInContainer('cat', file)
+if (content.getExitCode() != 0) {
+    throw new IllegalStateException('The share has no file ' + file + ': ' + 
content.getStderr())
+}
+if (content.getStdout() != 'id,item\n1,book') {
+    throw new IllegalStateException('Unexpected content of ' + file + ': ' + 
content.getStdout().inspect())
+}
+def files = smb.execInContainer('find', '/shared', '-type', 
'f').getStdout().readLines().sort()
+if (files != ['/shared/orders/order 1.csv', file]) {
+    throw new IllegalStateException('Unexpected files on the share: ' + files)
+}

Reply via email to