You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2016/05/22 07:06:12 UTC

[jira] [Assigned] (CAMEL-9981) CamelSpringJUnit4ClassRunner registers listeners twice

     [ https://issues.apache.org/jira/browse/CAMEL-9981?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-9981:
----------------------------------

    Assignee: Claus Ibsen

> CamelSpringJUnit4ClassRunner registers listeners twice
> ------------------------------------------------------
>
>                 Key: CAMEL-9981
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9981
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-test
>    Affects Versions: 2.17.1
>         Environment: ALL
>            Reporter: Gardella Juan Pablo
>            Assignee: Claus Ibsen
>              Labels: test
>
> Using camel-test-spring I found that CamelSpringJUnit4ClassRunner registers the listener twice. This causes the following error in transactional tests:
> {noformat}
> java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction.
> {noformat}
> To fix it, it is required to only add the expected listeners :
> {code:java}
> line:57
>          public CamelTestContextManager(Class<?> testClass) {
>             super(testClass);
>             // inject Camel first, and then disable jmx and add the stop-watch
>             // WARNING: The listeners are registered within the super class.
>             /// DON'T get current listeners.
>             // List<TestExecutionListener> list = getTestExecutionListeners();
>             //
>             List<TestExecutionListener> list = new ArrayList<TestExecutionListener>(3);
>             list.add(new CamelSpringTestContextLoaderTestExecutionListener());
>             list.add(new DisableJmxTestExecutionListener());
>             list.add(new StopWatchTestExecutionListener());
>             OrderComparator.sort(list);
>             registerTestExecutionListeners(list);
>         }
> {code}
> Spring version: 4.2.5.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)