Claus Ibsen created CAMEL-24852:
-----------------------------------

             Summary: camel-jbang - the validator reports a resource:classpath: 
file that sits next to the route, and a ${} placeholder in a file endpoint's 
directory
                 Key: CAMEL-24852
                 URL: https://issues.apache.org/jira/browse/CAMEL-24852
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang
            Reporter: Claus Ibsen


Two startup failures from the round-2 benchmark (series l2) where the validator 
was clean and the runtime refused the file with a message the validator could 
have given before the run. Both echo a message the runtime already has.

*1. resource: pointing at a file next to the route with classpath:*

{code:yaml}
- setBody:
    expression:
      groovy:
        expression: "resource:classpath:shipment-mapping.groovy"
{code}

with {{shipment-mapping.groovy}} in the same directory as the route. {{camel 
run}} fails with "Cannot load resource classpath:shipment-mapping.groovy" 
({{FileNotFoundException}}); {{resource:file:shipment-mapping.groovy}} works. 
The validator (directory-aware path, the one that has the files) should check a 
{{resource:}} reference: if the file exists next to the route but the scheme is 
{{classpath:}}, say to write {{resource:file:<name>}}; if it exists nowhere, 
say it is not found.

*2. a ${...} placeholder in a file endpoint's directory*

{code:yaml}
- to:
    uri: "file://archived/${header.monthDir}?fileName=${header.CamelFileName}"
{code}

fails at startup with "Invalid directory: archived/${header.monthDir}. Dynamic 
expressions with ${ } placeholders is not allowed. Use the fileName option to 
set the dynamic expression." The endpoint checks should report a placeholder in 
the directory part of a file (and ftp/sftp/smb) endpoint with that message, and 
the toD hint where the whole uri is dynamic.

Both in the catalog layer of {{SourceValidator}} (camel-jbang-core: 
EndpointChecks / a resource check), tests next to the existing ones.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to