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 09aa4faac chore: smb-source and smb-sink follow the camel-smb fixes of 
4.24: optional directoryName and password, encryptData and timeouts, sortBy 
groups (#3350)
09aa4faac is described below

commit 09aa4faac3db1fdc61eff093c5139793bb7326ae
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 17:24:28 2026 +0100

    chore: smb-source and smb-sink follow the camel-smb fixes of 4.24: optional 
directoryName and password, encryptData and timeouts, sortBy groups (#3350)
    
    * chore: smb-source sortBy takes reverse:, ignoreCase: and several orders, 
and move with delete fails to start (CAMEL-27368)
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
    
    * chore: smb-source and smb-sink directoryName and password are optional, 
for the share root and guest access (CAMEL-27361, CAMEL-27367)
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
    
    * chore: smb-source and smb-sink encryptData and connect, read and write 
timeouts (CAMEL-27369)
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
    
    * chore: smb-source and smb-sink transactTimeout (CAMEL-27369, CAMEL-27370)
    
    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]>
---
 kamelets/smb-sink.kamelet.yaml                     | 34 ++++++++--
 kamelets/smb-source.kamelet.yaml                   | 41 +++++++++---
 .../main/resources/META-INF/kamelets-index.json    |  4 +-
 .../main/resources/kamelets/smb-sink.kamelet.yaml  | 34 ++++++++--
 .../resources/kamelets/smb-source.kamelet.yaml     | 41 +++++++++---
 .../resources/smb/smb-sink-route.citrus.it.yaml    | 50 ++++++++++++++-
 .../src/test/resources/smb/smb-sink-route.yaml     | 65 +++++++++++++++++++
 ....yaml => smb-source-guest-route.citrus.it.yaml} | 75 +++++++++++++---------
 ...urce-route.yaml => smb-source-guest-route.yaml} | 23 ++-----
 .../resources/smb/smb-source-route.citrus.it.yaml  |  2 +-
 .../src/test/resources/smb/smb-source-route.yaml   |  5 ++
 .../src/test/resources/smb/smbServer.groovy        | 17 ++++-
 .../src/test/resources/smb/verifyUpload.groovy     | 16 ++++-
 13 files changed, 315 insertions(+), 92 deletions(-)

diff --git a/kamelets/smb-sink.kamelet.yaml b/kamelets/smb-sink.kamelet.yaml
index 6af926d89..7cb19f582 100644
--- a/kamelets/smb-sink.kamelet.yaml
+++ b/kamelets/smb-sink.kamelet.yaml
@@ -40,13 +40,11 @@ spec:
 
       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  [...]
+      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`, or, on a share that allows 
guest access, with `username`  [...]
     required:
       - connectionHost
       - shareName
-      - directoryName
       - username
-      - password
     type: object
     properties:
       connectionHost:
@@ -66,7 +64,7 @@ spec:
         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.
+        description: The directory within the share to write the files to, 
with `/` between its parts, such as `incoming/orders`. When it is not set, the 
files are written at the top of the share. It is created when it does not 
exist, unless `autoCreate` is false.
         type: string
         example: incoming/orders
       username:
@@ -77,11 +75,31 @@ spec:
         - urn:camel:group:credentials
       password:
         title: Password
-        description: The password of `username`.
+        description: The password of `username`. When it is not set, the 
Kamelet logs in with an empty password, which with `username` set to `Guest` is 
a guest login, on a share that allows guest access.
         type: string
         format: password
         x-descriptors:
         - urn:camel:group:credentials
+      encryptData:
+        title: Encrypt Data
+        description: If true, everything sent to and from the server, the 
content of the files included, is encrypted (SMB 3 encryption), also on a share 
that does not require it. A share that requires encryption, such as one with 
`smb encrypt = required` on Samba, refuses the connection unless it is true. 
The server must support SMB 3.
+        type: boolean
+        default: false
+      connectTimeout:
+        title: Connect Timeout
+        description: How long to wait for the connection to the server, in 
milliseconds. When it is not set, 5000 (5 seconds).
+        type: integer
+        example: 10000
+      writeTimeout:
+        title: Write Timeout
+        description: How long to wait for the server to answer a write of the 
content of a file, in milliseconds. When it is not set, 60000 (1 minute).
+        type: integer
+        example: 120000
+      transactTimeout:
+        title: Request Timeout
+        description: How long to wait for the server to answer the other 
requests, such as listing a directory, or opening, renaming or deleting a file, 
in milliseconds. When it is not set, 60000 (1 minute).
+        type: integer
+        example: 30000
       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.
@@ -178,11 +196,15 @@ spec:
               hostname: "{{connectionHost}}"
               port: "{{connectionPort}}"
               shareName: "{{shareName}}"
-              path: "{{directoryName}}"
+              path: "{{?directoryName}}"
               autoCreate: "{{autoCreate}}"
+              connectTimeout: "{{?connectTimeout}}"
               doneFileName: "RAW({{?doneFileName}})"
               domain: "RAW({{?domain}})"
+              encryptData: "{{encryptData}}"
               fileExist: "{{fileExist}}"
               password: "RAW({{?password}})"
               tempPrefix: "RAW({{?tempPrefix}})"
+              transactTimeout: "{{?transactTimeout}}"
               username: "RAW({{?username}})"
+              writeTimeout: "{{?writeTimeout}}"
diff --git a/kamelets/smb-source.kamelet.yaml b/kamelets/smb-source.kamelet.yaml
index dd1d294e2..157052662 100644
--- a/kamelets/smb-source.kamelet.yaml
+++ b/kamelets/smb-source.kamelet.yaml
@@ -38,13 +38,11 @@ spec:
 
       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 [...]
+      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:
@@ -64,7 +62,7 @@ spec:
         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`.
+        description: The directory within the share to read the files from, 
with `/` between its parts, such as `outgoing/orders`. When it is not set, the 
files at the top of the share are read. `/` reads them too, but the names in 
the file headers then start with `/`, such as `/orders.csv`.
         type: string
         example: outgoing/orders
       username:
@@ -75,11 +73,31 @@ spec:
         - urn:camel:group:credentials
       password:
         title: Password
-        description: The password of `username`.
+        description: The password of `username`. When it is not set, the 
Kamelet logs in with an empty password, which with `username` set to `Guest` is 
a guest login, on a share that allows guest access.
         type: string
         format: password
         x-descriptors:
         - urn:camel:group:credentials
+      encryptData:
+        title: Encrypt Data
+        description: If true, everything sent to and from the server, the 
content of the files included, is encrypted (SMB 3 encryption), also on a share 
that does not require it. A share that requires encryption, such as one with 
`smb encrypt = required` on Samba, refuses the connection unless it is true. 
The server must support SMB 3.
+        type: boolean
+        default: false
+      connectTimeout:
+        title: Connect Timeout
+        description: How long to wait for the connection to the server, in 
milliseconds. When it is not set, 5000 (5 seconds).
+        type: integer
+        example: 10000
+      readTimeout:
+        title: Read Timeout
+        description: How long to wait for the server to answer a read of the 
content of a file, in milliseconds. When it is not set, 60000 (1 minute).
+        type: integer
+        example: 120000
+      transactTimeout:
+        title: Request Timeout
+        description: How long to wait for the server to answer the other 
requests, such as listing a directory, or opening, renaming or deleting a file, 
in milliseconds. When it is not set, 60000 (1 minute).
+        type: integer
+        example: 30000
       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.
@@ -112,7 +130,7 @@ spec:
         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 [...]
+        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:
@@ -163,10 +181,9 @@ spec:
         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.
+        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. Put `reverse:` in front for the 
reverse order, such as `reverse:file:modified` for the newest first, or 
`ignoreCase:` to sort names without case. Separate several orders with `;`, 
such as `file:modified;file:name`. 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
+        example: "reverse: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.'
@@ -214,12 +231,14 @@ spec:
         hostname: "{{connectionHost}}"
         port: "{{connectionPort}}"
         shareName: "{{shareName}}"
-        path: "{{directoryName}}"
+        path: "{{?directoryName}}"
         antInclude: "RAW({{?antInclude}})"
         autoCreate: "{{autoCreate}}"
+        connectTimeout: "{{?connectTimeout}}"
         delay: "{{?delay}}"
         delete: "{{delete}}"
         domain: "RAW({{?domain}})"
+        encryptData: "{{encryptData}}"
         exclude: "RAW({{?exclude}})"
         idempotent: "{{idempotent}}"
         idempotentRepository: "#bean:{{?idempotentRepository}}"
@@ -231,9 +250,11 @@ spec:
         preMove: "{{?preMove}}"
         readLock: "{{?readLock}}"
         readLockMinAge: "{{?readLockMinAge}}"
+        readTimeout: "{{?readTimeout}}"
         recursive: "{{recursive}}"
         sortBy: "RAW({{?sortBy}})"
         streamDownload: "{{?streamDownload}}"
+        transactTimeout: "{{?transactTimeout}}"
         username: "RAW({{?username}})"
       steps:
         - choice:
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 d7861c523..22690b12d 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
@@ -2005,7 +2005,7 @@
     "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 [...]
+    "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"
@@ -2015,7 +2015,7 @@
     "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, [...]
+    "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"
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
index 6af926d89..7cb19f582 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/smb-sink.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/smb-sink.kamelet.yaml
@@ -40,13 +40,11 @@ spec:
 
       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  [...]
+      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`, or, on a share that allows 
guest access, with `username`  [...]
     required:
       - connectionHost
       - shareName
-      - directoryName
       - username
-      - password
     type: object
     properties:
       connectionHost:
@@ -66,7 +64,7 @@ spec:
         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.
+        description: The directory within the share to write the files to, 
with `/` between its parts, such as `incoming/orders`. When it is not set, the 
files are written at the top of the share. It is created when it does not 
exist, unless `autoCreate` is false.
         type: string
         example: incoming/orders
       username:
@@ -77,11 +75,31 @@ spec:
         - urn:camel:group:credentials
       password:
         title: Password
-        description: The password of `username`.
+        description: The password of `username`. When it is not set, the 
Kamelet logs in with an empty password, which with `username` set to `Guest` is 
a guest login, on a share that allows guest access.
         type: string
         format: password
         x-descriptors:
         - urn:camel:group:credentials
+      encryptData:
+        title: Encrypt Data
+        description: If true, everything sent to and from the server, the 
content of the files included, is encrypted (SMB 3 encryption), also on a share 
that does not require it. A share that requires encryption, such as one with 
`smb encrypt = required` on Samba, refuses the connection unless it is true. 
The server must support SMB 3.
+        type: boolean
+        default: false
+      connectTimeout:
+        title: Connect Timeout
+        description: How long to wait for the connection to the server, in 
milliseconds. When it is not set, 5000 (5 seconds).
+        type: integer
+        example: 10000
+      writeTimeout:
+        title: Write Timeout
+        description: How long to wait for the server to answer a write of the 
content of a file, in milliseconds. When it is not set, 60000 (1 minute).
+        type: integer
+        example: 120000
+      transactTimeout:
+        title: Request Timeout
+        description: How long to wait for the server to answer the other 
requests, such as listing a directory, or opening, renaming or deleting a file, 
in milliseconds. When it is not set, 60000 (1 minute).
+        type: integer
+        example: 30000
       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.
@@ -178,11 +196,15 @@ spec:
               hostname: "{{connectionHost}}"
               port: "{{connectionPort}}"
               shareName: "{{shareName}}"
-              path: "{{directoryName}}"
+              path: "{{?directoryName}}"
               autoCreate: "{{autoCreate}}"
+              connectTimeout: "{{?connectTimeout}}"
               doneFileName: "RAW({{?doneFileName}})"
               domain: "RAW({{?domain}})"
+              encryptData: "{{encryptData}}"
               fileExist: "{{fileExist}}"
               password: "RAW({{?password}})"
               tempPrefix: "RAW({{?tempPrefix}})"
+              transactTimeout: "{{?transactTimeout}}"
               username: "RAW({{?username}})"
+              writeTimeout: "{{?writeTimeout}}"
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
index dd1d294e2..157052662 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/smb-source.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/smb-source.kamelet.yaml
@@ -38,13 +38,11 @@ spec:
 
       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 [...]
+      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:
@@ -64,7 +62,7 @@ spec:
         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`.
+        description: The directory within the share to read the files from, 
with `/` between its parts, such as `outgoing/orders`. When it is not set, the 
files at the top of the share are read. `/` reads them too, but the names in 
the file headers then start with `/`, such as `/orders.csv`.
         type: string
         example: outgoing/orders
       username:
@@ -75,11 +73,31 @@ spec:
         - urn:camel:group:credentials
       password:
         title: Password
-        description: The password of `username`.
+        description: The password of `username`. When it is not set, the 
Kamelet logs in with an empty password, which with `username` set to `Guest` is 
a guest login, on a share that allows guest access.
         type: string
         format: password
         x-descriptors:
         - urn:camel:group:credentials
+      encryptData:
+        title: Encrypt Data
+        description: If true, everything sent to and from the server, the 
content of the files included, is encrypted (SMB 3 encryption), also on a share 
that does not require it. A share that requires encryption, such as one with 
`smb encrypt = required` on Samba, refuses the connection unless it is true. 
The server must support SMB 3.
+        type: boolean
+        default: false
+      connectTimeout:
+        title: Connect Timeout
+        description: How long to wait for the connection to the server, in 
milliseconds. When it is not set, 5000 (5 seconds).
+        type: integer
+        example: 10000
+      readTimeout:
+        title: Read Timeout
+        description: How long to wait for the server to answer a read of the 
content of a file, in milliseconds. When it is not set, 60000 (1 minute).
+        type: integer
+        example: 120000
+      transactTimeout:
+        title: Request Timeout
+        description: How long to wait for the server to answer the other 
requests, such as listing a directory, or opening, renaming or deleting a file, 
in milliseconds. When it is not set, 60000 (1 minute).
+        type: integer
+        example: 30000
       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.
@@ -112,7 +130,7 @@ spec:
         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 [...]
+        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:
@@ -163,10 +181,9 @@ spec:
         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.
+        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. Put `reverse:` in front for the 
reverse order, such as `reverse:file:modified` for the newest first, or 
`ignoreCase:` to sort names without case. Separate several orders with `;`, 
such as `file:modified;file:name`. 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
+        example: "reverse: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.'
@@ -214,12 +231,14 @@ spec:
         hostname: "{{connectionHost}}"
         port: "{{connectionPort}}"
         shareName: "{{shareName}}"
-        path: "{{directoryName}}"
+        path: "{{?directoryName}}"
         antInclude: "RAW({{?antInclude}})"
         autoCreate: "{{autoCreate}}"
+        connectTimeout: "{{?connectTimeout}}"
         delay: "{{?delay}}"
         delete: "{{delete}}"
         domain: "RAW({{?domain}})"
+        encryptData: "{{encryptData}}"
         exclude: "RAW({{?exclude}})"
         idempotent: "{{idempotent}}"
         idempotentRepository: "#bean:{{?idempotentRepository}}"
@@ -231,9 +250,11 @@ spec:
         preMove: "{{?preMove}}"
         readLock: "{{?readLock}}"
         readLockMinAge: "{{?readLockMinAge}}"
+        readTimeout: "{{?readTimeout}}"
         recursive: "{{recursive}}"
         sortBy: "RAW({{?sortBy}})"
         streamDownload: "{{?streamDownload}}"
+        transactTimeout: "{{?transactTimeout}}"
         username: "RAW({{?username}})"
       steps:
         - choice:
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
index 38e01959b..e3cec65bb 100644
--- 
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
@@ -16,7 +16,7 @@
 # ---------------------------------------------------------------------------
 
 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'
+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, fails a 
message whose CamelFileName points outside the directory, writes at the top of 
the share as a guest, with no password and no directoryName, and writes to a 
share that requires encryption only with encryptData'
 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
@@ -102,7 +102,53 @@ actions:
           reasonPhrase: "OK"
           version: "HTTP/1.1"
 
-  # The share has the file, with the body as its content, and nothing outside 
the directory
+  # A guest without a password and without directoryName writes the file at 
the top of the share
+  - http:
+      server: "smbHttpServer"
+      receiveRequest:
+        POST:
+          path: "/guest"
+          type: "plaintext"
+          headers:
+            - name: "X-File-Name-Produced"
+              value: 'guest.csv'
+          body:
+            data: |-
+              id,item
+              2,pen
+  - http:
+      server: "smbHttpServer"
+      sendResponse:
+        response:
+          status: 200
+          reasonPhrase: "OK"
+          version: "HTTP/1.1"
+
+  # The share that requires encryption refuses the connection without 
encryptData, and takes the file with it
+  - http:
+      server: "smbHttpServer"
+      receiveRequest:
+        POST:
+          path: "/secure"
+          type: "plaintext"
+          headers:
+            - name: "X-Error"
+              value: '@contains(''STATUS_ACCESS_DENIED'')@'
+            - name: "X-File-Name-Produced"
+              value: 'secret.csv'
+          body:
+            data: |-
+              id,item
+              3,key
+  - http:
+      server: "smbHttpServer"
+      sendResponse:
+        response:
+          status: 200
+          reasonPhrase: "OK"
+          version: "HTTP/1.1"
+
+  # The share has the files, with the bodies as their content, and nothing 
outside the directories
   - repeatOnError:
       until: "i = 10"
       autoSleep: 1000
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
index 87d4dd220..4e595e9c9 100644
--- 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
@@ -44,6 +44,9 @@
               username: 'citrus'
               # a password with characters that have a meaning in an endpoint 
address
               password: 's3cr&t+pw'
+              connectTimeout: 10000
+              writeTimeout: 30000
+              transactTimeout: 20000
         # what the Kamelet gives: the Java type of the body and the 
Content-Type
         - setHeader:
             name: X-Body-Type
@@ -89,3 +92,65 @@
             name: CamelFileName
         - to:
             uri: "{{http.sink.url}}/rejected"
+        # then as a guest, with no password, to the top of the share (no 
directoryName)
+        - removeHeaders:
+            pattern: "*"
+        - setBody:
+            constant: "id,item\n2,pen"
+        - setHeader:
+            name: file
+            constant: 'guest.csv'
+        - to:
+            uri: "kamelet:smb-sink"
+            parameters:
+              connectionHost: '{{smb.host}}'
+              connectionPort: '{{smb.port}}'
+              shareName: 'files'
+              username: 'Guest'
+        - setHeader:
+            name: X-File-Name-Produced
+            simple: "${header.CamelFileNameProduced}"
+        - to:
+            uri: "{{http.sink.url}}/guest"
+        # then to the share secure, which requires encryption: refused without 
encryptData, written with it
+        - removeHeaders:
+            pattern: "*"
+        - setBody:
+            constant: "id,item\n3,key"
+        - setHeader:
+            name: file
+            constant: 'secret.csv'
+        - doTry:
+            steps:
+              - to:
+                  uri: "kamelet:smb-sink"
+                  parameters:
+                    connectionHost: '{{smb.host}}'
+                    connectionPort: '{{smb.port}}'
+                    shareName: 'secure'
+                    username: 'citrus'
+                    password: 's3cr&t+pw'
+              - setHeader:
+                  name: X-Error
+                  constant: 'none'
+            doCatch:
+              - exception:
+                  - "java.lang.Exception"
+                steps:
+                  - setHeader:
+                      name: X-Error
+                      simple: "${exception.message}"
+        - to:
+            uri: "kamelet:smb-sink"
+            parameters:
+              connectionHost: '{{smb.host}}'
+              connectionPort: '{{smb.port}}'
+              shareName: 'secure'
+              username: 'citrus'
+              password: 's3cr&t+pw'
+              encryptData: true
+        - setHeader:
+            name: X-File-Name-Produced
+            simple: "${header.CamelFileNameProduced}"
+        - to:
+            uri: "{{http.sink.url}}/secure"
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-source-guest-route.citrus.it.yaml
similarity index 60%
copy from 
tests/camel-kamelets-itest/src/test/resources/smb/smb-sink-route.citrus.it.yaml
copy to 
tests/camel-kamelets-itest/src/test/resources/smb/smb-source-guest-route.citrus.it.yaml
index 38e01959b..517452d01 100644
--- 
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-source-guest-route.citrus.it.yaml
@@ -15,11 +15,10 @@
 # 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'
+name: smb-source-guest-route-test
+description: 'smb-source logs in as a guest, with no password, reads the files 
at the top of the share when directoryName is not set, and reads them in the 
order of sortBy file:length;reverse:ignoreCase:file:name'
 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
+  # Start the Samba server (port 445) with the share files; smbServer.groovy 
turns on guest access
   - testcontainers:
       start:
         container:
@@ -46,7 +45,7 @@ actions:
         run:
           waitForRunningState: false
           integration:
-            file: "smb/smb-sink-route.yaml"
+            file: "smb/smb-source-guest-route.yaml"
             systemProperties:
               properties:
                 - name: "http.sink.url"
@@ -56,24 +55,23 @@ actions:
                 - name: "smb.port"
                   value: "${CITRUS_TESTCONTAINERS_SMB_PORT}"
 
-  # The message goes on unchanged, with the path of the file within the share
+  # The files at the top of the share, the smallest first, then by name in 
reverse order without case,
+  # with their names without a leading /
   - http:
       server: "smbHttpServer"
       receiveRequest:
         POST:
-          path: "/result"
+          path: "/root"
           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'
+            - name: "file"
+              value: '0.txt'
+            - name: "X-File-Name"
+              value: '0.txt'
+            - name: "X-Unc-Path"
+              value: '\\${CITRUS_TESTCONTAINERS_SMB_HOST}\files\0.txt'
           body:
-            data: |-
-              id,item
-              1,book
+            data: '0'
   - http:
       server: "smbHttpServer"
       sendResponse:
@@ -81,19 +79,43 @@ actions:
           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"
+          path: "/root"
           type: "plaintext"
           headers:
-            - name: "X-Error"
-              value: 'java.lang.IllegalArgumentException'
+            - name: "file"
+              value: 'B.txt'
+            - name: "X-File-Name"
+              value: 'B.txt'
+            - name: "X-Unc-Path"
+              value: '\\${CITRUS_TESTCONTAINERS_SMB_HOST}\files\B.txt'
           body:
-            data: '@contains(''jailed to the starting directory'')@'
+            data: 'BB'
+  - http:
+      server: "smbHttpServer"
+      sendResponse:
+        response:
+          status: 200
+          reasonPhrase: "OK"
+          version: "HTTP/1.1"
+  - http:
+      server: "smbHttpServer"
+      receiveRequest:
+        POST:
+          path: "/root"
+          type: "plaintext"
+          headers:
+            - name: "file"
+              value: 'a.txt'
+            - name: "X-File-Name"
+              value: 'a.txt'
+            - name: "X-Unc-Path"
+              value: '\\${CITRUS_TESTCONTAINERS_SMB_HOST}\files\a.txt'
+          body:
+            data: 'aa'
   - http:
       server: "smbHttpServer"
       sendResponse:
@@ -101,12 +123,3 @@ actions:
           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-source-route.yaml 
b/tests/camel-kamelets-itest/src/test/resources/smb/smb-source-guest-route.yaml
similarity index 68%
copy from 
tests/camel-kamelets-itest/src/test/resources/smb/smb-source-route.yaml
copy to 
tests/camel-kamelets-itest/src/test/resources/smb/smb-source-guest-route.yaml
index 875fe08a3..d76529ee7 100644
--- a/tests/camel-kamelets-itest/src/test/resources/smb/smb-source-route.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/smb/smb-source-guest-route.yaml
@@ -22,36 +22,23 @@
         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'
+        # no directoryName: the files at the top of the share; a guest, with 
no password
+        username: 'Guest'
+        # the smallest first, then by name in reverse order, without case: 
0.txt, B.txt, a.txt
+        sortBy: 'file:length;reverse:ignoreCase:file:name'
         # 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"
+            uri: "{{http.sink.url}}/root"
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
index 414781da9..6f8211f51 100644
--- 
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
@@ -16,7 +16,7 @@
 # ---------------------------------------------------------------------------
 
 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'
+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, with encryptData on a share that 
does not require it'
 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
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
index 875fe08a3..2e654a75d 100644
--- 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
@@ -27,6 +27,11 @@
         # a password with characters that have a meaning in an endpoint address
         password: 's3cr&t+pw'
         move: '.done'
+        # encrypted, also on a share that does not require it
+        encryptData: true
+        connectTimeout: 10000
+        readTimeout: 30000
+        transactTimeout: 20000
         # one poll is enough: no poll runs while the test stops the server
         delay: 60000
       steps:
diff --git a/tests/camel-kamelets-itest/src/test/resources/smb/smbServer.groovy 
b/tests/camel-kamelets-itest/src/test/resources/smb/smbServer.groovy
index b40f2142a..984b2aaee 100644
--- a/tests/camel-kamelets-itest/src/test/resources/smb/smbServer.groovy
+++ b/tests/camel-kamelets-itest/src/test/resources/smb/smbServer.groovy
@@ -16,15 +16,26 @@
  */
 
 // 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.
+// upload, with the file orders/order 1.csv, whose name has a space, the file 
upload/day 1.csv, which the
+// sink test replaces, and the files 0.txt (1 byte), a.txt and B.txt (2 bytes 
each) at the top of the share.
+// It also turns on guest access: the user Guest, with no password, logs in as 
a guest (map to guest = Bad User,
+// guest ok = yes on the share), and adds the share secure, the directory 
/shared/secure, which requires encryption
+// (smb encrypt = required).
 
 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"
+        " && printf 'old' > '/shared/upload/day 1.csv'" +
+        " && printf '0' > /shared/0.txt && printf 'aa' > /shared/a.txt && 
printf 'BB' > /shared/B.txt" +
+        " && chown -R citrus /shared && chgrp -R smb /shared" +
+        " && sed -i 's/^\\[global\\]/[global]\\n    map to guest = Bad User/' 
/etc/samba/smb.tmp" +
+        " && printf '   guest ok = yes\\n' >> /etc/samba/smb.tmp" +
+        " && mkdir -p /shared/secure && chown citrus /shared/secure && chgrp 
smb /shared/secure" +
+        " && printf '[secure]\\n    path = /shared/secure\\n    read only = 
no\\n    smb encrypt = required\\n" +
+        "    force user = citrus\\n    force group = smb\\n' >> 
/etc/samba/smb.tmp" +
+        " && smbcontrol smbd reload-config"
 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/verifyUpload.groovy 
b/tests/camel-kamelets-itest/src/test/resources/smb/verifyUpload.groovy
index cec5b77d8..b207ba2ac 100644
--- a/tests/camel-kamelets-itest/src/test/resources/smb/verifyUpload.groovy
+++ b/tests/camel-kamelets-itest/src/test/resources/smb/verifyUpload.groovy
@@ -15,8 +15,9 @@
  * 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.
+// Checks that the share has the file upload/day 1.csv, with the body of the 
message as its content, the file
+// guest.csv at the top of the share, written as a guest, the file secret.csv 
on the share secure, written with
+// encryption, and no other file written.
 
 import org.testcontainers.containers.GenericContainer
 
@@ -30,7 +31,16 @@ if (content.getExitCode() != 0) {
 if (content.getStdout() != 'id,item\n1,book') {
     throw new IllegalStateException('Unexpected content of ' + file + ': ' + 
content.getStdout().inspect())
 }
+def guest = smb.execInContainer('cat', '/shared/guest.csv')
+if (guest.getExitCode() != 0 || guest.getStdout() != 'id,item\n2,pen') {
+    throw new IllegalStateException('Unexpected /shared/guest.csv: ' + 
guest.getStdout().inspect() + guest.getStderr())
+}
 def files = smb.execInContainer('find', '/shared', '-type', 
'f').getStdout().readLines().sort()
-if (files != ['/shared/orders/order 1.csv', file]) {
+def secret = smb.execInContainer('cat', '/shared/secure/secret.csv')
+if (secret.getExitCode() != 0 || secret.getStdout() != 'id,item\n3,key') {
+    throw new IllegalStateException('Unexpected /shared/secure/secret.csv: ' + 
secret.getStdout().inspect() + secret.getStderr())
+}
+if (files != ['/shared/0.txt', '/shared/B.txt', '/shared/a.txt', 
'/shared/guest.csv', '/shared/orders/order 1.csv',
+              '/shared/secure/secret.csv', file]) {
     throw new IllegalStateException('Unexpected files on the share: ' + files)
 }

Reply via email to