qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject qpid-jms git commit: QPIDJMS-290 Make test more active in catching connection drop
Date Wed, 03 May 2017 17:12:52 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master f255f7742 -> d6112e77c


QPIDJMS-290 Make test more active in catching connection drop

On some Windows CI machines the connection drop is not being detected so
the test needs to more actively check the state of the connection.

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

Branch: refs/heads/master
Commit: d6112e77c7c718fb50c82472671cd02e59342061
Parents: f255f77
Author: Timothy Bish <tabish121@gmail.com>
Authored: Wed May 3 13:10:05 2017 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Wed May 3 13:10:05 2017 -0400

----------------------------------------------------------------------
 .../transports/netty/NettyWsTransportTest.java  | 26 ++++++++++++++------
 1 file changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d6112e77/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java
index a50728d..4675352 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyWsTransportTest.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.IOException;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
@@ -145,8 +146,8 @@ public class NettyWsTransportTest extends NettyTcpTransportTest {
                 // The transport should allow for the size of data we sent.
                 transport.setMaxFrameSize(FRAME_SIZE);
                 transport.connect(null);
-                transport.send(sendBuffer.copy());
                 transports.add(transport);
+                transport.send(sendBuffer.copy());
             } catch (Exception e) {
                 fail("Should have connected to the server at " + serverLocation + " but got
exception: " + e);
             }
@@ -193,8 +194,8 @@ public class NettyWsTransportTest extends NettyTcpTransportTest {
                 // when data arrives that is larger than this value.
                 transport.setMaxFrameSize(FRAME_SIZE / 2);
                 transport.connect(null);
-                transport.send(sendBuffer.copy());
                 transports.add(transport);
+                transport.send(sendBuffer.copy());
             } catch (Exception e) {
                 fail("Should have connected to the server at " + serverLocation + " but got
exception: " + e);
             }
@@ -224,20 +225,31 @@ public class NettyWsTransportTest extends NettyTcpTransportTest {
 
             List<Transport> transports = new ArrayList<Transport>();
 
-            Transport transport = createTransport(serverLocation, testListener, createClientOptions());
+            final Transport transport = createTransport(serverLocation, testListener, createClientOptions());
             try {
                 // Transport allows bigger frames in so that server is the one causing the
failure.
                 transport.setMaxFrameSize(FRAME_SIZE);
                 transport.connect(null);
-                transport.send(sendBuffer.copy());
                 transports.add(transport);
+                transport.send(sendBuffer.copy());
             } catch (Exception e) {
                 fail("Should have connected to the server at " + serverLocation + " but got
exception: " + e);
             }
 
-            assertTrue("Transport should have lost connection", Wait.waitFor(() -> !transport.isConnected()));
-        }
+            assertTrue("Transport should have lost connection", Wait.waitFor(new Wait.Condition()
{
 
-        assertFalse(exceptions.isEmpty());
+                @Override
+                public boolean isSatisified() throws Exception {
+                    try {
+                        transport.send(sendBuffer);
+                    } catch (IOException e) {
+                        LOG.info("Transport send caught error:", e);
+                        return true;
+                    }
+
+                    return false;
+                }
+            }));
+        }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message