You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2019/08/21 16:35:53 UTC
[qpid-broker-j] 11/21: QPID-8350: [Tests][AMQP 1.0] Improve begin
tests
This is an automated email from the ASF dual-hosted git repository.
orudyy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git
commit c3eb4fd8c94cf86a2eacbf06cf480fc3d4763034
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Mon Aug 19 14:26:04 2019 +0100
QPID-8350: [Tests][AMQP 1.0] Improve begin tests
---
.../protocol/v1_0/transport/session/BeginTest.java | 33 ++++++++++++++--------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transport/session/BeginTest.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transport/session/BeginTest.java
index 24cb435..f25d275 100644
--- a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transport/session/BeginTest.java
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transport/session/BeginTest.java
@@ -23,7 +23,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.notNullValue;
+import static org.junit.Assume.assumeThat;
import java.net.InetSocketAddress;
@@ -46,7 +48,7 @@ public class BeginTest extends BrokerAdminUsingTestBase
{
@Test
@SpecificationTest(section = "1.3.4",
- description = "Begin without mandatory fields should result in a decoding error.")
+ description = "mandatory [...] a non null value for the field is always encoded.")
public void emptyBegin() throws Exception
{
final InetSocketAddress addr = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
@@ -60,7 +62,7 @@ public class BeginTest extends BrokerAdminUsingTestBase
.beginOutgoingWindow(null)
.begin().consumeResponse()
.getLatestResponse(Close.class);
- assertThat(responseClose.getError(), is(notNullValue()));
+ assumeThat(responseClose.getError(), is(notNullValue()));
assertThat(responseClose.getError().getCondition(), equalTo(AmqpError.DECODE_ERROR));
}
}
@@ -93,20 +95,29 @@ public class BeginTest extends BrokerAdminUsingTestBase
@Test
@SpecificationTest(section = "2.7.1",
- description = "A peer that receives a channel number outside the supported range MUST close "
- + "the connection with the framing-error error-code..")
+ description = "A peer MUST not use channel numbers outside the range that its partner can handle."
+ + "A peer that receives a channel number outside the supported range MUST close "
+ + "the connection with the framing-error error-code..")
public void channelMax() throws Exception
{
final InetSocketAddress addr = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
try (FrameTransport transport = new FrameTransport(addr).connect())
{
- Close responseClose = transport.newInteraction()
- .negotiateProtocol().consumeResponse()
- .openChannelMax(UnsignedShort.valueOf(5))
- .open().consumeResponse(Open.class)
- .sessionChannel(UnsignedShort.valueOf(6))
- .begin().consumeResponse()
- .getLatestResponse(Close.class);
+ final Interaction interaction = transport.newInteraction();
+ final int ourChannelMax = 5;
+ final Open responseOpen = interaction.negotiateProtocol().consumeResponse()
+ .openChannelMax(UnsignedShort.valueOf(ourChannelMax))
+ .open().consumeResponse(Open.class).getLatestResponse(Open.class);
+
+ final UnsignedShort remoteChannelMax = responseOpen.getChannelMax();
+ assumeThat(remoteChannelMax, is(notNullValue()));
+ assumeThat(remoteChannelMax.intValue(), is(lessThan(UnsignedShort.MAX_VALUE.intValue())));
+
+ final int illegalSessionChannel = remoteChannelMax.intValue() + 1;
+
+ final Close responseClose = interaction.sessionChannel(UnsignedShort.valueOf(illegalSessionChannel))
+ .begin().consumeResponse()
+ .getLatestResponse(Close.class);
assertThat(responseClose.getError(), is(notNullValue()));
assertThat(responseClose.getError().getCondition(), equalTo(ConnectionError.FRAMING_ERROR));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org