You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2012/08/13 11:01:06 UTC

Re: Problem with testng CamelSpringTestSupport: several contexts runs simultaneously

On Wed, Jul 25, 2012 at 12:05 PM, sensen <n....@web.de> wrote:
> Hello,
> we have I problem with the setup and tearDown of the applicationContext
> which is managed
> by the CamelSpringTestSupport-Class of the testng-package.
> When there are several test-methods within several test-classes that extends
> CamelSpringTestSupport,
> a lot of CamelContexts are started, but they are not correctly stopped. So
> that while executing
> the last test, there are several Contexts running in parallel which results
> in
> unpredictable behaviour.
>
> As far as we can see, the reason for this behaviour is:
> The applicationContext (and the CamelContext) is created in an
> @BeforeMethod-setup-method.
> So, by default, for every test-method a context is created and started.
> BUT: the context is teared down in the tearDown()-method which is annotated
> with @AfterTest.
> This method is only executed once at the end of all test.
> FIX: we think that the tearDown()-method must not be annotated with
> @AfterTest but with
> @AfterMethod.
>
> Is this observeration right? Or is there an error in our understanding?
>

Yes it seems like a bug. Feel free to log a JIRA ticket.

> Sincerely Yours,
> Norbert Sensen
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-testng-CamelSpringTestSupport-several-contexts-runs-simultaneously-tp5716447.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Problem with testng CamelSpringTestSupport: several contexts runs simultaneously

Posted by sensen <n....@web.de>.
Thank you!



--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-testng-CamelSpringTestSupport-several-contexts-runs-simultaneously-tp5716447p5717286.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Problem with testng CamelSpringTestSupport: several contexts runs simultaneously

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I logged a ticket and committed a fix
https://issues.apache.org/jira/browse/CAMEL-5500

On Mon, Aug 13, 2012 at 11:01 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Wed, Jul 25, 2012 at 12:05 PM, sensen <n....@web.de> wrote:
>> Hello,
>> we have I problem with the setup and tearDown of the applicationContext
>> which is managed
>> by the CamelSpringTestSupport-Class of the testng-package.
>> When there are several test-methods within several test-classes that extends
>> CamelSpringTestSupport,
>> a lot of CamelContexts are started, but they are not correctly stopped. So
>> that while executing
>> the last test, there are several Contexts running in parallel which results
>> in
>> unpredictable behaviour.
>>
>> As far as we can see, the reason for this behaviour is:
>> The applicationContext (and the CamelContext) is created in an
>> @BeforeMethod-setup-method.
>> So, by default, for every test-method a context is created and started.
>> BUT: the context is teared down in the tearDown()-method which is annotated
>> with @AfterTest.
>> This method is only executed once at the end of all test.
>> FIX: we think that the tearDown()-method must not be annotated with
>> @AfterTest but with
>> @AfterMethod.
>>
>> Is this observeration right? Or is there an error in our understanding?
>>
>
> Yes it seems like a bug. Feel free to log a JIRA ticket.
>
>> Sincerely Yours,
>> Norbert Sensen
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-testng-CamelSpringTestSupport-several-contexts-runs-simultaneously-tp5716447.html
>> Sent from the Camel Development mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen