activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1379939 - in /activemq/trunk/activemq-camel/src: main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java
Date Sun, 02 Sep 2012 10:54:23 GMT
Author: davsclaus
Date: Sun Sep  2 10:54:22 2012
New Revision: 1379939

URL: http://svn.apache.org/viewvc?rev=1379939&view=rev
Log:
AMQ-3861: Offer a way to not set a transaction manager in activemq-camel. Thanks to patch
from Babak. Requires Camel 2.10 or better.

Modified:
    activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
    activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java

Modified: activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java?rev=1379939&r1=1379938&r2=1379939&view=diff
==============================================================================
--- activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
(original)
+++ activemq/trunk/activemq-camel/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
Sun Sep  2 10:54:22 2012
@@ -115,18 +115,6 @@ public class ActiveMQConfiguration exten
         this.usePooledConnection = usePooledConnection;
     }
 
-    @Override
-    public PlatformTransactionManager getTransactionManager() {
-        PlatformTransactionManager answer = super.getTransactionManager();
-        if (isTransacted() && answer == null) {
-            // lets auto-default the transaction manager if its not specified
-            answer = createTransactionManager();
-            setTransactionManager(answer);
-            answer = getTransactionManager();
-        }
-        return answer;
-    }
-
     /**
      * Factory method to create a default transaction manager if one is not specified
      */

Modified: activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java?rev=1379939&r1=1379938&r2=1379939&view=diff
==============================================================================
--- activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java
(original)
+++ activemq/trunk/activemq-camel/src/test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java
Sun Sep  2 10:54:22 2012
@@ -19,6 +19,7 @@ package org.apache.activemq.camel.compon
 import org.apache.activemq.spring.ActiveMQConnectionFactory;
 import org.apache.activemq.pool.PooledConnectionFactory;
 import org.apache.camel.Endpoint;
+import org.apache.camel.component.jms.JmsConfiguration;
 import org.apache.camel.component.jms.JmsConsumer;
 import org.apache.camel.component.jms.JmsEndpoint;
 import org.apache.camel.component.jms.JmsProducer;
@@ -56,6 +57,20 @@ public class ActiveMQConfigureTest exten
     }
 
     @Test
+    public void testSessionTransactedWithoutTransactionManager() throws Exception {
+        JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo?transacted=true&lazyCreateTransactionManager=false");
+        JmsConfiguration configuration = endpoint.getConfiguration();
+        
+        assertIsInstanceOf(ActiveMQConfiguration.class, configuration);
+
+        assertTrue("The JMS sessions are not transacted!", endpoint.isTransacted());
+        assertTrue("The JMS sessions are not transacted!", configuration.isTransacted());
+
+        assertNull("A transaction manager has been lazy-created!", endpoint.getTransactionManager());
+        assertNull("A transaction manager has been lazy-created!", configuration.getTransactionManager());
+    }
+
+    @Test
     public void testJmsTemplateDoesNotUsePoolingConnectionFactory() throws Exception {
         JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo?usePooledConnection=false");
         JmsProducer producer = (JmsProducer) endpoint.createProducer();



Mime
View raw message