You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jessy Chenavas <je...@gmail.com> on 2020/06/24 10:27:51 UTC

How to properly handle Camel files endpoint in jUnit test

Hello,

I found on your website this mailing list to ask some questions about Camel.
I have some trouble making my test work, I have an endpoint that waits for
files, and I want to test it.
To achieve this I've created a mock of my endpoint, an exchange with the
file and I'm sending it.
The problem is that Camel is renaming my sended file and also removing the
extension, the rename makes it unusable by my route (which has specific
filters) and the removal of the extension makes it also unusable since I
need it in my process.

Here is a stackoverflow post with my test code:
https://stackoverflow.com/questions/62510321/camel-mock-file-endpoint-problem-with-file-extension

Am I missing something ? Some options on the exchange ?

Thanks,
Jessy CHENAVAS.

Re: How to properly handle Camel files endpoint in jUnit test

Posted by Alex Dettinger <al...@gmail.com>.
Hi Jessy,

  In such a case, I would rather do something inspired from one of the
camel file test:
https://github.com/apache/camel/tree/master/core/camel-core/src/test/java/org/apache/camel/component/file

hth,
Alex

On Wed, Jun 24, 2020 at 3:00 PM Jessy Chenavas <je...@gmail.com>
wrote:

> Hello,
>
> I found on your website this mailing list to ask some questions about
> Camel.
> I have some trouble making my test work, I have an endpoint that waits for
> files, and I want to test it.
> To achieve this I've created a mock of my endpoint, an exchange with the
> file and I'm sending it.
> The problem is that Camel is renaming my sended file and also removing the
> extension, the rename makes it unusable by my route (which has specific
> filters) and the removal of the extension makes it also unusable since I
> need it in my process.
>
> Here is a stackoverflow post with my test code:
>
> https://stackoverflow.com/questions/62510321/camel-mock-file-endpoint-problem-with-file-extension
>
> Am I missing something ? Some options on the exchange ?
>
> Thanks,
> Jessy CHENAVAS.
>