Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.14.0, 2.15.0, 2.17.1
-
Component/s: camel-test
-
Labels:
-
Environment:
ALL
-
Estimated Complexity:Novice
-
Flags:Important
Description
Using camel-test-spring I found that CamelSpringJUnit4ClassRunner registers the listener twice. This causes the following error in transactional tests:
java.lang.IllegalStateException: Cannot start a new transaction without ending the existing transaction.
To fix it, it is required to only add the expected listeners :
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);
}
Spring version: 4.2.5.