Gardella Juan Pablo created CAMEL-9981:
------------------------------------------
Summary: 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
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)