Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 157312009F9 for ; Mon, 23 May 2016 08:55:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 142A0160A0F; Mon, 23 May 2016 06:55:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5FCA0160A2C for ; Mon, 23 May 2016 08:55:14 +0200 (CEST) Received: (qmail 18785 invoked by uid 500); 23 May 2016 06:55:13 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 18557 invoked by uid 99); 23 May 2016 06:55:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 May 2016 06:55:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 0BB762C1F73 for ; Mon, 23 May 2016 06:55:13 +0000 (UTC) Date: Mon, 23 May 2016 06:55:13 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CAMEL-9981) CamelSpringJUnit4ClassRunner registers listeners twice MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 23 May 2016 06:55:15 -0000 [ 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 list = getTestExecutionListeners(); > // > List list = new ArrayList(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)