Clarify test recommendations when using Arquillian?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Clarify test recommendations when using Arquillian?

Rick Wagner
Hello Camel Riders,

I've recently spent some time working on Camel testing, but find the
documentation a bit confusing when Camel is used with Arquillian.

The docs describe how 'AdviceWith' [1] can be used, and how
isUseAdviceWith() can be used to let Camel know you are advising a route.
The problem is that something like Arquillian can insert another layer of
behavior into the scenario, the user may be unaware.  (The particular use
case:  'AdviceWith' is ignored when using Arquillian, because Arquillian
causes the route to be deployed and started before the unit test can apply
'AdviceWith'.)

Does anyone else find this confusing?

Thank you,

Rick

P.S.  I'd be glad to supply a PR or other suggested change to the Camel
site, but I'm afraid I find the docs change process confusing as well.
I've cloned the Camel repo, but can't seem to find the source for the
article at [1], perhaps it's not on the source tip.  If I'm missing the
'right way' to do it, please let me know.

[1] https://camel.apache.org/advicewith.html
Reply | Threaded
Open this post in threaded view
|

AW: Clarify test recommendations when using Arquillian?

christian.jacob@innogy.com
Hi Rick,

IMHO Arquillian is something that was not invented for unit tests. Instead, one should use it for larger tests like regression tests or integration tests. And I doubt that you need adviceWith in those test scenarios.

Kind Regards,
Christian

-----Urspr√ľngliche Nachricht-----
Von: Rick Wagner [mailto:[hidden email]]
Gesendet: Mittwoch, 3. Juli 2019 17:36
An: [hidden email]
Betreff: Clarify test recommendations when using Arquillian?

Hello Camel Riders,

I've recently spent some time working on Camel testing, but find the
documentation a bit confusing when Camel is used with Arquillian.

The docs describe how 'AdviceWith' [1] can be used, and how
isUseAdviceWith() can be used to let Camel know you are advising a route.
The problem is that something like Arquillian can insert another layer of
behavior into the scenario, the user may be unaware.  (The particular use
case:  'AdviceWith' is ignored when using Arquillian, because Arquillian
causes the route to be deployed and started before the unit test can apply
'AdviceWith'.)

Does anyone else find this confusing?

Thank you,

Rick

P.S.  I'd be glad to supply a PR or other suggested change to the Camel
site, but I'm afraid I find the docs change process confusing as well.
I've cloned the Camel repo, but can't seem to find the source for the
article at [1], perhaps it's not on the source tip.  If I'm missing the
'right way' to do it, please let me know.

[1] https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcamel.apache.org%2Fadvicewith.html&data=02%7C01%7C%7C194a30712e3c4b3f913a08d6ffcc2fab%7Cf481d56fc63d4d748406d64e74f44395%7C0%7C1%7C636977649774543316&sdata=W5%2BOkWkXxJH5Tn%2F5JyJTfuql4lQoncBUvxx%2BbRk0DAc%3D&reserved=0
----------------------------------------------------------------
innogy SE
Vorsitzender des Aufsichtsrates: Dr. Erhard Schipporeit
Vorstand: Uwe Tigges (Vorsitzender), Dr. Hans Buenting,
Dr. Bernhard Guenther, Arno Hahn, Martin Herrmann, Hildegard Mueller
Sitz der Gesellschaft: Essen, Eingetragen beim Amtsgericht Essen,
Handelsregister-Nr. HRB 27091, USt-IdNr. DE304171711
Reply | Threaded
Open this post in threaded view
|

Re: Clarify test recommendations when using Arquillian?

astefanutti
In reply to this post by Rick Wagner
Hi Rick,

You can find an example on how to use AdviceWith along with Arquillian and CDI here:

https://github.com/apache/camel/blob/camel-2.24.1/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/AdvisedRouteTest.java#L84-L92

The trick is to used a context that is not auto started:

https://github.com/apache/camel/blob/ffbe4efdc9e065b076a3952631facae46a1e25f3/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/ManualStartupCamelContext.java

--
Antonin

> On 3 Jul 2019, at 17:35, Rick Wagner <[hidden email]> wrote:
>
> Hello Camel Riders,
>
> I've recently spent some time working on Camel testing, but find the
> documentation a bit confusing when Camel is used with Arquillian.
>
> The docs describe how 'AdviceWith' [1] can be used, and how
> isUseAdviceWith() can be used to let Camel know you are advising a route.
> The problem is that something like Arquillian can insert another layer of
> behavior into the scenario, the user may be unaware.  (The particular use
> case:  'AdviceWith' is ignored when using Arquillian, because Arquillian
> causes the route to be deployed and started before the unit test can apply
> 'AdviceWith'.)
>
> Does anyone else find this confusing?
>
> Thank you,
>
> Rick
>
> P.S.  I'd be glad to supply a PR or other suggested change to the Camel
> site, but I'm afraid I find the docs change process confusing as well.
> I've cloned the Camel repo, but can't seem to find the source for the
> article at [1], perhaps it's not on the source tip.  If I'm missing the
> 'right way' to do it, please let me know.
>
> [1] https://camel.apache.org/advicewith.html

Reply | Threaded
Open this post in threaded view
|

Re: Clarify test recommendations when using Arquillian?

Rick Wagner
Many thanks, Antonin!  This is helpful.

Rick

On Thu, Jul 4, 2019 at 1:44 AM Antonin Stefanutti <[hidden email]>
wrote:

> Hi Rick,
>
> You can find an example on how to use AdviceWith along with Arquillian and
> CDI here:
>
>
> https://github.com/apache/camel/blob/camel-2.24.1/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/AdvisedRouteTest.java#L84-L92
>
> The trick is to used a context that is not auto started:
>
>
> https://github.com/apache/camel/blob/ffbe4efdc9e065b076a3952631facae46a1e25f3/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/ManualStartupCamelContext.java
>
> --
> Antonin
>
> > On 3 Jul 2019, at 17:35, Rick Wagner <[hidden email]> wrote:
> >
> > Hello Camel Riders,
> >
> > I've recently spent some time working on Camel testing, but find the
> > documentation a bit confusing when Camel is used with Arquillian.
> >
> > The docs describe how 'AdviceWith' [1] can be used, and how
> > isUseAdviceWith() can be used to let Camel know you are advising a route.
> > The problem is that something like Arquillian can insert another layer of
> > behavior into the scenario, the user may be unaware.  (The particular use
> > case:  'AdviceWith' is ignored when using Arquillian, because Arquillian
> > causes the route to be deployed and started before the unit test can
> apply
> > 'AdviceWith'.)
> >
> > Does anyone else find this confusing?
> >
> > Thank you,
> >
> > Rick
> >
> > P.S.  I'd be glad to supply a PR or other suggested change to the Camel
> > site, but I'm afraid I find the docs change process confusing as well.
> > I've cloned the Camel repo, but can't seem to find the source for the
> > article at [1], perhaps it's not on the source tip.  If I'm missing the
> > 'right way' to do it, please let me know.
> >
> > [1] https://camel.apache.org/advicewith.html
>
>