activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1379414 - in /activemq/trunk/activemq-ra/src: main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java
Date Fri, 31 Aug 2012 10:46:50 GMT
Author: dejanb
Date: Fri Aug 31 10:46:49 2012
New Revision: 1379414

URL: http://svn.apache.org/viewvc?rev=1379414&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3986 - improve test, copy prefetch policies on managed
connection factory

Modified:
    activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java
    activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java?rev=1379414&r1=1379413&r2=1379414&view=diff
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java
(original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java
Fri Aug 31 10:46:49 2012
@@ -56,23 +56,42 @@ public class ActiveMQManagedConnectionFa
         {
             if ( log.isDebugEnabled() ) {
                 log.debug("copying standard ResourceAdapter configuration properties");
-        }
+            }
+
             ActiveMQConnectionRequestInfo baseInfo = ((MessageResourceAdapter) adapter).getInfo().copy();
             if (getClientid() == null) {
                 setClientid(baseInfo.getClientid());
-        }
+            }
             if (getPassword() == null) {
                 setPassword(baseInfo.getPassword());
-        }
+            }
             if (getServerUrl() == null) {
                 setServerUrl(baseInfo.getServerUrl());
-        }
+            }
             if (getUseInboundSession() == null) {
                 setUseInboundSession(baseInfo.getUseInboundSession());
-        }
+            }
             if (getUserName() == null) {
                 setUserName(baseInfo.getUserName());
-    }
+            }
+            if (getDurableTopicPrefetch() != null) {
+                setDurableTopicPrefetch(baseInfo.getDurableTopicPrefetch());
+            }
+            if (getOptimizeDurableTopicPrefetch() != null) {
+                setOptimizeDurableTopicPrefetch(baseInfo.getOptimizeDurableTopicPrefetch());
+            }
+            if (getQueuePrefetch() != null) {
+                setQueuePrefetch(baseInfo.getQueuePrefetch());
+            }
+            if (getQueueBrowserPrefetch() != null) {
+                setQueueBrowserPrefetch(baseInfo.getQueueBrowserPrefetch());
+            }
+            if (getTopicPrefetch() != null) {
+                setTopicPrefetch(baseInfo.getTopicPrefetch());
+            }
+            if (getInputStreamPrefetch() != null) {
+                setInputStreamPrefetch(baseInfo.getInputStreamPrefetch());
+            }
         }
     }
 

Modified: activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java?rev=1379414&r1=1379413&r2=1379414&view=diff
==============================================================================
--- activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java
(original)
+++ activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java
Fri Aug 31 10:46:49 2012
@@ -21,9 +21,14 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.util.Timer;
 import javax.jms.Connection;
 import javax.jms.Session;
 import javax.jms.TopicSubscriber;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.UnavailableException;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.work.WorkManager;
 
 import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnection;
@@ -82,19 +87,22 @@ public class ActiveMQConnectionFactoryTe
     }
 
     public void testOptimizeDurablePrefetch() throws Exception {
-        ActiveMQConnectionRequestInfo info = new ActiveMQConnectionRequestInfo();
-        info.setServerUrl(url);
-        info.setUserName(user);
-        info.setPassword(pwd);
-        info.setOptimizeDurableTopicPrefetch(new Integer(500));
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(mcf, new ConnectionManagerAdapter(),
info);
-        Connection con = factory.createConnection("defaultUser", "defaultPassword");
+        ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
+        ra.setServerUrl(url);
+        ra.setUserName(user);
+        ra.setPassword(pwd);
+
+        ra.setOptimizeDurableTopicPrefetch(0);
+        ra.setDurableTopicPrefetch(0);
+
+        Connection con = ra.makeConnection();
+
         con.setClientID("x");
         Session sess = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
         TopicSubscriber sub = sess.createDurableSubscriber(sess.createTopic("TEST"), "x");
         con.start();
 
-        assertEquals(500, ((ActiveMQTopicSubscriber)sub).getPrefetchNumber());
+        assertEquals(0, ((ActiveMQTopicSubscriber)sub).getPrefetchNumber());
     }
 
 }



Mime
View raw message