Repository: qpid-jms
Updated Branches:
  refs/heads/master 7a9d2cefd -> 9565185b0


NO-JIRA Make some tests more tolerant to timing changes

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/9565185b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/9565185b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/9565185b

Branch: refs/heads/master
Commit: 9565185b0cbdf137b98791e3e927d67a26ab6431
Parents: 7a9d2ce
Author: Timothy Bish <[email protected]>
Authored: Thu Aug 4 12:49:16 2016 -0400
Committer: Timothy Bish <[email protected]>
Committed: Thu Aug 4 12:49:16 2016 -0400

----------------------------------------------------------------------
 .../provider/failover/FailoverProviderTest.java | 24 ++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/9565185b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java
index cd46ad7..bd2ed86 100644
--- 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverProviderTest.java
@@ -210,14 +210,16 @@ public class FailoverProviderTest extends 
FailoverProviderTestSupport {
             "?failover.startupMaxReconnectAttempts=5" +
             "&failover.useReconnectBackOff=false");
 
-        Connection connection = factory.createConnection();
-
+        Connection connection = null;
         try {
+            connection = factory.createConnection();
             connection.start();
             fail("Should have stopped after five retries.");
         } catch (JMSException ex) {
         } finally {
-            connection.close();
+            if (connection != null) {
+                connection.close();
+            }
         }
 
         assertEquals(5, mockPeer.getContextStats().getProvidersCreated());
@@ -232,14 +234,16 @@ public class FailoverProviderTest extends 
FailoverProviderTestSupport {
             "?failover.maxReconnectAttempts=5" +
             "&failover.useReconnectBackOff=false");
 
-        Connection connection = factory.createConnection();
-
+        Connection connection = null;
         try {
+            connection = factory.createConnection();
             connection.start();
             fail("Should have stopped after five retries.");
         } catch (JMSException ex) {
         } finally {
-            connection.close();
+            if (connection != null) {
+                connection.close();
+            }
         }
 
         assertEquals(5, mockPeer.getContextStats().getProvidersCreated());
@@ -256,14 +260,16 @@ public class FailoverProviderTest extends 
FailoverProviderTestSupport {
             "&failover.reconnectDelay=10" +
             "&failover.useReconnectBackOff=true");
 
-        Connection connection = factory.createConnection();
-
+        Connection connection = null;
         try {
+            connection = factory.createConnection();
             connection.start();
             fail("Should have stopped after five retries.");
         } catch (JMSException ex) {
         } finally {
-            connection.close();
+            if (connection != null) {
+                connection.close();
+            }
         }
 
         assertEquals(5, mockPeer.getContextStats().getProvidersCreated());


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to