activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r643439 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/camel/component/ test/java/org/apache/activemq/camel/component/
Date Tue, 01 Apr 2008 15:21:17 GMT
Author: jstrachan
Date: Tue Apr  1 08:21:13 2008
New Revision: 643439

URL: http://svn.apache.org/viewvc?rev=643439&view=rev
Log:
fix for failing test case

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java?rev=643439&r1=643438&r2=643439&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQComponent.java
Tue Apr  1 08:21:13 2008
@@ -85,6 +85,14 @@
         this.exposeAllQueues = exposeAllQueues;
     }
 
+    public void setUsePooledConnection(boolean usePooledConnection) {
+        getConfiguration().setUsePooledConnection(usePooledConnection);
+    }
+
+    public void setUseSingleConnection(boolean useSingleConnection) {
+        getConfiguration().setUseSingleConnection(useSingleConnection);
+    }
+
     @Override
     protected void doStart() throws Exception {
         super.doStart();

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java?rev=643439&r1=643438&r2=643439&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQConfiguration.java
Tue Apr  1 08:21:13 2008
@@ -97,7 +97,6 @@
         }
         else if (isUseSingleConnection()) {
             return new SingleConnectionFactory(answer);
-            //return new PooledConnectionFactory(answer);
         }
         else {
             return answer;
@@ -109,7 +108,7 @@
         // for folks not using this option
         try {
             Class type = loadClass("org.apache.activemq.pool.PooledConnectionFactory", getClass().getClassLoader());
-            Constructor constructor = type.getConstructor(ActiveMQConnectionFactory.class);
+            Constructor constructor = type.getConstructor(org.apache.activemq.ActiveMQConnectionFactory.class);
             return (ConnectionFactory) constructor.newInstance(connectionFactory);
         }
         catch (Exception e) {

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java?rev=643439&r1=643438&r2=643439&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/camel/component/ActiveMQConfigureTest.java
Tue Apr  1 08:21:13 2008
@@ -17,6 +17,7 @@
 package org.apache.activemq.camel.component;
 
 import org.apache.activemq.spring.ActiveMQConnectionFactory;
+import org.apache.activemq.pool.PooledConnectionFactory;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Endpoint;
 import org.apache.camel.component.jms.JmsConsumer;
@@ -25,6 +26,7 @@
 import org.apache.camel.processor.Logger;
 import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.listener.AbstractMessageListenerContainer;
+import org.springframework.jms.connection.SingleConnectionFactory;
 
 /**
  * @version $Revision$
@@ -32,12 +34,31 @@
 public class ActiveMQConfigureTest extends ContextTestSupport {
     
     public void testJmsTemplateUsesPoolingConnectionFactory() throws Exception {
+        JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo?usePooledConnection=true");
+        JmsProducer producer = endpoint.createProducer();
+
+        JmsTemplate template = assertIsInstanceOf(JmsTemplate.class, producer.getTemplate());
+        assertEquals("pubSubDomain", false, template.isPubSubDomain());
+        assertIsInstanceOf(PooledConnectionFactory.class, template.getConnectionFactory());
+    }
+
+    public void testJmsTemplateUsesSingleConnectionFactory() throws Exception {
         JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo");
         JmsProducer producer = endpoint.createProducer();
 
         JmsTemplate template = assertIsInstanceOf(JmsTemplate.class, producer.getTemplate());
-        assertIsInstanceOf(ActiveMQConnectionFactory.class, template.getConnectionFactory());
         assertEquals("pubSubDomain", false, template.isPubSubDomain());
+        SingleConnectionFactory connectionFactory = assertIsInstanceOf(SingleConnectionFactory.class,
template.getConnectionFactory());
+        assertIsInstanceOf(ActiveMQConnectionFactory.class, connectionFactory.getTargetConnectionFactory());
+    }
+
+    public void testJmsTemplateDoesNotUsePoolingConnectionFactory() throws Exception {
+        JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo?useSingleConnection=false");
+        JmsProducer producer = endpoint.createProducer();
+
+        JmsTemplate template = assertIsInstanceOf(JmsTemplate.class, producer.getTemplate());
+        assertEquals("pubSubDomain", false, template.isPubSubDomain());
+        assertIsInstanceOf(ActiveMQConnectionFactory.class, template.getConnectionFactory());
     }
 
     public void testListenerContainerUsesSpringConnectionFactory() throws Exception {
@@ -45,9 +66,9 @@
         JmsConsumer consumer = endpoint.createConsumer(new Logger());
 
         AbstractMessageListenerContainer listenerContainer = consumer.getListenerContainer();
-        assertIsInstanceOf(ActiveMQConnectionFactory.class, listenerContainer.getConnectionFactory());
         assertEquals("pubSubDomain", true, listenerContainer.isPubSubDomain());
-
+        SingleConnectionFactory connectionFactory = assertIsInstanceOf(SingleConnectionFactory.class,
listenerContainer.getConnectionFactory());
+        assertIsInstanceOf(ActiveMQConnectionFactory.class, connectionFactory.getTargetConnectionFactory());
     }
 
     @Override



Mime
View raw message