Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 17B5CFD4B for ; Wed, 17 Jul 2013 07:21:27 +0000 (UTC) Received: (qmail 84919 invoked by uid 500); 17 Jul 2013 07:21:26 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 84892 invoked by uid 500); 17 Jul 2013 07:21:26 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Delivered-To: moderator for users@camel.apache.org Received: (qmail 71596 invoked by uid 99); 17 Jul 2013 07:15:47 -0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=SPF_FAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: encountered temporary error during SPF processing of domain of roman.stumm@gmx.de) Date: Wed, 17 Jul 2013 00:15:00 -0700 (PDT) From: "roman.stumm" To: users@camel.apache.org Message-ID: <1374045300949-5735768.post@n5.nabble.com> In-Reply-To: <1329829237485-5502129.post@n5.nabble.com> References: <1329829237485-5502129.post@n5.nabble.com> Subject: Re: Testing a transacted route with CamelTestSupport MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org When I write a unit-test or use a test-spring.xml, I can use my DummyTransactionManager like this: or programmatically: class MyTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = new DefaultCamelContext(createSimpleRegistry()); return context; } private Registry createSimpleRegistry() { registry = new SimpleRegistry(); registry.put("transactionManager", new DummyTransactionManager()); return registry; } } So I can use transacted() in camel-routes, but without accessing a JMS-TransactionManager or any DataSource, just as a unit-test... Here is the class: public class DummyTransactionManager implements PlatformTransactionManager { public TransactionStatus getTransaction(TransactionDefinition transactionDefinition) throws TransactionException { return new SimpleTransactionStatus(); } public void commit(TransactionStatus transactionStatus) throws TransactionException { } public void rollback(TransactionStatus transactionStatus) throws TransactionException { } } -- View this message in context: http://camel.465427.n5.nabble.com/Testing-a-transacted-route-with-CamelTestSupport-tp5502129p5735768.html Sent from the Camel - Users mailing list archive at Nabble.com.