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/23 06:55:13 UTC
[jira] [Resolved] (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 resolved CAMEL-9981.
--------------------------------
Resolution: Fixed
Thanks for the test case.
> 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.14.0, 2.15.0, 2.17.1
> Environment: ALL
> Reporter: Gardella Juan Pablo
> Assignee: Claus Ibsen
> Labels: test
> Fix For: 2.17.2, 2.18.0
>
> Attachments: camel-9981-test.zip
>
>
> 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)