You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2017/06/14 13:31:09 UTC
qpid-broker-j git commit: QPID-7823: [Java Broker] Add failing test
(currently ignored) demonstrating this JIRA.
Repository: qpid-broker-j
Updated Branches:
refs/heads/master 739164c36 -> 322760c7c
QPID-7823: [Java Broker] Add failing test (currently ignored) demonstrating this JIRA.
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/322760c7
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/322760c7
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/322760c7
Branch: refs/heads/master
Commit: 322760c7cfb81f9e85ac0af8f93c481ab849a702
Parents: 739164c
Author: Lorenz Quack <lq...@apache.org>
Authored: Wed Jun 14 14:29:31 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Wed Jun 14 14:29:31 2017 +0100
----------------------------------------------------------------------
.../protocol/v1_0/messaging/MessageFormat.java | 127 +++++++++++++++++++
1 file changed, 127 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/322760c7/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
----------------------------------------------------------------------
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
new file mode 100644
index 0000000..8dcffc0
--- /dev/null
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/MessageFormat.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.tests.protocol.v1_0.messaging;
+
+import static org.hamcrest.CoreMatchers.either;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.fail;
+
+import java.net.InetSocketAddress;
+import java.nio.charset.StandardCharsets;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.qpid.server.protocol.v1_0.type.Binary;
+import org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Attach;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Close;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Detach;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Disposition;
+import org.apache.qpid.server.protocol.v1_0.type.transport.End;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
+import org.apache.qpid.server.protocol.v1_0.type.transport.Transfer;
+import org.apache.qpid.tests.protocol.v1_0.BrokerAdmin;
+import org.apache.qpid.tests.protocol.v1_0.FrameTransport;
+import org.apache.qpid.tests.protocol.v1_0.MessageEncoder;
+import org.apache.qpid.tests.protocol.v1_0.PerformativeResponse;
+import org.apache.qpid.tests.protocol.v1_0.ProtocolTestBase;
+import org.apache.qpid.tests.protocol.v1_0.Response;
+import org.apache.qpid.tests.protocol.v1_0.SpecificationTest;
+
+public class MessageFormat extends ProtocolTestBase
+{
+ private InetSocketAddress _brokerAddress;
+
+ @Before
+ public void setUp()
+ {
+ _brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
+ getBrokerAdmin().createQueue(BrokerAdmin.TEST_QUEUE_NAME);
+ }
+
+ @Ignore("QPID-7823")
+ @Test
+ @SpecificationTest(section = "2.7.5",
+ description = "message-format: "
+ + "This field MUST be specified for the first transfer of a multi-transfer message and can "
+ + "only be omitted for continuation transfers. It is an error if the message-format on a "
+ + "continuation transfer differs from the message-format on the first transfer of a delivery.")
+ public void differentMessageFormatOnSameDeliveryFails() throws Exception
+ {
+ try (FrameTransport transport = new FrameTransport(_brokerAddress).connect())
+ {
+ final UnsignedInteger linkHandle = UnsignedInteger.ZERO;
+ transport.doAttachSendingLink(linkHandle, BrokerAdmin.TEST_QUEUE_NAME);
+
+ MessageEncoder messageEncoder = new MessageEncoder();
+ messageEncoder.addData("foo");
+
+ Transfer transfer = new Transfer();
+ transfer.setHandle(linkHandle);
+ transfer.setDeliveryTag(new Binary("testDeliveryTag".getBytes(StandardCharsets.UTF_8)));
+ transfer.setDeliveryId(UnsignedInteger.ONE);
+ transfer.setMore(true);
+ transfer.setMessageFormat(UnsignedInteger.valueOf(0));
+ transfer.setPayload(messageEncoder.getPayload());
+ transport.sendPerformative(transfer);
+
+ final Response<?> response = transport.getNextResponse();
+ if (response != null)
+ {
+ assertThat(response.getBody(), is(instanceOf(Disposition.class)));
+ }
+
+ messageEncoder.addData("bar");
+ transfer.setMessageFormat(UnsignedInteger.valueOf(1));
+ transport.sendPerformative(transfer);
+
+ final Response<?> response2 = transport.getNextResponse();
+ assertThat(response2, is(notNullValue()));
+ final Object responseBody = response2.getBody();
+ final Error error;
+ if (responseBody instanceof Detach)
+ {
+ error = ((Detach) responseBody).getError();
+ }
+ else if (responseBody instanceof End)
+ {
+ error = ((End) responseBody).getError();
+ }
+ else if (responseBody instanceof Close)
+ {
+ error = ((Close) responseBody).getError();
+ }
+ else
+ {
+ fail(String.format("Expected response of either Detach, End, or Close. Got '%s'", responseBody));
+ error = null;
+ }
+
+ assertThat(error, is(notNullValue()));
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org