camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "roman.stumm" <>
Subject Re: Testing a transacted route with CamelTestSupport
Date Wed, 17 Jul 2013 07:15:00 GMT
When I write a unit-test or use a test-spring.xml, I can use my
DummyTransactionManager like this:

 <bean id="transactionManager"

or programmatically:

class MyTest extends CamelTestSupport {

    protected CamelContext createCamelContext() throws Exception {
        CamelContext context = new
        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
            throws TransactionException {
        return new SimpleTransactionStatus();

    public void commit(TransactionStatus transactionStatus) throws
TransactionException {

    public void rollback(TransactionStatus transactionStatus) throws
TransactionException {


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message