You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2017/10/02 21:41:59 UTC

qpid-broker-j git commit: QPID-7946 : Fix ProtocolNegotiationTest for AMQP 1.0 and Windows

Repository: qpid-broker-j
Updated Branches:
  refs/heads/master 8abda0619 -> 526019c75


QPID-7946 : Fix ProtocolNegotiationTest for AMQP 1.0 and Windows


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/526019c7
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/526019c7
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/526019c7

Branch: refs/heads/master
Commit: 526019c750fed803ccd16a01177009cc0bfee1ff
Parents: 8abda06
Author: Rob Godfrey <rg...@apache.org>
Authored: Mon Oct 2 23:41:28 2017 +0200
Committer: Rob Godfrey <rg...@apache.org>
Committed: Mon Oct 2 23:41:28 2017 +0200

----------------------------------------------------------------------
 .../qpid/transport/ProtocolNegotiationTest.java       | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/526019c7/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java b/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java
index c86f944..dcffc95 100644
--- a/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java
+++ b/systests/src/test/java/org/apache/qpid/transport/ProtocolNegotiationTest.java
@@ -49,6 +49,7 @@ import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.port.AmqpPort;
 import org.apache.qpid.server.protocol.v0_10.ServerDisassembler;
+import org.apache.qpid.server.util.SystemUtils;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.server.protocol.v0_10.transport.Frame;
@@ -198,6 +199,9 @@ public class ProtocolNegotiationTest extends QpidBrokerTestCase
             int len = inputStream.read(receivedHeader);
             assertEquals("Unexpected number of bytes available from socket", receivedHeader.length, len);
 
+            // read the server start / sasl mechanisms
+            inputStream.read(new byte[1024]);
+
             // Send heartbeat frames to simulate a client that, although active, fails to
             // authenticate within the allowed period
 
@@ -212,6 +216,13 @@ public class ProtocolNegotiationTest extends QpidBrokerTestCase
                 }
                 Thread.sleep(100);
             }
+            // If AMQP 1.0 we won't have sent anything (heartbeats not valid until after SASL)
+            // Windows also seems to allow writes to a socket which has actually been closed.
+            if(!brokenPipe && (SystemUtils.isWindows() || isBroker10()))
+            {
+                final int read = inputStream.read(new byte[10]);
+                brokenPipe = -1 == read;
+            }
             assertTrue("Expected pipe to become broken within "
                        + Port.CONNECTION_MAXIMUM_AUTHENTICATION_DELAY + " timeout", brokenPipe);
         }
@@ -300,10 +311,9 @@ public class ProtocolNegotiationTest extends QpidBrokerTestCase
             ServerDisassembler serverDisassembler = new ServerDisassembler(sender, Frame.HEADER_SIZE + 1);
             serverDisassembler.command(null, heartbeat);
         }
-        else
+        else if(isBroker08())
         {
             HeartbeatBody.FRAME.writePayload(sender);
-
         }
 
         return sender.hasSuccess();


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