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/07/03 12:24:42 UTC
[qpid-broker-j] 01/03: NO-JIRA: Remove mistakenly merged test
classes and resource
This is an automated email from the ASF dual-hosted git repository.
orudyy pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git
commit c4e24d209788a7f7961947007b6b75e7b4c8f822
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Wed Jul 3 12:33:21 2019 +0100
NO-JIRA: Remove mistakenly merged test classes and resource
---
.../qpid/tests/protocol/v0_10/ProtocolTest.java | 154 ---------------------
.../qpid/tests/protocol/v0_8/ProtocolTest.java | 154 ---------------------
.../basic/MalformedMessageValidation.java | 87 ------------
.../src/main/resources/java_broker_keystore.jks | Bin 4425 -> 0 bytes
4 files changed, 395 deletions(-)
diff --git a/systests/protocol-tests-amqp-0-10/src/test/java/org/apache/qpid/tests/protocol/v0_10/ProtocolTest.java b/systests/protocol-tests-amqp-0-10/src/test/java/org/apache/qpid/tests/protocol/v0_10/ProtocolTest.java
deleted file mode 100644
index 35675e1..0000000
--- a/systests/protocol-tests-amqp-0-10/src/test/java/org/apache/qpid/tests/protocol/v0_10/ProtocolTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *
- * 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.v0_10;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.contains;
-import static org.junit.Assert.assertArrayEquals;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.net.InetSocketAddress;
-import java.nio.charset.StandardCharsets;
-
-import org.hamcrest.core.IsEqual;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.qpid.server.protocol.v0_10.transport.ConnectionStart;
-import org.apache.qpid.tests.protocol.HeaderResponse;
-import org.apache.qpid.tests.protocol.Response;
-import org.apache.qpid.tests.protocol.SpecificationTest;
-import org.apache.qpid.tests.utils.BrokerAdmin;
-import org.apache.qpid.tests.utils.BrokerAdminUsingTestBase;
-
-public class ProtocolTest extends BrokerAdminUsingTestBase
-{
- private static final String DEFAULT_LOCALE = "en_US";
- private InetSocketAddress _brokerAddress;
-
- @Before
- public void setUp()
- {
- _brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
- }
-
- @Test
- @SpecificationTest(section = "4.3. Version Negotiation",
- description = "When the client opens a new socket connection to an AMQP server,"
- + " it MUST send a protocol header with the client's preferred protocol version."
- + "If the requested protocol version is supported, the server MUST send its own protocol"
- + " header with the requested version to the socket, and then implement the protocol accordingly")
- public void versionNegotiation() throws Exception
- {
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
- final Interaction interaction = transport.newInteraction();
- Response<?> response = interaction.negotiateProtocol().consumeResponse().getLatestResponse();
- assertThat(response, is(instanceOf(HeaderResponse.class)));
- assertThat(response.getBody(), is(IsEqual.equalTo(transport.getProtocolHeader())));
-
- ConnectionStart connectionStart = interaction.consumeResponse().getLatestResponse(ConnectionStart.class);
- assertThat(connectionStart.getMechanisms(), is(notNullValue()));
- assertThat(connectionStart.getMechanisms(), contains(ConnectionInteraction.SASL_MECHANISM_ANONYMOUS));
- assertThat(connectionStart.getLocales(), is(notNullValue()));
- assertThat(connectionStart.getLocales(), contains(DEFAULT_LOCALE));
- }
- }
-
- @Test
- @SpecificationTest(section = "4.3. Version Negotiation",
- description = "If the server can't parse the protocol header, the server MUST send a valid protocol "
- + "header with a supported protocol version and then close the socket.")
- public void unrecognisedProtocolHeader() throws Exception
- {
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
-
- final Interaction interaction = transport.newInteraction();
-
- byte[] unknownHeader = "NOTANAMQPHEADER".getBytes(StandardCharsets.UTF_8);
- byte[] expectedResponse = "AMQP\001\001\000\012".getBytes(StandardCharsets.UTF_8);
- final byte[] response = interaction.protocolHeader(unknownHeader)
- .negotiateProtocol()
- .consumeResponse().getLatestResponse(byte[].class);
- assertArrayEquals("Unexpected protocol header response", expectedResponse, response);
- transport.assertNoMoreResponsesAndChannelClosed();
- }
- }
-
- @Test
- @SpecificationTest(section = "4.3. Version Negotiation",
- description = "If the requested protocol version is not supported, the server MUST send a protocol "
- + "header with a supported protocol version and then close the socket.")
- public void unrecognisedProtocolVersion() throws Exception
- {
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
-
-
- final Interaction interaction = transport.newInteraction();
-
- byte[] unknownAmqpVersion = "AMQP\001\001\000\013".getBytes(StandardCharsets.UTF_8);
- byte[] expectedResponse = "AMQP\001\001\000\012".getBytes(StandardCharsets.UTF_8);
- final byte[] response = interaction.protocolHeader(unknownAmqpVersion)
- .negotiateProtocol()
- .consumeResponse().getLatestResponse(byte[].class);
- assertArrayEquals("Unexpected protocol header response", expectedResponse, response);
- transport.assertNoMoreResponsesAndChannelClosed();
- }
- }
-
- @Test
- @SpecificationTest(section = "8. Domains", description = "valid values for the frame type indicator.")
- public void invalidSegmentType() throws Exception
- {
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
- final Interaction interaction = transport.newInteraction();
-
- interaction.negotiateProtocol().consumeResponse()
- .consumeResponse(ConnectionStart.class);
-
- try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
- DataOutputStream dos = new DataOutputStream(bos))
- {
- dos.writeByte(0); /* flags */
- dos.writeByte(4); /* segment type - undefined value in 0-10 */
- dos.writeShort(12); /* size */
- dos.writeByte(0);
- dos.writeByte(0); /* track */
- dos.writeShort(0); /* channel */
- dos.writeByte(0);
- dos.writeByte(0);
- dos.writeByte(0);
- dos.writeByte(0);
-
- transport.sendBytes(bos.toByteArray());
- }
- transport.flush();
- transport.assertNoMoreResponsesAndChannelClosed();
- }
- }
-}
diff --git a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ProtocolTest.java b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ProtocolTest.java
deleted file mode 100644
index 8475bb9..0000000
--- a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/ProtocolTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *
- * 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.v0_8;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assume.assumeThat;
-
-import java.net.InetSocketAddress;
-import java.nio.charset.StandardCharsets;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.qpid.server.protocol.ProtocolVersion;
-import org.apache.qpid.server.protocol.v0_8.transport.AMQBody;
-import org.apache.qpid.server.protocol.v0_8.transport.AMQVersionAwareProtocolSession;
-import org.apache.qpid.server.protocol.v0_8.transport.ConnectionStartBody;
-import org.apache.qpid.server.transport.ByteBufferSender;
-import org.apache.qpid.tests.protocol.SpecificationTest;
-import org.apache.qpid.tests.utils.BrokerAdmin;
-import org.apache.qpid.tests.utils.BrokerAdminUsingTestBase;
-
-public class ProtocolTest extends BrokerAdminUsingTestBase
-{
- private InetSocketAddress _brokerAddress;
-
- @Before
- public void setUp()
- {
- _brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
- }
-
- @Test
- @SpecificationTest(section = "4.2.2",
- description = "If the server does not recognise the first 5 octets of data on the socket [...], it MUST "
- + "write a valid protocol header to the socket, [...] and then close the socket connection.")
- public void unrecognisedProtocolHeader() throws Exception
- {
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
- assumeThat(transport.getProtocolVersion(), is(equalTo(ProtocolVersion.v0_91)));
-
- final Interaction interaction = transport.newInteraction();
-
- byte[] unknownHeader = "NOTANAMQPHEADER".getBytes(StandardCharsets.UTF_8);
- byte[] expectedResponse = "AMQP\000\000\011\001".getBytes(StandardCharsets.UTF_8);
- final byte[] response = interaction.protocolHeader(unknownHeader)
- .negotiateProtocol()
- .consumeResponse().getLatestResponse(byte[].class);
- assertArrayEquals("Unexpected protocol header response", expectedResponse, response);
- transport.assertNoMoreResponsesAndChannelClosed();
- }
- }
-
- @Test
- @SpecificationTest(section = "4.2.2",
- description = "If the server [...] does not support the specific protocol version that the client "
- + "requests, it MUST write a valid protocol header to the socket, [...] and then close "
- + "the socket connection.")
- public void unrecognisedProtocolVersion() throws Exception
- {
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
- assumeThat(transport.getProtocolVersion(), is(equalTo(ProtocolVersion.v0_91)));
-
- final Interaction interaction = transport.newInteraction();
-
- byte[] unknownAmqpVersion = "AMQP\000\000\010\002".getBytes(StandardCharsets.UTF_8);
- byte[] expectedResponse = "AMQP\000\000\011\001".getBytes(StandardCharsets.UTF_8);
- final byte[] response = interaction.protocolHeader(unknownAmqpVersion)
- .negotiateProtocol()
- .consumeResponse().getLatestResponse(byte[].class);
- assertArrayEquals("Unexpected protocol header response", expectedResponse, response);
- transport.assertNoMoreResponsesAndChannelClosed();
- }
- }
-
- @Test
- @SpecificationTest(section = "4.2.2", description = "The server either accepts [...] the protocol header")
- public void validProtocolVersion() throws Exception
- {
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
- final Interaction interaction = transport.newInteraction();
-
- interaction.negotiateProtocol()
- .consumeResponse().getLatestResponse(ConnectionStartBody.class);
-
- }
- }
-
- @Test
- @SpecificationTest(section = "4.2.2",
- description = "If a peer receives a frame with a type that is not one of these defined types, it MUST "
- + "treat this as a fatal protocol error and close the connection without sending any "
- + "further data on it")
- public void unrecognisedFrameType() throws Exception
- {
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
- final Interaction interaction = transport.newInteraction();
-
- interaction.negotiateProtocol()
- .consumeResponse(ConnectionStartBody.class)
- .sendPerformative(new AMQBody()
- {
- @Override
- public byte getFrameType()
- {
- return (byte)5; // Spec defines 1 - 4 only.
- }
-
- @Override
- public int getSize()
- {
- return 0;
- }
-
- @Override
- public long writePayload(final ByteBufferSender sender)
- {
- return 0;
- }
-
- @Override
- public void handle(final int channelId, final AMQVersionAwareProtocolSession session)
- {
- throw new UnsupportedOperationException();
- }
- }).sync();
- transport.assertNoMoreResponsesAndChannelClosed();
- }
- }
-}
diff --git a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/extension/basic/MalformedMessageValidation.java b/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/extension/basic/MalformedMessageValidation.java
deleted file mode 100644
index 6391081..0000000
--- a/systests/protocol-tests-amqp-0-8/src/test/java/org/apache/qpid/tests/protocol/v0_8/extension/basic/MalformedMessageValidation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * 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.v0_8.extension.basic;
-
-import static org.apache.qpid.tests.utils.BrokerAdmin.KIND_BROKER_J;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import java.net.InetSocketAddress;
-import java.nio.charset.StandardCharsets;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
-import org.apache.qpid.server.protocol.v0_8.FieldTable;
-import org.apache.qpid.server.protocol.v0_8.FieldTableFactory;
-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.v0_8.FrameTransport;
-import org.apache.qpid.tests.protocol.v0_8.Interaction;
-import org.apache.qpid.tests.utils.BrokerAdmin;
-import org.apache.qpid.tests.utils.BrokerAdminUsingTestBase;
-import org.apache.qpid.tests.utils.BrokerSpecific;
-import org.apache.qpid.tests.utils.ConfigItem;
-
-@BrokerSpecific(kind = KIND_BROKER_J)
-@ConfigItem(name = "qpid.connection.forceValidation", value = "true")
-public class MalformedMessageValidation extends BrokerAdminUsingTestBase
-{
- private InetSocketAddress _brokerAddress;
- private static final String CONTENT_TEXT = "Test";
-
- @Before
- public void setUp()
- {
- _brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
- getBrokerAdmin().createQueue(BrokerAdmin.TEST_QUEUE_NAME);
- }
-
- @Test
- public void malformedHeaderValue() throws Exception
- {
- final FieldTable malformedHeader = createMalformedHeaders();
- byte[] contentBytes = CONTENT_TEXT.getBytes(StandardCharsets.UTF_8);
- try(FrameTransport transport = new FrameTransport(_brokerAddress).connect())
- {
- final Interaction interaction = transport.newInteraction();
- interaction.openAnonymousConnection()
- .channel().open().consumeResponse(ChannelOpenOkBody.class)
- .basic().publishExchange("")
- .publishRoutingKey(BrokerAdmin.TEST_QUEUE_NAME)
- .contentHeaderPropertiesHeaders(malformedHeader)
- .content(contentBytes)
- .publishMessage()
- .consumeResponse(ConnectionCloseBody.class);
- }
- assertThat(getBrokerAdmin().getQueueDepthMessages(BrokerAdmin.TEST_QUEUE_NAME), is(equalTo(0)));
- }
-
- private static FieldTable createMalformedHeaders()
- {
- final QpidByteBuffer buf = QpidByteBuffer.allocate(1);
- buf.put((byte) -1);
- buf.flip();
- return FieldTableFactory.createFieldTable(buf);
- }
-}
diff --git a/systests/qpid-systests-http-management/src/main/resources/java_broker_keystore.jks b/systests/qpid-systests-http-management/src/main/resources/java_broker_keystore.jks
deleted file mode 100644
index b45991f..0000000
Binary files a/systests/qpid-systests-http-management/src/main/resources/java_broker_keystore.jks and /dev/null differ
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org