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 2017/11/21 17:18:33 UTC
qpid-broker-j git commit: QPID-8038: [Broker-J][AMQP 1.0] Improve 0-8
protocol tests
Repository: qpid-broker-j
Updated Branches:
refs/heads/master 2cbb62913 -> c3a3f3a93
QPID-8038: [Broker-J][AMQP 1.0] Improve 0-8 protocol tests
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/c3a3f3a9
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/c3a3f3a9
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/c3a3f3a9
Branch: refs/heads/master
Commit: c3a3f3a931df8969b2fec19f42dccc68e0000ae9
Parents: 2cbb629
Author: Alex Rudyy <or...@apache.org>
Authored: Mon Nov 20 15:07:01 2017 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Tue Nov 21 10:17:05 2017 +0000
----------------------------------------------------------------------
.../tests/protocol/v0_8/BasicInteraction.java | 4 ++-
.../qpid/tests/protocol/v0_8/Interaction.java | 24 +++++++++++----
.../qpid/tests/protocol/v0_8/BasicTest.java | 31 ++++++++++++--------
.../qpid/tests/protocol/v0_8/ChannelTest.java | 24 +++++++++++++--
.../tests/protocol/v0_8/ConnectionTest.java | 6 ++--
.../qpid/tests/protocol/v0_8/QueueTest.java | 2 +-
6 files changed, 66 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c3a3f3a9/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/BasicInteraction.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/BasicInteraction.java b/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/BasicInteraction.java
index 9ef66ec..bf8c4eb 100644
--- a/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/BasicInteraction.java
+++ b/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/BasicInteraction.java
@@ -134,12 +134,14 @@ public class BasicInteraction
frames.add(new AMQFrame(_interaction.getChannelId(), contentHeaderBody));
if (contentSize > 0)
{
+ final byte[] contentCopy = new byte[contentSize];
+ System.arraycopy(_content, 0, contentCopy, 0, contentSize);
final int framePayloadMax = _interaction.getMaximumFrameSize() - 8;
int offset = 0;
do
{
int contentToCopyLength = Math.min(framePayloadMax, contentSize - offset);
- ContentBody contentBody = new ContentBody(ByteBuffer.wrap(_content, offset,
+ ContentBody contentBody = new ContentBody(ByteBuffer.wrap(contentCopy, offset,
contentToCopyLength));
frames.add(new AMQFrame(_interaction.getChannelId(), contentBody));
offset += contentToCopyLength;
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c3a3f3a9/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/Interaction.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/Interaction.java b/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/Interaction.java
index 29e058c..35f4bf5 100644
--- a/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/Interaction.java
+++ b/systests/protocol-tests-amqp-0-8/src/main/java/org/apache/qpid/tests/protocol/v0_8/Interaction.java
@@ -32,10 +32,18 @@ public class Interaction extends org.apache.qpid.tests.protocol.Interaction<Inte
private int _channelId;
private int _maximumPayloadSize = 512;
+ private ConnectionInteraction _connectionInteraction;
+ private ChannelInteraction _channelInteraction;
+ private QueueInteraction _queueInteraction;
+ private BasicInteraction _basicInteraction;
Interaction(final FrameTransport transport)
{
super(transport);
+ _connectionInteraction = new ConnectionInteraction(this);
+ _channelInteraction = new ChannelInteraction(this);
+ _queueInteraction = new QueueInteraction(this);
+ _basicInteraction = new BasicInteraction(this);
}
@Override
@@ -52,7 +60,7 @@ public class Interaction extends org.apache.qpid.tests.protocol.Interaction<Inte
public Interaction sendPerformative(final AMQBody amqBody) throws Exception
{
- return sendPerformative(getChannelId(), amqBody);
+ return sendPerformative(_channelId, amqBody);
}
public Interaction sendPerformative(int channel, final AMQBody amqBody) throws Exception
@@ -79,17 +87,17 @@ public class Interaction extends org.apache.qpid.tests.protocol.Interaction<Inte
public ConnectionInteraction connection()
{
- return new ConnectionInteraction(this);
+ return _connectionInteraction;
}
public ChannelInteraction channel()
{
- return new ChannelInteraction(this);
+ return _channelInteraction;
}
public QueueInteraction queue()
{
- return new QueueInteraction(this);
+ return _queueInteraction;
}
public int getChannelId()
@@ -97,6 +105,12 @@ public class Interaction extends org.apache.qpid.tests.protocol.Interaction<Inte
return _channelId;
}
+ public Interaction channelId(final int channelId)
+ {
+ _channelId = channelId;
+ return this;
+ }
+
public int getMaximumFrameSize()
{
return _maximumPayloadSize;
@@ -104,6 +118,6 @@ public class Interaction extends org.apache.qpid.tests.protocol.Interaction<Inte
public BasicInteraction basic()
{
- return new BasicInteraction(this);
+ return _basicInteraction;
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c3a3f3a9/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/BasicTest.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/BasicTest.java b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/BasicTest.java
index eb51925..7349b8d 100644
--- a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/BasicTest.java
+++ b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/BasicTest.java
@@ -88,7 +88,7 @@ public class BasicTest extends BrokerAdminUsingTestBase
@Test
- @SpecificationTest(section = "1.8.3.3", description = " start a queue consumer")
+ @SpecificationTest(section = "1.8.3.3", description = "start a queue consumer")
public void consumeMessage() throws Exception
{
try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
@@ -102,20 +102,25 @@ public class BasicTest extends BrokerAdminUsingTestBase
byte deliveryMode = (byte) 1;
byte priority = (byte) 2;
interaction.openAnonymousConnection()
- .channel().open().consumeResponse(ChannelOpenOkBody.class)
- .basic().qosPrefetchCount(1).qos().consumeResponse(BasicQosOkBody.class)
+ .channel().open()
+ .consumeResponse(ChannelOpenOkBody.class)
+ .basic().qosPrefetchCount(1)
+ .qos()
+ .consumeResponse(BasicQosOkBody.class)
.basic().consumeConsumerTag(consumerTag)
- .consumeQueue(queueName)
- .consume().consumeResponse(BasicConsumeOkBody.class)
- .channel().flow(true).consumeResponse(ChannelFlowOkBody.class)
+ .consumeQueue(queueName)
+ .consume()
+ .consumeResponse(BasicConsumeOkBody.class)
+ .channel().flow(true)
+ .consumeResponse(ChannelFlowOkBody.class)
.basic().contentHeaderPropertiesContentType(messageContentType)
- .contentHeaderPropertiesHeaders(messageHeaders)
- .contentHeaderPropertiesDeliveryMode(deliveryMode)
- .contentHeaderPropertiesPriority(priority)
- .publishExchange("")
- .publishRoutingKey(queueName)
- .content(messageContent)
- .publishMessage()
+ .contentHeaderPropertiesHeaders(messageHeaders)
+ .contentHeaderPropertiesDeliveryMode(deliveryMode)
+ .contentHeaderPropertiesPriority(priority)
+ .publishExchange("")
+ .publishRoutingKey(queueName)
+ .content(messageContent)
+ .publishMessage()
.consumeResponse(BasicDeliverBody.class);
BasicDeliverBody delivery = interaction.getLatestResponse(BasicDeliverBody.class);
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c3a3f3a9/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ChannelTest.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ChannelTest.java b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ChannelTest.java
index 4ca4ae8..b5cf60d 100644
--- a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ChannelTest.java
+++ b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ChannelTest.java
@@ -25,7 +25,9 @@ import java.net.InetSocketAddress;
import org.junit.Before;
import org.junit.Test;
+import org.apache.qpid.server.protocol.v0_8.transport.ChannelCloseOkBody;
import org.apache.qpid.server.protocol.v0_8.transport.ChannelOpenOkBody;
+import org.apache.qpid.server.protocol.v0_8.transport.ConnectionCloseBody;
import org.apache.qpid.tests.protocol.SpecificationTest;
import org.apache.qpid.tests.utils.BrokerAdmin;
import org.apache.qpid.tests.utils.BrokerAdminUsingTestBase;
@@ -41,14 +43,32 @@ public class ChannelTest extends BrokerAdminUsingTestBase
}
@Test
- @SpecificationTest(section = "1.4.2.1", description = "start connection negotiation")
+ @SpecificationTest(section = "1.5.2.1", description = "open a channel for use")
public void channelOpen() throws Exception
{
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
+ try (FrameTransport transport = new FrameTransport(_brokerAddress).connect())
{
final Interaction interaction = transport.newInteraction();
+
interaction.openAnonymousConnection()
+ .channelId(1)
.channel().open().consumeResponse(ChannelOpenOkBody.class);
}
}
+
+ @Test
+ @SpecificationTest(section = "1.5.2.5", description = "request a channel close")
+ public void channelClose() throws Exception
+ {
+ try (FrameTransport transport = new FrameTransport(_brokerAddress).connect())
+ {
+ final Interaction interaction = transport.newInteraction();
+
+ interaction.openAnonymousConnection()
+ .channelId(1)
+ .channel().open().consumeResponse(ChannelOpenOkBody.class)
+ .channel().close().consumeResponse(ChannelCloseOkBody.class)
+ .channel().flow(true).consumeResponse(ConnectionCloseBody.class);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c3a3f3a9/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ConnectionTest.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ConnectionTest.java b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ConnectionTest.java
index 1fbbf2a..b4909c6 100644
--- a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ConnectionTest.java
+++ b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ConnectionTest.java
@@ -80,7 +80,7 @@ public class ConnectionTest extends BrokerAdminUsingTestBase
}
@Test
- @SpecificationTest(section = "1.4.2.5", description = "select security mechanism and locale")
+ @SpecificationTest(section = "1.4.2.6", description = "negotiate connection tuning parameters")
public void connectionTuneOkAndOpen() throws Exception
{
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect())
@@ -102,7 +102,7 @@ public class ConnectionTest extends BrokerAdminUsingTestBase
}
@Test
- @SpecificationTest(section = "1.4.2.5", description = "[...] the minimum negotiated value for frame-max is also"
+ @SpecificationTest(section = "1.4.2.6", description = "[...] the minimum negotiated value for frame-max is also"
+ " frame-min-size [4096].")
public void tooSmallFrameSize() throws Exception
{
@@ -124,7 +124,7 @@ public class ConnectionTest extends BrokerAdminUsingTestBase
}
@Test
- @SpecificationTest(section = "1.4.2.5.2.", description = "If the client specifies a frame max that is higher than"
+ @SpecificationTest(section = "1.4.2.6.2.", description = "If the client specifies a frame max that is higher than"
+ " the value provided by the server, the server MUST"
+ " close the connection without attempting a negotiated"
+ " close. The server may report the error in some fashion"
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/c3a3f3a9/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/QueueTest.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/QueueTest.java b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/QueueTest.java
index 920ea73..e54dad3b 100644
--- a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/QueueTest.java
+++ b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/QueueTest.java
@@ -47,7 +47,7 @@ public class QueueTest extends BrokerAdminUsingTestBase
}
@Test
- @SpecificationTest(section = "1.4.2.1", description = "start connection negotiation")
+ @SpecificationTest(section = "1.7.2.1", description = "declare queue, create if needed")
public void queueDeclare() throws Exception
{
try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org