You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2016/05/10 19:42:43 UTC

activemq git commit: Need to test the underlying connection to ensure we aren't using an old one that isn't cleaned up since each checked grabs a new PooledConnection wrapper.

Repository: activemq
Updated Branches:
  refs/heads/master 71893f143 -> c81a9348e


Need to test the underlying connection to ensure we aren't using an old
one that isn't cleaned up since each checked grabs a new
PooledConnection wrapper. 

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/c81a9348
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/c81a9348
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/c81a9348

Branch: refs/heads/master
Commit: c81a9348ee370627093d9291fba8b3ddb4400d1e
Parents: 71893f1
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue May 10 15:41:58 2016 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue May 10 15:41:58 2016 -0400

----------------------------------------------------------------------
 .../PooledConnectionSecurityExceptionTest.java  | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/c81a9348/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
index e18d356..3a8eb27 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
@@ -107,7 +107,7 @@ public class PooledConnectionSecurityExceptionTest {
 
     @Test
     public void testFailureGetsNewConnectionOnRetry() throws Exception {
-        final Connection connection1 = pooledConnFact.createConnection("invalid", "credentials");
+        final PooledConnection connection1 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials");
 
         try {
             connection1.start();
@@ -121,11 +121,12 @@ public class PooledConnectionSecurityExceptionTest {
 
             @Override
             public boolean isSatisified() throws Exception {
-                return connection1 != pooledConnFact.createConnection("invalid", "credentials");
+                return connection1.getConnection() !=
+                          ((PooledConnection) pooledConnFact.createConnection("invalid", "credentials")).getConnection();
             }
         }));
 
-        Connection connection2 = pooledConnFact.createConnection("invalid", "credentials");
+        PooledConnection connection2 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials");
         try {
             connection2.start();
             fail("Should fail to connect");
@@ -133,7 +134,7 @@ public class PooledConnectionSecurityExceptionTest {
             LOG.info("Caught expected security error");
         }
 
-        assertNotSame(connection1, connection2);
+        assertNotSame(connection1.getConnection(), connection2.getConnection());
     }
 
     @Test
@@ -141,7 +142,6 @@ public class PooledConnectionSecurityExceptionTest {
         pooledConnFact.setMaxConnections(10);
 
         Connection connection1 = pooledConnFact.createConnection("invalid", "credentials");
-
         try {
             connection1.start();
             fail("Should fail to connect");
@@ -189,13 +189,13 @@ public class PooledConnectionSecurityExceptionTest {
     public void testFailoverWithInvalidCredentials() throws Exception {
 
         ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(
-            "failover:(" + connectionURI + ")");
+            "failover:(" + connectionURI + "?trace=true)");
 
         pooledConnFact = new PooledConnectionFactory();
         pooledConnFact.setConnectionFactory(cf);
         pooledConnFact.setMaxConnections(1);
 
-        final Connection connection1 = pooledConnFact.createConnection("invalid", "credentials");
+        final PooledConnection connection1 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials");
 
         try {
             connection1.start();
@@ -210,12 +210,13 @@ public class PooledConnectionSecurityExceptionTest {
 
             @Override
             public boolean isSatisified() throws Exception {
-                return connection1 != pooledConnFact.createConnection("invalid", "credentials");
+                return connection1.getConnection() !=
+                          ((PooledConnection) pooledConnFact.createConnection("invalid", "credentials")).getConnection();
             }
         }));
 
-        final Connection connection2 = pooledConnFact.createConnection("invalid", "credentials");
-        assertNotSame(connection1, connection2);
+        final PooledConnection connection2 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials");
+        assertNotSame(connection1.getConnection(), connection2.getConnection());
 
         try {
             connection2.start();